Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfigPath(workingDir string) string
- func FindConfigFilesInPath(terragruntOptions *options.TerragruntOptions) ([]string, error)
- func IsTerragruntConfigFile(path string) (bool, error)
- func ResolveTerragruntConfigString(terragruntConfigString string, include IncludeConfig, ...) (string, error)
- func SubstituteVars(str string, terragruntOptions *options.TerragruntOptions) string
- type ActualCommand
- type ApprovalConfig
- type ApprovalConfigList
- func (list ApprovalConfigList) Enabled() ApprovalConfigList
- func (list ApprovalConfigList) Help(listOnly bool, lookups ...string) (result string)
- func (list *ApprovalConfigList) Merge(imported ApprovalConfigList)
- func (list ApprovalConfigList) Run(status error, args ...interface{}) (result []interface{}, err error)
- func (list ApprovalConfigList) ShouldBeApproved(command string) (bool, *ApprovalConfig)
- type CouldNotResolveTerragruntConfigInFile
- type ExtraCommand
- type ExtraCommandList
- func (list ExtraCommandList) ActualCommand(cmd string) ActualCommand
- func (list ExtraCommandList) Enabled() ExtraCommandList
- func (list ExtraCommandList) GetVersions() string
- func (list ExtraCommandList) Help(listOnly bool, lookups ...string) (result string)
- func (list *ExtraCommandList) Merge(imported ExtraCommandList)
- func (list ExtraCommandList) Run(status error, args ...interface{}) (result []interface{}, err error)
- type GenericItem
- type GenericItemList
- type Hook
- type HookFilter
- type HookList
- func (list HookList) Enabled() HookList
- func (list HookList) Filter(filter HookFilter) HookList
- func (list HookList) Help(listOnly bool, lookups ...string) (result string)
- func (list *HookList) MergeAppend(imported HookList)
- func (list *HookList) MergePrepend(imported HookList)
- func (list HookList) Run(status error, args ...interface{}) (result []interface{}, err error)
- type ImportFiles
- type ImportFilesList
- func (list ImportFilesList) Enabled() ImportFilesList
- func (list ImportFilesList) Help(listOnly bool, lookups ...string) (result string)
- func (list *ImportFilesList) Merge(imported ImportFilesList)
- func (list ImportFilesList) Run(status error, args ...interface{}) (result []interface{}, err error)
- func (list ImportFilesList) RunOnModules(terragruntOptions *options.TerragruntOptions) (result interface{}, err error)
- type IncludeConfig
- type IncludedConfigMissingPath
- type LockConfig
- type ModuleDependencies
- type RunConditions
- type TerraformConfig
- type TerraformExtraArguments
- type TerraformExtraArgumentsList
- func (list TerraformExtraArgumentsList) Enabled() TerraformExtraArgumentsList
- func (list TerraformExtraArgumentsList) Filter(source string) (result []string, err error)
- func (list TerraformExtraArgumentsList) Help(listOnly bool, lookups ...string) (result string)
- func (list *TerraformExtraArgumentsList) Merge(imported TerraformExtraArgumentsList)
- func (list TerraformExtraArgumentsList) Run(status error, args ...interface{}) (result []interface{}, err error)
- type TerragruntConfig
- type TerragruntConfigFile
- type TerragruntExtensionBase
- type TerragruntExtensioner
- func IApprovalConfig(item interface{}) TerragruntExtensioner
- func IExtraCommand(item interface{}) TerragruntExtensioner
- func IGenericItem(item interface{}) TerragruntExtensioner
- func IHook(item interface{}) TerragruntExtensioner
- func IImportFiles(item interface{}) TerragruntExtensioner
- func ITerraformExtraArguments(item interface{}) TerragruntExtensioner
- type UnknownHelperFunction
Constants ¶
const ( // DefaultTerragruntConfigPath is the name of the default file name where to store terragrunt definitions DefaultTerragruntConfigPath = "terraform.tfvars" // OldTerragruntConfigPath is the name of the legacy file name used to store terragrunt definitions OldTerragruntConfigPath = ".terragrunt" // TerragruntScriptFolder is the name of the scripts folder generated under the temporary terragrunt folder TerragruntScriptFolder = ".terragrunt-scripts" )
Variables ¶
var AfterInitState = func(hook Hook) bool { return hook.AfterInitState && !hook.BeforeImports }
AfterInitState is a filter function
var BeforeImports = func(hook Hook) bool { return hook.BeforeImports }
BeforeImports is a filter function
var BeforeInitState = func(hook Hook) bool { return !hook.AfterInitState && !hook.BeforeImports }
BeforeInitState is a filter function
var TerraformCommandWithInput = []string{
"apply",
"import",
"init",
"plan",
"refresh",
}
TerraformCommandWithInput is the list of Terraform commands accepting --input
var TerraformCommandWithLockTimeout = []string{
"apply",
"destroy",
"import",
"init",
"plan",
"refresh",
"taint",
"untaint",
}
TerraformCommandWithLockTimeout is the list of Terraform commands accepting --lock-timeout
var TerraformCommandWithVarFile = []string{
"apply",
"console",
"destroy",
"import",
"plan",
"push",
"refresh",
"validate",
}
TerraformCommandWithVarFile is the list of Terraform commands accepting -var-file
var TitleID = color.New(color.FgHiYellow).SprintFunc()
TitleID add formating to the id of the elements
Functions ¶
func DefaultConfigPath ¶ added in v0.10.0
DefaultConfigPath returns 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(terragruntOptions *options.TerragruntOptions) ([]string, error)
FindConfigFilesInPath 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
IsTerragruntConfigFile 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:
- The file exists
- It is a .terragrunt file, which is the old Terragrunt-specific file format
- 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)
ResolveTerragruntConfigString 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.
func SubstituteVars ¶ added in v1.0.0
func SubstituteVars(str string, terragruntOptions *options.TerragruntOptions) string
SubstituteVars substitutes any variables in the string if there is a value associated with the variable
Types ¶
type ActualCommand ¶ added in v1.0.0
type ActualCommand struct { Command string BehaveAs string Extra *ExtraCommand }
ActualCommand represents the command that should be executed
type ApprovalConfig ¶ added in v1.0.0
type ApprovalConfig struct { TerragruntExtensionBase `hcl:",squash"` Commands []string `hcl:"commands"` ExpectStatements []string `hcl:"expect_statements"` CompletedStatements []string `hcl:"completed_statements"` }
ApprovalConfig represents an `expect` format configuration that instructs terragrunt to wait for input on an ExpectStatement and to exit the command on a CompletedStatement
func (ApprovalConfig) String ¶ added in v1.0.0
func (item ApprovalConfig) String() string
type ApprovalConfigList ¶ added in v1.0.0
type ApprovalConfigList []ApprovalConfig
ApprovalConfigList represents an array of ApprovalConfig
func (ApprovalConfigList) Enabled ¶ added in v1.0.0
func (list ApprovalConfigList) Enabled() ApprovalConfigList
Enabled returns only the enabled items on the list
func (ApprovalConfigList) Help ¶ added in v1.0.0
func (list ApprovalConfigList) Help(listOnly bool, lookups ...string) (result string)
Help returns the information relative to the elements within the list
func (*ApprovalConfigList) Merge ¶ added in v1.0.0
func (list *ApprovalConfigList) Merge(imported ApprovalConfigList)
Merge elements from an imported list to the current list
func (ApprovalConfigList) Run ¶ added in v1.0.0
func (list ApprovalConfigList) Run(status error, args ...interface{}) (result []interface{}, err error)
Run execute the content of the list
func (ApprovalConfigList) ShouldBeApproved ¶ added in v1.0.0
func (list ApprovalConfigList) ShouldBeApproved(command string) (bool, *ApprovalConfig)
ShouldBeApproved looks for an approval config that corresponds to the given command. If if exists, it's returned with the value `true`.
type CouldNotResolveTerragruntConfigInFile ¶ added in v0.10.0
type CouldNotResolveTerragruntConfigInFile string
CouldNotResolveTerragruntConfigInFile is the error returned when the configuration file could not be resolved
func (CouldNotResolveTerragruntConfigInFile) Error ¶ added in v0.10.0
func (err CouldNotResolveTerragruntConfigInFile) Error() string
type ExtraCommand ¶ added in v1.0.0
type ExtraCommand struct { TerragruntExtensionBase `hcl:",squash"` Commands []string `hcl:"commands"` Aliases []string `hcl:"aliases"` Arguments []string `hcl:"arguments"` ExpandArgs *bool `hcl:"expand_args"` UseState *bool `hcl:"use_state"` ActAs string `hcl:"act_as"` VersionArg string `hcl:"version"` ShellCommand bool `hcl:"shell_command"` // This indicates that the command is a shell command and output should not be redirected IgnoreError bool `hcl:"ignore_error"` }
ExtraCommand is a definition of user extra command that should be executed in place of terraform
type ExtraCommandList ¶ added in v1.0.0
type ExtraCommandList []ExtraCommand
ExtraCommandList represents an array of ExtraCommand
func (ExtraCommandList) ActualCommand ¶ added in v1.0.0
func (list ExtraCommandList) ActualCommand(cmd string) ActualCommand
ActualCommand returns
func (ExtraCommandList) Enabled ¶ added in v1.0.0
func (list ExtraCommandList) Enabled() ExtraCommandList
Enabled returns only the enabled items on the list
func (ExtraCommandList) GetVersions ¶ added in v1.0.0
func (list ExtraCommandList) GetVersions() string
GetVersions returns the the list of versions for extra commands that have a version available
func (ExtraCommandList) Help ¶ added in v1.0.0
func (list ExtraCommandList) Help(listOnly bool, lookups ...string) (result string)
Help returns the information relative to the elements within the list
func (*ExtraCommandList) Merge ¶ added in v1.0.0
func (list *ExtraCommandList) Merge(imported ExtraCommandList)
Merge elements from an imported list to the current list
func (ExtraCommandList) Run ¶ added in v1.0.0
func (list ExtraCommandList) Run(status error, args ...interface{}) (result []interface{}, err error)
Run execute the content of the list
type GenericItem ¶ added in v1.0.0
GenericItem is a generic implementation
type GenericItemList ¶ added in v1.0.0
type GenericItemList []GenericItem
GenericItemList represents an array of GenericItem
func (GenericItemList) Enabled ¶ added in v1.0.0
func (list GenericItemList) Enabled() GenericItemList
Enabled returns only the enabled items on the list
func (GenericItemList) Help ¶ added in v1.0.0
func (list GenericItemList) Help(listOnly bool, lookups ...string) (result string)
Help returns the information relative to the elements within the list
func (GenericItemList) Run ¶ added in v1.0.0
func (list GenericItemList) Run(status error, args ...interface{}) (result []interface{}, err error)
Run execute the content of the list
type Hook ¶ added in v1.0.0
type Hook struct { TerragruntExtensionBase `hcl:",squash"` Command string `hcl:"command"` Arguments []string `hcl:"arguments"` ExpandArgs bool `hcl:"expand_args"` OnCommands []string `hcl:"on_commands"` IgnoreError bool `hcl:"ignore_error"` BeforeImports bool `hcl:"before_imports"` AfterInitState bool `hcl:"after_init_state"` Order int `hcl:"order"` ShellCommand bool `hcl:"shell_command"` // This indicates that the command is a shell command and output should not be redirected }
Hook is a definition of user command that should be executed as part of the terragrunt process
type HookFilter ¶ added in v1.0.0
HookFilter is used to filter the hook on supplied criteria
type HookList ¶ added in v1.0.0
type HookList []Hook
HookList represents an array of Hook
func (HookList) Filter ¶ added in v1.0.0
func (list HookList) Filter(filter HookFilter) HookList
Filter returns a list of hook that match the supplied filter
func (HookList) Help ¶ added in v1.0.0
Help returns the information relative to the elements within the list
func (*HookList) MergeAppend ¶ added in v1.0.0
MergeAppend appends elements from an imported list to the current list
func (*HookList) MergePrepend ¶ added in v1.0.0
MergePrepend prepends elements from an imported list to the current list
type ImportFiles ¶ added in v1.0.0
type ImportFiles struct { TerragruntExtensionBase `hcl:",squash"` Source string `hcl:"source"` Files []string `hcl:"files"` CopyAndRename []copyAndRename `hcl:"copy_and_remove"` Required *bool `hcl:"required,omitempty"` ImportIntoModules bool `hcl:"import_into_modules"` FileMode *int `hcl:"file_mode"` Target string `hcl:"target"` Prefix string `hcl:"prefix"` }
ImportFiles is a configuration of files that must be imported from another directory to the terraform directory prior executing terraform commands
type ImportFilesList ¶ added in v1.0.0
type ImportFilesList []ImportFiles
ImportFilesList represents an array of ImportFiles
func (ImportFilesList) Enabled ¶ added in v1.0.0
func (list ImportFilesList) Enabled() ImportFilesList
Enabled returns only the enabled items on the list
func (ImportFilesList) Help ¶ added in v1.0.0
func (list ImportFilesList) Help(listOnly bool, lookups ...string) (result string)
Help returns the information relative to the elements within the list
func (*ImportFilesList) Merge ¶ added in v1.0.0
func (list *ImportFilesList) Merge(imported ImportFilesList)
Merge elements from an imported list to the current list
func (ImportFilesList) Run ¶ added in v1.0.0
func (list ImportFilesList) Run(status error, args ...interface{}) (result []interface{}, err error)
Run execute the content of the list
func (ImportFilesList) RunOnModules ¶ added in v1.0.0
func (list ImportFilesList) RunOnModules(terragruntOptions *options.TerragruntOptions) (result interface{}, err error)
RunOnModules executes list configuration on module folders
type IncludeConfig ¶ added in v0.4.0
type IncludeConfig struct { Source string `hcl:"source"` Path string `hcl:"path"` // contains filtered or unexported fields }
IncludeConfig represents the configuration settings for a parent Terragrunt configuration file that you can "include" in a child Terragrunt configuration file
func (IncludeConfig) String ¶ added in v1.0.0
func (include IncludeConfig) String() string
type IncludedConfigMissingPath ¶ added in v0.4.0
type IncludedConfigMissingPath string
IncludedConfigMissingPath is the error returned when there is no path defined in the include directive
func (IncludedConfigMissingPath) Error ¶ added in v0.4.0
func (err IncludedConfigMissingPath) Error() string
type LockConfig ¶ added in v0.1.0
type LockConfig map[interface{}]interface{}
LockConfig is 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 RunConditions ¶ added in v1.0.0
type RunConditions struct { Run map[string][]interface{} `hcl:"run_if"` Ignore map[string][]interface{} `hcl:"ignore_if"` }
RunConditions defines the rules that are evaluated in order to determine
func (RunConditions) ShouldRun ¶ added in v1.0.0
func (conditions RunConditions) ShouldRun(terragruntOptions *options.TerragruntOptions) bool
ShouldRun returns whether or not the current project should be run based on its run conditions and the variables in its options.
type TerraformConfig ¶ added in v0.9.4
type TerraformConfig struct { ExtraArgs TerraformExtraArgumentsList `hcl:"extra_arguments"` Source string `hcl:"source"` }
TerraformConfig specifies where to find the Terraform configuration files
func (TerraformConfig) String ¶ added in v0.9.4
func (conf TerraformConfig) String() string
type TerraformExtraArguments ¶ added in v0.10.2
type TerraformExtraArguments struct { TerragruntExtensionBase `hcl:",squash"` Source string `hcl:"source"` Arguments []string `hcl:"arguments"` Vars []string `hcl:"vars"` RequiredVarFiles []string `hcl:"required_var_files"` OptionalVarFiles []string `hcl:"optional_var_files"` Commands []string `hcl:"commands"` }
TerraformExtraArguments sets a list of arguments to pass to Terraform if command fits any in the `Commands` list
type TerraformExtraArgumentsList ¶ added in v1.0.0
type TerraformExtraArgumentsList []TerraformExtraArguments
TerraformExtraArgumentsList represents an array of TerraformExtraArguments
func (TerraformExtraArgumentsList) Enabled ¶ added in v1.0.0
func (list TerraformExtraArgumentsList) Enabled() TerraformExtraArgumentsList
Enabled returns only the enabled items on the list
func (TerraformExtraArgumentsList) Filter ¶ added in v1.0.0
func (list TerraformExtraArgumentsList) Filter(source string) (result []string, err error)
Filter applies extra_arguments to the current configuration
func (TerraformExtraArgumentsList) Help ¶ added in v1.0.0
func (list TerraformExtraArgumentsList) Help(listOnly bool, lookups ...string) (result string)
Help returns the information relative to the elements within the list
func (*TerraformExtraArgumentsList) Merge ¶ added in v1.0.0
func (list *TerraformExtraArgumentsList) Merge(imported TerraformExtraArgumentsList)
Merge elements from an imported list to the current list
func (TerraformExtraArgumentsList) Run ¶ added in v1.0.0
func (list TerraformExtraArgumentsList) Run(status error, args ...interface{}) (result []interface{}, err error)
Run execute the content of the list
type TerragruntConfig ¶
type TerragruntConfig struct { Description string `hcl:"description"` RunConditions *RunConditions `hcl:"run_conditions"` Terraform *TerraformConfig `hcl:"terraform"` RemoteState *remote.RemoteState `hcl:"remote_state"` Dependencies *ModuleDependencies `hcl:"dependencies"` Uniqueness *string `hcl:"uniqueness_criteria"` AssumeRole interface{} `hcl:"assume_role"` PreHooks HookList `hcl:"pre_hook"` PostHooks HookList `hcl:"post_hook"` ExtraCommands ExtraCommandList `hcl:"extra_command"` ImportFiles ImportFilesList `hcl:"import_files"` ApprovalConfig ApprovalConfigList `hcl:"approval_config"` // contains filtered or unexported fields }
TerragruntConfig represents a parsed and expanded configuration
func ParseConfigFile ¶ added in v0.6.0
func ParseConfigFile(terragruntOptions *options.TerragruntOptions, include IncludeConfig) (config *TerragruntConfig, err error)
ParseConfigFile parses 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)
ReadTerragruntConfig reads the Terragrunt config file from its default location
func (TerragruntConfig) ExtraArguments ¶ added in v1.0.0
func (conf TerragruntConfig) ExtraArguments(source string) ([]string, error)
ExtraArguments processes the extra_arguments defined in the terraform section of the config file
func (TerragruntConfig) String ¶ added in v0.9.4
func (conf TerragruntConfig) String() string
func (*TerragruntConfig) SubstituteAllVariables ¶ added in v1.0.0
func (conf *TerragruntConfig) SubstituteAllVariables(terragruntOptions *options.TerragruntOptions, substituteFinal bool)
SubstituteAllVariables replace all remaining variables by the value
type TerragruntConfigFile ¶ added in v1.0.0
type TerragruntConfigFile struct { TerragruntConfig `hcl:",squash"` Include *IncludeConfig Lock *LockConfig Path string }
TerragruntConfigFile represents the configuration supported in a Terragrunt configuration file (i.e. terraform.tfvars or .terragrunt)
func (TerragruntConfigFile) String ¶ added in v1.0.0
func (tcf TerragruntConfigFile) String() string
type TerragruntExtensionBase ¶ added in v1.0.0
type TerragruntExtensionBase struct { Name string `hcl:",key"` DisplayName string `hcl:"display_name"` Description string `hcl:"description"` OS []string `hcl:"os"` Disabled bool `hcl:"disabled"` // contains filtered or unexported fields }
TerragruntExtensionBase is the base object to define object used to extend the behavior of terragrunt
func (TerragruntExtensionBase) String ¶ added in v1.0.0
func (base TerragruntExtensionBase) String() string
type TerragruntExtensioner ¶ added in v1.0.0
type TerragruntExtensioner interface {
// contains filtered or unexported methods
}
TerragruntExtensioner defines the interface that must be implemented by Terragrunt Extension objects
func IApprovalConfig ¶ added in v1.0.0
func IApprovalConfig(item interface{}) TerragruntExtensioner
IApprovalConfig returns TerragruntExtensioner from the supplied type
func IExtraCommand ¶ added in v1.0.0
func IExtraCommand(item interface{}) TerragruntExtensioner
IExtraCommand returns TerragruntExtensioner from the supplied type
func IGenericItem ¶ added in v1.0.0
func IGenericItem(item interface{}) TerragruntExtensioner
IGenericItem returns TerragruntExtensioner from the supplied type
func IHook ¶ added in v1.0.0
func IHook(item interface{}) TerragruntExtensioner
IHook returns TerragruntExtensioner from the supplied type
func IImportFiles ¶ added in v1.0.0
func IImportFiles(item interface{}) TerragruntExtensioner
IImportFiles returns TerragruntExtensioner from the supplied type
func ITerraformExtraArguments ¶ added in v1.0.0
func ITerraformExtraArguments(item interface{}) TerragruntExtensioner
ITerraformExtraArguments returns TerragruntExtensioner from the supplied type
type UnknownHelperFunction ¶ added in v0.4.0
type UnknownHelperFunction string
UnknownHelperFunction indicates an unknown invoked command
func (UnknownHelperFunction) Error ¶ added in v0.4.0
func (err UnknownHelperFunction) Error() string
Source Files ¶
- config.go
- config_helpers.go
- config_substitute.go
- extension_approval_config.go
- extension_base.go
- extension_base_list.go
- extension_extra_args.go
- extension_extra_command.go
- extension_hook.go
- extension_import_files.go
- generated_approval_config.go
- generated_extra_args.go
- generated_extra_command.go
- generated_hooks.go
- generated_import_files.go