add an interp that fails during planned destroy

Chain some values so that we can get an interpolation that fails if a
module input is evaluated during destroy.
This commit is contained in:
James Bardin 2019-12-18 15:37:08 -05:00
parent aa8a0f063c
commit 6bad4e3dc0
3 changed files with 13 additions and 3 deletions

View File

@ -10521,7 +10521,6 @@ func TestContext2Apply_plannedDestroyInterpolatedCount(t *testing.T) {
} }
ctxOpts.ProviderResolver = providerResolver ctxOpts.ProviderResolver = providerResolver
ctxOpts.Destroy = true
ctx, diags = NewContext(ctxOpts) ctx, diags = NewContext(ctxOpts)
if diags.HasErrors() { if diags.HasErrors() {
t.Fatalf("err: %s", diags.Err()) t.Fatalf("err: %s", diags.Err())

View File

@ -3,9 +3,18 @@ variable "list" {
} }
resource "aws_instance" "a" { 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" { output "out" {
value = "${aws_instance.a.*.id}" value = aws_instance.a[*].id
} }

View File

@ -0,0 +1,2 @@
variable "input" {
}