Documentation
¶
Index ¶
- func BuildTerraformGraph(stacks map[string]any, leftDelims ...string) (*dependency.Graph, error)
- func ExecuteTerraform(ctx context.Context, opts TerraformOptions) error
- func FilterTerraformGraph(atmosConfig *schema.AtmosConfiguration, graph *dependency.Graph, ...) (*dependency.Graph, error)
- func FlagDepthToFilterDepth(flagValue int) int
- func TerraformTargets(stacks map[string]any) []*dependency.Node
- type TerraformDispatcher
- type TerraformExecution
- type TerraformExecutionResult
- type TerraformExecutor
- type TerraformNodeOutcome
- type TerraformOptions
- type TerraformSelection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTerraformGraph ¶
BuildTerraformGraph builds a Terraform component graph from described stacks.
func ExecuteTerraform ¶
func ExecuteTerraform(ctx context.Context, opts TerraformOptions) error
ExecuteTerraform runs selected Terraform components through the shared scheduler.
func FilterTerraformGraph ¶
func FilterTerraformGraph(atmosConfig *schema.AtmosConfiguration, graph *dependency.Graph, info *schema.ConfigAndStacksInfo, selection *TerraformSelection) (*dependency.Graph, error)
FilterTerraformGraph narrows graph nodes to the user-selected bulk operation set. The primary selection (stack/components/query filters or a precomputed --affected selection) produces the candidate set; tags/labels narrow it to the kept seed. Closure flags then expand around it:
run = (seedKept + dependencies(seedKept)) + {n in dependents(candidates) : n matches tags/labels}
Dependencies (prerequisites) run regardless of tags/labels because they are required by what was selected. Dependents added by --include-dependents honour tags/labels, and their traversal starts from every candidate, so a candidate that fails tags/labels is not run itself but its matching dependents still are. Depth is counted on the full graph, and dependents dropped along the way are contracted so that ordering between the surviving nodes is preserved. This mirrors `atmos describe affected`.
func FlagDepthToFilterDepth ¶ added in v1.225.0
FlagDepthToFilterDepth converts the flag encoding (-1 = unlimited, N>0 = depth) into dependency.Filter's encoding (0 = unlimited). Exported so selection producers (e.g. the terraform --affected path) can carry the flag-side depth into TerraformSelection using the same conversion the closure spec applies to info.
func TerraformTargets ¶ added in v1.229.0
func TerraformTargets(stacks map[string]any) []*dependency.Node
TerraformTargets returns enabled, concrete Terraform components from described stacks without resolving their dependency graph.
Types ¶
type TerraformDispatcher ¶
type TerraformDispatcher struct {
// contains filtered or unexported fields
}
TerraformDispatcher adapts scheduler nodes to Terraform component execution.
func (*TerraformDispatcher) Dispatch ¶
func (d *TerraformDispatcher) Dispatch(ctx context.Context, node *dependency.Node) (scheduler.Result, error)
Dispatch executes one Terraform scheduler node.
type TerraformExecution ¶
type TerraformExecution struct {
Context context.Context
Info schema.ConfigAndStacksInfo
Stdout io.Writer
Stderr io.Writer
CaptureOutput bool
Flush func() error
}
TerraformExecution contains the execution context for one Terraform component.
type TerraformExecutionResult ¶
TerraformExecutionResult contains captured output for one Terraform component.
func (TerraformExecutionResult) CombinedOutput ¶
func (r TerraformExecutionResult) CombinedOutput() string
CombinedOutput returns stdout and stderr in the order hooks expect.
type TerraformExecutor ¶
type TerraformExecutor func(TerraformExecution) (TerraformExecutionResult, error)
TerraformExecutor executes one resolved Terraform component instance.
type TerraformNodeOutcome ¶
type TerraformNodeOutcome struct {
Processed bool `json:"processed"`
Changed bool `json:"changed"`
ExitCode int `json:"exit_code"`
LogFiles map[string]string `json:"log_files,omitempty"`
Output string `json:"-"`
}
TerraformNodeOutcome records the scheduler-visible result for one Terraform node.
type TerraformOptions ¶
type TerraformOptions struct {
AtmosConfig *schema.AtmosConfiguration
Info *schema.ConfigAndStacksInfo
Stacks map[string]any
Executor TerraformExecutor
Selection *TerraformSelection
}
TerraformOptions configures graph-backed Terraform bulk execution.
type TerraformSelection ¶
type TerraformSelection struct {
NodeIDs []string
IncludeDependencies bool
IncludeDependents bool
// DependencyDepth/DependentDepth bound the closure expansion in each
// direction when the matching Include* field is true (0 = unlimited).
DependencyDepth int
DependentDepth int
}
TerraformSelection narrows the scheduler graph to a precomputed set of Terraform nodes, optionally including graph closure around those nodes.