From c06f24b32305eb5e0db406ca2446e2eeedef8963 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Tue, 16 Oct 2018 12:22:58 -0700 Subject: [PATCH] core: Use hcl2shimConfigValueFromHCL2Block when shimming ResourceConfig This ensures more HCL1/HIL-like behaviors when dealing with nested blocks that are not set in the configuration, which is important for compatibility with helper/schema's validation logic. --- terraform/resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/resource.go b/terraform/resource.go index 961289c6fc..d1941739b7 100644 --- a/terraform/resource.go +++ b/terraform/resource.go @@ -227,9 +227,9 @@ func NewResourceConfigShimmed(val cty.Value, schema *configschema.Block) *Resour } ret := &ResourceConfig{} - legacyVal := hcl2shim.ConfigValueFromHCL2(val) + legacyVal := hcl2shim.ConfigValueFromHCL2Block(val, schema) if legacyVal != nil { - ret.Config = legacyVal.(map[string]interface{}) // guaranteed compatible because we require an object type + ret.Config = legacyVal // Now we need to walk through our structure and find any unknown values, // producing the separate list ComputedKeys to represent these. We use the