Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFiles ¶
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
func NewTFVariable ¶
func NewTFVariable(p jsonschema.Property, required bool) TFVariable
NewTFVariable creates a new TFVariable from a JSON Schema Property
type TFVariableFile ¶
type TFVariableFile struct {
Variable map[string]TFVariable `json:"variable"`
}
TFVariableFile is a representation of a variables.tf file in JSON format