configstack

package
v0.55.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 21 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoTerraformModulesFound = fmt.Errorf("Could not find any subfolders with Terragrunt configuration files")

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 ListStackDependentModules added in v0.55.0

func ListStackDependentModules(stack *Stack) map[string][]string

ListStackDependentModules - build a map with each module and its dependent modules

func RunModules

func RunModules(modules []*TerraformModule, parallelism int) 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 RunModulesIgnoreOrder added in v0.20.2

func RunModulesIgnoreOrder(modules []*TerraformModule, parallelism int) 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 without caring for inter-dependencies.

func RunModulesReverseOrder

func RunModulesReverseOrder(modules []*TerraformModule, parallelism int) 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 WriteDot added in v0.23.7

func WriteDot(w io.Writer, terragruntOptions *options.TerragruntOptions, modules []*TerraformModule) error

WriteDot is used to emit a GraphViz compatible definition for a directed graph. It can be used to dump a .dot file. This is a similar implementation to terraform's digraph https://github.com/hashicorp/terraform/blob/master/digraph/graphviz.go adding some styling to modules that are excluded from the execution in *-all commands

Types

type DependencyCycle

type DependencyCycle []string

func (DependencyCycle) Error

func (err DependencyCycle) Error() string

type DependencyFinishedWithError

type DependencyFinishedWithError struct {
	Module     *TerraformModule
	Dependency *TerraformModule
	Err        error
}

func (DependencyFinishedWithError) Error

func (err DependencyFinishedWithError) Error() string

func (DependencyFinishedWithError) ExitStatus added in v0.12.14

func (this DependencyFinishedWithError) ExitStatus() (int, error)

type DependencyNotFoundWhileCrossLinking

type DependencyNotFoundWhileCrossLinking struct {
	Module     *runningModule
	Dependency *TerraformModule
}

func (DependencyNotFoundWhileCrossLinking) Error

type DependencyOrder

type DependencyOrder int

This controls in what order dependencies should be enforced between modules

const (
	NormalOrder DependencyOrder = iota
	ReverseOrder
	IgnoreOrder
)

type ErrorProcessingModule added in v0.13.12

type ErrorProcessingModule struct {
	UnderlyingError       error
	ModulePath            string
	HowThisModuleWasFound string
}

func (ErrorProcessingModule) Error added in v0.13.12

func (err ErrorProcessingModule) Error() string

type ForceLogLevelHook added in v0.35.5

type ForceLogLevelHook struct {
	TriggerLevels []logrus.Level
	ForcedLevel   logrus.Level
}

ForceLogLevelHook - log hook which can change log level for messages which contains specific substrings

func NewForceLogLevelHook added in v0.35.5

func NewForceLogLevelHook(forcedLevel logrus.Level) *ForceLogLevelHook

NewForceLogLevelHook - create default log reduction hook

func (*ForceLogLevelHook) Fire added in v0.35.5

func (hook *ForceLogLevelHook) Fire(entry *logrus.Entry) error

Fire - function invoked against log entries when entry will match loglevel from Levels()

func (*ForceLogLevelHook) Levels added in v0.35.5

func (hook *ForceLogLevelHook) Levels() []logrus.Level

Levels - return log levels on which hook will be triggered

type InfiniteRecursion added in v0.13.15

type InfiniteRecursion struct {
	RecursionLevel int
	Modules        map[string]*TerraformModule
}

func (InfiniteRecursion) Error added in v0.13.15

func (err InfiniteRecursion) Error() string

type LogEntriesDropperFormatter added in v0.35.5

type LogEntriesDropperFormatter struct {
	OriginalFormatter logrus.Formatter
}

LogEntriesDropperFormatter - custom formatter which will ignore log entries which has lower level than preconfigured in logger

func (*LogEntriesDropperFormatter) Format added in v0.35.5

func (formatter *LogEntriesDropperFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format - custom entry formatting function which will drop entries with lower level than set in logger

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 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 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, childTerragruntConfig *config.TerragruntConfig) (*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

func (stack *Stack) CheckForCycles() error

Return an error if there is a dependency cycle in the modules of this stack.

func (*Stack) Graph added in v0.23.7

func (stack *Stack) Graph(terragruntOptions *options.TerragruntOptions)

Graph creates a graphviz representation of the modules

func (*Stack) JsonModuleDeployOrder added in v0.48.5

func (stack *Stack) JsonModuleDeployOrder(terraformCommand string) (string, error)

JsonModuleDeployOrder will return the modules that will be deployed by a plan/apply operation, in the order that the operations happen.

func (*Stack) LogModuleDeployOrder added in v0.35.4

func (stack *Stack) LogModuleDeployOrder(logger *logrus.Entry, terraformCommand string) error

LogModuleDeployOrder will log the modules that will be deployed by this operation, in the order that the operations happen. For plan and apply, the order will be bottom to top (dependencies first), while for destroy the order will be in reverse.

func (*Stack) Run added in v0.28.1

func (stack *Stack) Run(terragruntOptions *options.TerragruntOptions) error

func (*Stack) String

func (stack *Stack) String() string

Render this stack as a human-readable string

type TerraformModule

type TerraformModule struct {
	Path                 string
	Dependencies         []*TerraformModule
	Config               config.TerragruntConfig
	TerragruntOptions    *options.TerragruntOptions
	AssumeAlreadyApplied bool
	FlagExcluded         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 FindWhereWorkingDirIsIncluded added in v0.33.0

func FindWhereWorkingDirIsIncluded(terragruntOptions *options.TerragruntOptions, terragruntConfig *config.TerragruntConfig) []*TerraformModule

FindWhereWorkingDirIsIncluded - find where working directory is included, flow: 1. Find root git top level directory and build list of modules 2. Iterate over includes from terragruntOptions if git top level directory detection failed 3. Filter found module only items which has in dependencies working directory

func ResolveTerraformModules

func ResolveTerraformModules(terragruntConfigPaths []string, terragruntOptions *options.TerragruntOptions, childTerragruntConfig *config.TerragruntConfig, howThesePathsWereFound string) ([]*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) MarshalJSON added in v0.48.5

func (module TerraformModule) MarshalJSON() ([]byte, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL