Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForCycles(modules []*TerraformModule) error
- func RunModules(modules []*TerraformModule) error
- func RunModulesReverseOrder(modules []*TerraformModule) error
- func RunModulesWithHandler(modules []*TerraformModule, handler ModuleHandler, order DependencyOrder) error
- type DependencyCycle
- type DependencyNotFoundWhileCrossLinking
- type DependencyOrder
- type ModuleHandler
- type ModuleStatus
- type MultiError
- type PlanMultiError
- type RunningModuleByPath
- type SimpleTerraformModule
- type SimpleTerraformModules
- type Stack
- func (stack *Stack) CheckForCycles() error
- func (stack Stack) JSON() string
- func (stack *Stack) Output(command string, terragruntOptions *options.TerragruntOptions) error
- func (stack *Stack) Plan(command string, terragruntOptions *options.TerragruntOptions) error
- func (stack *Stack) RunAll(command []string, terragruntOptions *options.TerragruntOptions, ...) error
- func (stack Stack) SimpleModules() SimpleTerraformModules
- func (stack *Stack) SortModules()
- func (stack *Stack) String() string
- type TerraformModule
- type TerraformModuleByPath
- type UnrecognizedDependency
Constants ¶
const ERROR_EXIT_CODE = 1
const NORMAL_EXIT_CODE = 0
const UNDEFINED_EXIT_CODE = -1
Variables ¶
var CreateMultiErrors = func(errs []error) error { return MultiError{Errors: errs} }
Using CreateMultiErrors as a variable instead of a function allows us to override the function used to compose multi error object. It is used if a command wants to change the default behavior of the severity analysis that is implemented by default.
Functions ¶
func CheckForCycles ¶
func CheckForCycles(modules []*TerraformModule) error
Check for dependency cycles in the given list of modules and return an error if one is found
func RunModules ¶
func RunModules(modules []*TerraformModule) error
Run the given map of module path to runningModule. To "run" a module, execute the RunTerragrunt command in its TerragruntOptions object. The modules will be executed in an order determined by their inter-dependencies, using as much concurrency as possible.
func RunModulesReverseOrder ¶
func RunModulesReverseOrder(modules []*TerraformModule) error
Run the given map of module path to runningModule. To "run" a module, execute the RunTerragrunt command in its TerragruntOptions object. The modules will be executed in the reverse order of their inter-dependencies, using as much concurrency as possible.
func RunModulesWithHandler ¶ added in v1.0.0
func RunModulesWithHandler(modules []*TerraformModule, handler ModuleHandler, order DependencyOrder) error
Run the given map of module path to runningModule. To "run" a module, execute the RunTerragrunt command in its TerragruntOptions object. The modules will be executed in an order determined by their inter-dependencies, using as much concurrency as possible. This version accepts a function as parameter (see: ModuleHander). The handler is called when the command is completed (either succeeded or failed).
Types ¶
type DependencyCycle ¶
type DependencyCycle []string
func (DependencyCycle) Error ¶
func (err DependencyCycle) Error() string
type DependencyNotFoundWhileCrossLinking ¶
type DependencyNotFoundWhileCrossLinking struct { Module *runningModule Dependency *TerraformModule }
func (DependencyNotFoundWhileCrossLinking) Error ¶
func (err DependencyNotFoundWhileCrossLinking) Error() string
type DependencyOrder ¶
type DependencyOrder int
This controls in what order dependencies should be enforced between modules
const ( NormalOrder DependencyOrder = iota ReverseOrder )
type ModuleHandler ¶ added in v1.0.0
type ModuleHandler func(TerraformModule, string, error) (string, error)
Handler function prototype to inject interaction during the processing. The function receive the current module, its output and its error in parameter. Normally, the handler should return the same error as received in parameter, but it is possible to alter the normal course of the proccess by changing the error result.
type ModuleStatus ¶
type ModuleStatus int
Represents the status of a module that we are trying to apply as part of the apply-all or destroy-all command
const ( Waiting ModuleStatus = iota Running Finished )
type MultiError ¶
type MultiError struct {
Errors []error
}
func (MultiError) Error ¶
func (e MultiError) Error() string
func (MultiError) ExitStatus ¶ added in v0.12.14
func (e MultiError) ExitStatus() (int, error)
type PlanMultiError ¶ added in v1.0.0
type PlanMultiError struct {
MultiError
}
This is a specialized version of MultiError type It handles the exit code differently from the base implementation
func (PlanMultiError) ExitStatus ¶ added in v1.0.0
func (this PlanMultiError) ExitStatus() (int, error)
type RunningModuleByPath ¶
type RunningModuleByPath []*runningModule
func (RunningModuleByPath) Len ¶
func (byPath RunningModuleByPath) Len() int
func (RunningModuleByPath) Less ¶
func (byPath RunningModuleByPath) Less(i, j int) bool
func (RunningModuleByPath) Swap ¶
func (byPath RunningModuleByPath) Swap(i, j int)
type SimpleTerraformModule ¶ added in v1.0.0
type SimpleTerraformModule struct { Path string `json:"path"` Dependencies []string `json:"dependencies,omitempty" yaml:",omitempty"` }
SimpleTerraformModule represents a simplified version of TerraformModule
type SimpleTerraformModules ¶ added in v1.0.0
type SimpleTerraformModules []SimpleTerraformModule
SimpleTerraformModules represents a list of simplified version of TerraformModule
func (SimpleTerraformModules) MakeRelative ¶ added in v1.0.0
func (modules SimpleTerraformModules) MakeRelative() (result SimpleTerraformModules)
MakeRelative transforms each absolute path in relative path
type Stack ¶
type Stack struct { Path string Modules []*TerraformModule }
Represents a stack of Terraform modules (i.e. folders with Terraform templates) that you can "spin up" or "spin down" in a single command
func FindStackInSubfolders ¶
func FindStackInSubfolders(terragruntOptions *options.TerragruntOptions) (*Stack, error)
Find all the Terraform modules in the subfolders of the working directory of the given TerragruntOptions and assemble them into a Stack object that can be applied or destroyed in a single command
func (*Stack) CheckForCycles ¶
Return an error if there is a dependency cycle in the modules of this stack.
func (*Stack) Output ¶
func (stack *Stack) Output(command string, terragruntOptions *options.TerragruntOptions) error
Output prints the outputs of all the modules in the given stack in their specified order.
func (*Stack) Plan ¶ added in v0.12.13
func (stack *Stack) Plan(command string, terragruntOptions *options.TerragruntOptions) error
Plan all the modules in the given stack in their specified order.
func (*Stack) RunAll ¶ added in v1.0.0
func (stack *Stack) RunAll(command []string, terragruntOptions *options.TerragruntOptions, order DependencyOrder) error
Run the specified command on all modules in the given stack in their specified order.
func (Stack) SimpleModules ¶ added in v1.0.0
func (stack Stack) SimpleModules() SimpleTerraformModules
SimpleModules returns the list of modules (simplified serializable version)
func (*Stack) SortModules ¶ added in v1.0.0
func (stack *Stack) SortModules()
SortModules sorts in-place the list of modules topologically
type TerraformModule ¶
type TerraformModule struct { Path string Dependencies []*TerraformModule Config config.TerragruntConfig TerragruntOptions *options.TerragruntOptions AssumeAlreadyApplied bool }
Represents a single module (i.e. folder with Terraform templates), including the Terragrunt configuration for that module and the list of other modules that this module depends on
func ResolveTerraformModules ¶
func ResolveTerraformModules(terragruntConfigPaths []string, terragruntOptions *options.TerragruntOptions) ([]*TerraformModule, error)
Go through each of the given Terragrunt configuration files and resolve the module that configuration file represents into a TerraformModule struct. Return the list of these TerraformModule structs.
func (*TerraformModule) Simple ¶ added in v1.0.0
func (module *TerraformModule) Simple() SimpleTerraformModule
Simple returns a simplified version of the module with paths relative to working dir
func (TerraformModule) String ¶
func (module TerraformModule) String() string
Render this module as a human-readable string
type TerraformModuleByPath ¶
type TerraformModuleByPath []*TerraformModule
func (TerraformModuleByPath) Len ¶
func (byPath TerraformModuleByPath) Len() int
func (TerraformModuleByPath) Less ¶
func (byPath TerraformModuleByPath) Less(i, j int) bool
func (TerraformModuleByPath) Swap ¶
func (byPath TerraformModuleByPath) Swap(i, j int)
type UnrecognizedDependency ¶
type UnrecognizedDependency struct { ModulePath string DependencyPath string TerragruntConfigPaths []string }
func (UnrecognizedDependency) Error ¶
func (err UnrecognizedDependency) Error() string