terraform/lang
Martin Atkins 6dcf8195b8 lang/blocktoattr: Selectively allow block syntax to be used for attributes
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.
2019-03-28 10:41:01 -07:00
..
blocktoattr lang/blocktoattr: Selectively allow block syntax to be used for attributes 2019-03-28 10:41:01 -07:00
funcs lang/funcs: Port the "reverse" function from the old functions set 2019-03-19 17:32:19 -07:00
data.go core: Static-validate resource references against schemas 2018-11-26 08:25:03 -08:00
data_test.go core: Static-validate resource references against schemas 2018-11-26 08:25:03 -08:00
doc.go lang: new package for the runtime parts of the config language 2018-10-16 18:44:26 -07:00
eval.go vendor: go get github.com/hashicorp/hcl2@master 2019-03-19 10:04:45 -07:00
eval_test.go move "configschema" from "config" to "configs" 2018-10-16 18:50:29 -07:00
functions.go lang/funcs: Port the "reverse" function from the old functions set 2019-03-19 17:32:19 -07:00
references.go lang: Consider "dynamic" blocks when resolving references 2019-03-19 10:04:45 -07:00
scope.go terraform: ugly huge change to weave in new HCL2-oriented types 2018-10-16 18:46:46 -07:00