terraformWriter

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 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 only used in terraform 0.11 and represents the literal string to use as a value.
	// "${}" interpolation is supported.
	Value string `cty:"value"`

	// The below fields are only used in terraform 0.12.
	// ResourceType represents the type of a resource in a literal reference
	ResourceType string `cty:"resource_type"`
	// ResourceName represents the name of a resource in a literal reference
	ResourceName string `cty:"resource_name"`
	// ResourceProp represents the property of a resource in a literal reference
	ResourceProp string `cty:"resource_prop"`
	// FilePath represents the path for a file reference
	FilePath string `cty:"file_path"`
	// FileFn represents the function used to reference the file
	FileFn fileFn `cty:"file_fn"`
}

Literal represents a literal in terraform syntax

func LiteralFileExpression

func LiteralFileExpression(modulePath string, base64 bool) *Literal

func LiteralFromStringValue

func LiteralFromStringValue(s string) *Literal

func LiteralProperty

func LiteralProperty(resourceType, resourceName, prop string) *Literal
func LiteralSelfLink(resourceType, resourceName 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