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.
This commit is contained in:
Martin Atkins 2018-05-23 16:08:13 -07:00
parent b6d3d69d3a
commit d236a9e4cd
2 changed files with 9 additions and 6 deletions

View File

@ -1053,11 +1053,14 @@ DIFF:
CREATE: aws_instance.bar
foo: "" => "<computed>"
list: "" => "<computed>"
type: "" => "aws_instance"
CREATE: aws_instance.foo
list.#: "" => "<computed>"
num: "" => "2"
type: "" => "aws_instance"
compute: "" => "list.#"
list: "" => "<computed>"
list.#: "" => "<computed>"
num: "" => "2"
type: "" => "aws_instance"
STATE:

View File

@ -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
}