Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfigPath(workingDir string) string
- func FindConfigFilesInPath(rootPath string, terragruntOptions *options.TerragruntOptions) ([]string, error)
- func IsTerragruntConfigFile(path string) (bool, error)
- func ResolveTerragruntConfigString(terragruntConfigString string, include *IncludeConfig, ...) (string, error)
- type CouldNotResolveTerragruntConfigInFile
- type EmptyStringNotAllowed
- type EnvVar
- type ErrorParsingTerragruntConfig
- type Hook
- type IncludeConfig
- type IncludedConfigMissingPath
- type InvalidArgError
- type InvalidGetEnvParams
- type InvalidInterpolationSyntax
- type InvalidStringParams
- type LockConfig
- type ModuleDependencies
- type ParentFileNotFound
- type TerraformConfig
- type TerraformExtraArguments
- type TerragruntConfig
- type TooManyLevelsOfInheritance
- type UnknownHelperFunction
Constants ¶
const DefaultTerragruntConfigPath = "terraform.tfvars"
const OldTerragruntConfigPath = ".terragrunt"
Variables ¶
var HELPER_FUNCTION_GET_ENV_PARAMETERS_SYNTAX_REGEX = regexp.MustCompile(`^\s*"(?P<env>[^=]+?)"\s*\,\s*"(?P<default>.*?)"\s*$`)
var HELPER_FUNCTION_SYNTAX_REGEX = regexp.MustCompile(`^\$\{\s*(.*?)\((.*?)\)\s*\}$`)
var INTERPOLATION_PARAMETERS = `(\s*"[^"]*?"\s*,?\s*)*`
var INTERPOLATION_SYNTAX_REGEX = regexp.MustCompile(fmt.Sprintf(`\$\{\s*\w+\(%s\)\s*\}`, INTERPOLATION_PARAMETERS))
var INTERPOLATION_SYNTAX_REGEX_REMAINING = regexp.MustCompile(`\$\{.*?\}`)
var INTERPOLATION_SYNTAX_REGEX_SINGLE = regexp.MustCompile(fmt.Sprintf(`"(%s)"`, INTERPOLATION_SYNTAX_REGEX))
var TERRAFORM_COMMANDS_NEED_INPUT = []string{
"apply",
"import",
"init",
"plan",
"refresh",
}
List of terraform commands that accept -input=
var TERRAFORM_COMMANDS_NEED_LOCKING = []string{
"apply",
"destroy",
"import",
"init",
"plan",
"refresh",
"taint",
"untaint",
}
List of terraform commands that accept -lock-timeout
var TERRAFORM_COMMANDS_NEED_VARS = []string{
"apply",
"console",
"destroy",
"import",
"plan",
"push",
"refresh",
"validate",
}
List of terraform commands that accept -var or -var-file
Functions ¶
func DefaultConfigPath ¶ added in v0.10.0
Return the default path to use for the Terragrunt configuration file. The reason this is a method rather than a constant is that older versions of Terragrunt stored configuration in a different file. This method returns the path to the old configuration format if such a file exists and the new format otherwise.
func FindConfigFilesInPath ¶ added in v0.10.0
func FindConfigFilesInPath(rootPath string, terragruntOptions *options.TerragruntOptions) ([]string, error)
Returns a list of all Terragrunt config files in the given path or any subfolder of the path. A file is a Terragrunt config file if it has a name as returned by the DefaultConfigPath method and contains Terragrunt config contents as returned by the IsTerragruntConfigFile method.
func IsTerragruntConfigFile ¶ added in v0.10.0
Returns true if the given path corresponds to file that could be a Terragrunt config file. A file could be a Terragrunt config file if:
1. The file exists 2. It is a .terragrunt file, which is the old Terragrunt-specific file format 3. The file contains HCL contents with a terragrunt = { ... } block
func ResolveTerragruntConfigString ¶ added in v0.4.0
func ResolveTerragruntConfigString(terragruntConfigString string, include *IncludeConfig, terragruntOptions *options.TerragruntOptions) (string, error)
Given a string value from a Terragrunt configuration, parse the string, resolve any calls to helper functions using the syntax ${...}, and return the final value.
Types ¶
type CouldNotResolveTerragruntConfigInFile ¶ added in v0.10.0
type CouldNotResolveTerragruntConfigInFile string
func (CouldNotResolveTerragruntConfigInFile) Error ¶ added in v0.10.0
func (err CouldNotResolveTerragruntConfigInFile) Error() string
type EmptyStringNotAllowed ¶ added in v0.13.8
type EmptyStringNotAllowed string
func (EmptyStringNotAllowed) Error ¶ added in v0.13.8
func (err EmptyStringNotAllowed) Error() string
type ErrorParsingTerragruntConfig ¶ added in v0.13.14
func (ErrorParsingTerragruntConfig) Error ¶ added in v0.13.14
func (err ErrorParsingTerragruntConfig) Error() string
type Hook ¶ added in v0.14.4
type Hook struct { Name string `hcl:",key"` Commands []string `hcl:"commands,omitempty"` Execute []string `hcl:"execute,omitempty"` RunOnError bool `hcl:"run_on_error,omitempty"` }
Hook specifies terraform commands (apply/plan) and array of os commands to execute
type IncludeConfig ¶ added in v0.4.0
type IncludeConfig struct {
Path string `hcl:"path"`
}
IncludeConfig represents the configuration settings for a parent Terragrunt configuration file that you can "include" in a child Terragrunt configuration file
type IncludedConfigMissingPath ¶ added in v0.4.0
type IncludedConfigMissingPath string
func (IncludedConfigMissingPath) Error ¶ added in v0.4.0
func (err IncludedConfigMissingPath) Error() string
type InvalidArgError ¶ added in v0.14.4
type InvalidArgError string
func (InvalidArgError) Error ¶ added in v0.14.4
func (e InvalidArgError) Error() string
type InvalidGetEnvParams ¶ added in v0.13.8
type InvalidGetEnvParams string
func (InvalidGetEnvParams) Error ¶ added in v0.13.8
func (err InvalidGetEnvParams) Error() string
type InvalidInterpolationSyntax ¶ added in v0.4.0
type InvalidInterpolationSyntax string
func (InvalidInterpolationSyntax) Error ¶ added in v0.4.0
func (err InvalidInterpolationSyntax) Error() string
type InvalidStringParams ¶ added in v0.13.9
type InvalidStringParams string
func (InvalidStringParams) Error ¶ added in v0.13.9
func (err InvalidStringParams) Error() string
type LockConfig ¶ added in v0.1.0
type LockConfig map[interface{}]interface{}
Older versions of Terraform did not support locking, so Terragrunt offered locking as a feature. As of version 0.9.0, Terraform supports locking natively, so this feature was removed from Terragrunt. However, we keep around the LockConfig so we can log a warning for Terragrunt users who are still trying to use it.
type ModuleDependencies ¶ added in v0.6.0
type ModuleDependencies struct {
Paths []string `hcl:"paths"`
}
ModuleDependencies represents the paths to other Terraform modules that must be applied before the current module can be applied
func (*ModuleDependencies) String ¶ added in v0.9.4
func (deps *ModuleDependencies) String() string
type ParentFileNotFound ¶ added in v0.13.8
func (ParentFileNotFound) Error ¶ added in v0.13.8
func (err ParentFileNotFound) Error() string
type TerraformConfig ¶ added in v0.9.4
type TerraformConfig struct { ExtraArgs []TerraformExtraArguments `hcl:"extra_arguments"` Source string `hcl:"source"` BeforeHooks []Hook `hcl:"before_hook"` AfterHooks []Hook `hcl:"after_hook"` }
TerraformConfig specifies where to find the Terraform configuration files
func (*TerraformConfig) GetAfterHooks ¶ added in v0.14.4
func (conf *TerraformConfig) GetAfterHooks() []Hook
func (*TerraformConfig) GetBeforeHooks ¶ added in v0.14.4
func (conf *TerraformConfig) GetBeforeHooks() []Hook
func (*TerraformConfig) String ¶ added in v0.9.4
func (conf *TerraformConfig) String() string
func (*TerraformConfig) ValidateHooks ¶ added in v0.14.4
func (conf *TerraformConfig) ValidateHooks() error
type TerraformExtraArguments ¶ added in v0.10.2
type TerraformExtraArguments struct { Name string `hcl:",key"` Arguments []string `hcl:"arguments,omitempty"` RequiredVarFiles []string `hcl:"required_var_files,omitempty"` OptionalVarFiles []string `hcl:"optional_var_files,omitempty"` Commands []string `hcl:"commands,omitempty"` EnvVars map[string]string `hcl:"env_vars,omitempty"` }
TerraformExtraArguments sets a list of arguments to pass to Terraform if command fits any in the `Commands` list
func (*TerraformExtraArguments) String ¶ added in v0.10.2
func (conf *TerraformExtraArguments) String() string
type TerragruntConfig ¶
type TerragruntConfig struct { Terraform *TerraformConfig RemoteState *remote.RemoteState Dependencies *ModuleDependencies PreventDestroy bool Skip bool IamRole string }
TerragruntConfig represents a parsed and expanded configuration
func ParseConfigFile ¶ added in v0.6.0
func ParseConfigFile(configPath string, terragruntOptions *options.TerragruntOptions, include *IncludeConfig) (*TerragruntConfig, error)
Parse the Terragrunt config file at the given path. If the include parameter is not nil, then treat this as a config included in some other config file when resolving relative paths.
func ReadTerragruntConfig ¶
func ReadTerragruntConfig(terragruntOptions *options.TerragruntOptions) (*TerragruntConfig, error)
Read the Terragrunt config file from its default location
func (*TerragruntConfig) String ¶ added in v0.9.4
func (conf *TerragruntConfig) String() string
type TooManyLevelsOfInheritance ¶ added in v0.4.0
type TooManyLevelsOfInheritance struct { ConfigPath string FirstLevelIncludePath string SecondLevelIncludePath string }
func (TooManyLevelsOfInheritance) Error ¶ added in v0.4.0
func (err TooManyLevelsOfInheritance) Error() string
type UnknownHelperFunction ¶ added in v0.4.0
type UnknownHelperFunction string
func (UnknownHelperFunction) Error ¶ added in v0.4.0
func (err UnknownHelperFunction) Error() string