terraform

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 102 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package terraform implements the Terraform component provider and runtime. Shared host services are injected; this package does not import internal/exec.

Index

Constants

View Source
const (
	LogKeyComponent = "component"
	LogKeyStack     = "stack"
)
View Source
const TerraformAllOutputsExpression = "."

TerraformAllOutputsExpression is the YQ identity expression used to fetch the whole real output map from a Terraform state/output getter, so the entire map comes back through the same cached, authenticated, and masked lookup path as any other expression.

Variables

View Source
var (
	ErrInvalidFormat                      = errors.New("invalid format")
	ErrCreatingTempDirectory              = errors.New("error creating temporary directory")
	ErrCreatingIntermediateSubdirectories = errors.New("error creating intermediate subdirectories")
	ErrGettingJsonForPlanfile             = errors.New("error getting JSON for planfile")
	ErrConvertingJsonToGoType             = errors.New("error converting JSON to Go type")
	ErrNoComponent                        = errors.New("no component specified")
)
View Source
var (
	// ErrNoJSONOutput is returned when no JSON output is found in terraform show output.
	ErrNoJSONOutput = errors.New("no JSON output found in terraform show output")
)

Static errors.

View Source
var ErrTemplatingDisabledWithTemplates = errors.New("the stack manifests contain Go templates, but templating is disabled in atmos.yaml in 'templates.settings.enabled'\n" +
	"to enable templating, refer to https://atmos.tools/core-concepts/stacks/templating")

ErrTemplatingDisabledWithTemplates is returned when stack manifests contain Go templates but templating is disabled.

Functions

func AllDiagnosticsAreModuleSourceInterpolation

func AllDiagnosticsAreModuleSourceInterpolation(diags tfconfig.Diagnostics) bool

AllDiagnosticsAreModuleSourceInterpolation reports whether every error-severity diagnostic in diags belongs to a known module-source-interpolation event.

Terraform-config-inspect emits a *companion* diagnostic at the same source position as the "Variables not allowed" one -- e.g. "Unsuitable value: value must be known", produced when it then tries to decode the resulting unknown value into module.source's target type. Both are side effects of the same root cause (decoding with a nil hcl.EvalContext), so diagnostics are grouped by position: a group is known-safe if ANY diagnostic in it matches the known pattern. Diagnostics at any OTHER position must independently match, so a genuine, unrelated error is never absorbed into the same group just because it happens to share the diagnostics list.

This must inspect diags individually rather than the collapsed diags.Err() string: tfconfig's Diagnostics.Error() only renders the first diagnostic's Summary/Detail, collapsing any others to "(and N other messages)" with no text at all. Matching against that collapsed string means a genuine, unrelated diagnostic occurring alongside the known-safe one -- and sorting before it -- would never surface in the matched text, yet the caller would still skip validation for the whole diagnostics set, silently discarding the real error.

func BuildComponentAuthCacheKey

func BuildComponentAuthCacheKey(parent auth.AuthManager, authSection map[string]any) (string, bool)

BuildComponentAuthCacheKey keys a per-component AuthManager by the parent auth chain plus a deterministic JSON fingerprint of the component's auth section. Because identities are defined globally and only referenced by components, "same auth section" is a safe, provable proxy for "same identity" — it never merges components whose sections differ. The parent chain disambiguates an inherited identity from an auto-detected one. Returns cacheable=false when the section cannot be serialized (e.g. a channel/func value), so callers resolve without caching. Shared by describeStacksProcessor and the nested terraform.state path so the two cannot drift.

func CheckBackendTypeAfterProcessing

func CheckBackendTypeAfterProcessing(backendType string) error

CheckBackendTypeAfterProcessing validates that backend_type is not empty after template processing.

func CleanTerraformWorkspace

func CleanTerraformWorkspace(componentPath string)

CleanTerraformWorkspace deletes the `.terraform/environment` file from the component directory. The `.terraform/environment` file contains the name of the currently selected workspace, helping Terraform identify the active workspace context for managing your infrastructure. We delete the file to prevent the Terraform prompt asking to select the default or the previously used workspace. This happens when different backends are used for the same component.

func CleanTerraformWorkspaceWithEnv

func CleanTerraformWorkspaceWithEnv(componentPath string, envList []string)

CleanTerraformWorkspaceWithEnv is CleanTerraformWorkspace for a subprocess environment: a TF_DATA_DIR in envList (typically info.ComponentEnvList) wins over this process's own environment, so the cleanup targets the data directory Terraform will actually use.

func ClearLastAuthContext

func ClearLastAuthContext()

ClearLastAuthContext resets the persisted auth context. Called by tests.

func ComputeTerraformSecretVarKeys

func ComputeTerraformSecretVarKeys(info *schema.ConfigAndStacksInfo)

ComputeTerraformSecretVarKeys records the set of top-level variable keys whose value contains a resolved secret, so they can be kept out of the on-disk varfile and injected as TF_VAR_<name> environment variables instead. It must run after secret resolution (ProcessStacks) and before auth credentials are registered with the masker, so that the varfile-write and env-assembly steps partition the variables identically.

func ConstructTerraformComponentPlanfileName

func ConstructTerraformComponentPlanfileName(info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentPlanfileName constructs the planfile name for a terraform component in a stack.

func ConstructTerraformComponentPlanfilePath

func ConstructTerraformComponentPlanfilePath(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentPlanfilePath constructs the planfile path for a terraform component in a stack.

func ConstructTerraformComponentTestVarfileName

func ConstructTerraformComponentTestVarfileName(info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentTestVarfileName constructs the test varfile name for a terraform component in a stack.

func ConstructTerraformComponentTestVarfilePath

func ConstructTerraformComponentTestVarfilePath(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentTestVarfilePath constructs the test varfile path for a terraform component in a stack.

func ConstructTerraformComponentVarfileName

func ConstructTerraformComponentVarfileName(info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentVarfileName constructs the varfile name for a terraform component in a stack.

func ConstructTerraformComponentVarfilePath

func ConstructTerraformComponentVarfilePath(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentVarfilePath constructs the varfile path for a terraform component in a stack.

func ConstructTerraformComponentWorkingDir

func ConstructTerraformComponentWorkingDir(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) string

ConstructTerraformComponentWorkingDir constructs the working dir for a terraform component in a stack.

func CopyPlanFileIfNeeded

func CopyPlanFileIfNeeded(planFile, componentPath string) (string, func(), error)

CopyPlanFileIfNeeded copies the plan file to the component directory if it's not already there.

func CreateComponentAuthManager

func CreateComponentAuthManager(
	atmosConfig *schema.AtmosConfiguration,
	componentConfig map[string]any,
	component string,
	stack string,
	parentAuthManager auth.AuthManager,
) (auth.AuthManager, error)

CreateComponentAuthManager merges component auth with global auth and creates a new AuthManager.

func DiskSafeTerraformTestVars

func DiskSafeTerraformTestVars(info *schema.ConfigAndStacksInfo) map[string]any

DiskSafeTerraformTestVars excludes secret-bearing values from the variables written to the test varfile.

func DiskSafeVars

func DiskSafeVars(info *schema.ConfigAndStacksInfo) map[string]any

DiskSafeVars returns ComponentVarsSection with secret-bearing top-level keys removed, so resolved secrets are never written to the on-disk varfile. Returns the original map unchanged when no secret-bearing variables were detected.

func EnsureTerraformComponentExists

func EnsureTerraformComponentExists(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) error

EnsureTerraformComponentExists checks if a terraform component exists and provisions it via JIT when source.uri is configured. Errors are wrapped with ErrInvalidTerraformComponent.

func ExecuteShellCommandWithRetry

func ExecuteShellCommandWithRetry(
	atmosConfig *schema.AtmosConfiguration,
	info *schema.ConfigAndStacksInfo,
	phase string,
	invoke invokeShellCommandFunc,
	baseOpts ...component.ExecutionOption,
) error

ExecuteShellCommandWithRetry runs invoke exactly once when info.ComponentRetrySection is nil or has no Conditions configured (zero behavioural change for non-retry components). It is component-type agnostic: terraform, helmfile, packer, and ansible all shell out through ExecuteShellCommand and share this same wrapper.

When retry is configured, stdout and stderr are tee'd into a buffer and the buffer is matched against the compiled retry conditions after each attempt. Errors whose captured output matches at least one condition trigger another attempt with the configured backoff; other errors fail fast. This is intentionally pattern-driven so that real failures (e.g., `terraform plan` exit-code-2) are never retried unless the user opts in by listing a matching condition.

If baseOpts already requests its own stdout/stderr capture (e.g. helmfile capturing output for a NodeHooks.After callback), that writer keeps receiving the full output — the retry buffer is teed in alongside it via io.MultiWriter, not substituted for it.

`phase` is included in retry log lines so users can see which subprocess invocation is being retried (e.g. "init", "workspace-select", "apply", "sync", "build").

func ExecuteTerraformGenerateBackendCmd

func ExecuteTerraformGenerateBackendCmd(cmd interface{}, args []string) error

ExecuteTerraformGenerateBackendCmd executes `terraform generate backend` command. This function is superseded; use ExecuteGenerateBackend with typed parameters instead.

func ExecuteTerraformGenerateVarfileCmd

func ExecuteTerraformGenerateVarfileCmd(cmd interface{}, args []string) error

ExecuteTerraformGenerateVarfileCmd executes `terraform generate varfile` command. This function is superseded; use ExecuteGenerateVarfile with typed parameters instead.

func ExtractJSONFromOutput

func ExtractJSONFromOutput(output string) (string, error)

ExtractJSONFromOutput extracts the JSON part from terraform show output.

func FilterPlanDiffFlags

func FilterPlanDiffFlags(args []string) []string

FilterPlanDiffFlags filters out --orig and --new flags from arguments.

func FilterTerraformAffected

func FilterTerraformAffected(affectedList []schema.Affected) []schema.Affected

FilterTerraformAffected narrows the affected list to items that `atmos terraform plan/apply --affected` should actually execute: terraform components only, and only those that still exist (not deleted in HEAD). Helmfile and Packer items belong to their own subcommands; deleted components have no on-disk module so terraform plan/apply against them would fail or no-op. See issue #2361. Exported so other terraform-affected dispatchers (e.g. `atmos terraform lint --affected`) reuse the same filter instead of re-declaring it.

func GenerateBackendConfig

func GenerateBackendConfig(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateBackendConfig delegates backend-file generation using the resolved configuration and working directory.

func GenerateProviderOverrides

func GenerateProviderOverrides(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateProviderOverrides writes `providers_override.tf.json` from the component's `providers` section, and removes a previously generated file when that section is no longer configured.

func GenerateRequiredProviders

func GenerateRequiredProviders(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateRequiredProviders generates the terraform_override.tf.json file with required_version and required_providers blocks from stack configuration (DEV-3124).

func GetAllTerraformOutputs

func GetAllTerraformOutputs(
	atmosConfig *schema.AtmosConfiguration,
	component string,
	stack string,
	skipInit bool,
	authContext *schema.AuthContext,
	authManager any,
) (map[string]any, error)

GetAllTerraformOutputs is a backward-compatible wrapper that delegates to pkg/terraform/output. This function is kept for backward compatibility with existing tests and code. New code should use tfoutput.GetComponentOutputs directly.

func GetComponentRemoteStateBackendStaticType

func GetComponentRemoteStateBackendStaticType(sections *map[string]any) map[string]any

GetComponentRemoteStateBackendStaticType returns the `remote_state_backend` section for a component in a stack.

func GetLastAuthContext

func GetLastAuthContext() (*schema.AuthContext, any)

GetLastAuthContext returns the auth context and manager from the most recent ExecuteTerraform call.

func GetStaticRemoteStateOutput

func GetStaticRemoteStateOutput(
	atmosConfig *schema.AtmosConfiguration,
	component string,
	stack string,
	remoteStateSection map[string]any,
	output string,
) (any, bool, error)

GetStaticRemoteStateOutput is a backward-compatible wrapper that delegates to pkg/terraform/output. This function is kept for backward compatibility with existing tests and code. New code should use tfoutput.GetStaticRemoteStateOutput directly.

func GetTerraformEnvCliArgs

func GetTerraformEnvCliArgs() []string

GetTerraformEnvCliArgs reads the TF_CLI_ARGS environment variable and returns a slice of arguments. Example: TF_CLI_ARGS="-var environment=prod -auto-approve -var region=us-east-1". Returns: ["-var", "environment=prod", "-auto-approve", "-var", "region=us-east-1"].

func GetTerraformEnvCliVars

func GetTerraformEnvCliVars() (map[string]any, error)

GetTerraformEnvCliVars reads the TF_CLI_ARGS environment variable, parses all `-var` arguments, and returns them as a map of variables with proper type conversion. This function processes JSON values and returns them as parsed objects. It handles both formats: -var key=value and -var=key=value. Example: TF_CLI_ARGS='-var name=test -var=region=us-east-1 -var tags={"env":"prod","team":"devops"}' Returns: map[string]any{"name": "test", "region": "us-east-1", "tags": map[string]any{"env": "prod", "team": "devops"}}.

func GetTerraformOutput

func GetTerraformOutput(
	atmosConfig *schema.AtmosConfiguration,
	stack string,
	component string,
	output string,
	skipCache bool,
	authContext *schema.AuthContext,
	authManager any,
) (any, bool, error)

GetTerraformOutput is a backward-compatible wrapper that delegates to pkg/terraform/output. This function is kept for backward compatibility with existing tests and code. New code should use tfoutput.GetOutput directly.

func HasDefaultIdentity

func HasDefaultIdentity(authSection map[string]any) bool

HasDefaultIdentity checks if the auth section contains at least one identity with default: true.

func HasTerraformTestVars

func HasTerraformTestVars(info *schema.ConfigAndStacksInfo) bool

HasTerraformTestVars reports whether the current test command supplies additional test variables.

func IsOpenTofu

func IsOpenTofu(atmosConfig *schema.AtmosConfiguration, tenv *dependencies.ToolchainEnvironment) bool

IsOpenTofu detects whether the configured terraform command is OpenTofu or Terraform. It uses a two-tier detection strategy:

  1. Fast path: Check if the executable basename contains "tofu"
  2. Slow path: Execute the version command and check the output

The tenv parameter provides toolchain path resolution. If nil, the command is used as-is (system PATH only). Pass the ToolchainEnvironment from the current command invocation so toolchain-installed executables are found. Results are cached by resolved command path to avoid repeated subprocess execution.

func ParsePlanDiffFlags

func ParsePlanDiffFlags(args []string) (string, string, error)

ParsePlanDiffFlags extracts the orig and new plan file paths from command arguments.

func RejectComputedTerraformVars

func RejectComputedTerraformVars(vars map[string]any) error

RejectComputedTerraformVars ensures display-only degraded values cannot cross into Terraform through either tfvars JSON or TF_VAR_ environment variables.

func ResetNestedAuthManagerCache

func ResetNestedAuthManagerCache()

ResetNestedAuthManagerCache clears the nested-component AuthManager cache. Exported for tests to guarantee isolation between test functions; never called in production.

func ResetStateCache

func ResetStateCache()

ResetStateCache clears the terraform state cache and the nested-component AuthManager cache. This is exported for use in tests to ensure cache isolation between test functions. The two caches are cleared together because the managers in nestedAuthManagerCache are what read the state held in terraformStateCache: clearing state to force a fresh backend read while reusing a stale auth manager would be inconsistent. Neither cache is reset in production.

func SecretVarEnv

func SecretVarEnv(info *schema.ConfigAndStacksInfo) ([]string, error)

SecretVarEnv returns the TF_VAR_<name> environment entries for the component's secret-bearing variables, for injection into the subprocess environment.

func SetLastAuthContext

func SetLastAuthContext(authContext *schema.AuthContext, authManager any)

SetLastAuthContext persists the auth context and manager from the current terraform execution so PostRunE hooks can reuse them.

func TerraformDeclaredVarType

func TerraformDeclaredVarType(componentSection map[string]any, varName string) (string, bool)

TerraformDeclaredVarType returns the raw HCL type text (e.g. "string", "number", "list(string)") componentSection's resolved Terraform component declares for varName in its variables.tf, as already captured by terraform-config-inspect during stack processing (see terraformSensitiveVarKeys for the same map shape). Returns ("", false) when the component isn't Terraform, its module didn't parse, the variable isn't declared, or it's declared with no explicit type (implicit any).

func TerraformTestSecretVarEnv

func TerraformTestSecretVarEnv(info *schema.ConfigAndStacksInfo) ([]string, error)

TerraformTestSecretVarEnv encodes secret-bearing test variables as TF_VAR_ environment entries.

func TerraformTestVars

func TerraformTestVars(info *schema.ConfigAndStacksInfo) map[string]any

TerraformTestVars returns test.vars for the test subcommand, or nil for other commands and absent values.

func ValidateComponent

func ValidateComponent(component string) error

ValidateComponent checks if the provided component is not empty.

func ValidateOriginalPlanFile

func ValidateOriginalPlanFile(origPlanFile, componentPath string) (string, error)

ValidateOriginalPlanFile ensures original plan file exists and returns absolute path.

func ValidatePlanfileFormat

func ValidatePlanfileFormat(format *string) error

ValidatePlanfileFormat checks if the format is valid and sets default if empty.

func VarfileVarsToWrite

func VarfileVarsToWrite(info *schema.ConfigAndStacksInfo, withSecrets bool, varFilePath string) map[string]any

VarfileVarsToWrite returns the variables to write to a generated varfile. By default, secret-bearing variables are omitted so plaintext secrets never hit disk; with withSecrets=true they are included (e.g. to export the file). An appropriate warning is emitted in each case. Requires that secrets have already been resolved into info.

func WithFallbackModeHint

func WithFallbackModeHint(err error) error

WithFallbackModeHint adds a hint to a non-recoverable lookup error raised in `fallback` mode: fallback reads real state first, so a machine without credentials, network access, or the Terraform binary now fails where mocks-only resolution would not.

Types

type AuthContextWrapper

type AuthContextWrapper struct {
	StackInfo *schema.ConfigAndStacksInfo
}

AuthContextWrapper passes existing authentication context to nested component lookups. It exposes stack information but has no identity, provider, or credential configuration. Authentication operations are unsupported; most panic if called.

func NewAuthContextWrapper

func NewAuthContextWrapper(authContext *schema.AuthContext) *AuthContextWrapper

NewAuthContextWrapper creates an AuthManager wrapper that returns the given AuthContext.

func (*AuthContextWrapper) Authenticate

func (a *AuthContextWrapper) Authenticate(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error)

func (*AuthContextWrapper) AuthenticateIsolated

func (a *AuthContextWrapper) AuthenticateIsolated(ctx context.Context, identityName string) (*schema.AuthContext, error)

AuthenticateIsolated returns ErrNotImplemented because this wrapper cannot authenticate identities.

func (*AuthContextWrapper) AuthenticateProvider

func (a *AuthContextWrapper) AuthenticateProvider(ctx context.Context, providerName string) (*auth_types.WhoamiInfo, error)

AuthenticateProvider returns ErrNotImplemented because this wrapper cannot authenticate providers.

func (*AuthContextWrapper) CredentialStoreType

func (a *AuthContextWrapper) CredentialStoreType() string

func (*AuthContextWrapper) EnsureIdentityEnvironment

func (a *AuthContextWrapper) EnsureIdentityEnvironment(ctx context.Context, identityName string) (map[string]string, error)

func (*AuthContextWrapper) ExecuteIdentityIntegrations

func (a *AuthContextWrapper) ExecuteIdentityIntegrations(ctx context.Context, identityName string) error

func (*AuthContextWrapper) ExecuteIntegration

func (a *AuthContextWrapper) ExecuteIntegration(ctx context.Context, integrationName string, opts ...auth_types.IntegrationOption) error

func (*AuthContextWrapper) GetCachedCredentials

func (a *AuthContextWrapper) GetCachedCredentials(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error)

Stub methods to satisfy AuthManager interface (not used by ExecuteDescribeComponent).

func (*AuthContextWrapper) GetChain

func (a *AuthContextWrapper) GetChain() []string

GetChain returns an empty chain so nested components can select their own default identity.

func (*AuthContextWrapper) GetDefaultIdentity

func (a *AuthContextWrapper) GetDefaultIdentity(forceSelect bool) (string, error)

func (*AuthContextWrapper) GetEnvironmentVariables

func (a *AuthContextWrapper) GetEnvironmentVariables(identityName string) (map[string]string, error)

func (*AuthContextWrapper) GetFilesDisplayPath

func (a *AuthContextWrapper) GetFilesDisplayPath(providerName string) string

func (*AuthContextWrapper) GetIdentities

func (a *AuthContextWrapper) GetIdentities() map[string]schema.Identity

func (*AuthContextWrapper) GetIntegration

func (a *AuthContextWrapper) GetIntegration(integrationName string) (*schema.Integration, error)

func (*AuthContextWrapper) GetProviderForIdentity

func (a *AuthContextWrapper) GetProviderForIdentity(identityName string) string

func (*AuthContextWrapper) GetProviderKindForIdentity

func (a *AuthContextWrapper) GetProviderKindForIdentity(identityName string) (string, error)

func (*AuthContextWrapper) GetProviders

func (a *AuthContextWrapper) GetProviders() map[string]schema.Provider

func (*AuthContextWrapper) GetRealm

func (a *AuthContextWrapper) GetRealm() realm.RealmInfo

GetRealm returns an empty realm because the wrapper does not resolve authentication realms.

func (*AuthContextWrapper) GetStackInfo

func (a *AuthContextWrapper) GetStackInfo() *schema.ConfigAndStacksInfo

GetStackInfo returns the stack information carrying the inherited authentication context.

func (*AuthContextWrapper) ListIdentities

func (a *AuthContextWrapper) ListIdentities() []string

func (*AuthContextWrapper) ListProviders

func (a *AuthContextWrapper) ListProviders() []string

func (*AuthContextWrapper) Logout

func (a *AuthContextWrapper) Logout(ctx context.Context, identityName string, deleteKeychain bool) error

func (*AuthContextWrapper) LogoutAll

func (a *AuthContextWrapper) LogoutAll(ctx context.Context, deleteKeychain bool) error

func (*AuthContextWrapper) LogoutProvider

func (a *AuthContextWrapper) LogoutProvider(ctx context.Context, providerName string, deleteKeychain bool) error

func (*AuthContextWrapper) MaybeOfferAnyProfileFallback

func (a *AuthContextWrapper) MaybeOfferAnyProfileFallback(ctx context.Context) error

func (*AuthContextWrapper) PrepareShellEnvironment

func (a *AuthContextWrapper) PrepareShellEnvironment(ctx context.Context, identityName string, currentEnv []string) ([]string, error)

func (*AuthContextWrapper) ResolvePrincipalSetting

func (a *AuthContextWrapper) ResolvePrincipalSetting(identityName, key string) (interface{}, bool)

ResolvePrincipalSetting reports no setting because the wrapper has no identity configuration.

func (*AuthContextWrapper) ResolveProviderConfig

func (a *AuthContextWrapper) ResolveProviderConfig(identityName string) (*schema.Provider, bool)

ResolveProviderConfig reports no provider because the wrapper carries context only.

func (*AuthContextWrapper) RevokeEphemeralIntegrations

func (a *AuthContextWrapper) RevokeEphemeralIntegrations(_ context.Context, _ string, _ *bool) error

func (*AuthContextWrapper) Validate

func (a *AuthContextWrapper) Validate() error

func (*AuthContextWrapper) Whoami

func (a *AuthContextWrapper) Whoami(ctx context.Context, identityName string) (*auth_types.WhoamiInfo, error)

type AuthManagerQueryFactory

type AuthManagerQueryFactory interface {
	Create(identity string, authConfig *schema.AuthConfig, flagSelectValue string, atmosConfig *schema.AtmosConfiguration) (auth.AuthManager, error)
}

AuthManagerQueryFactory creates an AuthManager for ExecuteTerraformQuery's multi-component execution path. This interface allows dependency injection and testing without performing real authentication.

type BackendConfig

type BackendConfig struct {
	BackendSection map[string]any
	BackendType    string
	Err            error
}

backendConfig holds extracted backend configuration from a component section.

func ExtractBackendConfig

func ExtractBackendConfig(componentSection map[string]any) BackendConfig

ExtractBackendConfig extracts and validates backend configuration from a component section.

type ComponentAuthManagerResolver

type ComponentAuthManagerResolver = func(*schema.AtmosConfiguration, map[string]any, string, string, auth.AuthManager) (auth.AuthManager, error)

ComponentAuthManagerResolver constructs component-scoped authentication.

type ComponentAuthResolver

type ComponentAuthResolver = func(*schema.AtmosConfiguration, string, string, auth.AuthManager) (auth.AuthManager, error)

ComponentAuthResolver resolves authentication for a nested component lookup.

type ComponentStack

type ComponentStack struct {
	Component string
	Stack     string
}

ComponentStack identifies a concrete terraform component in a stack.

type DependencyParser

type DependencyParser interface {
	ParseComponentDependencies(stackName, componentName string, componentSection map[string]any) error
}

DependencyParser is the shared graph parser used by Terraform dependency discovery.

type Executor

type Executor struct {
	*Operations
	// contains filtered or unexported fields
}

Executor owns Terraform's execution pipeline and reference lookups.

func NewExecutor

func NewExecutor(services Services) *Executor

NewExecutor binds shared host services to a Terraform executor.

func (*Executor) DeclaredFallbackMocks

func (e *Executor) DeclaredFallbackMocks(
	atmosConfig *schema.AtmosConfiguration,
	stackInfo *schema.ConfigAndStacksInfo,
	lookup *TerraformStateLookup,
) (map[string]any, error)

DeclaredFallbackMocks returns the referenced component's mocks when --use-mocks runs in `fallback` mode and the component declares a `mocks` map. It returns nil (and no error) when mocks are off, the mode is not fallback, or the component declares none; callers then use the plain real lookup unchanged.

func (*Executor) Execute

func (e *Executor) Execute(ctx *component.ExecutionContext) error

Execute preserves caller options while making the provider request's context authoritative.

func (*Executor) ExecuteTerraformAffected

func (e *Executor) ExecuteTerraformAffected(args *component.DescribeAffectedCmdArgs, info *schema.ConfigAndStacksInfo) error

ExecuteTerraformAffected executes `atmos terraform <command> --affected`.

func (*Executor) ExecuteTerraformAffectedWithContext

func (e *Executor) ExecuteTerraformAffectedWithContext(ctx context.Context, args *component.DescribeAffectedCmdArgs, info *schema.ConfigAndStacksInfo) error

ExecuteTerraformAffectedWithContext executes affected Terraform components through the shared graph-backed scheduler path.

func (*Executor) ExecuteTerraformAll

func (e *Executor) ExecuteTerraformAll(info *schema.ConfigAndStacksInfo) error

ExecuteTerraformAll executes terraform commands for all components in dependency order.

func (*Executor) ExecuteTerraformAllWithContext

func (e *Executor) ExecuteTerraformAllWithContext(ctx context.Context, info *schema.ConfigAndStacksInfo) error

ExecuteTerraformAllWithContext executes all selected Terraform components through the graph-backed scheduler using the provided cancellation context.

func (*Executor) ExecuteTerraformQuery

func (e *Executor) ExecuteTerraformQuery(info *schema.ConfigAndStacksInfo) error

ExecuteTerraformQuery executes `atmos terraform <command> --query <yq-expression --stack <stack>`.

func (*Executor) ExecuteTerraformQueryWithContext

func (e *Executor) ExecuteTerraformQueryWithContext(ctx context.Context, info *schema.ConfigAndStacksInfo) error

ExecuteTerraformQueryWithContext executes graph-backed multi-component Terraform work.

func (*Executor) ExecuteTerraformShell

func (e *Executor) ExecuteTerraformShell(opts *tf.ShellOptions, atmosConfig *schema.AtmosConfiguration) error

ExecuteTerraformShell starts an interactive shell configured for a terraform component.

func (*Executor) GenerateArtifacts

func (e *Executor) GenerateArtifacts(ctx *component.ExecutionContext) error

GenerateArtifacts writes configuration in the prepared component working directory.

func (*Executor) GenerateConfigFiles

func (e *Executor) GenerateConfigFiles(config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateConfigFiles writes the backend configuration, generated files, and provider overrides for the component into the working directory.

NOTE: GenerateFilesForComponent is also called by autoGenerateComponentFiles (inside resolveAndProvisionComponentPath) when AutoGenerateFiles=true. That call handles the generate: section from stack config, while this call handles the standard backend/provider override files. The two calls serve different purposes and both are needed. This is pre-existing behavior from the original terraform.go.

func (*Executor) GetTerraformState

func (e *Executor) GetTerraformState(
	atmosConfig *schema.AtmosConfiguration,
	yamlFunc string,
	stack string,
	component string,
	output string,
	skipCache bool,
	authContext *schema.AuthContext,
	authManager any,
	options ...TerraformLookupOptions,
) (any, error)

GetTerraformState retrieves a specified Terraform output variable for a given component within a stack. It optionally uses a cache to avoid redundant state retrievals and supports both static and dynamic backends. Parameters:

  • atmosConfig: Atmos configuration pointer
  • yamlFunc: Name of the calling YAML function for error context
  • stack: Stack identifier
  • component: Component identifier
  • output: Output variable key to retrieve
  • skipCache: Flag to bypass cache lookup
  • authContext: Optional auth context containing Atmos-managed credentials
  • authManager: Optional auth manager for nested operations that need authentication

Returns the output value or nil if the component is not provisioned.

func (*Executor) HookStoreDefaultIdentity

func (e *Executor) HookStoreDefaultIdentity(authManager auth.AuthManager, info *schema.ConfigAndStacksInfo) string

HookStoreDefaultIdentity resolves the identity that identity-less stores invoked by terraform lifecycle hooks (e.g. the after-apply `store-outputs` hook) should inherit. It mirrors the main terraform path (injectTerraformStoreAuthResolver): it auto-detects the active identity from the auth manager's chain when info carries no explicit identity, then normalizes empty/select/disabled to "" (meaning "no inheritance — keep ambient/default SDK credentials"). It returns "" when no auth manager is present, preserving the prior behavior for runs without Atmos auth.

The hook executes in a freshly loaded config (prepareHookContext), so it must re-derive this from the persisted auth manager rather than relying on the apply-phase config.

func (*Executor) ListTerraformComponentTargets

func (e *Executor) ListTerraformComponentTargets(atmosConfig *schema.AtmosConfiguration, filterStack string, components []string, query string) ([]ComponentStack, error)

ListTerraformComponentTargets returns the concrete, enabled terraform components to act on, filtered by stack, an explicit component list, and an optional YQ query. Order is unspecified — it suits order-independent operations like cache mirroring (which, unlike plan/apply, has no inter-component dependencies). Auth and YAML functions are disabled: only structural component selection is needed.

func (*Executor) OutputGetter

func (e *Executor) OutputGetter() TerraformOutputGetter

OutputGetter returns a reference getter bound to this executor.

func (*Executor) ResolveAuthManagerForNestedComponent

func (e *Executor) ResolveAuthManagerForNestedComponent(
	atmosConfig *schema.AtmosConfiguration,
	component string,
	stack string,
	parentAuthManager auth.AuthManager,
) (auth.AuthManager, error)

ResolveAuthManagerForNestedComponent determines which AuthManager to use for a nested component evaluation.

Logic:

  1. Gets component config WITHOUT processing templates/functions (to avoid circular dependency)
  2. Checks if component has auth configuration defined
  3. If component has auth config: - Merges component auth with global auth - Creates and authenticates a new AuthManager with merged config - Returns the new AuthManager (component-specific authentication)
  4. If component has no auth config: - Returns the provided parentAuthManager (inherits parent's authentication)

This enables each nested component to optionally override authentication settings while defaulting to the parent's AuthManager if no override is specified.

Parameters:

  • atmosConfig: Global Atmos configuration
  • component: Component name to check for auth config
  • stack: Stack name
  • parentAuthManager: AuthManager from parent level (may be nil)

Returns:

  • AuthManager to use for this component (may be new or inherited)
  • error if component config retrieval or auth creation fails.

func (*Executor) ResolveTerraformMockOutput

func (e *Executor) ResolveTerraformMockOutput(
	atmosConfig *schema.AtmosConfiguration,
	stackInfo *schema.ConfigAndStacksInfo,
	stack string,
	component string,
	output string,
) (any, bool, error)

ResolveTerraformMockOutput resolves a Terraform lookup from the referenced component's literal `mocks` map in `always` mode. It deliberately describes the target with templates and YAML functions disabled so mocks cannot trigger the real dependency they replace.

The second return value reports whether always-mode mock resolution was active. In that mode a missing component mock or output is an error; callers must never fall back to remote state while the user explicitly requested hermetic mocks. In `fallback` mode this reports inactive: the Terraform lookups merge the mocks under the real outputs instead (see resolveTerraformOutputWithMocks).

func (*Executor) ResolveTerraformOutputWithMocks

func (e *Executor) ResolveTerraformOutputWithMocks(
	atmosConfig *schema.AtmosConfiguration,
	lookup *TerraformStateLookup,
	mocks map[string]any,
	realOutputs map[string]any,
	realErr error,
) (any, error)

ResolveTerraformOutputWithMocks evaluates the caller's expression against the component mocks deep-merged under the real outputs in `fallback` mode. Precedence is therefore: real value, then component mock, then YQ `//` default, then the original lookup error (or nil for an output missing from provisioned state).

The merge is recursive for maps, so a mock fills a key missing from a real map output (real `config = {a = 1}` plus mock `config: {b: 2}` resolves `.config.b` to 2). Every value present in the real outputs wins, and lists and scalars are never merged element by element.

The realOutputs argument is the whole real output map (nil when the state is not provisioned or the output map is absent) and realErr is the recoverable lookup error that produced it, if any. Neither the mocks nor the real map is mutated: the merge builds new maps.

func (*Executor) SetupComponentAuthForCLI

func (e *Executor) SetupComponentAuthForCLI(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (auth.AuthManager, error)

SetupComponentAuthForCLI exposes the shared component auth setup to non-Terraform command layers that still need authenticated YAML functions such as !terraform.state.

func (*Executor) SetupTerraformAuthForCLI

func (e *Executor) SetupTerraformAuthForCLI(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (any, error)

SetupTerraformAuthForCLI exposes terraform auth setup to command-layer callers that need the same merged-auth and explicit-identity behavior as ExecuteTerraform.

func (*Executor) StateGetter

func (e *Executor) StateGetter() TerraformStateGetter

StateGetter returns a reference getter bound to this executor.

type GenerateBackendOptions

type GenerateBackendOptions = tf.GenerateBackendOptions

type OperationServices

type OperationServices interface {
	GenerateFilesForComponent(config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error
	ProcessStacks(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo schema.ConfigAndStacksInfo, checkStack bool, processTemplates bool, processYamlFunctions bool, skip []string, authManager auth.AuthManager) (schema.ConfigAndStacksInfo, error)
	FindStacksMap(atmosConfig *schema.AtmosConfiguration, ignoreMissingFiles bool) (map[string]any, map[string]map[string]any, component.AllStacksDeferredContexts, error)
	ProcessTmpl(atmosConfig *schema.AtmosConfiguration, tmplName string, tmplValue string, tmplData any, ignoreMissingTemplateValues bool) (string, error)
	ProcessTmplWithDatasources(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo *schema.ConfigAndStacksInfo, settingsSection schema.Settings, tmplName string, tmplValue string, tmplData any, ignoreMissingTemplateValues bool) (string, error)
	ProcessCustomYamlTags(atmosConfig *schema.AtmosConfiguration, input schema.AtmosSectionMapType, currentStack string, skip []string, stackInfo *schema.ConfigAndStacksInfo) (schema.AtmosSectionMapType, error)
	ProcessCommandLineArgs(componentType string, cmd *cobra.Command, args []string, additionalArgsAndFlags []string) (schema.ConfigAndStacksInfo, error)
	ResolveDeferredYamlFunctions(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo *schema.ConfigAndStacksInfo, settingsSectionStruct *schema.Settings, componentTemplateContext map[string]any, skip []string, evalSections []string, warnings ...func(degradation.Warning)) error
	PrepareConfigurationValues(config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, skip []string, sections []string) ([]string, func() error)
	StackLocalsForComponent(rawStackConfigs map[string]map[string]any, stackFile string, componentType string) map[string]any
	CloneComponentSectionWithOverrides(raw map[string]any, overrides map[string]any) map[string]any
	ContainsStarlark(value any) bool
	BuildTerraformWorkspace(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo schema.ConfigAndStacksInfo) (string, error)
	ExecuteTerraform(info schema.ConfigAndStacksInfo, opts ...component.ExecutionOption) error
}

OperationServices supplies shared Atmos configuration and execution services. Implementations are injected per Operations instance; no process-global callbacks are installed.

type Operations

type Operations struct {
	// contains filtered or unexported fields
}

Operations owns Terraform generation, plan comparison, and verification.

func NewOperations

func NewOperations(host OperationServices) *Operations

NewOperations binds shared services to a Terraform operations instance.

func (*Operations) ComparePlansAndGenerateDiff

func (s *Operations) ComparePlansAndGenerateDiff(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, componentPath, origPlanFile, newPlanFile string) error

ComparePlansAndGenerateDiff compares two plan files and generates a diff.

func (*Operations) ExecuteGenerateBackend

func (s *Operations) ExecuteGenerateBackend(opts *GenerateBackendOptions, atmosConfig *schema.AtmosConfiguration) error

ExecuteGenerateBackend generates backend config for a terraform component.

func (*Operations) ExecuteGeneratePlanfile

func (s *Operations) ExecuteGeneratePlanfile(opts *PlanfileOptions, atmosConfig *schema.AtmosConfiguration) error

ExecuteGeneratePlanfile generates a planfile for a terraform component.

func (*Operations) ExecuteGenerateVarfile

func (s *Operations) ExecuteGenerateVarfile(opts *VarfileOptions, atmosConfig *schema.AtmosConfiguration) error

ExecuteGenerateVarfile generates a varfile for a terraform component.

func (*Operations) ExecuteTerraformGenerateBackends

func (s *Operations) ExecuteTerraformGenerateBackends(
	atmosConfig *schema.AtmosConfiguration,
	fileTemplate string,
	format string,
	stacks []string,
	components []string,
) error

ExecuteTerraformGenerateBackends generates backend configs for all terraform components.

func (*Operations) ExecuteTerraformGeneratePlanfile

func (s *Operations) ExecuteTerraformGeneratePlanfile(
	options *PlanfileOptions,
	info *schema.ConfigAndStacksInfo,
) error

ExecuteTerraformGeneratePlanfile executes `terraform generate planfile`.

func (*Operations) ExecuteTerraformGeneratePlanfileOld

func (s *Operations) ExecuteTerraformGeneratePlanfileOld(cmd *cobra.Command, args []string) error

ExecuteTerraformGeneratePlanfileOld executes `terraform generate planfile` command.

func (*Operations) ExecuteTerraformGenerateRequiredProvidersCmd

func (s *Operations) ExecuteTerraformGenerateRequiredProvidersCmd(cmd *cobra.Command, args []string) error

ExecuteTerraformGenerateRequiredProvidersCmd executes `terraform generate required-providers` command. This generates a terraform_override.tf.json file with required_version and required_providers blocks from stack configuration (DEV-3124).

func (*Operations) ExecuteTerraformGenerateVarfiles

func (s *Operations) ExecuteTerraformGenerateVarfiles(
	atmosConfig *schema.AtmosConfiguration,
	fileTemplate string,
	format string,
	stacks []string,
	components []string,
) error

ExecuteTerraformGenerateVarfiles generates varfiles for all terraform components in all stacks.

func (*Operations) GenerateConfigFiles

func (s *Operations) GenerateConfigFiles(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateConfigFiles generates backend, custom, provider, and version configuration.

func (*Operations) GenerateConfigFilesWithContext

func (s *Operations) GenerateConfigFilesWithContext(ctx context.Context, atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error

GenerateConfigFilesWithContext is GenerateConfigFiles bound to ctx: contributors and generators receive ctx, and a cancellation stops generation before the next stage writes.

func (*Operations) GenerateNewPlanFile

func (s *Operations) GenerateNewPlanFile(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, componentPath string, tmpDir string) (string, error)

GenerateNewPlanFile generates a new plan file by running terraform plan.

func (*Operations) RunTerraformShowWithExecutor

func (s *Operations) RunTerraformShowWithExecutor(info *schema.ConfigAndStacksInfo, planFile string, executor TerraformPlanDiffExecutor) (string, error)

RunTerraformShowWithExecutor captures plan JSON through the supplied executor without changing the caller's command metadata.

func (*Operations) TerraformPlanDiff

func (s *Operations) TerraformPlanDiff(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) error

TerraformPlanDiff represents the plan-diff command implementation.

func (*Operations) VerifyPlanfile

func (s *Operations) VerifyPlanfile(info *schema.ConfigAndStacksInfo, storedPlanFile string, mode schema.PlanfileVerifyMode) error

VerifyPlanfile verifies that a stored planfile matches the current state before applying. It generates a fresh plan and compares it to the stored one using the plan-diff infrastructure. The storedPlanFile parameter is the path to the stored planfile to verify against. On a match (or when mode is warn) info.PlanFile is set to the fresh planfile path and info.UseTerraformPlan is set to true so the subsequent apply uses the verified fresh plan. The stored planfile is cleaned up. When drift is detected and mode is fail, it returns an error wrapping ErrPlanVerificationFailed; when mode is warn, it logs the drift and proceeds.

type PlanFileOptions

type PlanFileOptions struct {
	ComponentPath string
	OrigPlanFile  string
	NewPlanFile   string
	TmpDir        string
}

PlanFileOptions contains parameters for plan file operations.

type PlanfileOptions

type PlanfileOptions = tf.PlanfileOptions

PlanfileOptions is an alias to pkg/terraform.PlanfileOptions for backwards compatibility.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the built-in Terraform component implementation. Registration is performed by the host that supplies Runtime; importing this package has no registration side effects and cannot overwrite an installed provider.

func New

func New(runtime Runtime) *Provider

New constructs a provider with the supplied Terraform runtime.

func (*Provider) Execute

func (p *Provider) Execute(ctx *component.ExecutionContext) error

Execute runs a Terraform operation using the component runtime.

func (*Provider) GenerateArtifacts

func (p *Provider) GenerateArtifacts(ctx *component.ExecutionContext) error

GenerateArtifacts writes files for an already resolved component. It does not initialize Terraform, select a workspace, or execute a plan/apply operation.

func (*Provider) GetAvailableCommands

func (*Provider) GetAvailableCommands() []string

GetAvailableCommands advertises tool commands. Execution deliberately remains open to passthrough commands supported by the selected Terraform/OpenTofu binary.

func (*Provider) GetBasePath

func (*Provider) GetBasePath(config *schema.AtmosConfiguration) string

GetBasePath returns the configured source directory or its conventional default.

func (*Provider) GetGroup

func (*Provider) GetGroup() string

GetGroup returns the infrastructure tooling group.

func (*Provider) GetType

func (*Provider) GetType() string

GetType returns the stable component family, including OpenTofu executions.

func (*Provider) ListComponents

func (*Provider) ListComponents(ctx context.Context, _ string, stack map[string]any) ([]string, error)

ListComponents lists configured Terraform instances without evaluating them.

func (*Provider) ValidateComponent

func (*Provider) ValidateComponent(config map[string]any) error

ValidateComponent validates the resolved backend type's shape. Policy and module validation remain in the lifecycle, where stack and auth are available.

type RetryExecParams

type RetryExecParams struct {
	AllArgsAndFlags []string
	ComponentPath   string
	EnvVars         []string
}

RetryExecParams bundles the per-invocation shell command inputs shared by the helmfile/packer retry-wrapping helpers (executeHelmfileCommandWithRetry, executePackerCommandWithRetry), keeping their parameter lists within the argument-limit.

type Runtime

type Runtime interface {
	Execute(*component.ExecutionContext) error
	GenerateArtifacts(*component.ExecutionContext) error
}

Runtime supplies Terraform execution and artifact generation. Implementations must preserve execution options and error identity.

type Services

type Services struct {
	OperationServices
	ExecuteDescribeComponent                      func(params *component.ExecuteDescribeComponentParams) (map[string]any, error)
	ExecuteDescribeStacksWithAuthDisabled         func(atmosConfig *schema.AtmosConfiguration, filterByStack string, components []string, componentTypes []string, sections []string, ignoreMissingFiles bool, processTemplates bool, processYamlFunctions bool, includeEmptyStacks bool, skip []string, authManager auth.AuthManager, authDisabled bool) (map[string]any, error)
	ExecuteDescribeStacksWithAuthDisabledAndMocks func(atmosConfig *schema.AtmosConfiguration, filterByStack string, components []string, componentTypes []string, sections []string, ignoreMissingFiles bool, processTemplates bool, processYamlFunctions bool, includeEmptyStacks bool, skip []string, authManager auth.AuthManager, authDisabled bool, useMocks bool) (map[string]any, error)
	ExecuteDescribeStacksWithMocks                func(atmosConfig *schema.AtmosConfiguration, filterByStack string, components []string, componentTypes []string, sections []string, ignoreMissingFiles bool, processTemplates bool, processYamlFunctions bool, includeEmptyStacks bool, skip []string, authManager auth.AuthManager, useMocks bool, tagsFilter []string, labelsFilter map[string]string, errOptions component.DescribeStacksErrorOptions) (map[string]any, error)
	ExecuteShellCommand                           func(atmosConfig schema.AtmosConfiguration, command string, args []string, dir string, env []string, dryRun bool, redirectStdError string, opts ...component.ExecutionOption) error
	ExecuteTerraform                              func(info schema.ConfigAndStacksInfo, opts ...component.ExecutionOption) error
	GenerateFilesForComponent                     func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, workingDir string) error
	GetAffectedComponents                         func(args *component.DescribeAffectedCmdArgs) ([]schema.Affected, error)
	GetEagerEvaluationSetting                     func(atmosConfig *schema.AtmosConfiguration) bool
	NewDependencyParserWithDelimiter              func(builder *dependency.GraphBuilder, nodeMap map[string]string, targetStates map[string]string, leftDelim string) DependencyParser
	ProcessStacks                                 func(atmosConfig *schema.AtmosConfiguration, configAndStacksInfo schema.ConfigAndStacksInfo, checkStack bool, processTemplates bool, processYamlFunctions bool, skip []string, authManager auth.AuthManager) (schema.ConfigAndStacksInfo, error)
	ValidateComponent                             func(atmosConfig *schema.AtmosConfiguration, componentName string, componentSection map[string]any, schemaPath string, schemaType string, modulePaths []string, timeoutSeconds int) (bool, error)
	// AdmitComponent evaluates component admission policy before any identity is resolved.
	AdmitComponent                   func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, authManager auth.AuthManager) error
	AttachComponentReporting         func(result *error, info *schema.ConfigAndStacksInfo, componentType string, command string)
	CreateAndAuthenticateAuthManager func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (auth.AuthManager, error)
	DefaultAuthManagerCreator        func(string, *schema.AuthConfig, string, *schema.AtmosConfiguration, auth.ReExecContext) (auth.AuthManager, error)
	DefaultMergedAuthConfigGetter    func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (*schema.AuthConfig, error)
	DeferredTargetAuth               func(ac *schema.AtmosConfiguration, component string, stack string, parents ...auth.AuthManager) (auth.AuthManager, error)
	DeferredTargetAuthAndCache       func(ac *schema.AtmosConfiguration, component string, stack string, parents ...auth.AuthManager) (auth.AuthManager, *deferred.ValueCache, error)
	EnvVarFromList                   func(env []string, key string) string
	ExecTerraformShellCommand        func(atmosConfig *schema.AtmosConfiguration, component string, stack string, componentEnvList []string, varFile string, workingDir string, workspaceName string, componentPath string) error
	GetMergedAuthConfig              func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (*schema.AuthConfig, error)
	HasYqDefault                     func(yqExpr string) bool
	IsComponentEnabled               func(metadataSection map[string]any, componentName string) bool
	MapCIExitCode                    func(atmosConfig *schema.AtmosConfiguration, exitCode int) int
	ResolveIdentityConfigError       func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, err error, wrapSentinel error) error
	ResolvedTargetAuthContext        func(ac *schema.AtmosConfiguration, manager auth.AuthManager, fallback *schema.AuthContext, disabled bool) *schema.AuthContext
	ShouldUploadStatus               func(info *schema.ConfigAndStacksInfo) bool
	StoreAutoDetectedIdentity        func(authManager auth.AuthManager, info *schema.ConfigAndStacksInfo)
	UploadStatus                     func(info *schema.ConfigAndStacksInfo, exitCode int, client pro.AtmosProAPIClientInterface, gitRepo git.GitRepoInterface) error
}

Services supplies the shared Atmos facilities used by one Terraform executor.

type ShellCommandOption

type ShellCommandOption = component.ExecutionOption

type TerraformLookupOptions

type TerraformLookupOptions = terraform.LookupOptions

TerraformLookupOptions is retained for compatibility with existing reference getters. Evaluation settings are owned by pkg/terraform.

type TerraformOutputGetter

type TerraformOutputGetter interface {
	// GetOutput retrieves terraform output for a component.
	// Note: High parameter count matches GetTerraformOutput signature.
	GetOutput(
		atmosConfig *schema.AtmosConfiguration,
		stack string,
		component string,
		output string,
		skipCache bool,
		authContext *schema.AuthContext,
		authManager any,
		options ...TerraformLookupOptions,
	) (any, bool, error)
}

TerraformOutputGetter defines the interface for getting terraform output. This interface allows for dependency injection and testing.

type TerraformPlanDiffExecutor

type TerraformPlanDiffExecutor interface {
	ExecuteTerraform(schema.ConfigAndStacksInfo, ...ShellCommandOption) error
}

type TerraformPlanDiffExecutorFunc

type TerraformPlanDiffExecutorFunc func(schema.ConfigAndStacksInfo, ...ShellCommandOption) error

func (TerraformPlanDiffExecutorFunc) ExecuteTerraform

type TerraformStateGetter

type TerraformStateGetter interface {
	// GetState retrieves terraform state for a component.
	// Note: High parameter count matches GetTerraformState signature.
	GetState(
		atmosConfig *schema.AtmosConfiguration,
		yamlFunc string,
		stack string,
		component string,
		output string,
		skipCache bool,
		authContext *schema.AuthContext,
		authManager any,
		options ...TerraformLookupOptions,
	) (any, error)
}

TerraformStateGetter defines the interface for getting terraform state. This interface allows for dependency injection and testing.

type TerraformStateLookup

type TerraformStateLookup struct {
	YamlFunc  string
	Stack     string
	Component string
	Output    string
	// contains filtered or unexported fields
}

type VarfileOptions

type VarfileOptions = tf.VarfileOptions

Jump to

Keyboard shortcuts

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