mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
Converting ListVal to ListVal instead of TupleVal in setElementCompareValue
This commit is contained in:
parent
31033001a8
commit
8fbb4d0163
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user