diff --git a/plans/objchange/objchange.go b/plans/objchange/objchange.go index 5a8af1481..6d88de97c 100644 --- a/plans/objchange/objchange.go +++ b/plans/objchange/objchange.go @@ -357,13 +357,13 @@ func setElementCompareValue(schema *configschema.Block, v cty.Value, isConfig bo // set and we've not changed the types of any elements here. attrs[name] = cty.SetVal(elems) } else { - attrs[name] = cty.TupleVal(elems) + attrs[name] = cty.ListVal(elems) } } else { if blockType.Nesting == configschema.NestingSet { attrs[name] = cty.SetValEmpty(blockType.Block.ImpliedType()) } else { - attrs[name] = cty.EmptyTupleVal + attrs[name] = cty.ListValEmpty(blockType.Block.ImpliedType()) } } diff --git a/plans/objchange/objchange_test.go b/plans/objchange/objchange_test.go index 97f749aca..3e0784808 100644 --- a/plans/objchange/objchange_test.go +++ b/plans/objchange/objchange_test.go @@ -572,6 +572,70 @@ func TestProposedNewObject(t *testing.T) { }), }), }, + "nested list in sed": { + &configschema.Block{ + BlockTypes: map[string]*configschema.NestedBlock{ + "foo": { + Nesting: configschema.NestingSet, + Block: configschema.Block{ + BlockTypes: map[string]*configschema.NestedBlock{ + "bar": { + Nesting: configschema.NestingList, + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "baz": { + Type: cty.String, + }, + "qux": { + Type: cty.String, + Computed: true, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + }, + }, + cty.ObjectVal(map[string]cty.Value{ + "foo": cty.SetVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "bar": cty.ListVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "baz": cty.StringVal("beep"), + "qux": cty.StringVal("boop"), + }), + }), + }), + }), + }), + cty.ObjectVal(map[string]cty.Value{ + "foo": cty.SetVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "bar": cty.ListVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "baz": cty.StringVal("beep"), + "qux": cty.NullVal(cty.String), + }), + }), + }), + }), + }), + cty.ObjectVal(map[string]cty.Value{ + "foo": cty.SetVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "bar": cty.ListVal([]cty.Value{ + cty.ObjectVal(map[string]cty.Value{ + "baz": cty.StringVal("beep"), + "qux": cty.StringVal("boop"), + }), + }), + }), + }), + }), + }, } for name, test := range tests {