terraform

package
v0.0.0-...-2263012 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFiles

func GenerateFiles(buildPath, stepPath string, b *bundle.Bundle, fs afero.Fs) error

Types

type TFOptionalVariable

type TFOptionalVariable struct {
	Type     string  `json:"type"`
	DoNotSet *string `json:"default"` // DO NOT SET THIS. The intention is to get a nil value for this
}

TFOptionalVariable is a representation of a terraform HCL "variable" with a default of null

func (TFOptionalVariable) IsTFVariable

func (TFOptionalVariable) IsTFVariable()

type TFRequiredVariable

type TFRequiredVariable struct {
	Type string `json:"type"`
}

TFRequiredVariable is a representation of a terraform HCL "variable"

func (TFRequiredVariable) IsTFVariable

func (TFRequiredVariable) IsTFVariable()

Dummy functions to satisfy the interface

type TFVariable

type TFVariable interface {
	IsTFVariable()
}

In terraform, we need to set "default: null" for non-required fields, however the "default" field should NOT be set if the field is required. There isn't a good way to solve this in Golang with a single struct. Thus, we need two structs: a TFRequiredVariable which *doesn't* serialize a default value (making it required by TF), and a TFOptionalVariable which does serialize a default value (represented as a nil pointer, which serializes to null) This interface allows us to work with them interchangably as needed

type TFVariableFile

type TFVariableFile struct {
	Variable map[string]TFVariable `json:"variable"`
}

TFVariableFile is a representation of a variables.tf file in JSON format

Jump to

Keyboard shortcuts

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