Skip to content

Commit

Permalink
add an interp that fails during planned destroy
Browse files Browse the repository at this point in the history
Chain some values so that we can get an interpolation that fails if a
module input is evaluated during destroy.
  • Loading branch information
jbardin committed Dec 19, 2019
1 parent aa8a0f0 commit 6bad4e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion terraform/context_apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10521,7 +10521,6 @@ func TestContext2Apply_plannedDestroyInterpolatedCount(t *testing.T) {
}

ctxOpts.ProviderResolver = providerResolver
ctxOpts.Destroy = true
ctx, diags = NewContext(ctxOpts)
if diags.HasErrors() {
t.Fatalf("err: %s", diags.Err())
Expand Down
13 changes: 11 additions & 2 deletions terraform/testdata/plan-destroy-interpolated-count/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ variable "list" {
}

resource "aws_instance" "a" {
count = "${length(var.list)}"
count = length(var.list)
}

locals {
ids = aws_instance.a[*].id
}

module "empty" {
source = "./mod"
input = zipmap(var.list, local.ids)
}

output "out" {
value = "${aws_instance.a.*.id}"
value = aws_instance.a[*].id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
variable "input" {
}

0 comments on commit 6bad4e3

Please sign in to comment.