From c51d22bdebd9cd85dee7eaae450f0f6f068e674a Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Fri, 16 Mar 2018 17:06:36 -0700 Subject: [PATCH] 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. --- config/hcl2shim/values.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/hcl2shim/values.go b/config/hcl2shim/values.go index 0b697a5f5..956c15dee 100644 --- a/config/hcl2shim/values.go +++ b/config/hcl2shim/values.go @@ -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 }