6dcf8195b8
This preprocessing step allows users to use nested block syntax to specify elements of an attribute that is defined as being a list or set of an object type. This restores part of the unintended flexibility permitted in Terraform v0.11 so that we can work around a few tricky edges where provider implementations were relying on Terraform's failure to validate this in earlier versions. For any body that is pre-processed using this new helper, we will recognize when a configuration author uses nested block syntax with a name that is specified in the schema as an attribute of a suitable type and tweak the schema just in time before decoding to expect that usage and then fix up the result on the way out to conform to the original schema. Achieving this requires an abstraction inversion because only Terraform's high-level schema has enough information to decide how to rewrite the incoming low-level schema. We must therefore here implement HCL's lowest-level API interface in terms of the higher-level abstractions of hcldec and Terraform's configschema. Because of the abstraction inversion this fixup mechanism cannot be used generally for arbitrary HCL bodies but we can use it carefully inside the lang package where its own API can guarantee the necessary invariants for this to work. |
||
---|---|---|
.. | ||
doc.go | ||
fixup.go | ||
fixup_test.go |