terraformWriter

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: Apache-2.0 Imports: 11 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 LiteralEmptyStrConditionalExpression added in v1.26.3

func LiteralEmptyStrConditionalExpression(empty, value *Literal) *Literal

LiteralEmptyStrConditionalExpression constructs a Literal which returns `null` if the supplied "empty" expression is an empty string, 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 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 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 TerraformProvider added in v1.27.0

type TerraformProvider struct {
	// Name is the name of the terraform provider
	Name string
	// Arguments are additional settings used in the provider definition
	Arguments map[string]string
}

TerraformProvider is a provider definition for a terraform file written to cloud storage (S3, GCS, etc)

type TerraformWriter

type TerraformWriter struct {

	// Providers is a list of TF Providers we need for writing files
	Providers map[string]*TerraformProvider

	// 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) EnsureTerraformProvider added in v1.27.0

func (t *TerraformWriter) EnsureTerraformProvider(name string, arguments map[string]string) *TerraformProvider

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