From d236a9e4cdda8e0208eb31ae9ac682e54c9e11b7 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 23 May 2018 16:08:13 -0700 Subject: [PATCH] core: update TestContext2Plan_computedList for changed assumptions Previously this test's fixture was depending on the fact that attribute access of an unknown value would always succeed and return another unknown value, but under the new language interpreter an unknown value still retains type information and so accessing this "bar" attribute would fail the semantic check. We also have to fuss a bit here to work around the limitations of the testDiffFn implementation, which doesn't have enough context to understand that "list" in the ResourceConfig is the same as "list.#" in its result. Since this part of the provider API will change soon to use cty values directly, this change just accepts a slightly-odd-looking diff in the mean time, with both "list" and "list.#" populated. --- terraform/terraform_test.go | 9 ++++++--- terraform/test-fixtures/plan-computed-list/main.tf | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index a9885cc690..d9424a4f07 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -1053,11 +1053,14 @@ DIFF: CREATE: aws_instance.bar foo: "" => "" + list: "" => "" type: "" => "aws_instance" CREATE: aws_instance.foo - list.#: "" => "" - num: "" => "2" - type: "" => "aws_instance" + compute: "" => "list.#" + list: "" => "" + list.#: "" => "" + num: "" => "2" + type: "" => "aws_instance" STATE: diff --git a/terraform/test-fixtures/plan-computed-list/main.tf b/terraform/test-fixtures/plan-computed-list/main.tf index dd61d43f2c..aeec6ba935 100644 --- a/terraform/test-fixtures/plan-computed-list/main.tf +++ b/terraform/test-fixtures/plan-computed-list/main.tf @@ -1,8 +1,8 @@ resource "aws_instance" "foo" { - num = "2" - compute = "list.#" + num = "2" + compute = "list.#" } resource "aws_instance" "bar" { - foo = "${aws_instance.foo.list.0.bar}" + foo = aws_instance.foo.list.0 }