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.
This commit is contained in:
Martin Atkins 2018-10-16 12:22:58 -07:00
parent d1d0ede069
commit c06f24b323

View File

@ -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