Documentation
¶
Overview ¶
Package addrs is a fork of Terraform's internal/addrs package.
This package contains reference addresses in the Terraform Language and implementations that parse hcl.Traversal to produce references.
Index ¶
- Constants
- type CountAttr
- type ForEachAttr
- type InputVariable
- type InstanceKey
- type InstanceKeyType
- type IntKey
- type LocalValue
- type Module
- type ModuleCall
- type ModuleCallInstance
- type ModuleCallInstanceOutput
- type PathAttr
- type Reference
- type Referenceable
- type Resource
- type ResourceInstance
- type ResourceMode
- type StringKey
- type TerraformAttr
Constants ¶
const Self selfT = 0
Self is the address of the special object "self" that behaves as an alias for a containing object currently in scope.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountAttr ¶ added in v0.12.0
type CountAttr struct { Name string // contains filtered or unexported fields }
CountAttr is the address of an attribute of the "count" object in the interpolation scope, like "count.index".
type ForEachAttr ¶ added in v0.12.0
type ForEachAttr struct { Name string // contains filtered or unexported fields }
ForEachAttr is the address of an attribute referencing the current "for_each" object in the interpolation scope, addressed using the "each" keyword, ex. "each.key" and "each.value"
func (ForEachAttr) String ¶ added in v0.12.0
func (f ForEachAttr) String() string
type InputVariable ¶ added in v0.12.0
type InputVariable struct { Name string // contains filtered or unexported fields }
InputVariable is the address of an input variable.
func (InputVariable) String ¶ added in v0.12.0
func (v InputVariable) String() string
type InstanceKey ¶ added in v0.12.0
type InstanceKey interface { String() string // Value returns the cty.Value of the appropriate type for the InstanceKey // value. Value() cty.Value // contains filtered or unexported methods }
InstanceKey represents the key of an instance within an object that contains multiple instances due to using "count" or "for_each" arguments in configuration.
IntKey and StringKey are the two implementations of this type. No other implementations are allowed. The single instance of an object that _isn't_ using "count" or "for_each" is represented by NoKey, which is a nil InstanceKey.
var NoKey InstanceKey
NoKey represents the absense of an InstanceKey, for the single instance of a configuration object that does not use "count" or "for_each" at all.
func ParseInstanceKey ¶ added in v0.12.0
func ParseInstanceKey(key cty.Value) (InstanceKey, error)
ParseInstanceKey returns the instance key corresponding to the given value, which must be known and non-null.
If an unknown or null value is provided then this function will panic. This function is intended to deal with the values that would naturally be found in a hcl.TraverseIndex, which (when parsed from source, at least) can never contain unknown or null values.
type InstanceKeyType ¶ added in v0.12.0
type InstanceKeyType rune
InstanceKeyType represents the different types of instance key that are supported. Usually it is sufficient to simply type-assert an InstanceKey value to either IntKey or StringKey, but this type and its values can be used to represent the types themselves, rather than specific values of those types.
const ( // NoKeyType is a type of NoKey instance key NoKeyType InstanceKeyType = 0 // IntKeyType is a type of IntKey instance key IntKeyType InstanceKeyType = 'I' // StringKeyType is a type of StringKey instance key StringKeyType InstanceKeyType = 'S' )
type IntKey ¶ added in v0.12.0
type IntKey int
IntKey is the InstanceKey representation representing integer indices, as used when the "count" argument is specified or if for_each is used with a sequence type.
type LocalValue ¶ added in v0.12.0
type LocalValue struct { Name string // contains filtered or unexported fields }
LocalValue is the address of a local value.
func (LocalValue) String ¶ added in v0.12.0
func (v LocalValue) String() string
type Module ¶
type Module []string
Module represents the structure of the module tree.
type ModuleCall ¶ added in v0.12.0
type ModuleCall struct { Name string // contains filtered or unexported fields }
ModuleCall is the address of a call from the current module to a child module.
func (ModuleCall) String ¶ added in v0.12.0
func (c ModuleCall) String() string
type ModuleCallInstance ¶ added in v0.12.0
type ModuleCallInstance struct { Call ModuleCall Key InstanceKey // contains filtered or unexported fields }
ModuleCallInstance is the address of one instance of a module created from a module call, which might create multiple instances using "count" or "for_each" arguments.
func (ModuleCallInstance) String ¶ added in v0.12.0
func (c ModuleCallInstance) String() string
type ModuleCallInstanceOutput ¶ added in v0.12.0
type ModuleCallInstanceOutput struct { Call ModuleCallInstance Name string // contains filtered or unexported fields }
ModuleCallInstanceOutput is the address of a particular named output produced by an instance of a module call.
func (ModuleCallInstanceOutput) String ¶ added in v0.12.0
func (co ModuleCallInstanceOutput) String() string
type PathAttr ¶ added in v0.12.0
type PathAttr struct { Name string // contains filtered or unexported fields }
PathAttr is the address of an attribute of the "path" object in the interpolation scope, like "path.module".
type Reference ¶ added in v0.12.0
type Reference struct { Subject Referenceable SourceRange hcl.Range Remaining hcl.Traversal }
Reference describes a reference to an address with source location information.
func ParseRef ¶ added in v0.12.0
func ParseRef(traversal hcl.Traversal) (*Reference, hcl.Diagnostics)
ParseRef attempts to extract a referencable address from the prefix of the given traversal, which must be an absolute traversal or this function will panic.
If no error diagnostics are returned, the returned reference includes the address that was extracted, the source range it was extracted from, and any remaining relative traversal that was not consumed as part of the reference.
If error diagnostics are returned then the Reference value is invalid and must not be used.
type Referenceable ¶ added in v0.12.0
type Referenceable interface { // String produces a string representation of the address that could be // parsed as a HCL traversal and passed to ParseRef to produce an identical // result. String() string // contains filtered or unexported methods }
Referenceable is an interface implemented by all address types that can appear as references in configuration language expressions.
type Resource ¶ added in v0.12.0
type Resource struct { Mode ResourceMode Type string Name string // contains filtered or unexported fields }
Resource is an address for a resource block within configuration, which contains potentially-multiple resource instances if that configuration block uses "count" or "for_each".
type ResourceInstance ¶ added in v0.12.0
type ResourceInstance struct { Resource Resource Key InstanceKey // contains filtered or unexported fields }
ResourceInstance is an address for a specific instance of a resource. When a resource is defined in configuration with "count" or "for_each" it produces zero or more instances, which can be addressed using this type.
func (ResourceInstance) String ¶ added in v0.12.0
func (r ResourceInstance) String() string
type ResourceMode ¶
type ResourceMode rune
ResourceMode defines which lifecycle applies to a given resource. Each resource lifecycle has a slightly different address format.
const ( // InvalidResourceMode is the zero value of ResourceMode and is not // a valid resource mode. InvalidResourceMode ResourceMode = 0 // ManagedResourceMode indicates a managed resource, as defined by // "resource" blocks in configuration. ManagedResourceMode ResourceMode = 'M' // DataResourceMode indicates a data resource, as defined by // "data" blocks in configuration. DataResourceMode ResourceMode = 'D' )
func (ResourceMode) String ¶ added in v0.12.0
func (i ResourceMode) String() string
type StringKey ¶ added in v0.12.0
type StringKey string
StringKey is the InstanceKey representation representing string indices, as used when the "for_each" argument is specified with a map or object type.
type TerraformAttr ¶ added in v0.12.0
type TerraformAttr struct { Name string // contains filtered or unexported fields }
TerraformAttr is the address of an attribute of the "terraform" object in the interpolation scope, like "terraform.workspace".
func (TerraformAttr) String ¶ added in v0.12.0
func (ta TerraformAttr) String() string