-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Fix destroy when modules vars are used in resource counts
A new problem was introduced by the prior fixes for destroy interpolation messages when resources depend on module variables with a _count_ attribute, this makes the variable crucial for properly building the graph - even in destroys. So removing all module variables from the graph as noops was overzealous. By borrowing the logic in `DestroyEdgeInclude` we are able to determine if we need to keep a given module variable relatively easily. I'd like to overhaul the `Destroy: true` implementation so that it does not depend on config at all, but I want to continue for now with the targeted fixes that we can backport into the 0.6 series.
- Loading branch information
Showing
4 changed files
with
105 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
terraform/test-fixtures/apply-destroy-mod-var-and-count/child/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
variable "mod_count" { } | ||
|
||
resource "aws_instance" "foo" { | ||
count = "${var.mod_count}" | ||
} |
4 changes: 4 additions & 0 deletions
4
terraform/test-fixtures/apply-destroy-mod-var-and-count/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module "child" { | ||
source = "./child" | ||
mod_count = "3" | ||
} |