Documentation
¶
Overview ¶
Package terragruntexec runs a Terragrunt unit through a pinned `terragrunt` executable.
Executable mode is the migration path next to native adaptation. Atmos still owns which units run, their order, authentication, the toolchain, the environment, and the UI. This package only translates one Atmos terraform invocation into one `terragrunt run` command for one unit, and never schedules anything: `--all` is expanded by Atmos into one command per unit.
Index ¶
- Constants
- func CheckCommand(info *schema.ConfigAndStacksInfo, command string) error
- func CheckSupported(info *schema.ConfigAndStacksInfo) error
- func CheckVersion(ctx context.Context, host Host, binary string, env []string) error
- func Owns(info *schema.ConfigAndStacksInfo) bool
- func Run(ctx context.Context, host Host, request *Request) error
- func UnitDirectory(root, unit string) (directory, config string)
- type Command
- type Host
- type Request
Constants ¶
const ( // Engine is the engine name executable-mode units are listed with. Engine = "terragrunt" // Binary is the tool name pinned in `dependencies.tools` or `.tool-versions`. Binary = "terragrunt" // MinimumVersion is the oldest Terragrunt with the `run` command and `--working-dir` this mode uses. MinimumVersion = "1.0.0" )
Variables ¶
This section is empty.
Functions ¶
func CheckCommand ¶
func CheckCommand(info *schema.ConfigAndStacksInfo, command string) error
CheckCommand rejects an Atmos terraform subcommand that has no Terragrunt equivalent for a unit.
func CheckSupported ¶
func CheckSupported(info *schema.ConfigAndStacksInfo) error
CheckSupported rejects invocations that executable mode cannot honor, before anything runs.
func CheckVersion ¶
CheckVersion verifies that the executable exists and is not older than MinimumVersion.
func Owns ¶
func Owns(info *schema.ConfigAndStacksInfo) bool
Owns reports whether the component runs through the terragrunt executable. The discovery engine recorded in the component settings decides, so one project section always runs in one mode.
func Run ¶
Run checks the executable and runs the unit's command. A dry run skips the version probe, so it works without the executable installed and has no side effects.
func UnitDirectory ¶
UnitDirectory returns the directory that holds the unit file and the `--config` value needed when the file is not named terragrunt.hcl.
Types ¶
type Command ¶
Command is one terragrunt invocation.
func BuildCommand ¶
BuildCommand translates one Atmos invocation into a `terragrunt run` command. Provider options become flags of `run`, which is where Terragrunt defines them; a sensitive option travels through the environment so it never appears in an argument list. Engine arguments follow `--` untouched.
type Host ¶
type Host interface {
// Version runs `<binary> --version` and returns its output.
Version(ctx context.Context, binary string, env []string) (string, error)
// Execute runs the command to completion.
Execute(ctx context.Context, command *Command) error
}
Host supplies what the executable needs from Atmos. Production code runs commands through the Atmos shell layer, which streams output through the UI, masks secrets, forwards interrupts, and returns the process exit code; tests inject a fake.
type Request ¶
type Request struct {
Component, Stack string
// Binary is the resolved terragrunt executable and Engine the resolved OpenTofu or Terraform one.
Binary, Engine string
// Unit is the project-relative path of the unit file; Root is the project directory.
Unit, Root string
SubCommand string
SubCommand2 string
// Arguments are the engine arguments passed after `--` on the Atmos command line.
Arguments []string
// Options are the provider options the user set; only explicit ones are present.
Options map[string]schema.ComponentProviderOption
// Features are the `features` of the provider configuration. Options of the command line and the
// environment replace them per name.
Features map[string]any
Environment []string
DryRun bool
SkipInit bool
}
Request describes one unit invocation.