terraformWriter

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 9 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 {
	// String is the Terraform representation.
	String string `cty:"string"`
}

Literal represents a literal in terraform syntax

func LiteralBinaryExpression added in v1.26.0

func LiteralBinaryExpression(lhs *Literal, operator string, rhs *Literal) *Literal

LiteralBinaryExpression constructs a Literal with the result of a binary operator expression. It is the caller's responsibility to ensure the supplied parameters do not use operators with lower precedence than the supplied operator.

func LiteralData added in v1.26.0

func LiteralData(dataSourceType, dataSourceName, prop string) *Literal

func LiteralFromIntValue added in v1.26.0

func LiteralFromIntValue[T constraints.Integer](i T) *Literal

func LiteralFromStringValue

func LiteralFromStringValue(s string) *Literal

func LiteralFunctionExpression added in v1.21.3

func LiteralFunctionExpression(functionName string, args ...*Literal) *Literal

LiteralFunctionExpression constructs a Literal representing the result of calling the supplied functionName with the supplied args.

func LiteralIndexExpression added in v1.26.0

func LiteralIndexExpression(collection *Literal, index *Literal) *Literal

LiteralIndexExpression constructs a Literal with the result of accessing the supplied collection using the supplied index. It is the caller's responsibility to ensure the supplied collection does not use operators with lower precedence than the index operator.

func LiteralListExpression added in v1.26.0

func LiteralListExpression(args ...*Literal) *Literal

LiteralListExpression constructs a Literal consisting of a list of supplied Literals.

func LiteralNullConditionalExpression added in v1.26.0

func LiteralNullConditionalExpression(nullable, value *Literal) *Literal

LiteralNullConditionalExpression constructs a Literal which returns `null` if the supplied "nullable" expression is null, otherwise returns "value". It is the caller's responsibility to ensure the supplied parameters do not use operators with lower precedence than the conditional operator.

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) IsSingleValue added in v1.26.0

func (l *Literal) IsSingleValue() bool

func (*Literal) MarshalJSON

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

func (*Literal) Write added in v1.26.0

func (l *Literal) Write(buffer *bytes.Buffer, indent int, key string)

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) AddFilePath added in v1.26.0

func (t *TerraformWriter) AddFilePath(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) GetDataSourcesByType added in v1.26.0

func (t *TerraformWriter) GetDataSourcesByType() (map[string]map[string]interface{}, 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) RenderDataSource added in v1.26.0

func (t *TerraformWriter) RenderDataSource(dataType string, dataName string, e interface{}) error

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