core: Fix TestContext2Plan_ignoreChangesWithFlatmaps

Prior to our v0.12 changes this test was confusingly using an attribute
named "set", but assigning a map to it. The expected test result suggested
that it was actually expecting legacy HCL2's weird interpretation of a
single map as a list of maps, and so to retain the intent of the test here
(in spite of the contrary name) we type "set" as list of map of string,
update the fixture to _actually_ be a list of maps, and then we get the
expected test result.
This commit is contained in:
Martin Atkins 2018-05-24 12:40:33 -07:00
parent c6787d0266
commit 3f4b7f847d
2 changed files with 9 additions and 4 deletions

View File

@ -3821,8 +3821,13 @@ func TestContext2Plan_ignoreChangesWithFlatmaps(t *testing.T) {
Attributes: map[string]*configschema.Attribute{
"user_data": {Type: cty.String, Optional: true},
"require_new": {Type: cty.String, Optional: true},
"set": {Type: cty.Map(cty.String), Optional: true},
"lst": {Type: cty.List(cty.String), Optional: true},
// This test predates the 0.12 work to integrate cty and
// HCL, and so it was ported as-is where its expected
// test output was clearly expecting a list of maps here
// even though it is named "set".
"set": {Type: cty.List(cty.Map(cty.String)), Optional: true},
"lst": {Type: cty.List(cty.String), Optional: true},
},
},
},

View File

@ -2,10 +2,10 @@ resource "aws_instance" "foo" {
user_data = "x"
require_new = "yes"
set = {
set = [{
a = "1"
b = "2"
}
}]
lst = ["j", "k"]