Documentation
¶
Index ¶
- Constants
- func ConfigValueFromHCL2(v cty.Value) interface{}
- func ConfigValueFromHCL2Block(v cty.Value, schema *configschema.Block) map[string]interface{}
- func FlatmapValueFromHCL2(v cty.Value) map[string]string
- func HCL2ValueFromConfigValue(v interface{}) cty.Value
- func HCL2ValueFromFlatmap(m map[string]string, ty cty.Type) (cty.Value, error)
Constants ¶
const UnknownVariableValue = "74D93920-ED26-11E3-AC10-0800200C9A66"
UnknownVariableValue is a sentinel value that can be used to denote that the value of a variable is unknown at this time. RawConfig uses this information to build up data about unknown keys.
Variables ¶
This section is empty.
Functions ¶
func ConfigValueFromHCL2 ¶
ConfigValueFromHCL2 converts a value from HCL2 (really, from the cty dynamic types library that HCL2 uses) to a value type that matches what would've been produced from the HCL-based interpolator for an equivalent structure.
This function will transform a cty null value into a Go nil value, which isn't a possible outcome of the HCL/HIL-based decoder and so callers may need to detect and reject any null values.
func ConfigValueFromHCL2Block ¶
func ConfigValueFromHCL2Block(v cty.Value, schema *configschema.Block) map[string]interface{}
ConfigValueFromHCL2Block is like ConfigValueFromHCL2 but it works only for known object values and uses the provided block schema to perform some additional normalization to better mimic the shape of value that the old HCL1/HIL-based codepaths would've produced.
In particular, it discards the collections that we use to represent nested blocks (other than NestingSingle) if they are empty, which better mimics the HCL1 behavior because HCL1 had no knowledge of the schema and so didn't know that an unspecified block _could_ exist.
The given object value must conform to the schema's implied type or this function will panic or produce incorrect results.
This is primarily useful for the final transition from new-style values to tofu.ResourceConfig before calling to a legacy provider, since helper/schema (the old provider SDK) is particularly sensitive to these subtle differences within its validation code.
func FlatmapValueFromHCL2 ¶
FlatmapValueFromHCL2 converts a value from HCL2 (really, from the cty dynamic types library that HCL2 uses) to a map compatible with what would be produced by the "flatmap" package.
The type of the given value informs the structure of the resulting map. The value must be of an object type or this function will panic.
Flatmap values can only represent maps when they are of primitive types, so the given value must not have any maps of complex types or the result is undefined.
func HCL2ValueFromConfigValue ¶
HCL2ValueFromConfigValue is the opposite of configValueFromHCL2: it takes a value as would be returned from the old interpolator and turns it into a cty.Value so it can be used within, for example, an HCL2 EvalContext.
func HCL2ValueFromFlatmap ¶
HCL2ValueFromFlatmap converts a map compatible with what would be produced by the "flatmap" package to a HCL2 (really, the cty dynamic types library that HCL2 uses) object type.
The intended result type must be provided in order to guide how the map contents are decoded. This must be an object type or this function will panic.
Flatmap values can only represent maps when they are of primitive types, so the given type must not have any maps of complex types or the result is undefined.
The result may contain null values if the given map does not contain keys for all of the different key paths implied by the given type.
Types ¶
This section is empty.