Revert "filter nulls when shimming a config"
This reverts commit 97bde5467c
.
This commit is contained in:
parent
f5395bd98a
commit
e024960c74
|
@ -167,10 +167,7 @@ func ConfigValueFromHCL2(v cty.Value) interface{} {
|
|||
it := v.ElementIterator()
|
||||
for it.Next() {
|
||||
_, ev := it.Element()
|
||||
cv := ConfigValueFromHCL2(ev)
|
||||
if cv != nil {
|
||||
l = append(l, cv)
|
||||
}
|
||||
l = append(l, ConfigValueFromHCL2(ev))
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
|
|
@ -232,26 +232,6 @@ func TestConfigValueFromHCL2Block(t *testing.T) {
|
|||
&configschema.Block{},
|
||||
nil,
|
||||
},
|
||||
// nulls should be filtered out of the config, since they couldn't exist
|
||||
// in hcl.
|
||||
{
|
||||
cty.ObjectVal(map[string]cty.Value{
|
||||
"list": cty.ListVal([]cty.Value{
|
||||
cty.StringVal("ok"),
|
||||
cty.NullVal(cty.String)}),
|
||||
}),
|
||||
&configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"list": {
|
||||
Type: cty.List(cty.String),
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{
|
||||
"list": []interface{}{"ok"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
|
@ -1342,7 +1342,8 @@ func validateConfigNulls(v cty.Value, path cty.Path) []*proto.Diagnostic {
|
|||
if ev.IsNull() {
|
||||
diags = append(diags, &proto.Diagnostic{
|
||||
Severity: proto.Diagnostic_ERROR,
|
||||
Summary: "null value found in list",
|
||||
Summary: "Null value found in list",
|
||||
Detail: "Null values are not allowed for this attribute value.",
|
||||
Attribute: convert.PathToAttributePath(append(path, cty.IndexStep{Key: kv})),
|
||||
})
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue