Documentation ¶
Overview ¶
Package codegen contains routines for generating terraform code
Index ¶
- Constants
- func RemoteStateConfigToTerraformCode(backend string, config map[string]interface{}) ([]byte, error)
- func WriteToFile(terragruntOptions *options.TerragruntOptions, basePath string, ...) error
- type GenerateConfig
- type GenerateConfigDisabled
- type GenerateConfigExists
- type GenerateFileExistsError
- type GenerateFileRemoveError
- type UnknownGenerateIfDisabledVal
- type UnknownGenerateIfExistsVal
Constants ¶
const ( // A comment that is added to the top of the generated file to indicate that this file was generated by Terragrunt. // We use a hardcoded random string at the end to make the string further unique. TerragruntGeneratedSignature = "Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa" // The default prefix to use for comments in the generated file DefaultCommentPrefix = "# " )
const ( ExistsErrorStr = "error" ExistsSkipStr = "skip" ExistsOverwriteStr = "overwrite" ExistsOverwriteTerragruntStr = "overwrite_terragrunt" DisabledSkipStr = "skip" DisabledRemoveStr = "remove" DisabledRemoveTerragruntStr = "remove_terragrunt" )
Variables ¶
This section is empty.
Functions ¶
func RemoteStateConfigToTerraformCode ¶
func RemoteStateConfigToTerraformCode(backend string, config map[string]interface{}) ([]byte, error)
RemoteStateConfigToTerraformCode converts the arbitrary map that represents a remote state config into HCL code to configure that remote state.
func WriteToFile ¶
func WriteToFile(terragruntOptions *options.TerragruntOptions, basePath string, config GenerateConfig) error
WriteToFile will generate a new file at the given target path with the given contents. If a file already exists at the target path, the behavior depends on the value of IfExists: - if ExistsError, return an error. - if ExistsSkip, do nothing and return - if ExistsOverwrite, overwrite the existing file
Types ¶
type GenerateConfig ¶
type GenerateConfig struct { Path string `cty:"path"` IfExists GenerateConfigExists IfExistsStr string `cty:"if_exists"` IfDisabled GenerateConfigDisabled IfDisabledStr string `cty:"if_disabled"` CommentPrefix string `cty:"comment_prefix"` Contents string `cty:"contents"` DisableSignature bool `cty:"disable_signature"` Disable bool `cty:"disable"` }
GenerateConfig is configuration for generating code
type GenerateConfigDisabled ¶ added in v0.58.1
type GenerateConfigDisabled int
GenerateConfigDisabled is an enum to represent valid values for if_disabled.
const ( DisabledSkip GenerateConfigDisabled = iota DisabledRemove DisabledRemoveTerragrunt DisabledUnknown )
func GenerateConfigDisabledFromString ¶ added in v0.58.1
func GenerateConfigDisabledFromString(val string) (GenerateConfigDisabled, error)
GenerateConfigDisabledFromString converts a string representation of if_disabled into the enum, returning an error if it is not set to one of the known values.
type GenerateConfigExists ¶
type GenerateConfigExists int
GenerateConfigExists is an enum to represent valid values for if_exists.
const ( ExistsError GenerateConfigExists = iota ExistsSkip ExistsOverwrite ExistsOverwriteTerragrunt ExistsUnknown )
func GenerateConfigExistsFromString ¶
func GenerateConfigExistsFromString(val string) (GenerateConfigExists, error)
GenerateConfigExistsFromString converts a string representation of if_exists into the enum, returning an error if it is not set to one of the known values.
type GenerateFileExistsError ¶
type GenerateFileExistsError struct {
// contains filtered or unexported fields
}
func (GenerateFileExistsError) Error ¶
func (err GenerateFileExistsError) Error() string
type GenerateFileRemoveError ¶ added in v0.58.1
type GenerateFileRemoveError struct {
// contains filtered or unexported fields
}
func (GenerateFileRemoveError) Error ¶ added in v0.58.1
func (err GenerateFileRemoveError) Error() string
type UnknownGenerateIfDisabledVal ¶ added in v0.58.1
type UnknownGenerateIfDisabledVal struct {
// contains filtered or unexported fields
}
func (UnknownGenerateIfDisabledVal) Error ¶ added in v0.58.1
func (err UnknownGenerateIfDisabledVal) Error() string
type UnknownGenerateIfExistsVal ¶
type UnknownGenerateIfExistsVal struct {
// contains filtered or unexported fields
}
func (UnknownGenerateIfExistsVal) Error ¶
func (err UnknownGenerateIfExistsVal) Error() string