configstack

package
v0.86.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package configstack provides the implementation of the Runner, which run units as groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, l log.Logger, terragruntOptions *options.TerragruntOptions, opts ...common.Option) (common.StackRunner, error)

Build builds a new Runner.

Types

type DependencyController

type DependencyController struct {
	Runner         *common.UnitRunner
	DependencyDone chan *DependencyController
	Dependencies   map[string]*DependencyController
	NotifyWhenDone []*DependencyController
}

DependencyController manages dependencies and dependency order, and contains a UnitRunner.

func NewDependencyController

func NewDependencyController(unit *common.Unit) *DependencyController

NewDependencyController Create a new dependency controller for the given unit.

type DependencyOrder

type DependencyOrder int

DependencyOrder controls in what order dependencies should be enforced between units.

const (
	NormalOrder DependencyOrder = iota
	ReverseOrder
	IgnoreOrder
)

type Runner

type Runner struct {
	Stack *common.Stack
}

Runner implements the Stack interface and represents a stack of Terraform units (i.e. folders with Terraform templates) that you can "spin up" or "spin down" in a single command (formerly Stack)

func NewRunner

func NewRunner(l log.Logger, terragruntOptions *options.TerragruntOptions, opts ...common.Option) *Runner

NewRunner creates a new Runner.

func (*Runner) GetStack

func (runner *Runner) GetStack() *common.Stack

GetStack returns the queue used by this runner.

func (*Runner) GetUnitRunGraph

func (runner *Runner) GetUnitRunGraph(terraformCommand string) ([]common.Units, error)

GetUnitRunGraph converts the unit list to a graph that shows the order in which the units will be applied/destroyed. The return structure is a list of lists, where the nested list represents units that can be deployed concurrently, and the outer list indicates the order. This will only include those units that do NOT have the exclude flag set.

func (*Runner) JSONUnitDeployOrder

func (runner *Runner) JSONUnitDeployOrder(terraformCommand string) (string, error)

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

func (*Runner) ListStackDependentUnits

func (runner *Runner) ListStackDependentUnits() map[string][]string

ListStackDependentUnits - build a map with each unit and its dependent units

func (*Runner) LogUnitDeployOrder

func (runner *Runner) LogUnitDeployOrder(l log.Logger, terraformCommand string) error

LogUnitDeployOrder will log the units 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 (*Runner) ResolveTerraformModules

func (runner *Runner) ResolveTerraformModules(ctx context.Context, l log.Logger, terragruntConfigPaths []string) (common.Units, error)

ResolveTerraformModules goes through each of the given Terragrunt configuration files and resolve the unit that configuration file represents into a Unit struct. Return the list of these Unit structs.

func (*Runner) Run

func (runner *Runner) Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions) error

Run execute configstack.

func (*Runner) RunUnits

func (runner *Runner) RunUnits(ctx context.Context, opts *options.TerragruntOptions) error

RunUnits runs the given map of unit path to runningUnit. To "run" a unit, execute the runTerragrunt command in its TerragruntOptions object. The units will be executed in an order determined by their inter-dependencies, using as much concurrency as possible.

func (*Runner) RunUnitsIgnoreOrder

func (runner *Runner) RunUnitsIgnoreOrder(ctx context.Context, opts *options.TerragruntOptions) error

RunUnitsIgnoreOrder runs the given map of unit path to runningUnit. To "run" a unit, execute the runTerragrunt command in its TerragruntOptions object. The units will be executed without caring for inter-dependencies.

func (*Runner) RunUnitsReverseOrder

func (runner *Runner) RunUnitsReverseOrder(ctx context.Context, opts *options.TerragruntOptions) error

RunUnitsReverseOrder runs the given map of unit path to runningUnit. To "run" a unit, execute the runTerragrunt command in its TerragruntOptions object. The units will be executed in the reverse order of their inter-dependencies, using as much concurrency as possible.

func (*Runner) SetParseOptions

func (runner *Runner) SetParseOptions(parserOptions []hclparse.Option)

SetParseOptions sets the report for the stack.

func (*Runner) SetReport

func (runner *Runner) SetReport(report *report.Report)

SetReport sets the report for the stack.

func (*Runner) SetTerragruntConfig

func (runner *Runner) SetTerragruntConfig(config *config.TerragruntConfig)

SetTerragruntConfig sets the report for the stack.

func (*Runner) Units

func (runner *Runner) Units() common.Units

Units returns the Terraform units in the stack.

func (*Runner) WithOptions

func (runner *Runner) WithOptions(opts ...common.Option) *Runner

WithOptions updates the stack with the provided options.

type RunningUnits

type RunningUnits map[string]*DependencyController

RunningUnits is a map of unit path to DependencyController, representing the units that are currently running or

func ToRunningUnits

func ToRunningUnits(units common.Units, dependencyOrder DependencyOrder, r *report.Report, opts *options.TerragruntOptions) (RunningUnits, error)

ToRunningUnits converts the list of units to a map from unit path to a runningUnit struct. This struct contains information about executing the unit, such as whether it has finished running or not and any errors that happened. Note that this does NOT actually run the unit. For that, see the RunUnits method.

func (RunningUnits) RemoveFlagExcluded

func (units RunningUnits) RemoveFlagExcluded(r *report.Report, reportExperiment bool) (RunningUnits, error)

RemoveFlagExcluded returns a cleaned-up map that only contains units and dependencies that should not be excluded

Jump to

Keyboard shortcuts

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