terraformWriter

package
v1.26.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortLiterals

func SortLiterals(v []*Literal)

SortLiterals sorts a list of Literal, by key. It does so in-place

Types

type Literal

type Literal struct {
	// Value is used to support Terraform's "${}" interpolation.
	Value string `cty:"value"`
	// Index to support the index of the count meta-argument.
	Index bool `cty:"index"`

	// Tokens are portions of a literal reference joined by periods.
	// example: {"aws_vpc", "foo", "id"}
	Tokens []string `cty:"tokens"`

	// FnName represents the name of a terraform function.
	FnName string `cty:"fn_name"`
	// FnArgs contains string representations of arguments to the function call.
	// Any string arguments must be quoted.
	FnArgs []string `cty:"fn_arg"`
}

Literal represents a literal in terraform syntax

func LiteralFromStringValue

func LiteralFromStringValue(s string) *Literal

func LiteralFunctionExpression added in v1.21.3

func LiteralFunctionExpression(functionName string, args []string) *Literal

func LiteralProperty

func LiteralProperty(resourceType, resourceName, prop string) *Literal
func LiteralSelfLink(resourceType, resourceName string) *Literal

func LiteralTokens added in v1.21.3

func LiteralTokens(tokens ...string) *Literal

func LiteralWithIndex added in v1.25.0

func LiteralWithIndex(s string) *Literal

func (*Literal) MarshalJSON

func (l *Literal) MarshalJSON() ([]byte, error)

type OutputValue

type OutputValue struct {
	Value      *Literal
	ValueArray []*Literal
}

type TerraformWriter

type TerraformWriter struct {

	// Files is a map of TF resource Files that should be created
	Files map[string][]byte
	// contains filtered or unexported fields
}

func (*TerraformWriter) AddFileBytes

func (t *TerraformWriter) AddFileBytes(resourceType string, resourceName string, key string, data []byte, base64 bool) (*Literal, error)

func (*TerraformWriter) AddOutputVariable

func (t *TerraformWriter) AddOutputVariable(key string, literal *Literal) error

func (*TerraformWriter) AddOutputVariableArray

func (t *TerraformWriter) AddOutputVariableArray(key string, literal *Literal) error

func (*TerraformWriter) GetOutputs

func (t *TerraformWriter) GetOutputs() (map[string]OutputValue, error)

func (*TerraformWriter) GetResourcesByType

func (t *TerraformWriter) GetResourcesByType() (map[string]map[string]interface{}, error)

func (*TerraformWriter) InitTerraformWriter

func (t *TerraformWriter) InitTerraformWriter()

func (*TerraformWriter) RenderResource

func (t *TerraformWriter) RenderResource(resourceType string, resourceName string, e interface{}) error

Jump to

Keyboard shortcuts

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