parser

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectorSeparator = "connector--"

ConnectorSeparator is used to separate the connector id and the instance name.

View Source
const TerraformTypeData = "terraform_data"

The type terraform data implements the standard resource lifecycle, but does not directly take any other actions. Resource components should skip the data type.

Variables

This section is empty.

Functions

func ParseIndexKey added in v0.6.0

func ParseIndexKey(rs resourceState, is instanceObjectState) (string, error)

ParseIndexKey parse the index key from the instance object state. The index key is used to identify the terraform resource instance, e.g. `helm_release.foo[0]`.

func ParseInstanceID

func ParseInstanceID(rs resourceState, is instanceObjectState) (string, error)

ParseInstanceID get the real instance id from the instance object state. The instance id is stored in the "name" attribute of resource component.

func ParseInstanceMetadata

func ParseInstanceMetadata(is instanceObjectState) ([]byte, error)

ParseInstanceMetadata get the metadata from the instance object state.

func ParseInstanceProviderConnector

func ParseInstanceProviderConnector(providerString string) (string, error)

ParseInstanceProviderConnector get the provider connector from the provider instance string.

func ParseStateProviders

func ParseStateProviders(s string) ([]string, error)

ParseStateProviders parse terraform state and get providers.

Types

type AbsProviderConfig

type AbsProviderConfig struct {
	Provider Provider
	Alias    string
}

AbsProviderConfig is the absolute address of a provider configuration within a particular module instance.

func ParseAbsProviderConfig

func ParseAbsProviderConfig(traversal hcl.Traversal) (*AbsProviderConfig, error)

ParseAbsProviderConfig parses the given traversal as an absolute provider configuration address.

func ParseAbsProviderString

func ParseAbsProviderString(str string) (*AbsProviderConfig, error)

type OutputState deprecated

type OutputState struct {
	Value     property.Value `json:"value"`
	Type      cty.Type       `json:"type"`
	Sensitive bool           `json:"sensitive,omitempty"`
}

OutputState is the state of the output.

Deprecated: please use types.OutputValue instead.

type Provider

type Provider = tfaddr.Provider

type StateParser added in v0.6.0

type StateParser struct{}

func (StateParser) GetComponentsAndExtractDependencies added in v0.6.0

func (StateParser) GetComponentsAndExtractDependencies(
	ctx context.Context,
	mc model.ClientSet,
	run *model.ResourceRun,
) (
	components model.ResourceComponents,
	dependencies map[string][]string,
	err error,
)

GetComponentsAndExtractDependencies returns the components and dependency components after parse the resource state.

GetComponentsAndExtractDependencies returns list must not be `nil` unless unexpected input or raising error, it can be used to clean stale items safety if got an empty list.

func (StateParser) GetOriginalOutputs added in v0.6.0

func (p StateParser) GetOriginalOutputs(stateData, resourceName string) ([]types.OutputValue, error)

GetOriginalOutputs returns the original outputs after parsed the resource run output(terraform state).

The given run must carry the resource on the edges, especially the resource's name.

This function returns the original outputs, which means the output's name(hcl label) is the same as the original one defined on the terraform template.

func (StateParser) GetOriginalOutputsMap added in v0.6.0

func (p StateParser) GetOriginalOutputsMap(stateData, resourceName string) (map[string]types.OutputValue, error)

GetOriginalOutputsMap is similar to GetOriginalOutputs, but returns the original outputs in map form.

func (StateParser) GetOutputMap added in v0.6.0

func (StateParser) GetOutputMap(stateData string) (map[string]types.OutputValue, error)

GetOutputMap returns the original outputs after parsed the resource run output(terraform state).

Since we mutate the output names before executing a terraform deployment, the output's name(hcl label) is not the same as the original one defined on the terraform template.

This function is used for bridging the referring between multiple (walrus)resources. Use GetOriginalOutputsMap if wanna the original outputs.

Jump to

Keyboard shortcuts

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