hcl2shim

package
v0.11.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2021 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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

func ConfigValueFromHCL2(v cty.Value) interface{}

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 HCL2TypeForHILType

func HCL2TypeForHILType(hilType ast.Type) cty.Type

func HCL2ValueFromConfigValue

func HCL2ValueFromConfigValue(v interface{}) cty.Value

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 HCL2ValueFromHILVariable

func HCL2ValueFromHILVariable(v ast.Variable) cty.Value

func HILVariableFromHCL2Value

func HILVariableFromHCL2Value(v cty.Value) ast.Variable

Types

type SingleAttrBody

type SingleAttrBody struct {
	Name string
	Expr hcl2.Expression
}

SingleAttrBody is a weird implementation of hcl2.Body that acts as if it has a single attribute whose value is the given expression.

This is used to shim Resource.RawCount and Output.RawConfig to behave more like they do in the old HCL loader.

func (SingleAttrBody) Content

func (SingleAttrBody) JustAttributes

func (b SingleAttrBody) JustAttributes() (hcl2.Attributes, hcl2.Diagnostics)

func (SingleAttrBody) MissingItemRange

func (b SingleAttrBody) MissingItemRange() hcl2.Range

func (SingleAttrBody) PartialContent

func (b SingleAttrBody) PartialContent(schema *hcl2.BodySchema) (*hcl2.BodyContent, hcl2.Body, hcl2.Diagnostics)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL