Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTerraformVersion(constraint string, terragruntOptions *options.TerragruntOptions) error
- func CheckTerragruntVersion(constraint string, terragruntOptions *options.TerragruntOptions) error
- func CreateTerragruntCli(version string, writer io.Writer, errwriter io.Writer) *cli.App
- func ParseTerragruntOptions(cliContext *cli.Context) (*options.TerragruntOptions, error)
- func PopulateTerraformVersion(terragruntOptions *options.TerragruntOptions) error
- func RunTerragrunt(terragruntOptions *options.TerragruntOptions) error
- type ArgMissingValue
- type ArgumentNotAllowed
- type BackendNotDefined
- type FileCopyGetter
- type InvalidTerraformVersion
- type InvalidTerraformVersionSyntax
- type InvalidTerragruntVersion
- type MalformedJSONValErr
- type MaxRetriesExceeded
- type MissingCommand
- type MissingOverrides
- type ModuleIsProtected
- type NoTerraformFilesFound
- type RunAllDisabledErr
- type TerraformModule
- type TerraformModulesJson
- type TerragruntInfoGroup
- type TypeInferenceErr
- type UnrecognizedCommand
- type WorkingDirNotDir
- type WorkingDirNotFound
Constants ¶
const ( CMD_SPIN_UP = "spin-up" CMD_TEAR_DOWN = "tear-down" CMD_PLAN_ALL = "plan-all" CMD_APPLY_ALL = "apply-all" CMD_DESTROY_ALL = "destroy-all" CMD_OUTPUT_ALL = "output-all" CMD_VALIDATE_ALL = "validate-all" )
The following commands are DEPRECATED
const CMD_AWS_PROVIDER_PATCH = "aws-provider-patch"
const CMD_HCLFMT = "hclfmt"
const CMD_INIT = "init"
const CMD_INIT_FROM_MODULE = "init-from-module"
const CMD_LOCK = "lock"
const CMD_PROVIDERS = "providers"
const CMD_RENDER_JSON = "render-json"
const CMD_RUN_ALL = "run-all"
START: Constants useful for multimodule command handling
const CMD_TERRAGRUNT_GRAPH_DEPENDENCIES = "graph-dependencies"
const CMD_TERRAGRUNT_INFO = "terragrunt-info"
const CMD_TERRAGRUNT_READ_CONFIG = "terragrunt-read-config"
const CMD_TERRAGRUNT_VALIDATE_INPUTS = "validate-inputs"
const DEFAULT_TERRAFORM_VERSION_CONSTRAINT = ">= v0.12.0"
This uses the constraint syntax from https://github.com/hashicorp/go-version This version of Terragrunt was tested to work with Terraform 0.12.0 and above only
const MODULE_MANIFEST_NAME = ".terragrunt-module-manifest"
manifest for files copied from terragrunt module folder (i.e., the folder that contains the current terragrunt.hcl)
const SOURCE_MANIFEST_NAME = ".terragrunt-source-manifest"
manifest for files copied from the URL specified in the terraform { source = "<URL>" } config
const TERRAFORM_EXTENSION_GLOB = "*.tf"
const TFVarPrefix = "TF_VAR"
Prefix to use for terraform variables set with environment variables.
const TerragruntTFVarsFile = "terragrunt-debug.tfvars.json"
Variables ¶
var CUSTOM_USAGE_TEXT = `` /* 5061-byte string literal not displayed */
Since Terragrunt is just a thin wrapper for Terraform, and we don't want to repeat every single Terraform command in its definition, we don't quite fit into the model of any Go CLI library. Fortunately, urfave/cli allows us to override the whole template used for the Usage Text.
TODO: this description text has copy/pasted versions of many Terragrunt constants, such as command names and file names. It would be easy to make this code DRY using fmt.Sprintf(), but then it's hard to make the text align nicely. Write some code to take generate this help text automatically, possibly leveraging code that's part of urfave/cli.
var MODULE_REGEX = regexp.MustCompile(`module[[:blank:]]+".+"`)
var MULTI_MODULE_COMMANDS = []string{ CMD_RUN_ALL, CMD_APPLY_ALL, CMD_DESTROY_ALL, CMD_OUTPUT_ALL, CMD_PLAN_ALL, CMD_VALIDATE_ALL, }
var TERRAFORM_COMMANDS_THAT_DO_NOT_NEED_INIT = []string{
"version",
"terragrunt-info",
"graph-dependencies",
}
var TERRAFORM_COMMANDS_THAT_USE_STATE = []string{
"init",
"apply",
"destroy",
"env",
"import",
"graph",
"output",
"plan",
"push",
"refresh",
"show",
"taint",
"untaint",
"validate",
"force-unlock",
"state",
}
var TERRAFORM_HELP_FLAGS = []string{
"--help",
"-help",
"-h",
}
The supported flags to show help of terraform commands
var TerraformVersionRegex = regexp.MustCompile(`Terraform (v?\d+\.\d+\.\d+).*`)
TerraformVersionRegex verifies that terraform --version output is in one of the following formats: - Terraform v0.9.5-dev (cad024a5fe131a546936674ef85445215bbc4226+CHANGES) - Terraform v0.13.0-beta2 - Terraform v0.12.27 We only make sure the "v#.#.#" part is present in the output.
Functions ¶
func CheckTerraformVersion ¶ added in v0.12.5
func CheckTerraformVersion(constraint string, terragruntOptions *options.TerragruntOptions) error
Check that the currently installed Terraform version works meets the specified version constraint and return an error if it doesn't
func CheckTerragruntVersion ¶ added in v0.23.19
func CheckTerragruntVersion(constraint string, terragruntOptions *options.TerragruntOptions) error
Check that the currently running Terragrunt version meets the specified version constraint and return an error if it doesn't
func CreateTerragruntCli ¶
Create the Terragrunt CLI App
func ParseTerragruntOptions ¶ added in v0.6.0
func ParseTerragruntOptions(cliContext *cli.Context) (*options.TerragruntOptions, error)
ParseTerragruntOptions Parse command line options that are passed in for Terragrunt
func PopulateTerraformVersion ¶ added in v0.13.0
func PopulateTerraformVersion(terragruntOptions *options.TerragruntOptions) error
Populate the currently installed version of Terraform into the given terragruntOptions
func RunTerragrunt ¶ added in v0.21.7
func RunTerragrunt(terragruntOptions *options.TerragruntOptions) error
Downloads terraform source if necessary, then runs terraform with the given options and CLI args. This will forward all the args and extra_arguments directly to Terraform.
Types ¶
type ArgMissingValue ¶ added in v0.6.0
type ArgMissingValue string
func (ArgMissingValue) Error ¶ added in v0.6.0
func (err ArgMissingValue) Error() string
type ArgumentNotAllowed ¶ added in v0.13.0
func (ArgumentNotAllowed) Error ¶ added in v0.13.0
func (err ArgumentNotAllowed) Error() string
type BackendNotDefined ¶ added in v0.13.5
type BackendNotDefined struct { Opts *options.TerragruntOptions BackendType string }
func (BackendNotDefined) Error ¶ added in v0.13.5
func (err BackendNotDefined) Error() string
type FileCopyGetter ¶ added in v0.19.1
type FileCopyGetter struct { getter.FileGetter // List of glob paths that should be included in the copy. This can be used to override the default behavior of // Terragrunt, which will skip hidden folders. IncludeInCopy []string }
A custom getter.Getter implementation that uses file copying instead of symlinks. Symlinks are faster and use less disk space, but they cause issues in Windows and with infinite loops, so we copy files/folders instead.
type InvalidTerraformVersion ¶ added in v0.12.5
type InvalidTerraformVersion struct { CurrentVersion *version.Version VersionConstraints version.Constraints }
func (InvalidTerraformVersion) Error ¶ added in v0.12.5
func (err InvalidTerraformVersion) Error() string
type InvalidTerraformVersionSyntax ¶ added in v0.12.5
type InvalidTerraformVersionSyntax string
func (InvalidTerraformVersionSyntax) Error ¶ added in v0.12.5
func (err InvalidTerraformVersionSyntax) Error() string
type InvalidTerragruntVersion ¶ added in v0.23.19
type InvalidTerragruntVersion struct { CurrentVersion *version.Version VersionConstraints version.Constraints }
func (InvalidTerragruntVersion) Error ¶ added in v0.23.19
func (err InvalidTerragruntVersion) Error() string
type MalformedJSONValErr ¶ added in v0.30.2
type MalformedJSONValErr struct {
// contains filtered or unexported fields
}
func (MalformedJSONValErr) Error ¶ added in v0.30.2
func (err MalformedJSONValErr) Error() string
type MaxRetriesExceeded ¶ added in v0.17.0
type MaxRetriesExceeded struct {
Opts *options.TerragruntOptions
}
func (MaxRetriesExceeded) Error ¶ added in v0.17.0
func (err MaxRetriesExceeded) Error() string
type MissingCommand ¶ added in v0.33.1
type MissingCommand struct{}
func (MissingCommand) Error ¶ added in v0.33.1
func (commandName MissingCommand) Error() string
type MissingOverrides ¶ added in v0.23.40
type MissingOverrides string
func (MissingOverrides) Error ¶ added in v0.23.40
func (err MissingOverrides) Error() string
type ModuleIsProtected ¶ added in v0.16.4
type ModuleIsProtected struct {
Opts *options.TerragruntOptions
}
func (ModuleIsProtected) Error ¶ added in v0.16.4
func (err ModuleIsProtected) Error() string
type NoTerraformFilesFound ¶ added in v0.16.0
type NoTerraformFilesFound string
func (NoTerraformFilesFound) Error ¶ added in v0.16.0
func (path NoTerraformFilesFound) Error() string
type RunAllDisabledErr ¶ added in v0.28.1
type RunAllDisabledErr struct {
// contains filtered or unexported fields
}
func (RunAllDisabledErr) Error ¶ added in v0.28.1
func (err RunAllDisabledErr) Error() string
type TerraformModule ¶ added in v0.23.40
type TerraformModulesJson ¶ added in v0.23.40
type TerraformModulesJson struct {
Modules []TerraformModule
}
The format we expect in the .terraform/modules/modules.json file
type TerragruntInfoGroup ¶ added in v0.18.5
type TerragruntInfoGroup struct { ConfigPath string DownloadDir string IamRole string TerraformBinary string TerraformCommand string WorkingDir string }
Struct is output as JSON by 'terragrunt-info':
type TypeInferenceErr ¶ added in v0.30.2
type TypeInferenceErr struct {
// contains filtered or unexported fields
}
func (TypeInferenceErr) Error ¶ added in v0.30.2
func (err TypeInferenceErr) Error() string
type UnrecognizedCommand ¶ added in v0.6.0
type UnrecognizedCommand string
func (UnrecognizedCommand) Error ¶ added in v0.6.0
func (commandName UnrecognizedCommand) Error() string
type WorkingDirNotDir ¶ added in v0.31.10
func (WorkingDirNotDir) Error ¶ added in v0.31.10
func (err WorkingDirNotDir) Error() string
type WorkingDirNotFound ¶ added in v0.31.10
func (WorkingDirNotFound) Error ¶ added in v0.31.10
func (err WorkingDirNotFound) Error() string