config/hcl2shim: don't put nils in ConfigValue maps

Absent values are omitted by the old code we are emulating in HCL, so we
must do the same here in order to avoid breaking assumptions in the
helper/schema layer.
This commit is contained in:
Martin Atkins 2018-03-16 17:06:36 -07:00
parent 860a57d104
commit c51d22bdeb
1 changed files with 4 additions and 1 deletions

View File

@ -73,7 +73,10 @@ func ConfigValueFromHCL2(v cty.Value) interface{} {
it := v.ElementIterator()
for it.Next() {
ek, ev := it.Element()
l[ek.AsString()] = ConfigValueFromHCL2(ev)
cv := ConfigValueFromHCL2(ev)
if cv != nil {
l[ek.AsString()] = cv
}
}
return l
}