From f7b151527766e83f17d5b0ac5218dbab762900e2 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 29 Oct 2026 11:51:25 -0500 Subject: [PATCH 01/52] feat(plugin): add component configuration protocol and SDK --- .../plugins/extensions/component-engines.md | 25 +- docs/prd/plugins/overview.md | 2 +- docs/prd/plugins/platform/interfaces.md | 3 +- docs/prd/plugins/platform/protocol.md | 6 +- docs/prd/terragrunt-support.md | 22 +- go.mod | 2 + go.sum | 6 + pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go | 2046 ++++++++++++++--- .../proto/atmos/plugin/v1/plugin_grpc.pb.go | 426 ++++ pkg/plugin/runtime/native/component_test.go | 157 ++ pkg/plugin/runtime/native/main_test.go | 2 +- pkg/plugin/runtime/native/native.go | 27 +- proto/atmos/plugin/v1/plugin.proto | 151 ++ sdk/component/value.go | 154 ++ sdk/component/value_fuzz_test.go | 21 + sdk/component/value_test.go | 145 ++ sdk/go.mod | 4 + sdk/go.sum | 10 + sdk/plugin/plugin.go | 27 +- sdk/plugin/plugin_test.go | 8 +- sdk/proto/atmos/plugin/v1/plugin.pb.go | 2046 ++++++++++++++--- sdk/proto/atmos/plugin/v1/plugin_grpc.pb.go | 426 ++++ 22 files changed, 5058 insertions(+), 658 deletions(-) create mode 100644 pkg/plugin/runtime/native/component_test.go create mode 100644 sdk/component/value.go create mode 100644 sdk/component/value_fuzz_test.go create mode 100644 sdk/component/value_test.go diff --git a/docs/prd/plugins/extensions/component-engines.md b/docs/prd/plugins/extensions/component-engines.md index bbcf48d68b9..9aab536f01d 100644 --- a/docs/prd/plugins/extensions/component-engines.md +++ b/docs/prd/plugins/extensions/component-engines.md @@ -1,6 +1,6 @@ # Component configuration and engine plugins -**Status:** Implementation in progress. The protocol, SDK, native runtime clients, static component descriptors, explicit package loader, and configuration-service adapters exist. CLI discovery, stack adaptation, and native Terraform preparation are wired on this branch. End-to-end validation is limited to local Terragrunt fixtures; the full release gates remain. +**Status:** Implementation in progress. The protocol, SDK registration, native runtime clients, and SDK value codec exist. Installed component activation and stack/execution adapters are not implemented. **Decision:** Separate component type, configuration provider, and execution engine. Negotiate optional capabilities independently. A configuration provider must not need an executor. @@ -33,7 +33,7 @@ The checked-in [protocol](../../../../proto/atmos/plugin/v1/plugin.proto) is aut The following contracts still require implementation: -- Static metadata for modes, commands, and typed options. Component family, provider export name, package-local settings schema, and service version are implemented. +- Static metadata for types, providers, modes, commands, typed options, schemas, and versions. - Optional execution with stdout, stderr, diagnostics/logs, lifecycle events, and one authoritative outcome. - Scoped host process, filesystem, toolchain, and logging APIs. The existing broker does not provide these services yet. - External engine CI reporting. Native Terraform adaptation retains the existing Terraform CI path. @@ -75,15 +75,11 @@ Use static metadata for help without starting plugins. Use `pkg/flags.NewStandar ## Host integration -`pkg/plugin/adapter/component` supplies discovery, validation, preparation, and state clients. Its immutable registry is private to the invocation. It does not register or replace execution engines. Compose these providers with registered engines in the stack and execution adapters. Keep business logic out of `internal/exec`. +Add adapters in `pkg/plugin/adapter/component`. Compose configuration providers with registered engines. Keep business logic out of `internal/exec`. Open remaining closed type lists through registry metadata: `schema.Components.GetComponentConfig`, component auto-detection, stack component processing, component/reverse base paths, list extraction, `list sources`, stack-section validation/inheritance, dependency/affected dispatch, and CI dispatch. -`bootstrap.LoadComponents` accepts explicit capability-qualified provider references. It uses the existing package policy, OCI cache, lock, and restoration paths. An empty reference list does not inspect package manifests. Disabled packages cannot satisfy references. Schema validation and ownership checks precede native startup; a failed batch returns no registry. Activation does not call discovery or execute the engine. - -Declare each service under `spec.capabilities.components.discovery`, `.validation`, `.preparation`, or `.state`. Each export declares `component_type` and a package-local `schema`. All capabilities for one provider must agree on package identity, executable, schema, type, and negotiated description. Keep provider settings separate from resolved component inputs in every request. - -Connect this explicit loader to configuration and command contexts. Preserve lazy activation for unrelated operations. Do not add a process-global discovery callback or cache plugin results without provider/options/revision identity. +Extend bootstrap to activate explicitly referenced providers. Validate all exports and collisions before registering them. Preserve lazy activation for unrelated operations. Distinguish file/directory/glob watches, output dependencies, and ordering-only edges. Compare each Git revision in its own root. Include additions, removals, and renames; evaluating only current HCL is insufficient. @@ -94,18 +90,11 @@ Cancellation must stop invocations, processes, callbacks, and descendants. Test | Layer | Required result | State | |---|---|---| | Protocol and SDK | Independent services, lossless values, optional registration, native transport tests. | Implemented in this branch; not activated by installation. | -| Host activation | Static descriptors, provider settings schemas, private registry, package selection, and service adapters. | Implemented; opt-in CLI discovery is wired. | -| Host composition | Flags, scoped services, discovery/import and engine adapters. | Scoped discovery and native preparation are wired. Imports and typed plugin flags remain. | -| Terragrunt plugin | Separately built SDK package runs the advanced native fixture on stock Atmos. | Local package runs advanced and nested-stack fixtures through the CLI. Published installation remains. | -| Integration | Lists, state functions, affected, dependencies, UI, saved plans, and Pro share instances. | Lists and dependency scheduling are wired. Remaining integrations require validation. | +| Host composition | Descriptors, schemas/flags, collision rules, scoped services, discovery/import and engine adapters. | Required. | +| Terragrunt plugin | Separately built SDK package runs the advanced native fixture on stock Atmos. | Required. | +| Integration | Lists, state functions, affected, dependencies, UI, saved plans, and Pro share instances. | Required. | | Compatibility | Differential tests for supported constructs and explicit failures for unsupported behavior. | Required. | Require at least 90% patch coverage per layer. Test failures as well as successful calls. A protocol fixture does not prove installed-plugin or Terragrunt compatibility. The first product milestone is an installed Terragrunt plugin running the advanced native fixture through stock Atmos without snapshot patches or temporary callbacks. Port the pilot's field regressions before removing its temporary hooks. - -## Execution-context acceptance gate - -A configuration provider must receive the host execution context before it performs preparation effects. Test sanitized environments, explicit empty environments, identity selection, authentication failure, toolchain executable selection, PATH precedence, managed RC files, registry trust, cache policy, cancellation, and isolation between invocations. - -The provider does not choose the host execution directory. Atmos source/workdir provisioning owns that directory. Test that evaluated source changes preserve provision and metadata settings, that literal artifacts reach the resolved directory, and that backend identity does not change with workdir placement. Test repeated runs and two instances that use the same module. diff --git a/docs/prd/plugins/overview.md b/docs/prd/plugins/overview.md index 10daa24ecae..85437a9c6bf 100644 --- a/docs/prd/plugins/overview.md +++ b/docs/prd/plugins/overview.md @@ -38,7 +38,7 @@ A **plugin** is an installable, independently versioned package managed by `atmo ## Foundation and architectural direction -Atmos's existing registries are the integration points, but they are uneven. The [gap analysis](platform/gap-analysis.md) inventories each one: most replace silently on duplicate registration, two live in Go-internal packages, three interfaces carry no `context.Context`, and several surfaces still dispatch through closed lists rather than a registry. Terraform now uses the component registry. Helmfile and Packer still use legacy execution paths. The [component extension](extensions/component-engines.md) separates configuration providers from engines; its protocol and explicit host activation API are implemented, while CLI stack and execution integration remain pending. Other entries in the gap analysis describe the platform design baseline and must be checked against the implemented adapters. +Atmos's existing registries are the integration points, but they are uneven. The [gap analysis](platform/gap-analysis.md) inventories each one: most replace silently on duplicate registration, two live in Go-internal packages, three interfaces carry no `context.Context`, and several surfaces still dispatch through closed lists rather than a registry. Terraform now uses the component registry. Helmfile and Packer still use legacy execution paths. The [component extension](extensions/component-engines.md) separates configuration providers from engines; its protocol is implemented, while installed host activation remains pending. Other entries in the gap analysis describe the platform design baseline and must be checked against the implemented adapters. Auth now dispatches built-in and plugin provider and identity constructors through `pkg/auth/registry`. Preserve existing configuration and behavior as additional auth adapters are introduced. diff --git a/docs/prd/plugins/platform/interfaces.md b/docs/prd/plugins/platform/interfaces.md index f032052223a..d7b68442eeb 100644 --- a/docs/prd/plugins/platform/interfaces.md +++ b/docs/prd/plugins/platform/interfaces.md @@ -373,8 +373,7 @@ An adapter implements one existing Atmos interface by calling a wire service, so | Extension | Adapter (`pkg/plugin/adapter/...`) | Existing interface implemented | Wire service | API services | Must not cross | Phase 0 | |---|---|---|---|---|---|---| | Auth | `auth.ProviderAdapter`, `auth.IdentityAdapter` | [`types.Provider`](../../../../pkg/auth/types/interfaces.go): `Kind`, `Name`, `PreAuthenticate`, `Authenticate`, `Validate`, `Environment`, `Paths`, `PrepareEnvironment`, `Logout`, `GetFilesDisplayPath`, `SetRealm`. `types.Identity`: `Kind`, `GetProviderName`, `Authenticate`, `Validate`, `Environment`, `Paths`, `PrepareEnvironment`, `PostAuthenticate`, `Logout`, `CredentialsExist`, `LoadCredentials`, `SetRealm`. Optional `Provisioner`, `JustificationConsumer`. | `AuthProvider`, `AuthIdentity` | `api.Credentials`, `api.Prompt`, `api.Browser`, `api.HTTP`, `api.Log` | `types.AuthManager`, `*schema.Provider`, `*schema.Identity`, `*schema.AuthContext` | P0.1, P0.2 | -| Component configuration | `component.Provider`, private `component.Registry` | Discovery, validation, preparation, and state clients; composition with existing engines remains required. | `ComponentDiscovery`, `ComponentValidation`, `ComponentPreparation`, `ComponentState` | No process, filesystem, network, or private-credential grants yet. | `ExecutionContext`, `*schema.AtmosConfiguration`, `schema.ConfigAndStacksInfo` | P0.3, P0.6 | -| Component execution (planned) | Engine adapter | [`ComponentProvider`](../../../../pkg/component/provider.go); external engines must not replace built-in providers. | Optional execution contract | Scoped process, toolchain, filesystem, credentials, and logging services | Host execution structs and callbacks | P0.3, P0.6 | +| Component | `component.Adapter` | [`ComponentProvider`](../../../../pkg/component/provider.go): `GetType`, `GetGroup`, `GetBasePath`, `ListComponents`, `ValidateComponent`, `Execute`, `GenerateArtifacts`, `GetAvailableCommands`. | Independent component configuration services; optional execution follows | `api.Process`, `api.Toolchain`, `api.FS`, `api.Credentials`, `api.Log` | `ExecutionContext` struct, `*schema.AtmosConfiguration`, `schema.ConfigAndStacksInfo` | P0.3, P0.6 | | CI provider | `ci.Adapter` | [`provider.Provider`](../../../../pkg/ci/internal/provider/types.go): `Name`, `Detect`, `Context`, `GetStatus`, `CreateCheckRun`, `UpdateCheckRun`, `PostComment`, `OutputWriter`, `ResolveBase`. Optional `LabelReader`, `DebugModeDetector`, `LogGrouper`. | `CIProvider` | `api.HTTP`, `api.Secrets`, `api.Log` | `OutputWriter`, `io.Writer` | P0.3, P0.7 | | Component CI | `cicomponent.Adapter` | [`plugin.Plugin`](../../../../pkg/ci/internal/plugin/types.go): `GetType`, `GetHookBindings` (`HookBinding{Event, Handler}`). | `CIComponent` | `api.CIReporter`, `api.FS`, `api.Log` | `HookHandler` func, `HookContext.Provider`, `TemplateLoader`, `CreatePlanfileStore` | P0.5 | | Command | `command.Adapter` (lives behind `cmd/plugin`) | [`internal.CommandProvider`](../../../../cmd/internal/command.go): `GetCommand`, `GetName`, `GetGroup`, `GetFlagsBuilder`, `GetPositionalArgsBuilder`, `GetCompatibilityFlags`, `GetAliases`, `IsExperimental`. | `Commands.Run` for native plugins; in-process binding proposed for Starlark | Native command bootstrap currently grants `api.HTTP`; output uses RPC events, not inherited stdio | `*cobra.Command` | P0.3 | diff --git a/docs/prd/plugins/platform/protocol.md b/docs/prd/plugins/platform/protocol.md index 019994b0272..c5d481249f9 100644 --- a/docs/prd/plugins/platform/protocol.md +++ b/docs/prd/plugins/platform/protocol.md @@ -256,7 +256,7 @@ The runtime writes events to caller-provided stdout/stderr writers; callers supp ### Component configuration services -The component configuration protocol is now defined in `proto/atmos/plugin/v1/plugin.proto` and generated for the CLI and SDK. The host has static descriptors, explicit package loading, and service adapters. CLI stack and execution wiring remain pending. These independently negotiated version-1 services replace the earlier proposed monolithic `Component` service: +The component configuration protocol is now defined in `proto/atmos/plugin/v1/plugin.proto` and generated for the CLI and SDK. Installed host adapters remain pending. These independently negotiated version-1 services replace the earlier proposed monolithic `Component` service: | Capability | RPC | Result | |---|---|---| @@ -265,11 +265,11 @@ The component configuration protocol is now defined in `proto/atmos/plugin/v1/pl | `component.preparation` | `ComponentPreparation.Prepare` | Fresh inputs, module, backend identity, and literal generated files. | | `component.state` | `ComponentState.Resolve` | Backend/workspace identity without preparation. | -`ComponentRequest` carries explicit invocation, provider, coordinates, root/source, operation/options, effects, resolved component configuration, and separate provider settings. It does not carry host Go structs or callbacks. `ComponentValue` uses cty type JSON plus MessagePack and sensitivity paths, preserving exact numbers, unknowns, nulls, collection types, and sensitive values. Do not use `protobuf.Struct` for these values. The SDK rejects unsupported marks and sensitivity paths that cannot be applied. +`ComponentRequest` carries explicit invocation, provider, coordinates, root/source, operation/options, effects, and configuration. It does not carry host Go structs or callbacks. `ComponentValue` uses cty type JSON plus MessagePack and sensitivity paths, preserving exact numbers, unknowns, nulls, collection types, and sensitive values. Do not use `protobuf.Struct` for these values. The SDK rejects unsupported marks and sensitivity paths that cannot be applied. Configuration providers do not replace execution engines. Native Terragrunt units remain Terraform components executed by Atmos. Optional external execution and component CI services remain follow-on contracts: they must stream output, diagnostics/logs, lifecycle events, then exactly one authoritative outcome. Preserve detailed plan exit 2 as changes. Saved-plan identity must bind the exact applied artifact and effective configuration. -Static command/flag metadata, effect enforcement, host services, and CLI activation remain required. See the [component plugin PRD](../extensions/component-engines.md) for ownership, integration points, and acceptance. Protocol availability alone does not mean an installed component plugin works. +Static metadata/flags, effect enforcement, host services, and installation activation remain required. See the [component plugin PRD](../extensions/component-engines.md) for ownership, integration points, and acceptance. Protocol availability alone does not mean an installed component plugin works. ### CIProvider diff --git a/docs/prd/terragrunt-support.md b/docs/prd/terragrunt-support.md index 2be1fbad38e..19bde8248a5 100644 --- a/docs/prd/terragrunt-support.md +++ b/docs/prd/terragrunt-support.md @@ -1,6 +1,6 @@ # Terragrunt component plugin -**Status:** Implementation in progress. CLI discovery and native execution are wired to the SDK plugin on this branch. Validation covers local modules and local state. The plugin is not published. The requirements below define the complete target, not a compatibility claim. +**Status:** Implementation in progress. Shared component protocol work has started. The installed Terragrunt integration is not available. **Decision:** Ship Terragrunt as a separately versioned native plugin. Use Terragrunt Go modules to interpret HCL and Atmos to execute native Terraform components. Provide executable mode as a separate compatibility path. @@ -94,24 +94,6 @@ Discovery defaults to denying commands, network, secret decryption, writes, and Native plugins are trusted code. Broker grants and evaluator controls are not an OS sandbox. Test actual effect interception through nested includes and stack expansion. -## Atmos execution contracts - -Treat environment, identity, toolchain, and workdir behavior as release gates. - -- Resolve the selected Atmos identity before native preparation can read outputs, decrypt data, or run commands. Honor explicit, default, and disabled identity selection. Stop on authentication failure. -- Pass the sanitized subprocess environment to the evaluator. Do not merge ambient credentials back into it. Distinguish a missing environment from an explicitly empty environment. -- Use the same component environment, toolchain PATH, managed Terraform RC, registry trust, and cache policy for preparation and Terraform execution. Preserve empty overrides and last-value precedence. -- Pass an absolute executable path after toolchain resolution. HCL commands must use the invocation PATH. Never mutate the plugin process environment to switch identities or tools. -- Resolve explicit relative HCL commands from their Terragrunt unit directory. Keep `get_terragrunt_dir()` independent of the Atmos execution workdir. -- Keep credentials and temporary RC files scoped to the operation. Clean temporary files after preparation, provisioning, or execution fails. -- Test two identities and two tool versions in consecutive and concurrent invocations. Test cancellation and auth/tool failures before evaluator effects. -- Preserve configured workdir and source settings when replacing the evaluated module URI. Place generated files, variable files, and plans in the resolved Atmos working directory. -- Isolate discovered instances by stack and component. Do not let two stacks overwrite the same module's generated backend. -- Keep state identity independent of execution workdir. Relative Terragrunt backend paths must retain their upstream base. Workdir refresh must not move, delete, or recreate state. -- Test ordinary placement, automatic workdirs, absolute and project-relative working directory overrides, repeated runs, and conflicting directory ownership. Check both generated bytes and the backend used by Terraform. A rejected second owner must leave the first owner's artifacts and state unchanged. - -Read-only discovery precedes component authentication. If discovery requires an identity-dependent effect, report the unsupported requirement. Do not use ambient credentials as an implicit substitute for the selected identity. - ## State and cache ownership Resolve state independently of preparation. `!terraform.state` must work before a Terraform command runs for the target. Do not run hooks, write files, or read unrelated outputs to locate state. Reject backend expressions requiring those effects. @@ -126,8 +108,6 @@ The pilot found a separate named-workspace dependency gap: Terragrunt output rea `describe affected` and `terraform --affected` must share identities and source relationships. -The current native implementation creates separate discovery sessions for HEAD and BASE. It retains the invocation's trusted plugin, scope, environment, and cancellation. It restores HEAD before dependent expansion and execution. Acceptance covers local HCL and module watches, nested stack provenance, changed dependency targets, additions, removals, renames, mixed YAML/HCL graphs, stack filters, and dependent depth. Reads in unevaluated input expressions and arbitrary dynamic glob membership remain open requirements below. - - Track primary HCL, includes, cross-directory reads, `file`, `mark_as_read`, modules, and optional reads. - Watch directories and glob membership to detect new/deleted files. - Track root/nested stacks, values, catalog sources, generated origins, and changed remote references. diff --git a/go.mod b/go.mod index e0d05002448..e46583516a7 100644 --- a/go.mod +++ b/go.mod @@ -630,6 +630,8 @@ require ( github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/urfave/cli v1.22.17 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/xlab/treeprint v1.2.0 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect diff --git a/go.sum b/go.sum index e5b3b81a9ed..55e29ebe176 100644 --- a/go.sum +++ b/go.sum @@ -1529,6 +1529,12 @@ github.com/versent/saml2aws/v2 v2.36.19 h1:LrELOG9AA4migQQMfihmmJ++H8bGevElRNzoN github.com/versent/saml2aws/v2 v2.36.19/go.mod h1:ti3sEknT847HYw3rY2MdQcpf8WzHCNTTsGjkGZW7a1w= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo= github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= +github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/wlynxg/chardet v1.0.5 h1:BNEolSEujJUtKwkaqNb0D6Ue+d7VTKTh5rXDyEdiipU= github.com/wlynxg/chardet v1.0.5/go.mod h1:q4N3YNbywQtX0u12Eh0+0LZB53Ayc7nOfHHaio+RcVA= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= diff --git a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go index f225dbf5a02..7bfc4bd9c3a 100644 --- a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go +++ b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go @@ -25,6 +25,107 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ComponentSource_Kind int32 + +const ( + ComponentSource_KIND_UNSPECIFIED ComponentSource_Kind = 0 + ComponentSource_FILE ComponentSource_Kind = 1 + ComponentSource_DIRECTORY ComponentSource_Kind = 2 + ComponentSource_GLOB ComponentSource_Kind = 3 +) + +// Enum value maps for ComponentSource_Kind. +var ( + ComponentSource_Kind_name = map[int32]string{ + 0: "KIND_UNSPECIFIED", + 1: "FILE", + 2: "DIRECTORY", + 3: "GLOB", + } + ComponentSource_Kind_value = map[string]int32{ + "KIND_UNSPECIFIED": 0, + "FILE": 1, + "DIRECTORY": 2, + "GLOB": 3, + } +) + +func (x ComponentSource_Kind) Enum() *ComponentSource_Kind { + p := new(ComponentSource_Kind) + *p = x + return p +} + +func (x ComponentSource_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ComponentSource_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_atmos_plugin_v1_plugin_proto_enumTypes[0].Descriptor() +} + +func (ComponentSource_Kind) Type() protoreflect.EnumType { + return &file_atmos_plugin_v1_plugin_proto_enumTypes[0] +} + +func (x ComponentSource_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ComponentSource_Kind.Descriptor instead. +func (ComponentSource_Kind) EnumDescriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{30, 0} +} + +type ComponentDependency_Kind int32 + +const ( + ComponentDependency_KIND_UNSPECIFIED ComponentDependency_Kind = 0 + ComponentDependency_ORDER ComponentDependency_Kind = 1 + ComponentDependency_OUTPUT ComponentDependency_Kind = 2 +) + +// Enum value maps for ComponentDependency_Kind. +var ( + ComponentDependency_Kind_name = map[int32]string{ + 0: "KIND_UNSPECIFIED", + 1: "ORDER", + 2: "OUTPUT", + } + ComponentDependency_Kind_value = map[string]int32{ + "KIND_UNSPECIFIED": 0, + "ORDER": 1, + "OUTPUT": 2, + } +) + +func (x ComponentDependency_Kind) Enum() *ComponentDependency_Kind { + p := new(ComponentDependency_Kind) + *p = x + return p +} + +func (x ComponentDependency_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ComponentDependency_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_atmos_plugin_v1_plugin_proto_enumTypes[1].Descriptor() +} + +func (ComponentDependency_Kind) Type() protoreflect.EnumType { + return &file_atmos_plugin_v1_plugin_proto_enumTypes[1] +} + +func (x ComponentDependency_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ComponentDependency_Kind.Descriptor instead. +func (ComponentDependency_Kind) EnumDescriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{31, 0} +} + // Invocation identifies the live call authorized to use the Atmos API broker. type Invocation struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -1685,326 +1786,1673 @@ func (*CommandEvent_Stderr) isCommandEvent_Event() {} func (*CommandEvent_Exit) isCommandEvent_Event() {} -var File_atmos_plugin_v1_plugin_proto protoreflect.FileDescriptor - -const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + - "\n" + - "\x1catmos/plugin/v1/plugin.proto\x12\x0fatmos.plugin.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa8\x03\n" + - "\n" + - "Invocation\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + - "\aattempt\x18\x02 \x01(\rR\aattempt\x126\n" + - "\bdeadline\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\bdeadline\x12+\n" + - "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\x12N\n" + - "\venvironment\x18\x05 \x03(\v2,.atmos.plugin.v1.Invocation.EnvironmentEntryR\venvironment\x12\x14\n" + - "\x05stack\x18\x06 \x01(\tR\x05stack\x12\x1c\n" + - "\tcomponent\x18\a \x01(\tR\tcomponent\x12%\n" + - "\x0ecomponent_type\x18\b \x01(\tR\rcomponentType\x12 \n" + - "\vinteractive\x18\t \x01(\bR\vinteractive\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb0\x01\n" + - "\vCredentials\x12\x12\n" + - "\x04type\x18\x01 \x01(\tR\x04type\x129\n" + - "\n" + - "expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12+\n" + - "\x04data\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04data\x12%\n" + - "\x0esensitive_keys\x18\x04 \x03(\tR\rsensitiveKeys\"S\n" + - "\x13ServiceVersionRange\x12\x18\n" + - "\aservice\x18\x01 \x01(\tR\aservice\x12\x10\n" + - "\x03min\x18\x02 \x01(\rR\x03min\x12\x10\n" + - "\x03max\x18\x03 \x01(\rR\x03max\"6\n" + - "\x06Export\x12\x18\n" + - "\aservice\x18\x01 \x01(\tR\aservice\x12\x12\n" + - "\x04kind\x18\x02 \x01(\tR\x04kind\"\x83\x01\n" + - "\x0fDescribeRequest\x12#\n" + - "\ratmos_version\x18\x01 \x01(\tR\fatmosVersion\x12K\n" + - "\x0ehost_supported\x18\x02 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\rhostSupported\"\x94\x02\n" + - "\x10DescribeResponse\x12\x1f\n" + - "\vplugin_name\x18\x01 \x01(\tR\n" + - "pluginName\x12%\n" + - "\x0eplugin_version\x18\x02 \x01(\tR\rpluginVersion\x12'\n" + - "\x0fmanifest_digest\x18\x03 \x01(\tR\x0emanifestDigest\x12@\n" + - "\bservices\x18\x04 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\bservices\x121\n" + - "\aexports\x18\x05 \x03(\v2\x17.atmos.plugin.v1.ExportR\aexports\x12\x1a\n" + - "\bfeatures\x18\x06 \x03(\tR\bfeatures\"\xf7\x01\n" + - "\x10ConfigureRequest\x12O\n" + - "\n" + - "broker_ids\x18\x01 \x03(\v20.atmos.plugin.v1.ConfigureRequest.BrokerIdsEntryR\tbrokerIds\x123\n" + - "\bsettings\x18\x02 \x01(\v2\x17.google.protobuf.StructR\bsettings\x12\x1f\n" + - "\vpackage_dir\x18\x03 \x01(\tR\n" + - "packageDir\x1a<\n" + - "\x0eBrokerIdsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\"\xb9\x01\n" + - "\x0fProviderRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + - "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x12\x14\n" + - "\x05realm\x18\x05 \x01(\tR\x05realm\"\xf0\x01\n" + - "\x0fIdentityRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + - "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x125\n" + - "\tprincipal\x18\x05 \x01(\v2\x17.google.protobuf.StructR\tprincipal\x12\x14\n" + - "\x05realm\x18\x06 \x01(\tR\x05realm\"@\n" + - "\bProgress\x12\x18\n" + - "\amessage\x18\x01 \x01(\tR\amessage\x12\x1a\n" + - "\bfraction\x18\x02 \x01(\x02R\bfraction\"\xb4\x01\n" + - "\vInteraction\x12\x12\n" + - "\x04kind\x18\x01 \x01(\tR\x04kind\x12\x14\n" + - "\x05title\x18\x02 \x01(\tR\x05title\x12@\n" + - "\x06fields\x18\x03 \x03(\v2(.atmos.plugin.v1.Interaction.FieldsEntryR\x06fields\x1a9\n" + - "\vFieldsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xcf\x01\n" + - "\x11AuthenticateEvent\x127\n" + - "\bprogress\x18\x01 \x01(\v2\x19.atmos.plugin.v1.ProgressH\x00R\bprogress\x12@\n" + - "\vinteraction\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.InteractionH\x00R\vinteraction\x126\n" + - "\x06result\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\x06resultB\a\n" + - "\x05event\"<\n" + - "\n" + - "Diagnostic\x12\x14\n" + - "\x05field\x18\x01 \x01(\tR\x05field\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage\"Q\n" + - "\x10ValidateResponse\x12=\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"C\n" + - "\vUnsupported\x12\x1c\n" + - "\toperation\x18\x01 \x01(\tR\toperation\x12\x16\n" + - "\x06reason\x18\x02 \x01(\tR\x06reason\"\x86\x01\n" + - "\x0eRefreshRequest\x12<\n" + - "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x126\n" + - "\acurrent\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\acurrent\"\x9f\x01\n" + - "\x0fRefreshResponse\x12@\n" + - "\vcredentials\x18\x01 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\vcredentials\x12@\n" + - "\vunsupported\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.UnsupportedH\x00R\vunsupportedB\b\n" + - "\x06result\"\xae\x01\n" + - "\x13EnvironmentResponse\x12W\n" + - "\venvironment\x18\x01 \x03(\v25.atmos.plugin.v1.EnvironmentResponse.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xf8\x01\n" + - "\x19PrepareEnvironmentRequest\x12<\n" + - "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x12]\n" + - "\venvironment\x18\x02 \x03(\v2;.atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"v\n" + - "\x0eCredentialPath\x12\x1a\n" + - "\blocation\x18\x01 \x01(\tR\blocation\x12\x12\n" + - "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + - "\brequired\x18\x03 \x01(\bR\brequired\x12\x18\n" + - "\apurpose\x18\x04 \x01(\tR\apurpose\"F\n" + - "\rPathsResponse\x125\n" + - "\x05paths\x18\x01 \x03(\v2\x1f.atmos.plugin.v1.CredentialPathR\x05paths\"\x95\x01\n" + - "\x1bIdentityAuthenticateRequest\x12<\n" + - "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x128\n" + - "\bupstream\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\bupstream\"\xf2\x01\n" + - "\x16IdentityPrepareRequest\x12<\n" + - "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x12Z\n" + - "\venvironment\x18\x02 \x03(\v28.atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb4\x01\n" + - "\x0eCommandRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + - "\targuments\x18\x03 \x03(\tR\targuments\x123\n" + - "\bsettings\x18\x04 \x01(\v2\x17.google.protobuf.StructR\bsettings\"!\n" + - "\vCommandExit\x12\x12\n" + - "\x04code\x18\x01 \x01(\rR\x04code\"\x7f\n" + - "\fCommandEvent\x12\x18\n" + - "\x06stdout\x18\x01 \x01(\fH\x00R\x06stdout\x12\x18\n" + - "\x06stderr\x18\x02 \x01(\fH\x00R\x06stderr\x122\n" + - "\x04exit\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CommandExitH\x00R\x04exitB\a\n" + - "\x05event2\x9f\x01\n" + - "\x04Info\x12O\n" + - "\bDescribe\x12 .atmos.plugin.v1.DescribeRequest\x1a!.atmos.plugin.v1.DescribeResponse\x12F\n" + - "\tConfigure\x12!.atmos.plugin.v1.ConfigureRequest\x1a\x16.google.protobuf.Empty2\xd3\x04\n" + - "\fAuthProvider\x12O\n" + - "\bValidate\x12 .atmos.plugin.v1.ProviderRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12V\n" + - "\fAuthenticate\x12 .atmos.plugin.v1.ProviderRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12L\n" + - "\aRefresh\x12\x1f.atmos.plugin.v1.RefreshRequest\x1a .atmos.plugin.v1.RefreshResponse\x12B\n" + - "\x06Logout\x12 .atmos.plugin.v1.ProviderRequest\x1a\x16.google.protobuf.Empty\x12U\n" + - "\vEnvironment\x12 .atmos.plugin.v1.ProviderRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + - "\x05Paths\x12 .atmos.plugin.v1.ProviderRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12f\n" + - "\x12PrepareEnvironment\x12*.atmos.plugin.v1.PrepareEnvironmentRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2\x8e\x04\n" + - "\fAuthIdentity\x12O\n" + - "\bValidate\x12 .atmos.plugin.v1.IdentityRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12b\n" + - "\fAuthenticate\x12,.atmos.plugin.v1.IdentityAuthenticateRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12B\n" + - "\x06Logout\x12 .atmos.plugin.v1.IdentityRequest\x1a\x16.google.protobuf.Empty\x12U\n" + - "\vEnvironment\x12 .atmos.plugin.v1.IdentityRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + - "\x05Paths\x12 .atmos.plugin.v1.IdentityRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12c\n" + - "\x12PrepareEnvironment\x12'.atmos.plugin.v1.IdentityPrepareRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2S\n" + - "\bCommands\x12G\n" + - "\x03Run\x12\x1f.atmos.plugin.v1.CommandRequest\x1a\x1d.atmos.plugin.v1.CommandEvent0\x01B@Z>github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1;pluginv1b\x06proto3" +// ComponentValue uses cty's JSON type encoding and MessagePack value encoding. +// Unlike protobuf.Struct, it preserves exact numbers, nulls, unknowns, and +// collection types. Marks are removed from MessagePack and carried as paths. +// An empty sensitive path marks the entire value. Never log these payloads. +type ComponentValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeJson []byte `protobuf:"bytes,1,opt,name=type_json,json=typeJson,proto3" json:"type_json,omitempty"` + Msgpack []byte `protobuf:"bytes,2,opt,name=msgpack,proto3" json:"msgpack,omitempty"` + SensitivePaths []*ComponentValuePath `protobuf:"bytes,3,rep,name=sensitive_paths,json=sensitivePaths,proto3" json:"sensitive_paths,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -var ( - file_atmos_plugin_v1_plugin_proto_rawDescOnce sync.Once - file_atmos_plugin_v1_plugin_proto_rawDescData []byte -) +func (x *ComponentValue) Reset() { + *x = ComponentValue{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -func file_atmos_plugin_v1_plugin_proto_rawDescGZIP() []byte { - file_atmos_plugin_v1_plugin_proto_rawDescOnce.Do(func() { - file_atmos_plugin_v1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc))) - }) - return file_atmos_plugin_v1_plugin_proto_rawDescData +func (x *ComponentValue) String() string { + return protoimpl.X.MessageStringOf(x) } -var ( - file_atmos_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 32) - file_atmos_plugin_v1_plugin_proto_goTypes = []any{ - (*Invocation)(nil), // 0: atmos.plugin.v1.Invocation - (*Credentials)(nil), // 1: atmos.plugin.v1.Credentials - (*ServiceVersionRange)(nil), // 2: atmos.plugin.v1.ServiceVersionRange - (*Export)(nil), // 3: atmos.plugin.v1.Export - (*DescribeRequest)(nil), // 4: atmos.plugin.v1.DescribeRequest - (*DescribeResponse)(nil), // 5: atmos.plugin.v1.DescribeResponse - (*ConfigureRequest)(nil), // 6: atmos.plugin.v1.ConfigureRequest - (*ProviderRequest)(nil), // 7: atmos.plugin.v1.ProviderRequest - (*IdentityRequest)(nil), // 8: atmos.plugin.v1.IdentityRequest - (*Progress)(nil), // 9: atmos.plugin.v1.Progress - (*Interaction)(nil), // 10: atmos.plugin.v1.Interaction - (*AuthenticateEvent)(nil), // 11: atmos.plugin.v1.AuthenticateEvent - (*Diagnostic)(nil), // 12: atmos.plugin.v1.Diagnostic - (*ValidateResponse)(nil), // 13: atmos.plugin.v1.ValidateResponse - (*Unsupported)(nil), // 14: atmos.plugin.v1.Unsupported - (*RefreshRequest)(nil), // 15: atmos.plugin.v1.RefreshRequest - (*RefreshResponse)(nil), // 16: atmos.plugin.v1.RefreshResponse - (*EnvironmentResponse)(nil), // 17: atmos.plugin.v1.EnvironmentResponse - (*PrepareEnvironmentRequest)(nil), // 18: atmos.plugin.v1.PrepareEnvironmentRequest - (*CredentialPath)(nil), // 19: atmos.plugin.v1.CredentialPath - (*PathsResponse)(nil), // 20: atmos.plugin.v1.PathsResponse - (*IdentityAuthenticateRequest)(nil), // 21: atmos.plugin.v1.IdentityAuthenticateRequest - (*IdentityPrepareRequest)(nil), // 22: atmos.plugin.v1.IdentityPrepareRequest - (*CommandRequest)(nil), // 23: atmos.plugin.v1.CommandRequest - (*CommandExit)(nil), // 24: atmos.plugin.v1.CommandExit - (*CommandEvent)(nil), // 25: atmos.plugin.v1.CommandEvent - nil, // 26: atmos.plugin.v1.Invocation.EnvironmentEntry - nil, // 27: atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry - nil, // 28: atmos.plugin.v1.Interaction.FieldsEntry - nil, // 29: atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry - nil, // 30: atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry - nil, // 31: atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry - (*timestamppb.Timestamp)(nil), // 32: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 33: google.protobuf.Struct - (*emptypb.Empty)(nil), // 34: google.protobuf.Empty +func (*ComponentValue) ProtoMessage() {} + +func (x *ComponentValue) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } -) + return mi.MessageOf(x) +} -var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ - 32, // 0: atmos.plugin.v1.Invocation.deadline:type_name -> google.protobuf.Timestamp - 26, // 1: atmos.plugin.v1.Invocation.environment:type_name -> atmos.plugin.v1.Invocation.EnvironmentEntry - 32, // 2: atmos.plugin.v1.Credentials.expires_at:type_name -> google.protobuf.Timestamp - 33, // 3: atmos.plugin.v1.Credentials.data:type_name -> google.protobuf.Struct - 2, // 4: atmos.plugin.v1.DescribeRequest.host_supported:type_name -> atmos.plugin.v1.ServiceVersionRange - 2, // 5: atmos.plugin.v1.DescribeResponse.services:type_name -> atmos.plugin.v1.ServiceVersionRange - 3, // 6: atmos.plugin.v1.DescribeResponse.exports:type_name -> atmos.plugin.v1.Export - 27, // 7: atmos.plugin.v1.ConfigureRequest.broker_ids:type_name -> atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry - 33, // 8: atmos.plugin.v1.ConfigureRequest.settings:type_name -> google.protobuf.Struct - 0, // 9: atmos.plugin.v1.ProviderRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 10: atmos.plugin.v1.ProviderRequest.spec:type_name -> google.protobuf.Struct - 0, // 11: atmos.plugin.v1.IdentityRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 12: atmos.plugin.v1.IdentityRequest.spec:type_name -> google.protobuf.Struct - 33, // 13: atmos.plugin.v1.IdentityRequest.principal:type_name -> google.protobuf.Struct - 28, // 14: atmos.plugin.v1.Interaction.fields:type_name -> atmos.plugin.v1.Interaction.FieldsEntry - 9, // 15: atmos.plugin.v1.AuthenticateEvent.progress:type_name -> atmos.plugin.v1.Progress - 10, // 16: atmos.plugin.v1.AuthenticateEvent.interaction:type_name -> atmos.plugin.v1.Interaction - 1, // 17: atmos.plugin.v1.AuthenticateEvent.result:type_name -> atmos.plugin.v1.Credentials - 12, // 18: atmos.plugin.v1.ValidateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 7, // 19: atmos.plugin.v1.RefreshRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest - 1, // 20: atmos.plugin.v1.RefreshRequest.current:type_name -> atmos.plugin.v1.Credentials - 1, // 21: atmos.plugin.v1.RefreshResponse.credentials:type_name -> atmos.plugin.v1.Credentials - 14, // 22: atmos.plugin.v1.RefreshResponse.unsupported:type_name -> atmos.plugin.v1.Unsupported - 29, // 23: atmos.plugin.v1.EnvironmentResponse.environment:type_name -> atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry - 7, // 24: atmos.plugin.v1.PrepareEnvironmentRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest - 30, // 25: atmos.plugin.v1.PrepareEnvironmentRequest.environment:type_name -> atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry - 19, // 26: atmos.plugin.v1.PathsResponse.paths:type_name -> atmos.plugin.v1.CredentialPath - 8, // 27: atmos.plugin.v1.IdentityAuthenticateRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest - 1, // 28: atmos.plugin.v1.IdentityAuthenticateRequest.upstream:type_name -> atmos.plugin.v1.Credentials - 8, // 29: atmos.plugin.v1.IdentityPrepareRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest - 31, // 30: atmos.plugin.v1.IdentityPrepareRequest.environment:type_name -> atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry - 0, // 31: atmos.plugin.v1.CommandRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 32: atmos.plugin.v1.CommandRequest.settings:type_name -> google.protobuf.Struct - 24, // 33: atmos.plugin.v1.CommandEvent.exit:type_name -> atmos.plugin.v1.CommandExit - 4, // 34: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest - 6, // 35: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest - 7, // 36: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 37: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest - 15, // 38: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest - 7, // 39: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 40: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 41: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest - 18, // 42: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest - 8, // 43: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest - 21, // 44: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest - 8, // 45: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest - 8, // 46: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest - 8, // 47: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest - 22, // 48: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest - 23, // 49: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest - 5, // 50: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse - 34, // 51: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty - 13, // 52: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 11, // 53: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 16, // 54: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse - 34, // 55: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty - 17, // 56: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 20, // 57: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse - 17, // 58: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 13, // 59: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 11, // 60: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 34, // 61: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty - 17, // 62: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 20, // 63: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse - 17, // 64: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 25, // 65: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent - 50, // [50:66] is the sub-list for method output_type - 34, // [34:50] is the sub-list for method input_type - 34, // [34:34] is the sub-list for extension type_name - 34, // [34:34] is the sub-list for extension extendee - 0, // [0:34] is the sub-list for field type_name +// Deprecated: Use ComponentValue.ProtoReflect.Descriptor instead. +func (*ComponentValue) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{26} } -func init() { file_atmos_plugin_v1_plugin_proto_init() } -func file_atmos_plugin_v1_plugin_proto_init() { - if File_atmos_plugin_v1_plugin_proto != nil { - return +func (x *ComponentValue) GetTypeJson() []byte { + if x != nil { + return x.TypeJson } - file_atmos_plugin_v1_plugin_proto_msgTypes[11].OneofWrappers = []any{ - (*AuthenticateEvent_Progress)(nil), - (*AuthenticateEvent_Interaction)(nil), - (*AuthenticateEvent_Result)(nil), + return nil +} + +func (x *ComponentValue) GetMsgpack() []byte { + if x != nil { + return x.Msgpack } - file_atmos_plugin_v1_plugin_proto_msgTypes[16].OneofWrappers = []any{ - (*RefreshResponse_Credentials)(nil), - (*RefreshResponse_Unsupported)(nil), + return nil +} + +func (x *ComponentValue) GetSensitivePaths() []*ComponentValuePath { + if x != nil { + return x.SensitivePaths } - file_atmos_plugin_v1_plugin_proto_msgTypes[25].OneofWrappers = []any{ - (*CommandEvent_Stdout)(nil), - (*CommandEvent_Stderr)(nil), - (*CommandEvent_Exit)(nil), + return nil +} + +type ComponentValuePath struct { + state protoimpl.MessageState `protogen:"open.v1"` + Steps []*ComponentValueStep `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentValuePath) Reset() { + *x = ComponentValuePath{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentValuePath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentValuePath) ProtoMessage() {} + +func (x *ComponentValuePath) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentValuePath.ProtoReflect.Descriptor instead. +func (*ComponentValuePath) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{27} +} + +func (x *ComponentValuePath) GetSteps() []*ComponentValueStep { + if x != nil { + return x.Steps + } + return nil +} + +type ComponentValueStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Selector: + // + // *ComponentValueStep_Attribute + // *ComponentValueStep_Index + Selector isComponentValueStep_Selector `protobuf_oneof:"selector"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentValueStep) Reset() { + *x = ComponentValueStep{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentValueStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentValueStep) ProtoMessage() {} + +func (x *ComponentValueStep) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentValueStep.ProtoReflect.Descriptor instead. +func (*ComponentValueStep) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{28} +} + +func (x *ComponentValueStep) GetSelector() isComponentValueStep_Selector { + if x != nil { + return x.Selector + } + return nil +} + +func (x *ComponentValueStep) GetAttribute() string { + if x != nil { + if x, ok := x.Selector.(*ComponentValueStep_Attribute); ok { + return x.Attribute + } + } + return "" +} + +func (x *ComponentValueStep) GetIndex() *ComponentValue { + if x != nil { + if x, ok := x.Selector.(*ComponentValueStep_Index); ok { + return x.Index + } + } + return nil +} + +type isComponentValueStep_Selector interface { + isComponentValueStep_Selector() +} + +type ComponentValueStep_Attribute struct { + Attribute string `protobuf:"bytes,1,opt,name=attribute,proto3,oneof"` +} + +type ComponentValueStep_Index struct { + Index *ComponentValue `protobuf:"bytes,2,opt,name=index,proto3,oneof"` +} + +func (*ComponentValueStep_Attribute) isComponentValueStep_Selector() {} + +func (*ComponentValueStep_Index) isComponentValueStep_Selector() {} + +// Coordinates are logical identities, independent of generated/cache paths. +// Native HCL adaptation has type terraform and engine terraform or opentofu. +type ComponentAddress struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stack string `protobuf:"bytes,1,opt,name=stack,proto3" json:"stack,omitempty"` + Component string `protobuf:"bytes,2,opt,name=component,proto3" json:"component,omitempty"` + ComponentType string `protobuf:"bytes,3,opt,name=component_type,json=componentType,proto3" json:"component_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentAddress) Reset() { + *x = ComponentAddress{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentAddress) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentAddress) ProtoMessage() {} + +func (x *ComponentAddress) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentAddress.ProtoReflect.Descriptor instead. +func (*ComponentAddress) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{29} +} + +func (x *ComponentAddress) GetStack() string { + if x != nil { + return x.Stack + } + return "" +} + +func (x *ComponentAddress) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *ComponentAddress) GetComponentType() string { + if x != nil { + return x.ComponentType + } + return "" +} + +// Paths are relative to root_directory in the requested revision. A directory +// watch includes additions/deletions; a file list alone cannot represent it. +type ComponentSource struct { + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Kind ComponentSource_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=atmos.plugin.v1.ComponentSource_Kind" json:"kind,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentSource) Reset() { + *x = ComponentSource{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentSource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentSource) ProtoMessage() {} + +func (x *ComponentSource) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentSource.ProtoReflect.Descriptor instead. +func (*ComponentSource) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{30} +} + +func (x *ComponentSource) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ComponentSource) GetKind() ComponentSource_Kind { + if x != nil { + return x.Kind + } + return ComponentSource_KIND_UNSPECIFIED +} + +func (x *ComponentSource) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type ComponentDependency struct { + state protoimpl.MessageState `protogen:"open.v1"` + Target *ComponentAddress `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Kind ComponentDependency_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=atmos.plugin.v1.ComponentDependency_Kind" json:"kind,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentDependency) Reset() { + *x = ComponentDependency{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentDependency) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentDependency) ProtoMessage() {} + +func (x *ComponentDependency) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentDependency.ProtoReflect.Descriptor instead. +func (*ComponentDependency) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{31} +} + +func (x *ComponentDependency) GetTarget() *ComponentAddress { + if x != nil { + return x.Target + } + return nil +} + +func (x *ComponentDependency) GetKind() ComponentDependency_Kind { + if x != nil { + return x.Kind + } + return ComponentDependency_KIND_UNSPECIFIED +} + +type DiscoveredComponent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *ComponentAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Engine string `protobuf:"bytes,3,opt,name=engine,proto3" json:"engine,omitempty"` + Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,5,opt,name=configuration,proto3" json:"configuration,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,6,rep,name=sources,proto3" json:"sources,omitempty"` + Dependencies []*ComponentDependency `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoveredComponent) Reset() { + *x = DiscoveredComponent{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoveredComponent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoveredComponent) ProtoMessage() {} + +func (x *DiscoveredComponent) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoveredComponent.ProtoReflect.Descriptor instead. +func (*DiscoveredComponent) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{32} +} + +func (x *DiscoveredComponent) GetAddress() *ComponentAddress { + if x != nil { + return x.Address + } + return nil +} + +func (x *DiscoveredComponent) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *DiscoveredComponent) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *DiscoveredComponent) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *DiscoveredComponent) GetConfiguration() *ComponentValue { + if x != nil { + return x.Configuration + } + return nil +} + +func (x *DiscoveredComponent) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *DiscoveredComponent) GetDependencies() []*ComponentDependency { + if x != nil { + return x.Dependencies + } + return nil +} + +// Omission denies effects. The host must enforce the same policy on API calls; +// this declaration is not an operating-system sandbox for trusted plugin code. +type ComponentEffects struct { + state protoimpl.MessageState `protogen:"open.v1"` + Commands bool `protobuf:"varint,1,opt,name=commands,proto3" json:"commands,omitempty"` + Network bool `protobuf:"varint,2,opt,name=network,proto3" json:"network,omitempty"` + Secrets bool `protobuf:"varint,3,opt,name=secrets,proto3" json:"secrets,omitempty"` + Writes bool `protobuf:"varint,4,opt,name=writes,proto3" json:"writes,omitempty"` + StateReads bool `protobuf:"varint,5,opt,name=state_reads,json=stateReads,proto3" json:"state_reads,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentEffects) Reset() { + *x = ComponentEffects{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentEffects) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentEffects) ProtoMessage() {} + +func (x *ComponentEffects) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentEffects.ProtoReflect.Descriptor instead. +func (*ComponentEffects) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{33} +} + +func (x *ComponentEffects) GetCommands() bool { + if x != nil { + return x.Commands + } + return false +} + +func (x *ComponentEffects) GetNetwork() bool { + if x != nil { + return x.Network + } + return false +} + +func (x *ComponentEffects) GetSecrets() bool { + if x != nil { + return x.Secrets + } + return false +} + +func (x *ComponentEffects) GetWrites() bool { + if x != nil { + return x.Writes + } + return false +} + +func (x *ComponentEffects) GetStateReads() bool { + if x != nil { + return x.StateReads + } + return false +} + +// Provider options have already passed host parsing/precedence. Map presence +// distinguishes an unset option from an explicit false, zero, or empty value. +// These are not Terraform argv. The provider validates supported semantics. +type ComponentOperation struct { + state protoimpl.MessageState `protogen:"open.v1"` + Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` + Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` + Options map[string]*ComponentValue `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentOperation) Reset() { + *x = ComponentOperation{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentOperation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentOperation) ProtoMessage() {} + +func (x *ComponentOperation) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentOperation.ProtoReflect.Descriptor instead. +func (*ComponentOperation) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{34} +} + +func (x *ComponentOperation) GetCommand() string { + if x != nil { + return x.Command + } + return "" +} + +func (x *ComponentOperation) GetMode() string { + if x != nil { + return x.Mode + } + return "" +} + +func (x *ComponentOperation) GetOptions() map[string]*ComponentValue { + if x != nil { + return x.Options + } + return nil +} + +type DiscoverComponentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + RootDirectory string `protobuf:"bytes,3,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Revision string `protobuf:"bytes,4,opt,name=revision,proto3" json:"revision,omitempty"` + IncludePaths []string `protobuf:"bytes,5,rep,name=include_paths,json=includePaths,proto3" json:"include_paths,omitempty"` + ExcludePaths []string `protobuf:"bytes,6,rep,name=exclude_paths,json=excludePaths,proto3" json:"exclude_paths,omitempty"` + // Explicit imports and automatic discovery share one evaluator. + Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoverComponentsRequest) Reset() { + *x = DiscoverComponentsRequest{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoverComponentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoverComponentsRequest) ProtoMessage() {} + +func (x *DiscoverComponentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoverComponentsRequest.ProtoReflect.Descriptor instead. +func (*DiscoverComponentsRequest) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{35} +} + +func (x *DiscoverComponentsRequest) GetInvocation() *Invocation { + if x != nil { + return x.Invocation + } + return nil +} + +func (x *DiscoverComponentsRequest) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *DiscoverComponentsRequest) GetRootDirectory() string { + if x != nil { + return x.RootDirectory + } + return "" +} + +func (x *DiscoverComponentsRequest) GetRevision() string { + if x != nil { + return x.Revision + } + return "" +} + +func (x *DiscoverComponentsRequest) GetIncludePaths() []string { + if x != nil { + return x.IncludePaths + } + return nil +} + +func (x *DiscoverComponentsRequest) GetExcludePaths() []string { + if x != nil { + return x.ExcludePaths + } + return nil +} + +func (x *DiscoverComponentsRequest) GetImports() []string { + if x != nil { + return x.Imports + } + return nil +} + +func (x *DiscoverComponentsRequest) GetOperation() *ComponentOperation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *DiscoverComponentsRequest) GetEffects() *ComponentEffects { + if x != nil { + return x.Effects + } + return nil +} + +type DiscoverComponentsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Components []*DiscoveredComponent `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoverComponentsResponse) Reset() { + *x = DiscoverComponentsResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoverComponentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoverComponentsResponse) ProtoMessage() {} + +func (x *DiscoverComponentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoverComponentsResponse.ProtoReflect.Descriptor instead. +func (*DiscoverComponentsResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{36} +} + +func (x *DiscoverComponentsResponse) GetComponents() []*DiscoveredComponent { + if x != nil { + return x.Components + } + return nil +} + +func (x *DiscoverComponentsResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ComponentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentRequest) Reset() { + *x = ComponentRequest{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentRequest) ProtoMessage() {} + +func (x *ComponentRequest) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentRequest.ProtoReflect.Descriptor instead. +func (*ComponentRequest) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{37} +} + +func (x *ComponentRequest) GetInvocation() *Invocation { + if x != nil { + return x.Invocation + } + return nil +} + +func (x *ComponentRequest) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *ComponentRequest) GetAddress() *ComponentAddress { + if x != nil { + return x.Address + } + return nil +} + +func (x *ComponentRequest) GetRootDirectory() string { + if x != nil { + return x.RootDirectory + } + return "" +} + +func (x *ComponentRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *ComponentRequest) GetOperation() *ComponentOperation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *ComponentRequest) GetEffects() *ComponentEffects { + if x != nil { + return x.Effects + } + return nil +} + +func (x *ComponentRequest) GetConfiguration() *ComponentValue { + if x != nil { + return x.Configuration + } + return nil +} + +type ComponentStateIdentity struct { + state protoimpl.MessageState `protogen:"open.v1"` + BackendType string `protobuf:"bytes,1,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` + Backend *ComponentValue `protobuf:"bytes,2,opt,name=backend,proto3" json:"backend,omitempty"` + Workspace string `protobuf:"bytes,3,opt,name=workspace,proto3" json:"workspace,omitempty"` + // Relative backend paths are interpreted against this directory. It can be + // different from the directory where Atmos prepares Terraform execution. + WorkingDirectory string `protobuf:"bytes,4,opt,name=working_directory,json=workingDirectory,proto3" json:"working_directory,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentStateIdentity) Reset() { + *x = ComponentStateIdentity{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentStateIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentStateIdentity) ProtoMessage() {} + +func (x *ComponentStateIdentity) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentStateIdentity.ProtoReflect.Descriptor instead. +func (*ComponentStateIdentity) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{38} +} + +func (x *ComponentStateIdentity) GetBackendType() string { + if x != nil { + return x.BackendType + } + return "" +} + +func (x *ComponentStateIdentity) GetBackend() *ComponentValue { + if x != nil { + return x.Backend + } + return nil +} + +func (x *ComponentStateIdentity) GetWorkspace() string { + if x != nil { + return x.Workspace + } + return "" +} + +func (x *ComponentStateIdentity) GetWorkingDirectory() string { + if x != nil { + return x.WorkingDirectory + } + return "" +} + +type ComponentGeneratedFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + // The adapter must reject unknown ownership policies, never overwrite by + // default. Content is evaluated bytes, not another template language. + IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` + Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentGeneratedFile) Reset() { + *x = ComponentGeneratedFile{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentGeneratedFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentGeneratedFile) ProtoMessage() {} + +func (x *ComponentGeneratedFile) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentGeneratedFile.ProtoReflect.Descriptor instead. +func (*ComponentGeneratedFile) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{39} +} + +func (x *ComponentGeneratedFile) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ComponentGeneratedFile) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *ComponentGeneratedFile) GetIfExists() string { + if x != nil { + return x.IfExists + } + return "" +} + +func (x *ComponentGeneratedFile) GetSensitive() bool { + if x != nil { + return x.Sensitive + } + return false +} + +type PrepareComponentResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Engine string `protobuf:"bytes,1,opt,name=engine,proto3" json:"engine,omitempty"` + WorkingDirectory string `protobuf:"bytes,2,opt,name=working_directory,json=workingDirectory,proto3" json:"working_directory,omitempty"` + ModuleSource string `protobuf:"bytes,3,opt,name=module_source,json=moduleSource,proto3" json:"module_source,omitempty"` + Inputs *ComponentValue `protobuf:"bytes,4,opt,name=inputs,proto3" json:"inputs,omitempty"` + State *ComponentStateIdentity `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + Files []*ComponentGeneratedFile `protobuf:"bytes,6,rep,name=files,proto3" json:"files,omitempty"` + Dependencies []*ComponentDependency `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,8,rep,name=sources,proto3" json:"sources,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,9,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PrepareComponentResponse) Reset() { + *x = PrepareComponentResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PrepareComponentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareComponentResponse) ProtoMessage() {} + +func (x *PrepareComponentResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareComponentResponse.ProtoReflect.Descriptor instead. +func (*PrepareComponentResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{40} +} + +func (x *PrepareComponentResponse) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *PrepareComponentResponse) GetWorkingDirectory() string { + if x != nil { + return x.WorkingDirectory + } + return "" +} + +func (x *PrepareComponentResponse) GetModuleSource() string { + if x != nil { + return x.ModuleSource + } + return "" +} + +func (x *PrepareComponentResponse) GetInputs() *ComponentValue { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *PrepareComponentResponse) GetState() *ComponentStateIdentity { + if x != nil { + return x.State + } + return nil +} + +func (x *PrepareComponentResponse) GetFiles() []*ComponentGeneratedFile { + if x != nil { + return x.Files + } + return nil +} + +func (x *PrepareComponentResponse) GetDependencies() []*ComponentDependency { + if x != nil { + return x.Dependencies + } + return nil +} + +func (x *PrepareComponentResponse) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *PrepareComponentResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ResolveComponentStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + State *ComponentStateIdentity `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,3,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResolveComponentStateResponse) Reset() { + *x = ResolveComponentStateResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResolveComponentStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResolveComponentStateResponse) ProtoMessage() {} + +func (x *ResolveComponentStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResolveComponentStateResponse.ProtoReflect.Descriptor instead. +func (*ResolveComponentStateResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{41} +} + +func (x *ResolveComponentStateResponse) GetState() *ComponentStateIdentity { + if x != nil { + return x.State + } + return nil +} + +func (x *ResolveComponentStateResponse) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *ResolveComponentStateResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +var File_atmos_plugin_v1_plugin_proto protoreflect.FileDescriptor + +const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + + "\n" + + "\x1catmos/plugin/v1/plugin.proto\x12\x0fatmos.plugin.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa8\x03\n" + + "\n" + + "Invocation\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + + "\aattempt\x18\x02 \x01(\rR\aattempt\x126\n" + + "\bdeadline\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\bdeadline\x12+\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\x12N\n" + + "\venvironment\x18\x05 \x03(\v2,.atmos.plugin.v1.Invocation.EnvironmentEntryR\venvironment\x12\x14\n" + + "\x05stack\x18\x06 \x01(\tR\x05stack\x12\x1c\n" + + "\tcomponent\x18\a \x01(\tR\tcomponent\x12%\n" + + "\x0ecomponent_type\x18\b \x01(\tR\rcomponentType\x12 \n" + + "\vinteractive\x18\t \x01(\bR\vinteractive\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb0\x01\n" + + "\vCredentials\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x129\n" + + "\n" + + "expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12+\n" + + "\x04data\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04data\x12%\n" + + "\x0esensitive_keys\x18\x04 \x03(\tR\rsensitiveKeys\"S\n" + + "\x13ServiceVersionRange\x12\x18\n" + + "\aservice\x18\x01 \x01(\tR\aservice\x12\x10\n" + + "\x03min\x18\x02 \x01(\rR\x03min\x12\x10\n" + + "\x03max\x18\x03 \x01(\rR\x03max\"6\n" + + "\x06Export\x12\x18\n" + + "\aservice\x18\x01 \x01(\tR\aservice\x12\x12\n" + + "\x04kind\x18\x02 \x01(\tR\x04kind\"\x83\x01\n" + + "\x0fDescribeRequest\x12#\n" + + "\ratmos_version\x18\x01 \x01(\tR\fatmosVersion\x12K\n" + + "\x0ehost_supported\x18\x02 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\rhostSupported\"\x94\x02\n" + + "\x10DescribeResponse\x12\x1f\n" + + "\vplugin_name\x18\x01 \x01(\tR\n" + + "pluginName\x12%\n" + + "\x0eplugin_version\x18\x02 \x01(\tR\rpluginVersion\x12'\n" + + "\x0fmanifest_digest\x18\x03 \x01(\tR\x0emanifestDigest\x12@\n" + + "\bservices\x18\x04 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\bservices\x121\n" + + "\aexports\x18\x05 \x03(\v2\x17.atmos.plugin.v1.ExportR\aexports\x12\x1a\n" + + "\bfeatures\x18\x06 \x03(\tR\bfeatures\"\xf7\x01\n" + + "\x10ConfigureRequest\x12O\n" + + "\n" + + "broker_ids\x18\x01 \x03(\v20.atmos.plugin.v1.ConfigureRequest.BrokerIdsEntryR\tbrokerIds\x123\n" + + "\bsettings\x18\x02 \x01(\v2\x17.google.protobuf.StructR\bsettings\x12\x1f\n" + + "\vpackage_dir\x18\x03 \x01(\tR\n" + + "packageDir\x1a<\n" + + "\x0eBrokerIdsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\"\xb9\x01\n" + + "\x0fProviderRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + + "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x12\x14\n" + + "\x05realm\x18\x05 \x01(\tR\x05realm\"\xf0\x01\n" + + "\x0fIdentityRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + + "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x125\n" + + "\tprincipal\x18\x05 \x01(\v2\x17.google.protobuf.StructR\tprincipal\x12\x14\n" + + "\x05realm\x18\x06 \x01(\tR\x05realm\"@\n" + + "\bProgress\x12\x18\n" + + "\amessage\x18\x01 \x01(\tR\amessage\x12\x1a\n" + + "\bfraction\x18\x02 \x01(\x02R\bfraction\"\xb4\x01\n" + + "\vInteraction\x12\x12\n" + + "\x04kind\x18\x01 \x01(\tR\x04kind\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12@\n" + + "\x06fields\x18\x03 \x03(\v2(.atmos.plugin.v1.Interaction.FieldsEntryR\x06fields\x1a9\n" + + "\vFieldsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xcf\x01\n" + + "\x11AuthenticateEvent\x127\n" + + "\bprogress\x18\x01 \x01(\v2\x19.atmos.plugin.v1.ProgressH\x00R\bprogress\x12@\n" + + "\vinteraction\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.InteractionH\x00R\vinteraction\x126\n" + + "\x06result\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\x06resultB\a\n" + + "\x05event\"<\n" + + "\n" + + "Diagnostic\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"Q\n" + + "\x10ValidateResponse\x12=\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"C\n" + + "\vUnsupported\x12\x1c\n" + + "\toperation\x18\x01 \x01(\tR\toperation\x12\x16\n" + + "\x06reason\x18\x02 \x01(\tR\x06reason\"\x86\x01\n" + + "\x0eRefreshRequest\x12<\n" + + "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x126\n" + + "\acurrent\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\acurrent\"\x9f\x01\n" + + "\x0fRefreshResponse\x12@\n" + + "\vcredentials\x18\x01 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\vcredentials\x12@\n" + + "\vunsupported\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.UnsupportedH\x00R\vunsupportedB\b\n" + + "\x06result\"\xae\x01\n" + + "\x13EnvironmentResponse\x12W\n" + + "\venvironment\x18\x01 \x03(\v25.atmos.plugin.v1.EnvironmentResponse.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xf8\x01\n" + + "\x19PrepareEnvironmentRequest\x12<\n" + + "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x12]\n" + + "\venvironment\x18\x02 \x03(\v2;.atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"v\n" + + "\x0eCredentialPath\x12\x1a\n" + + "\blocation\x18\x01 \x01(\tR\blocation\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + + "\brequired\x18\x03 \x01(\bR\brequired\x12\x18\n" + + "\apurpose\x18\x04 \x01(\tR\apurpose\"F\n" + + "\rPathsResponse\x125\n" + + "\x05paths\x18\x01 \x03(\v2\x1f.atmos.plugin.v1.CredentialPathR\x05paths\"\x95\x01\n" + + "\x1bIdentityAuthenticateRequest\x12<\n" + + "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x128\n" + + "\bupstream\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\bupstream\"\xf2\x01\n" + + "\x16IdentityPrepareRequest\x12<\n" + + "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x12Z\n" + + "\venvironment\x18\x02 \x03(\v28.atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb4\x01\n" + + "\x0eCommandRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + + "\targuments\x18\x03 \x03(\tR\targuments\x123\n" + + "\bsettings\x18\x04 \x01(\v2\x17.google.protobuf.StructR\bsettings\"!\n" + + "\vCommandExit\x12\x12\n" + + "\x04code\x18\x01 \x01(\rR\x04code\"\x7f\n" + + "\fCommandEvent\x12\x18\n" + + "\x06stdout\x18\x01 \x01(\fH\x00R\x06stdout\x12\x18\n" + + "\x06stderr\x18\x02 \x01(\fH\x00R\x06stderr\x122\n" + + "\x04exit\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CommandExitH\x00R\x04exitB\a\n" + + "\x05event\"\x95\x01\n" + + "\x0eComponentValue\x12\x1b\n" + + "\ttype_json\x18\x01 \x01(\fR\btypeJson\x12\x18\n" + + "\amsgpack\x18\x02 \x01(\fR\amsgpack\x12L\n" + + "\x0fsensitive_paths\x18\x03 \x03(\v2#.atmos.plugin.v1.ComponentValuePathR\x0esensitivePaths\"O\n" + + "\x12ComponentValuePath\x129\n" + + "\x05steps\x18\x01 \x03(\v2#.atmos.plugin.v1.ComponentValueStepR\x05steps\"y\n" + + "\x12ComponentValueStep\x12\x1e\n" + + "\tattribute\x18\x01 \x01(\tH\x00R\tattribute\x127\n" + + "\x05index\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueH\x00R\x05indexB\n" + + "\n" + + "\bselector\"m\n" + + "\x10ComponentAddress\x12\x14\n" + + "\x05stack\x18\x01 \x01(\tR\x05stack\x12\x1c\n" + + "\tcomponent\x18\x02 \x01(\tR\tcomponent\x12%\n" + + "\x0ecomponent_type\x18\x03 \x01(\tR\rcomponentType\"\xb9\x01\n" + + "\x0fComponentSource\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x129\n" + + "\x04kind\x18\x02 \x01(\x0e2%.atmos.plugin.v1.ComponentSource.KindR\x04kind\x12\x16\n" + + "\x06reason\x18\x03 \x01(\tR\x06reason\"?\n" + + "\x04Kind\x12\x14\n" + + "\x10KIND_UNSPECIFIED\x10\x00\x12\b\n" + + "\x04FILE\x10\x01\x12\r\n" + + "\tDIRECTORY\x10\x02\x12\b\n" + + "\x04GLOB\x10\x03\"\xc4\x01\n" + + "\x13ComponentDependency\x129\n" + + "\x06target\x18\x01 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\x06target\x12=\n" + + "\x04kind\x18\x02 \x01(\x0e2).atmos.plugin.v1.ComponentDependency.KindR\x04kind\"3\n" + + "\x04Kind\x12\x14\n" + + "\x10KIND_UNSPECIFIED\x10\x00\x12\t\n" + + "\x05ORDER\x10\x01\x12\n" + + "\n" + + "\x06OUTPUT\x10\x02\"\xeb\x02\n" + + "\x13DiscoveredComponent\x12;\n" + + "\aaddress\x18\x01 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\aaddress\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12\x16\n" + + "\x06engine\x18\x03 \x01(\tR\x06engine\x12\x16\n" + + "\x06source\x18\x04 \x01(\tR\x06source\x12E\n" + + "\rconfiguration\x18\x05 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\x12:\n" + + "\asources\x18\x06 \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12H\n" + + "\fdependencies\x18\a \x03(\v2$.atmos.plugin.v1.ComponentDependencyR\fdependencies\"\x9b\x01\n" + + "\x10ComponentEffects\x12\x1a\n" + + "\bcommands\x18\x01 \x01(\bR\bcommands\x12\x18\n" + + "\anetwork\x18\x02 \x01(\bR\anetwork\x12\x18\n" + + "\asecrets\x18\x03 \x01(\bR\asecrets\x12\x16\n" + + "\x06writes\x18\x04 \x01(\bR\x06writes\x12\x1f\n" + + "\vstate_reads\x18\x05 \x01(\bR\n" + + "stateReads\"\xeb\x01\n" + + "\x12ComponentOperation\x12\x18\n" + + "\acommand\x18\x01 \x01(\tR\acommand\x12\x12\n" + + "\x04mode\x18\x02 \x01(\tR\x04mode\x12J\n" + + "\aoptions\x18\x03 \x03(\v20.atmos.plugin.v1.ComponentOperation.OptionsEntryR\aoptions\x1a[\n" + + "\fOptionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x125\n" + + "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\x9b\x03\n" + + "\x19DiscoverComponentsRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12%\n" + + "\x0eroot_directory\x18\x03 \x01(\tR\rrootDirectory\x12\x1a\n" + + "\brevision\x18\x04 \x01(\tR\brevision\x12#\n" + + "\rinclude_paths\x18\x05 \x03(\tR\fincludePaths\x12#\n" + + "\rexclude_paths\x18\x06 \x03(\tR\fexcludePaths\x12\x18\n" + + "\aimports\x18\a \x03(\tR\aimports\x12A\n" + + "\toperation\x18\b \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + + "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\"\xa1\x01\n" + + "\x1aDiscoverComponentsResponse\x12D\n" + + "\n" + + "components\x18\x01 \x03(\v2$.atmos.plugin.v1.DiscoveredComponentR\n" + + "components\x12=\n" + + "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xae\x03\n" + + "\x10ComponentRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12;\n" + + "\aaddress\x18\x03 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\aaddress\x12%\n" + + "\x0eroot_directory\x18\x04 \x01(\tR\rrootDirectory\x12\x16\n" + + "\x06source\x18\x05 \x01(\tR\x06source\x12A\n" + + "\toperation\x18\x06 \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + + "\aeffects\x18\a \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12E\n" + + "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\"\xc1\x01\n" + + "\x16ComponentStateIdentity\x12!\n" + + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + + "\tworkspace\x18\x03 \x01(\tR\tworkspace\x12+\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x81\x01\n" + + "\x16ComponentGeneratedFile\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x12\x18\n" + + "\acontent\x18\x02 \x01(\fR\acontent\x12\x1b\n" + + "\tif_exists\x18\x03 \x01(\tR\bifExists\x12\x1c\n" + + "\tsensitive\x18\x04 \x01(\bR\tsensitive\"\x80\x04\n" + + "\x18PrepareComponentResponse\x12\x16\n" + + "\x06engine\x18\x01 \x01(\tR\x06engine\x12+\n" + + "\x11working_directory\x18\x02 \x01(\tR\x10workingDirectory\x12#\n" + + "\rmodule_source\x18\x03 \x01(\tR\fmoduleSource\x127\n" + + "\x06inputs\x18\x04 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x06inputs\x12=\n" + + "\x05state\x18\x05 \x01(\v2'.atmos.plugin.v1.ComponentStateIdentityR\x05state\x12=\n" + + "\x05files\x18\x06 \x03(\v2'.atmos.plugin.v1.ComponentGeneratedFileR\x05files\x12H\n" + + "\fdependencies\x18\a \x03(\v2$.atmos.plugin.v1.ComponentDependencyR\fdependencies\x12:\n" + + "\asources\x18\b \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12=\n" + + "\vdiagnostics\x18\t \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xd9\x01\n" + + "\x1dResolveComponentStateResponse\x12=\n" + + "\x05state\x18\x01 \x01(\v2'.atmos.plugin.v1.ComponentStateIdentityR\x05state\x12:\n" + + "\asources\x18\x02 \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12=\n" + + "\vdiagnostics\x18\x03 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics2\x9f\x01\n" + + "\x04Info\x12O\n" + + "\bDescribe\x12 .atmos.plugin.v1.DescribeRequest\x1a!.atmos.plugin.v1.DescribeResponse\x12F\n" + + "\tConfigure\x12!.atmos.plugin.v1.ConfigureRequest\x1a\x16.google.protobuf.Empty2\xd3\x04\n" + + "\fAuthProvider\x12O\n" + + "\bValidate\x12 .atmos.plugin.v1.ProviderRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12V\n" + + "\fAuthenticate\x12 .atmos.plugin.v1.ProviderRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12L\n" + + "\aRefresh\x12\x1f.atmos.plugin.v1.RefreshRequest\x1a .atmos.plugin.v1.RefreshResponse\x12B\n" + + "\x06Logout\x12 .atmos.plugin.v1.ProviderRequest\x1a\x16.google.protobuf.Empty\x12U\n" + + "\vEnvironment\x12 .atmos.plugin.v1.ProviderRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + + "\x05Paths\x12 .atmos.plugin.v1.ProviderRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12f\n" + + "\x12PrepareEnvironment\x12*.atmos.plugin.v1.PrepareEnvironmentRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2\x8e\x04\n" + + "\fAuthIdentity\x12O\n" + + "\bValidate\x12 .atmos.plugin.v1.IdentityRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12b\n" + + "\fAuthenticate\x12,.atmos.plugin.v1.IdentityAuthenticateRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12B\n" + + "\x06Logout\x12 .atmos.plugin.v1.IdentityRequest\x1a\x16.google.protobuf.Empty\x12U\n" + + "\vEnvironment\x12 .atmos.plugin.v1.IdentityRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + + "\x05Paths\x12 .atmos.plugin.v1.IdentityRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12c\n" + + "\x12PrepareEnvironment\x12'.atmos.plugin.v1.IdentityPrepareRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2S\n" + + "\bCommands\x12G\n" + + "\x03Run\x12\x1f.atmos.plugin.v1.CommandRequest\x1a\x1d.atmos.plugin.v1.CommandEvent0\x012y\n" + + "\x12ComponentDiscovery\x12c\n" + + "\bDiscover\x12*.atmos.plugin.v1.DiscoverComponentsRequest\x1a+.atmos.plugin.v1.DiscoverComponentsResponse2g\n" + + "\x13ComponentValidation\x12P\n" + + "\bValidate\x12!.atmos.plugin.v1.ComponentRequest\x1a!.atmos.plugin.v1.ValidateResponse2o\n" + + "\x14ComponentPreparation\x12W\n" + + "\aPrepare\x12!.atmos.plugin.v1.ComponentRequest\x1a).atmos.plugin.v1.PrepareComponentResponse2n\n" + + "\x0eComponentState\x12\\\n" + + "\aResolve\x12!.atmos.plugin.v1.ComponentRequest\x1a..atmos.plugin.v1.ResolveComponentStateResponseB@Z>github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1;pluginv1b\x06proto3" + +var ( + file_atmos_plugin_v1_plugin_proto_rawDescOnce sync.Once + file_atmos_plugin_v1_plugin_proto_rawDescData []byte +) + +func file_atmos_plugin_v1_plugin_proto_rawDescGZIP() []byte { + file_atmos_plugin_v1_plugin_proto_rawDescOnce.Do(func() { + file_atmos_plugin_v1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc))) + }) + return file_atmos_plugin_v1_plugin_proto_rawDescData +} + +var ( + file_atmos_plugin_v1_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 2) + file_atmos_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 49) + file_atmos_plugin_v1_plugin_proto_goTypes = []any{ + ComponentSource_Kind(0), // 0: atmos.plugin.v1.ComponentSource.Kind + ComponentDependency_Kind(0), // 1: atmos.plugin.v1.ComponentDependency.Kind + (*Invocation)(nil), // 2: atmos.plugin.v1.Invocation + (*Credentials)(nil), // 3: atmos.plugin.v1.Credentials + (*ServiceVersionRange)(nil), // 4: atmos.plugin.v1.ServiceVersionRange + (*Export)(nil), // 5: atmos.plugin.v1.Export + (*DescribeRequest)(nil), // 6: atmos.plugin.v1.DescribeRequest + (*DescribeResponse)(nil), // 7: atmos.plugin.v1.DescribeResponse + (*ConfigureRequest)(nil), // 8: atmos.plugin.v1.ConfigureRequest + (*ProviderRequest)(nil), // 9: atmos.plugin.v1.ProviderRequest + (*IdentityRequest)(nil), // 10: atmos.plugin.v1.IdentityRequest + (*Progress)(nil), // 11: atmos.plugin.v1.Progress + (*Interaction)(nil), // 12: atmos.plugin.v1.Interaction + (*AuthenticateEvent)(nil), // 13: atmos.plugin.v1.AuthenticateEvent + (*Diagnostic)(nil), // 14: atmos.plugin.v1.Diagnostic + (*ValidateResponse)(nil), // 15: atmos.plugin.v1.ValidateResponse + (*Unsupported)(nil), // 16: atmos.plugin.v1.Unsupported + (*RefreshRequest)(nil), // 17: atmos.plugin.v1.RefreshRequest + (*RefreshResponse)(nil), // 18: atmos.plugin.v1.RefreshResponse + (*EnvironmentResponse)(nil), // 19: atmos.plugin.v1.EnvironmentResponse + (*PrepareEnvironmentRequest)(nil), // 20: atmos.plugin.v1.PrepareEnvironmentRequest + (*CredentialPath)(nil), // 21: atmos.plugin.v1.CredentialPath + (*PathsResponse)(nil), // 22: atmos.plugin.v1.PathsResponse + (*IdentityAuthenticateRequest)(nil), // 23: atmos.plugin.v1.IdentityAuthenticateRequest + (*IdentityPrepareRequest)(nil), // 24: atmos.plugin.v1.IdentityPrepareRequest + (*CommandRequest)(nil), // 25: atmos.plugin.v1.CommandRequest + (*CommandExit)(nil), // 26: atmos.plugin.v1.CommandExit + (*CommandEvent)(nil), // 27: atmos.plugin.v1.CommandEvent + (*ComponentValue)(nil), // 28: atmos.plugin.v1.ComponentValue + (*ComponentValuePath)(nil), // 29: atmos.plugin.v1.ComponentValuePath + (*ComponentValueStep)(nil), // 30: atmos.plugin.v1.ComponentValueStep + (*ComponentAddress)(nil), // 31: atmos.plugin.v1.ComponentAddress + (*ComponentSource)(nil), // 32: atmos.plugin.v1.ComponentSource + (*ComponentDependency)(nil), // 33: atmos.plugin.v1.ComponentDependency + (*DiscoveredComponent)(nil), // 34: atmos.plugin.v1.DiscoveredComponent + (*ComponentEffects)(nil), // 35: atmos.plugin.v1.ComponentEffects + (*ComponentOperation)(nil), // 36: atmos.plugin.v1.ComponentOperation + (*DiscoverComponentsRequest)(nil), // 37: atmos.plugin.v1.DiscoverComponentsRequest + (*DiscoverComponentsResponse)(nil), // 38: atmos.plugin.v1.DiscoverComponentsResponse + (*ComponentRequest)(nil), // 39: atmos.plugin.v1.ComponentRequest + (*ComponentStateIdentity)(nil), // 40: atmos.plugin.v1.ComponentStateIdentity + (*ComponentGeneratedFile)(nil), // 41: atmos.plugin.v1.ComponentGeneratedFile + (*PrepareComponentResponse)(nil), // 42: atmos.plugin.v1.PrepareComponentResponse + (*ResolveComponentStateResponse)(nil), // 43: atmos.plugin.v1.ResolveComponentStateResponse + nil, // 44: atmos.plugin.v1.Invocation.EnvironmentEntry + nil, // 45: atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry + nil, // 46: atmos.plugin.v1.Interaction.FieldsEntry + nil, // 47: atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry + nil, // 48: atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry + nil, // 49: atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry + nil, // 50: atmos.plugin.v1.ComponentOperation.OptionsEntry + (*timestamppb.Timestamp)(nil), // 51: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 52: google.protobuf.Struct + (*emptypb.Empty)(nil), // 53: google.protobuf.Empty + } +) + +var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ + 51, // 0: atmos.plugin.v1.Invocation.deadline:type_name -> google.protobuf.Timestamp + 44, // 1: atmos.plugin.v1.Invocation.environment:type_name -> atmos.plugin.v1.Invocation.EnvironmentEntry + 51, // 2: atmos.plugin.v1.Credentials.expires_at:type_name -> google.protobuf.Timestamp + 52, // 3: atmos.plugin.v1.Credentials.data:type_name -> google.protobuf.Struct + 4, // 4: atmos.plugin.v1.DescribeRequest.host_supported:type_name -> atmos.plugin.v1.ServiceVersionRange + 4, // 5: atmos.plugin.v1.DescribeResponse.services:type_name -> atmos.plugin.v1.ServiceVersionRange + 5, // 6: atmos.plugin.v1.DescribeResponse.exports:type_name -> atmos.plugin.v1.Export + 45, // 7: atmos.plugin.v1.ConfigureRequest.broker_ids:type_name -> atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry + 52, // 8: atmos.plugin.v1.ConfigureRequest.settings:type_name -> google.protobuf.Struct + 2, // 9: atmos.plugin.v1.ProviderRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 10: atmos.plugin.v1.ProviderRequest.spec:type_name -> google.protobuf.Struct + 2, // 11: atmos.plugin.v1.IdentityRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 12: atmos.plugin.v1.IdentityRequest.spec:type_name -> google.protobuf.Struct + 52, // 13: atmos.plugin.v1.IdentityRequest.principal:type_name -> google.protobuf.Struct + 46, // 14: atmos.plugin.v1.Interaction.fields:type_name -> atmos.plugin.v1.Interaction.FieldsEntry + 11, // 15: atmos.plugin.v1.AuthenticateEvent.progress:type_name -> atmos.plugin.v1.Progress + 12, // 16: atmos.plugin.v1.AuthenticateEvent.interaction:type_name -> atmos.plugin.v1.Interaction + 3, // 17: atmos.plugin.v1.AuthenticateEvent.result:type_name -> atmos.plugin.v1.Credentials + 14, // 18: atmos.plugin.v1.ValidateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 9, // 19: atmos.plugin.v1.RefreshRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest + 3, // 20: atmos.plugin.v1.RefreshRequest.current:type_name -> atmos.plugin.v1.Credentials + 3, // 21: atmos.plugin.v1.RefreshResponse.credentials:type_name -> atmos.plugin.v1.Credentials + 16, // 22: atmos.plugin.v1.RefreshResponse.unsupported:type_name -> atmos.plugin.v1.Unsupported + 47, // 23: atmos.plugin.v1.EnvironmentResponse.environment:type_name -> atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry + 9, // 24: atmos.plugin.v1.PrepareEnvironmentRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest + 48, // 25: atmos.plugin.v1.PrepareEnvironmentRequest.environment:type_name -> atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry + 21, // 26: atmos.plugin.v1.PathsResponse.paths:type_name -> atmos.plugin.v1.CredentialPath + 10, // 27: atmos.plugin.v1.IdentityAuthenticateRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest + 3, // 28: atmos.plugin.v1.IdentityAuthenticateRequest.upstream:type_name -> atmos.plugin.v1.Credentials + 10, // 29: atmos.plugin.v1.IdentityPrepareRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest + 49, // 30: atmos.plugin.v1.IdentityPrepareRequest.environment:type_name -> atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry + 2, // 31: atmos.plugin.v1.CommandRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 32: atmos.plugin.v1.CommandRequest.settings:type_name -> google.protobuf.Struct + 26, // 33: atmos.plugin.v1.CommandEvent.exit:type_name -> atmos.plugin.v1.CommandExit + 29, // 34: atmos.plugin.v1.ComponentValue.sensitive_paths:type_name -> atmos.plugin.v1.ComponentValuePath + 30, // 35: atmos.plugin.v1.ComponentValuePath.steps:type_name -> atmos.plugin.v1.ComponentValueStep + 28, // 36: atmos.plugin.v1.ComponentValueStep.index:type_name -> atmos.plugin.v1.ComponentValue + 0, // 37: atmos.plugin.v1.ComponentSource.kind:type_name -> atmos.plugin.v1.ComponentSource.Kind + 31, // 38: atmos.plugin.v1.ComponentDependency.target:type_name -> atmos.plugin.v1.ComponentAddress + 1, // 39: atmos.plugin.v1.ComponentDependency.kind:type_name -> atmos.plugin.v1.ComponentDependency.Kind + 31, // 40: atmos.plugin.v1.DiscoveredComponent.address:type_name -> atmos.plugin.v1.ComponentAddress + 28, // 41: atmos.plugin.v1.DiscoveredComponent.configuration:type_name -> atmos.plugin.v1.ComponentValue + 32, // 42: atmos.plugin.v1.DiscoveredComponent.sources:type_name -> atmos.plugin.v1.ComponentSource + 33, // 43: atmos.plugin.v1.DiscoveredComponent.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 50, // 44: atmos.plugin.v1.ComponentOperation.options:type_name -> atmos.plugin.v1.ComponentOperation.OptionsEntry + 2, // 45: atmos.plugin.v1.DiscoverComponentsRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 36, // 46: atmos.plugin.v1.DiscoverComponentsRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 47: atmos.plugin.v1.DiscoverComponentsRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 34, // 48: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent + 14, // 49: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 2, // 50: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 31, // 51: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress + 36, // 52: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 53: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 28, // 54: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 55: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue + 28, // 56: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue + 40, // 57: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 41, // 58: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile + 33, // 59: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 32, // 60: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 61: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 40, // 62: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 32, // 63: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 64: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 28, // 65: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue + 6, // 66: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest + 8, // 67: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest + 9, // 68: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 69: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest + 17, // 70: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest + 9, // 71: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 72: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 73: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest + 20, // 74: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest + 10, // 75: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest + 23, // 76: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest + 10, // 77: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 78: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 79: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest + 24, // 80: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest + 25, // 81: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest + 37, // 82: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest + 39, // 83: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 84: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 85: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest + 7, // 86: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse + 53, // 87: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty + 15, // 88: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 89: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 18, // 90: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse + 53, // 91: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty + 19, // 92: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 93: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 94: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 15, // 95: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 96: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 53, // 97: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty + 19, // 98: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 99: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 100: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 27, // 101: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent + 38, // 102: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse + 15, // 103: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 42, // 104: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse + 43, // 105: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse + 86, // [86:106] is the sub-list for method output_type + 66, // [66:86] is the sub-list for method input_type + 66, // [66:66] is the sub-list for extension type_name + 66, // [66:66] is the sub-list for extension extendee + 0, // [0:66] is the sub-list for field type_name +} + +func init() { file_atmos_plugin_v1_plugin_proto_init() } +func file_atmos_plugin_v1_plugin_proto_init() { + if File_atmos_plugin_v1_plugin_proto != nil { + return + } + file_atmos_plugin_v1_plugin_proto_msgTypes[11].OneofWrappers = []any{ + (*AuthenticateEvent_Progress)(nil), + (*AuthenticateEvent_Interaction)(nil), + (*AuthenticateEvent_Result)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[16].OneofWrappers = []any{ + (*RefreshResponse_Credentials)(nil), + (*RefreshResponse_Unsupported)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[25].OneofWrappers = []any{ + (*CommandEvent_Stdout)(nil), + (*CommandEvent_Stderr)(nil), + (*CommandEvent_Exit)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[28].OneofWrappers = []any{ + (*ComponentValueStep_Attribute)(nil), + (*ComponentValueStep_Index)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc)), - NumEnums: 0, - NumMessages: 32, + NumEnums: 2, + NumMessages: 49, NumExtensions: 0, - NumServices: 4, + NumServices: 8, }, GoTypes: file_atmos_plugin_v1_plugin_proto_goTypes, DependencyIndexes: file_atmos_plugin_v1_plugin_proto_depIdxs, + EnumInfos: file_atmos_plugin_v1_plugin_proto_enumTypes, MessageInfos: file_atmos_plugin_v1_plugin_proto_msgTypes, }.Build() File_atmos_plugin_v1_plugin_proto = out.File diff --git a/pkg/plugin/proto/atmos/plugin/v1/plugin_grpc.pb.go b/pkg/plugin/proto/atmos/plugin/v1/plugin_grpc.pb.go index 106d410e528..bd48e39bb7b 100644 --- a/pkg/plugin/proto/atmos/plugin/v1/plugin_grpc.pb.go +++ b/pkg/plugin/proto/atmos/plugin/v1/plugin_grpc.pb.go @@ -906,3 +906,429 @@ var Commands_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "atmos/plugin/v1/plugin.proto", } + +const ( + ComponentDiscovery_Discover_FullMethodName = "/atmos.plugin.v1.ComponentDiscovery/Discover" +) + +// ComponentDiscoveryClient is the client API for ComponentDiscovery service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ComponentDiscoveryClient interface { + Discover(ctx context.Context, in *DiscoverComponentsRequest, opts ...grpc.CallOption) (*DiscoverComponentsResponse, error) +} + +type componentDiscoveryClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentDiscoveryClient(cc grpc.ClientConnInterface) ComponentDiscoveryClient { + return &componentDiscoveryClient{cc} +} + +func (c *componentDiscoveryClient) Discover(ctx context.Context, in *DiscoverComponentsRequest, opts ...grpc.CallOption) (*DiscoverComponentsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DiscoverComponentsResponse) + err := c.cc.Invoke(ctx, ComponentDiscovery_Discover_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentDiscoveryServer is the server API for ComponentDiscovery service. +// All implementations must embed UnimplementedComponentDiscoveryServer +// for forward compatibility. +type ComponentDiscoveryServer interface { + Discover(context.Context, *DiscoverComponentsRequest) (*DiscoverComponentsResponse, error) + mustEmbedUnimplementedComponentDiscoveryServer() +} + +// UnimplementedComponentDiscoveryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentDiscoveryServer struct{} + +func (UnimplementedComponentDiscoveryServer) Discover(context.Context, *DiscoverComponentsRequest) (*DiscoverComponentsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Discover not implemented") +} +func (UnimplementedComponentDiscoveryServer) mustEmbedUnimplementedComponentDiscoveryServer() {} +func (UnimplementedComponentDiscoveryServer) testEmbeddedByValue() {} + +// UnsafeComponentDiscoveryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentDiscoveryServer will +// result in compilation errors. +type UnsafeComponentDiscoveryServer interface { + mustEmbedUnimplementedComponentDiscoveryServer() +} + +func RegisterComponentDiscoveryServer(s grpc.ServiceRegistrar, srv ComponentDiscoveryServer) { + // If the following call panics, it indicates UnimplementedComponentDiscoveryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentDiscovery_ServiceDesc, srv) +} + +func _ComponentDiscovery_Discover_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoverComponentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentDiscoveryServer).Discover(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentDiscovery_Discover_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentDiscoveryServer).Discover(ctx, req.(*DiscoverComponentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentDiscovery_ServiceDesc is the grpc.ServiceDesc for ComponentDiscovery service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentDiscovery_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentDiscovery", + HandlerType: (*ComponentDiscoveryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Discover", + Handler: _ComponentDiscovery_Discover_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentValidation_Validate_FullMethodName = "/atmos.plugin.v1.ComponentValidation/Validate" +) + +// ComponentValidationClient is the client API for ComponentValidation service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Validation must precede discovery/preparation effects. It cannot silently +// substitute CLI mode for unsupported native semantics. +type ComponentValidationClient interface { + Validate(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ValidateResponse, error) +} + +type componentValidationClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentValidationClient(cc grpc.ClientConnInterface) ComponentValidationClient { + return &componentValidationClient{cc} +} + +func (c *componentValidationClient) Validate(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ValidateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ValidateResponse) + err := c.cc.Invoke(ctx, ComponentValidation_Validate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentValidationServer is the server API for ComponentValidation service. +// All implementations must embed UnimplementedComponentValidationServer +// for forward compatibility. +// +// Validation must precede discovery/preparation effects. It cannot silently +// substitute CLI mode for unsupported native semantics. +type ComponentValidationServer interface { + Validate(context.Context, *ComponentRequest) (*ValidateResponse, error) + mustEmbedUnimplementedComponentValidationServer() +} + +// UnimplementedComponentValidationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentValidationServer struct{} + +func (UnimplementedComponentValidationServer) Validate(context.Context, *ComponentRequest) (*ValidateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Validate not implemented") +} +func (UnimplementedComponentValidationServer) mustEmbedUnimplementedComponentValidationServer() {} +func (UnimplementedComponentValidationServer) testEmbeddedByValue() {} + +// UnsafeComponentValidationServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentValidationServer will +// result in compilation errors. +type UnsafeComponentValidationServer interface { + mustEmbedUnimplementedComponentValidationServer() +} + +func RegisterComponentValidationServer(s grpc.ServiceRegistrar, srv ComponentValidationServer) { + // If the following call panics, it indicates UnimplementedComponentValidationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentValidation_ServiceDesc, srv) +} + +func _ComponentValidation_Validate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentValidationServer).Validate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentValidation_Validate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentValidationServer).Validate(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentValidation_ServiceDesc is the grpc.ServiceDesc for ComponentValidation service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentValidation_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentValidation", + HandlerType: (*ComponentValidationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Validate", + Handler: _ComponentValidation_Validate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentPreparation_Prepare_FullMethodName = "/atmos.plugin.v1.ComponentPreparation/Prepare" +) + +// ComponentPreparationClient is the client API for ComponentPreparation service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Reevaluate immediately before the selected operation, after its dependencies. +// Preparing configuration does not authorize executing infrastructure commands. +type ComponentPreparationClient interface { + Prepare(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*PrepareComponentResponse, error) +} + +type componentPreparationClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentPreparationClient(cc grpc.ClientConnInterface) ComponentPreparationClient { + return &componentPreparationClient{cc} +} + +func (c *componentPreparationClient) Prepare(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*PrepareComponentResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PrepareComponentResponse) + err := c.cc.Invoke(ctx, ComponentPreparation_Prepare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentPreparationServer is the server API for ComponentPreparation service. +// All implementations must embed UnimplementedComponentPreparationServer +// for forward compatibility. +// +// Reevaluate immediately before the selected operation, after its dependencies. +// Preparing configuration does not authorize executing infrastructure commands. +type ComponentPreparationServer interface { + Prepare(context.Context, *ComponentRequest) (*PrepareComponentResponse, error) + mustEmbedUnimplementedComponentPreparationServer() +} + +// UnimplementedComponentPreparationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentPreparationServer struct{} + +func (UnimplementedComponentPreparationServer) Prepare(context.Context, *ComponentRequest) (*PrepareComponentResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Prepare not implemented") +} +func (UnimplementedComponentPreparationServer) mustEmbedUnimplementedComponentPreparationServer() {} +func (UnimplementedComponentPreparationServer) testEmbeddedByValue() {} + +// UnsafeComponentPreparationServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentPreparationServer will +// result in compilation errors. +type UnsafeComponentPreparationServer interface { + mustEmbedUnimplementedComponentPreparationServer() +} + +func RegisterComponentPreparationServer(s grpc.ServiceRegistrar, srv ComponentPreparationServer) { + // If the following call panics, it indicates UnimplementedComponentPreparationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentPreparation_ServiceDesc, srv) +} + +func _ComponentPreparation_Prepare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentPreparationServer).Prepare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentPreparation_Prepare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentPreparationServer).Prepare(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentPreparation_ServiceDesc is the grpc.ServiceDesc for ComponentPreparation service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentPreparation_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentPreparation", + HandlerType: (*ComponentPreparationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Prepare", + Handler: _ComponentPreparation_Prepare_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentState_Resolve_FullMethodName = "/atmos.plugin.v1.ComponentState/Resolve" +) + +// ComponentStateClient is the client API for ComponentState service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Resolve backend identity without preparing a component, running hooks, +// writing generated files, or reading unrelated dependency outputs. +type ComponentStateClient interface { + Resolve(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ResolveComponentStateResponse, error) +} + +type componentStateClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentStateClient(cc grpc.ClientConnInterface) ComponentStateClient { + return &componentStateClient{cc} +} + +func (c *componentStateClient) Resolve(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ResolveComponentStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResolveComponentStateResponse) + err := c.cc.Invoke(ctx, ComponentState_Resolve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentStateServer is the server API for ComponentState service. +// All implementations must embed UnimplementedComponentStateServer +// for forward compatibility. +// +// Resolve backend identity without preparing a component, running hooks, +// writing generated files, or reading unrelated dependency outputs. +type ComponentStateServer interface { + Resolve(context.Context, *ComponentRequest) (*ResolveComponentStateResponse, error) + mustEmbedUnimplementedComponentStateServer() +} + +// UnimplementedComponentStateServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentStateServer struct{} + +func (UnimplementedComponentStateServer) Resolve(context.Context, *ComponentRequest) (*ResolveComponentStateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Resolve not implemented") +} +func (UnimplementedComponentStateServer) mustEmbedUnimplementedComponentStateServer() {} +func (UnimplementedComponentStateServer) testEmbeddedByValue() {} + +// UnsafeComponentStateServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentStateServer will +// result in compilation errors. +type UnsafeComponentStateServer interface { + mustEmbedUnimplementedComponentStateServer() +} + +func RegisterComponentStateServer(s grpc.ServiceRegistrar, srv ComponentStateServer) { + // If the following call panics, it indicates UnimplementedComponentStateServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentState_ServiceDesc, srv) +} + +func _ComponentState_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentStateServer).Resolve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentState_Resolve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentStateServer).Resolve(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentState_ServiceDesc is the grpc.ServiceDesc for ComponentState service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentState_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentState", + HandlerType: (*ComponentStateServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Resolve", + Handler: _ComponentState_Resolve_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} diff --git a/pkg/plugin/runtime/native/component_test.go b/pkg/plugin/runtime/native/component_test.go new file mode 100644 index 00000000000..07b3ecd3d1a --- /dev/null +++ b/pkg/plugin/runtime/native/component_test.go @@ -0,0 +1,157 @@ +package native + +import ( + "context" + "os" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/zclconf/go-cty/cty" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/plugin/bridge" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +// This fixture deliberately supplies no executor. Its component configuration +// services must work independently of the existing command service. +type componentFixture struct { + pluginv1.UnimplementedComponentDiscoveryServer + pluginv1.UnimplementedComponentValidationServer + pluginv1.UnimplementedComponentPreparationServer + pluginv1.UnimplementedComponentStateServer +} + +func registerComponentFixture(server *grpc.Server) { + fixture := &componentFixture{} + pluginv1.RegisterComponentDiscoveryServer(server, fixture) + pluginv1.RegisterComponentValidationServer(server, fixture) + pluginv1.RegisterComponentPreparationServer(server, fixture) + pluginv1.RegisterComponentStateServer(server, fixture) +} + +func (*componentFixture) Discover(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + if request.GetInvocation().GetId() == "" || request.GetEffects().GetCommands() { + return nil, status.Error(codes.InvalidArgument, "discovery requires a scoped, read-only invocation") + } + return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{{ + Address: &pluginv1.ComponentAddress{Stack: "live", Component: "dev/app", ComponentType: "terraform"}, + Provider: request.Provider, Engine: "terraform", Source: "live/dev/app/terragrunt.hcl", + Sources: []*pluginv1.ComponentSource{{Path: "root.hcl", Kind: pluginv1.ComponentSource_FILE}, {Path: "modules/app", Kind: pluginv1.ComponentSource_DIRECTORY}}, + Dependencies: []*pluginv1.ComponentDependency{{Target: &pluginv1.ComponentAddress{Stack: "live", Component: "dev/network", ComponentType: "terraform"}, Kind: pluginv1.ComponentDependency_OUTPUT}}, + }}}, nil +} + +func (*componentFixture) Validate(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ValidateResponse, error) { + if request.GetOperation().GetMode() != "native" { + return &pluginv1.ValidateResponse{Diagnostics: []*pluginv1.Diagnostic{{Field: "operation.mode", Message: "only native mode is supported"}}}, nil + } + return &pluginv1.ValidateResponse{}, nil +} + +func (*componentFixture) Prepare(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + if request.GetOperation().GetCommand() == "wait" { + <-ctx.Done() + return nil, status.FromContextError(ctx.Err()).Err() + } + return &pluginv1.PrepareComponentResponse{ + Engine: "terraform", Inputs: request.Configuration, + Files: []*pluginv1.ComponentGeneratedFile{{Path: "literal.tf", Content: []byte("$${literal}\n%{ literal }\n"), IfExists: "error"}}, + }, nil +} + +func (*componentFixture) Resolve(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + return &pluginv1.ResolveComponentStateResponse{State: &pluginv1.ComponentStateIdentity{BackendType: "local", Workspace: "development", WorkingDirectory: request.RootDirectory}}, nil +} + +func TestComponentServicesAcrossNativeProcess(t *testing.T) { + executable, err := os.Executable() + require.NoError(t, err) + handle, err := Start(t.Context(), executable, WithDirectory(t.TempDir())) + require.NoError(t, err) + defer handle.Close() + root := t.TempDir() + err = handle.Invoke(t.Context(), bridge.Invocation{Namespace: "fixture/components"}, func(ctx context.Context, invocation *pluginv1.Invocation) error { + request := &pluginv1.ComponentRequest{Invocation: invocation, Provider: "fixture/hcl", RootDirectory: root, Operation: &pluginv1.ComponentOperation{Command: "plan", Mode: "native"}} + // State identity is available before discovery or preparation. + state, err := handle.State.Resolve(ctx, request) + require.NoError(t, err) + require.Equal(t, "development", state.State.Workspace) + require.Equal(t, root, state.State.WorkingDirectory) + validation, err := handle.Validation.Validate(ctx, request) + require.NoError(t, err) + require.Empty(t, validation.Diagnostics) + testComponentDiscovery(t, ctx, handle, invocation) + testComponentPreparation(t, ctx, handle, request) + request.Operation.Mode = "unsupported" + validation, err = handle.Validation.Validate(ctx, request) + require.NoError(t, err) + require.Len(t, validation.Diagnostics, 1) + require.Equal(t, "operation.mode", validation.Diagnostics[0].Field) + return nil + }) + require.NoError(t, err) +} + +func testComponentDiscovery(t *testing.T, ctx context.Context, handle *Handle, invocation *pluginv1.Invocation) { + t.Helper() + request := &pluginv1.DiscoverComponentsRequest{Invocation: invocation, Provider: "fixture/hcl", Revision: "base", Effects: &pluginv1.ComponentEffects{}} + result, err := handle.Discovery.Discover(ctx, request) + require.NoError(t, err) + require.Len(t, result.Components, 1) + unit := result.Components[0] + require.Equal(t, "dev/app", unit.Address.Component) + require.Equal(t, "terraform", unit.Address.ComponentType) + require.Len(t, unit.Sources, 2) + require.Equal(t, "root.hcl", unit.Sources[0].Path) + require.Equal(t, pluginv1.ComponentSource_DIRECTORY, unit.Sources[1].Kind) + require.Len(t, unit.Dependencies, 1) + require.Equal(t, "dev/network", unit.Dependencies[0].Target.Component) + require.Equal(t, pluginv1.ComponentDependency_OUTPUT, unit.Dependencies[0].Kind) + request.Effects.Commands = true + _, err = handle.Discovery.Discover(ctx, request) + require.Equal(t, codes.InvalidArgument, status.Code(err)) +} + +func testComponentPreparation(t *testing.T, ctx context.Context, handle *Handle, request *pluginv1.ComponentRequest) { + t.Helper() + value, err := cty.ParseNumberVal("9007199254740993123456789.123456789") + require.NoError(t, err) + typeJSON, err := ctyjson.MarshalType(value.Type()) + require.NoError(t, err) + payload, err := msgpack.Marshal(value, value.Type()) + require.NoError(t, err) + request.Configuration = &pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload, SensitivePaths: []*pluginv1.ComponentValuePath{{}}} + prepared, err := handle.Preparation.Prepare(ctx, request) + require.NoError(t, err) + require.True(t, proto.Equal(request.Configuration, prepared.Inputs)) + require.Len(t, prepared.Files, 1) + require.Equal(t, []byte("$${literal}\n%{ literal }\n"), prepared.Files[0].Content) + require.Equal(t, "error", prepared.Files[0].IfExists) + decoded, err := msgpack.Unmarshal(prepared.Inputs.Msgpack, value.Type()) + require.NoError(t, err) + require.True(t, value.RawEquals(decoded)) +} + +func TestComponentPreparationDeadlineStopsPlugin(t *testing.T) { + executable, err := os.Executable() + require.NoError(t, err) + handle, err := Start(t.Context(), executable, WithDirectory(t.TempDir()), WithCallTimeout(50*time.Millisecond)) + require.NoError(t, err) + defer handle.Close() + err = handle.Invoke(t.Context(), bridge.Invocation{Namespace: "fixture/deadline"}, func(ctx context.Context, invocation *pluginv1.Invocation) error { + _, err := handle.Preparation.Prepare(ctx, &pluginv1.ComponentRequest{Invocation: invocation, Operation: &pluginv1.ComponentOperation{Command: "wait"}}) + return err + }) + require.ErrorIs(t, err, errUtils.ErrPluginTimeout) + require.ErrorIs(t, err, context.DeadlineExceeded) + _, err = handle.State.Resolve(t.Context(), &pluginv1.ComponentRequest{}) + require.Equal(t, codes.Canceled, status.Code(err)) +} diff --git a/pkg/plugin/runtime/native/main_test.go b/pkg/plugin/runtime/native/main_test.go index ecc6ac5e57c..049965eea2a 100644 --- a/pkg/plugin/runtime/native/main_test.go +++ b/pkg/plugin/runtime/native/main_test.go @@ -9,7 +9,7 @@ import ( // TestMain lets the test binary act as the plugin process (see fakeplugin). func TestMain(m *testing.M) { - if fakeplugin.MaybeServe() { + if fakeplugin.MaybeServe(registerComponentFixture) { return } os.Exit(m.Run()) diff --git a/pkg/plugin/runtime/native/native.go b/pkg/plugin/runtime/native/native.go index e2b85721f66..ae54b6483fe 100644 --- a/pkg/plugin/runtime/native/native.go +++ b/pkg/plugin/runtime/native/native.go @@ -61,14 +61,18 @@ func WithAPI(server *bridge.Server) Option { return func(o *options) { o.api = s // Handle owns a native process and its versioned service clients. type Handle struct { - Info pluginv1.InfoClient - Provider pluginv1.AuthProviderClient - Identity pluginv1.AuthIdentityClient - Commands pluginv1.CommandsClient - api *bridge.Server - broker *plugin.GRPCBroker - process *plugin.Client - close sync.Once + Info pluginv1.InfoClient + Provider pluginv1.AuthProviderClient + Identity pluginv1.AuthIdentityClient + Commands pluginv1.CommandsClient + Discovery pluginv1.ComponentDiscoveryClient + Validation pluginv1.ComponentValidationClient + Preparation pluginv1.ComponentPreparationClient + State pluginv1.ComponentStateClient + api *bridge.Server + broker *plugin.GRPCBroker + process *plugin.Client + close sync.Once // command is the plugin process, kept to stop its process group. command *exec.Cmd // interrupt ends on SIGINT or SIGTERM so in-flight calls stop together with the process. @@ -228,5 +232,10 @@ func (*protocol) GRPCServer(*plugin.GRPCBroker, *grpc.Server) error { func (*protocol) GRPCClient(_ context.Context, broker *plugin.GRPCBroker, connection *grpc.ClientConn) (any, error) { defer perf.Track(nil, "native.protocol.GRPCClient")() - return &Handle{Info: pluginv1.NewInfoClient(connection), Provider: pluginv1.NewAuthProviderClient(connection), Identity: pluginv1.NewAuthIdentityClient(connection), Commands: pluginv1.NewCommandsClient(connection), broker: broker}, nil + return &Handle{ + Info: pluginv1.NewInfoClient(connection), Provider: pluginv1.NewAuthProviderClient(connection), + Identity: pluginv1.NewAuthIdentityClient(connection), Commands: pluginv1.NewCommandsClient(connection), + Discovery: pluginv1.NewComponentDiscoveryClient(connection), Validation: pluginv1.NewComponentValidationClient(connection), + Preparation: pluginv1.NewComponentPreparationClient(connection), State: pluginv1.NewComponentStateClient(connection), broker: broker, + }, nil } diff --git a/proto/atmos/plugin/v1/plugin.proto b/proto/atmos/plugin/v1/plugin.proto index 84af224110f..4318b4137e9 100644 --- a/proto/atmos/plugin/v1/plugin.proto +++ b/proto/atmos/plugin/v1/plugin.proto @@ -123,3 +123,154 @@ message CommandEvent { service Commands { rpc Run(CommandRequest) returns (stream CommandEvent); } + +// Component capabilities are independent. A configuration provider need not +// implement an executor or replace the built-in Terraform component provider. +// Negotiate each service through Info using component.discovery, +// component.validation, component.preparation, and component.state respectively. + +// ComponentValue uses cty's JSON type encoding and MessagePack value encoding. +// Unlike protobuf.Struct, it preserves exact numbers, nulls, unknowns, and +// collection types. Marks are removed from MessagePack and carried as paths. +// An empty sensitive path marks the entire value. Never log these payloads. +message ComponentValue { + bytes type_json = 1; + bytes msgpack = 2; + repeated ComponentValuePath sensitive_paths = 3; +} +message ComponentValuePath { repeated ComponentValueStep steps = 1; } +message ComponentValueStep { + oneof selector { + string attribute = 1; + ComponentValue index = 2; + } +} + +// Coordinates are logical identities, independent of generated/cache paths. +// Native HCL adaptation has type terraform and engine terraform or opentofu. +message ComponentAddress { + string stack = 1; + string component = 2; + string component_type = 3; +} + +// Paths are relative to root_directory in the requested revision. A directory +// watch includes additions/deletions; a file list alone cannot represent it. +message ComponentSource { + enum Kind { KIND_UNSPECIFIED = 0; FILE = 1; DIRECTORY = 2; GLOB = 3; } + string path = 1; + Kind kind = 2; + string reason = 3; +} +message ComponentDependency { + enum Kind { KIND_UNSPECIFIED = 0; ORDER = 1; OUTPUT = 2; } + ComponentAddress target = 1; + Kind kind = 2; +} +message DiscoveredComponent { + ComponentAddress address = 1; + string provider = 2; + string engine = 3; + string source = 4; + ComponentValue configuration = 5; + repeated ComponentSource sources = 6; + repeated ComponentDependency dependencies = 7; +} + +// Omission denies effects. The host must enforce the same policy on API calls; +// this declaration is not an operating-system sandbox for trusted plugin code. +message ComponentEffects { + bool commands = 1; + bool network = 2; + bool secrets = 3; + bool writes = 4; + bool state_reads = 5; +} + +// Provider options have already passed host parsing/precedence. Map presence +// distinguishes an unset option from an explicit false, zero, or empty value. +// These are not Terraform argv. The provider validates supported semantics. +message ComponentOperation { + string command = 1; + string mode = 2; + map options = 3; +} +message DiscoverComponentsRequest { + Invocation invocation = 1; + string provider = 2; + string root_directory = 3; + string revision = 4; + repeated string include_paths = 5; + repeated string exclude_paths = 6; + // Explicit imports and automatic discovery share one evaluator. + repeated string imports = 7; + ComponentOperation operation = 8; + ComponentEffects effects = 9; +} +message DiscoverComponentsResponse { + repeated DiscoveredComponent components = 1; + repeated Diagnostic diagnostics = 2; +} +service ComponentDiscovery { + rpc Discover(DiscoverComponentsRequest) returns (DiscoverComponentsResponse); +} + +message ComponentRequest { + Invocation invocation = 1; + string provider = 2; + ComponentAddress address = 3; + string root_directory = 4; + string source = 5; + ComponentOperation operation = 6; + ComponentEffects effects = 7; + ComponentValue configuration = 8; +} +// Validation must precede discovery/preparation effects. It cannot silently +// substitute CLI mode for unsupported native semantics. +service ComponentValidation { + rpc Validate(ComponentRequest) returns (ValidateResponse); +} + +message ComponentStateIdentity { + string backend_type = 1; + ComponentValue backend = 2; + string workspace = 3; + // Relative backend paths are interpreted against this directory. It can be + // different from the directory where Atmos prepares Terraform execution. + string working_directory = 4; +} +message ComponentGeneratedFile { + string path = 1; + bytes content = 2; + // The adapter must reject unknown ownership policies, never overwrite by + // default. Content is evaluated bytes, not another template language. + string if_exists = 3; + bool sensitive = 4; +} +message PrepareComponentResponse { + string engine = 1; + string working_directory = 2; + string module_source = 3; + ComponentValue inputs = 4; + ComponentStateIdentity state = 5; + repeated ComponentGeneratedFile files = 6; + repeated ComponentDependency dependencies = 7; + repeated ComponentSource sources = 8; + repeated Diagnostic diagnostics = 9; +} +// Reevaluate immediately before the selected operation, after its dependencies. +// Preparing configuration does not authorize executing infrastructure commands. +service ComponentPreparation { + rpc Prepare(ComponentRequest) returns (PrepareComponentResponse); +} + +message ResolveComponentStateResponse { + ComponentStateIdentity state = 1; + repeated ComponentSource sources = 2; + repeated Diagnostic diagnostics = 3; +} +// Resolve backend identity without preparing a component, running hooks, +// writing generated files, or reading unrelated dependency outputs. +service ComponentState { + rpc Resolve(ComponentRequest) returns (ResolveComponentStateResponse); +} diff --git a/sdk/component/value.go b/sdk/component/value.go new file mode 100644 index 00000000000..d2a4440e10f --- /dev/null +++ b/sdk/component/value.go @@ -0,0 +1,154 @@ +// Package component supplies lossless values for component configuration services. +package component + +import ( + "errors" + + "github.com/zclconf/go-cty/cty" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +// ErrInvalidValue identifies a value that cannot cross the component boundary. +// Errors deliberately omit payloads, including cty diagnostics containing values. +var ErrInvalidValue = errors.New("invalid component value") + +type valueMark string + +// Sensitive marks a value that must not be rendered without masking. +const Sensitive valueMark = "sensitive" + +// Encode preserves cty types, unknowns, exact numbers, and sensitivity. Other +// marks are rejected rather than silently removing their semantic meaning. +// +//nolint:lintroller // Pure SDK serialization; the standalone SDK cannot import host perf tracking. +func Encode(value cty.Value) (*pluginv1.ComponentValue, error) { + if value == cty.NilVal { + return nil, ErrInvalidValue + } + plain, marks := value.UnmarkDeepWithPaths() + typeJSON, err := ctyjson.MarshalType(plain.Type()) + if err != nil { + return nil, ErrInvalidValue + } + payload, err := msgpack.Marshal(plain, plain.Type()) + if err != nil { + return nil, ErrInvalidValue + } + result := &pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload} + for _, marked := range marks { + if len(marked.Marks) != 1 || !marked.Marks.Equal(cty.NewValueMarks(Sensitive)) { + return nil, ErrInvalidValue + } + path, err := encodePath(marked.Path) + if err != nil { + return nil, err + } + result.SensitivePaths = append(result.SensitivePaths, path) + } + return result, nil +} + +// Decode validates the type, payload, and sensitivity paths before accepting a +// value. Invalid paths must not silently drop sensitivity marks. +// +//nolint:lintroller // Pure SDK validation and decoding; the standalone SDK cannot import host perf tracking. +func Decode(encoded *pluginv1.ComponentValue) (cty.Value, error) { + if encoded == nil { + return cty.NilVal, ErrInvalidValue + } + typeOf, err := ctyjson.UnmarshalType(encoded.TypeJson) + if err != nil { + return cty.NilVal, ErrInvalidValue + } + value, err := msgpack.Unmarshal(encoded.Msgpack, typeOf) + if err != nil { + return cty.NilVal, ErrInvalidValue + } + marks := make([]cty.PathValueMarks, 0, len(encoded.SensitivePaths)) + for _, encodedPath := range encoded.SensitivePaths { + path, err := decodePath(encodedPath) + if err != nil { + return cty.NilVal, err + } + if _, err := path.Apply(value); err != nil { + return cty.NilVal, ErrInvalidValue + } + marks = append(marks, cty.PathValueMarks{Path: path, Marks: cty.NewValueMarks(Sensitive)}) + } + return applyMarks(value, marks) +} + +func applyMarks(value cty.Value, marks []cty.PathValueMarks) (cty.Value, error) { + result := value.MarkWithPaths(marks) + _, applied := result.UnmarkDeepWithPaths() + for _, expected := range marks { + found := false + for _, actual := range applied { + if expected.Equal(actual) { + found = true + break + } + } + if !found { + return cty.NilVal, ErrInvalidValue + } + } + return result, nil +} + +func encodePath(path cty.Path) (*pluginv1.ComponentValuePath, error) { + result := &pluginv1.ComponentValuePath{} + for _, step := range path { + item := &pluginv1.ComponentValueStep{} + switch step := step.(type) { + case cty.GetAttrStep: + item.Selector = &pluginv1.ComponentValueStep_Attribute{Attribute: step.Name} + case cty.IndexStep: + index, err := Encode(step.Key) + if err != nil { + return nil, err + } + item.Selector = &pluginv1.ComponentValueStep_Index{Index: index} + default: + return nil, ErrInvalidValue + } + result.Steps = append(result.Steps, item) + } + return result, nil +} + +func decodePath(encoded *pluginv1.ComponentValuePath) (cty.Path, error) { + if encoded == nil { + return nil, ErrInvalidValue + } + path := cty.Path{} + for _, step := range encoded.Steps { + switch step := step.GetSelector().(type) { + case *pluginv1.ComponentValueStep_Attribute: + path = path.GetAttr(step.Attribute) + case *pluginv1.ComponentValueStep_Index: + index, err := decodeIndex(step.Index) + if err != nil { + return nil, err + } + path = path.Index(index) + default: + return nil, ErrInvalidValue + } + } + return path, nil +} + +func decodeIndex(encoded *pluginv1.ComponentValue) (cty.Value, error) { + if encoded == nil || len(encoded.SensitivePaths) != 0 { + return cty.NilVal, ErrInvalidValue + } + index, err := Decode(encoded) + if err != nil || !index.IsKnown() || index.IsNull() || (!index.Type().Equals(cty.String) && !index.Type().Equals(cty.Number)) { + return cty.NilVal, ErrInvalidValue + } + return index, nil +} diff --git a/sdk/component/value_fuzz_test.go b/sdk/component/value_fuzz_test.go new file mode 100644 index 00000000000..409c9d2ddb7 --- /dev/null +++ b/sdk/component/value_fuzz_test.go @@ -0,0 +1,21 @@ +package component + +import ( + "errors" + "testing" + + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func FuzzDecodeValue(f *testing.F) { + f.Add([]byte(`"string"`), []byte{0xa2, 'o', 'k'}) + f.Add([]byte(`"number"`), []byte{42}) + f.Add([]byte(`"bool"`), []byte{0xc0}) + f.Add([]byte(`[]`), []byte{}) + f.Fuzz(func(t *testing.T, typeJSON, payload []byte) { + _, err := Decode(&pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload}) + if err != nil && (!errors.Is(err, ErrInvalidValue) || err.Error() != ErrInvalidValue.Error()) { + t.Fatal("decoder exposed payload details") + } + }) +} diff --git a/sdk/component/value_test.go b/sdk/component/value_test.go new file mode 100644 index 00000000000..16974ac163f --- /dev/null +++ b/sdk/component/value_test.go @@ -0,0 +1,145 @@ +package component + +import ( + "errors" + "testing" + + "github.com/zclconf/go-cty/cty" + "google.golang.org/protobuf/proto" + + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func TestValuesRoundTripThroughProtobuf(t *testing.T) { + t.Parallel() + large, err := cty.ParseNumberVal("9007199254740993123456789.123456789") + if err != nil { + t.Fatal(err) + } + values := map[string]cty.Value{ + "exact number": large, + "bool": cty.False, + "null": cty.NullVal(cty.String), + "unknown": cty.UnknownVal(cty.Number), + "dynamic unknown": cty.DynamicVal, + "sensitive unknown": cty.UnknownVal(cty.String).Mark(Sensitive), + "sensitive null": cty.NullVal(cty.String).Mark(Sensitive), + "empty list": cty.ListValEmpty(cty.Number), + "empty object": cty.EmptyObjectVal, + "set": cty.SetVal([]cty.Value{cty.StringVal("a"), cty.StringVal("b")}).Mark(Sensitive), + "list": cty.ListVal([]cty.Value{cty.StringVal("public"), cty.StringVal("private").Mark(Sensitive)}), + "map": cty.MapVal(map[string]cty.Value{"key": cty.StringVal("private").Mark(Sensitive)}), + "tuple": cty.TupleVal([]cty.Value{cty.True, large, cty.NullVal(cty.Number)}), + "nested": cty.ObjectVal(map[string]cty.Value{ + "known": large, + "unknown": cty.UnknownVal(cty.List(cty.String)), + "nested": cty.ObjectVal(map[string]cty.Value{"token": cty.StringVal("secret").Mark(Sensitive)}), + }), + } + for name, want := range values { + t.Run(name, func(t *testing.T) { + t.Parallel() + encoded, err := Encode(want) + if err != nil { + t.Fatal(err) + } + wire, err := proto.Marshal(encoded) + if err != nil { + t.Fatal(err) + } + decoded := &pluginv1.ComponentValue{} + if err := proto.Unmarshal(wire, decoded); err != nil { + t.Fatal(err) + } + got, err := Decode(decoded) + if err != nil { + t.Fatal(err) + } + if !got.RawEquals(want) { + t.Fatal("value, type, or sensitivity changed in transport") + } + }) + } +} + +func TestEncodeRejectsUnsupportedValuesAndMarks(t *testing.T) { + t.Parallel() + for _, value := range []cty.Value{ + cty.NilVal, + cty.StringVal("secret").Mark("unsupported"), + cty.StringVal("secret").WithMarks(cty.NewValueMarks(Sensitive, "unsupported")), + } { + _, err := Encode(value) + if !errors.Is(err, ErrInvalidValue) || err.Error() != ErrInvalidValue.Error() { + t.Fatalf("expected a safe error: %v", err) + } + } +} + +func TestDecodeRejectsMalformedPayloadsAndSensitivityPaths(t *testing.T) { + t.Parallel() + valid, err := Encode(cty.ObjectVal(map[string]cty.Value{"token": cty.StringVal("secret")})) + if err != nil { + t.Fatal(err) + } + index, err := Encode(cty.StringVal("token")) + if err != nil { + t.Fatal(err) + } + for name, change := range map[string]func(*pluginv1.ComponentValue){ + "invalid type": func(v *pluginv1.ComponentValue) { v.TypeJson = []byte(`"secret"`) }, + "invalid payload": func(v *pluginv1.ComponentValue) { v.Msgpack = []byte{0xc1} }, + "empty payload": func(v *pluginv1.ComponentValue) { v.Msgpack = nil }, + "nil path": func(v *pluginv1.ComponentValue) { v.SensitivePaths = []*pluginv1.ComponentValuePath{nil} }, + "nil step": func(v *pluginv1.ComponentValue) { + v.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{nil}}} + }, + "missing attribute": func(v *pluginv1.ComponentValue) { + v.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: "absent"}}}}} + }, + "index on object": func(v *pluginv1.ComponentValue) { + v.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{Index: index}}}}} + }, + "nil index": func(v *pluginv1.ComponentValue) { + v.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{}}}}} + }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + v := proto.Clone(valid).(*pluginv1.ComponentValue) + change(v) + _, err := Decode(v) + if !errors.Is(err, ErrInvalidValue) || err.Error() != ErrInvalidValue.Error() { + t.Fatalf("expected a safe error: %v", err) + } + }) + } + if _, err := Decode(nil); !errors.Is(err, ErrInvalidValue) { + t.Fatalf("nil payload accepted: %v", err) + } +} + +func TestDecodeRejectsInvalidIndexValues(t *testing.T) { + t.Parallel() + for _, value := range []cty.Value{cty.True, cty.NullVal(cty.String), cty.UnknownVal(cty.String), cty.StringVal("secret").Mark(Sensitive)} { + encoded, err := Encode(value) + if err != nil { + t.Fatal(err) + } + if _, err := decodeIndex(encoded); !errors.Is(err, ErrInvalidValue) { + t.Fatalf("invalid index accepted: %v", err) + } + } +} + +func TestDecodeCannotDropSensitivityBelowAnUnknownObject(t *testing.T) { + t.Parallel() + encoded, err := Encode(cty.UnknownVal(cty.Object(map[string]cty.Type{"token": cty.String}))) + if err != nil { + t.Fatal(err) + } + encoded.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: "token"}}}}} + if _, err := Decode(encoded); !errors.Is(err, ErrInvalidValue) { + t.Fatalf("unapplied sensitivity mark accepted: %v", err) + } +} diff --git a/sdk/go.mod b/sdk/go.mod index 001cf4642bf..d33704f05f8 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -4,11 +4,13 @@ go 1.26.0 require ( github.com/hashicorp/go-plugin v1.7.0 + github.com/zclconf/go-cty v1.18.1 google.golang.org/grpc v1.83.2 google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af ) require ( + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/fatih/color v1.13.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect @@ -16,6 +18,8 @@ require ( github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/oklog/run v1.1.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect golang.org/x/net v0.58.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.41.0 // indirect diff --git a/sdk/go.sum b/sdk/go.sum index eed4f2fdbe5..5a1989cd659 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,3 +1,5 @@ +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -37,8 +39,15 @@ github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DV github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/zclconf/go-cty v1.18.1 h1:yEGE8M4iIZlyKQURZNb2SnEyZlZHUcBCnx6KF81KuwM= +github.com/zclconf/go-cty v1.18.1/go.mod h1:qpnV6EDNgC1sns/AleL1fvatHw72j+S+nS+MJ+T2CSg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= @@ -72,5 +81,6 @@ google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsok google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/plugin/plugin.go b/sdk/plugin/plugin.go index 4f22a41220c..11c66dc858f 100644 --- a/sdk/plugin/plugin.go +++ b/sdk/plugin/plugin.go @@ -29,9 +29,13 @@ var ( // Services declares the implementations exported by the plugin. type Services struct { - Provider pluginv1.AuthProviderServer - Identity pluginv1.AuthIdentityServer - Commands pluginv1.CommandsServer + Provider pluginv1.AuthProviderServer + Identity pluginv1.AuthIdentityServer + Commands pluginv1.CommandsServer + Discovery pluginv1.ComponentDiscoveryServer + Validation pluginv1.ComponentValidationServer + Preparation pluginv1.ComponentPreparationServer + State pluginv1.ComponentStateServer } // Config supplies static identity and builds handlers sharing one Atmos API connection. @@ -71,9 +75,26 @@ func (p *nativePlugin) GRPCServer(broker *plugin.GRPCBroker, server *grpc.Server if services.Commands != nil { pluginv1.RegisterCommandsServer(server, services.Commands) } + registerComponents(server, &services) return nil } +// Component services are optional; configuration providers do not own execution. +func registerComponents(server *grpc.Server, services *Services) { + if services.Discovery != nil { + pluginv1.RegisterComponentDiscoveryServer(server, services.Discovery) + } + if services.Validation != nil { + pluginv1.RegisterComponentValidationServer(server, services.Validation) + } + if services.Preparation != nil { + pluginv1.RegisterComponentPreparationServer(server, services.Preparation) + } + if services.State != nil { + pluginv1.RegisterComponentStateServer(server, services.State) + } +} + func (*nativePlugin) GRPCClient(context.Context, *plugin.GRPCBroker, *grpc.ClientConn) (any, error) { return nil, errClientUnsupported } diff --git a/sdk/plugin/plugin_test.go b/sdk/plugin/plugin_test.go index 5b27d4c538b..75e65684c27 100644 --- a/sdk/plugin/plugin_test.go +++ b/sdk/plugin/plugin_test.go @@ -34,13 +34,17 @@ func TestNativePluginRegistersDeclaredServices(t *testing.T) { if !enabled { return Services{} } - return Services{Provider: &pluginv1.UnimplementedAuthProviderServer{}, Identity: &pluginv1.UnimplementedAuthIdentityServer{}, Commands: &pluginv1.UnimplementedCommandsServer{}} + return Services{ + Provider: &pluginv1.UnimplementedAuthProviderServer{}, Identity: &pluginv1.UnimplementedAuthIdentityServer{}, Commands: &pluginv1.UnimplementedCommandsServer{}, + Discovery: &pluginv1.UnimplementedComponentDiscoveryServer{}, Validation: &pluginv1.UnimplementedComponentValidationServer{}, + Preparation: &pluginv1.UnimplementedComponentPreparationServer{}, State: &pluginv1.UnimplementedComponentStateServer{}, + } }}} if err := native.GRPCServer(nil, server); err != nil { t.Fatal(err) } services := server.GetServiceInfo() - for _, name := range []string{"atmos.plugin.v1.AuthProvider", "atmos.plugin.v1.AuthIdentity", "atmos.plugin.v1.Commands"} { + for _, name := range []string{"atmos.plugin.v1.AuthProvider", "atmos.plugin.v1.AuthIdentity", "atmos.plugin.v1.Commands", "atmos.plugin.v1.ComponentDiscovery", "atmos.plugin.v1.ComponentValidation", "atmos.plugin.v1.ComponentPreparation", "atmos.plugin.v1.ComponentState"} { if _, exists := services[name]; exists != enabled { t.Fatalf("service %s registration mismatch: %v", name, services) } diff --git a/sdk/proto/atmos/plugin/v1/plugin.pb.go b/sdk/proto/atmos/plugin/v1/plugin.pb.go index f225dbf5a02..7bfc4bd9c3a 100644 --- a/sdk/proto/atmos/plugin/v1/plugin.pb.go +++ b/sdk/proto/atmos/plugin/v1/plugin.pb.go @@ -25,6 +25,107 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ComponentSource_Kind int32 + +const ( + ComponentSource_KIND_UNSPECIFIED ComponentSource_Kind = 0 + ComponentSource_FILE ComponentSource_Kind = 1 + ComponentSource_DIRECTORY ComponentSource_Kind = 2 + ComponentSource_GLOB ComponentSource_Kind = 3 +) + +// Enum value maps for ComponentSource_Kind. +var ( + ComponentSource_Kind_name = map[int32]string{ + 0: "KIND_UNSPECIFIED", + 1: "FILE", + 2: "DIRECTORY", + 3: "GLOB", + } + ComponentSource_Kind_value = map[string]int32{ + "KIND_UNSPECIFIED": 0, + "FILE": 1, + "DIRECTORY": 2, + "GLOB": 3, + } +) + +func (x ComponentSource_Kind) Enum() *ComponentSource_Kind { + p := new(ComponentSource_Kind) + *p = x + return p +} + +func (x ComponentSource_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ComponentSource_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_atmos_plugin_v1_plugin_proto_enumTypes[0].Descriptor() +} + +func (ComponentSource_Kind) Type() protoreflect.EnumType { + return &file_atmos_plugin_v1_plugin_proto_enumTypes[0] +} + +func (x ComponentSource_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ComponentSource_Kind.Descriptor instead. +func (ComponentSource_Kind) EnumDescriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{30, 0} +} + +type ComponentDependency_Kind int32 + +const ( + ComponentDependency_KIND_UNSPECIFIED ComponentDependency_Kind = 0 + ComponentDependency_ORDER ComponentDependency_Kind = 1 + ComponentDependency_OUTPUT ComponentDependency_Kind = 2 +) + +// Enum value maps for ComponentDependency_Kind. +var ( + ComponentDependency_Kind_name = map[int32]string{ + 0: "KIND_UNSPECIFIED", + 1: "ORDER", + 2: "OUTPUT", + } + ComponentDependency_Kind_value = map[string]int32{ + "KIND_UNSPECIFIED": 0, + "ORDER": 1, + "OUTPUT": 2, + } +) + +func (x ComponentDependency_Kind) Enum() *ComponentDependency_Kind { + p := new(ComponentDependency_Kind) + *p = x + return p +} + +func (x ComponentDependency_Kind) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ComponentDependency_Kind) Descriptor() protoreflect.EnumDescriptor { + return file_atmos_plugin_v1_plugin_proto_enumTypes[1].Descriptor() +} + +func (ComponentDependency_Kind) Type() protoreflect.EnumType { + return &file_atmos_plugin_v1_plugin_proto_enumTypes[1] +} + +func (x ComponentDependency_Kind) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ComponentDependency_Kind.Descriptor instead. +func (ComponentDependency_Kind) EnumDescriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{31, 0} +} + // Invocation identifies the live call authorized to use the Atmos API broker. type Invocation struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -1685,326 +1786,1673 @@ func (*CommandEvent_Stderr) isCommandEvent_Event() {} func (*CommandEvent_Exit) isCommandEvent_Event() {} -var File_atmos_plugin_v1_plugin_proto protoreflect.FileDescriptor - -const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + - "\n" + - "\x1catmos/plugin/v1/plugin.proto\x12\x0fatmos.plugin.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa8\x03\n" + - "\n" + - "Invocation\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + - "\aattempt\x18\x02 \x01(\rR\aattempt\x126\n" + - "\bdeadline\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\bdeadline\x12+\n" + - "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\x12N\n" + - "\venvironment\x18\x05 \x03(\v2,.atmos.plugin.v1.Invocation.EnvironmentEntryR\venvironment\x12\x14\n" + - "\x05stack\x18\x06 \x01(\tR\x05stack\x12\x1c\n" + - "\tcomponent\x18\a \x01(\tR\tcomponent\x12%\n" + - "\x0ecomponent_type\x18\b \x01(\tR\rcomponentType\x12 \n" + - "\vinteractive\x18\t \x01(\bR\vinteractive\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb0\x01\n" + - "\vCredentials\x12\x12\n" + - "\x04type\x18\x01 \x01(\tR\x04type\x129\n" + - "\n" + - "expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12+\n" + - "\x04data\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04data\x12%\n" + - "\x0esensitive_keys\x18\x04 \x03(\tR\rsensitiveKeys\"S\n" + - "\x13ServiceVersionRange\x12\x18\n" + - "\aservice\x18\x01 \x01(\tR\aservice\x12\x10\n" + - "\x03min\x18\x02 \x01(\rR\x03min\x12\x10\n" + - "\x03max\x18\x03 \x01(\rR\x03max\"6\n" + - "\x06Export\x12\x18\n" + - "\aservice\x18\x01 \x01(\tR\aservice\x12\x12\n" + - "\x04kind\x18\x02 \x01(\tR\x04kind\"\x83\x01\n" + - "\x0fDescribeRequest\x12#\n" + - "\ratmos_version\x18\x01 \x01(\tR\fatmosVersion\x12K\n" + - "\x0ehost_supported\x18\x02 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\rhostSupported\"\x94\x02\n" + - "\x10DescribeResponse\x12\x1f\n" + - "\vplugin_name\x18\x01 \x01(\tR\n" + - "pluginName\x12%\n" + - "\x0eplugin_version\x18\x02 \x01(\tR\rpluginVersion\x12'\n" + - "\x0fmanifest_digest\x18\x03 \x01(\tR\x0emanifestDigest\x12@\n" + - "\bservices\x18\x04 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\bservices\x121\n" + - "\aexports\x18\x05 \x03(\v2\x17.atmos.plugin.v1.ExportR\aexports\x12\x1a\n" + - "\bfeatures\x18\x06 \x03(\tR\bfeatures\"\xf7\x01\n" + - "\x10ConfigureRequest\x12O\n" + - "\n" + - "broker_ids\x18\x01 \x03(\v20.atmos.plugin.v1.ConfigureRequest.BrokerIdsEntryR\tbrokerIds\x123\n" + - "\bsettings\x18\x02 \x01(\v2\x17.google.protobuf.StructR\bsettings\x12\x1f\n" + - "\vpackage_dir\x18\x03 \x01(\tR\n" + - "packageDir\x1a<\n" + - "\x0eBrokerIdsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\"\xb9\x01\n" + - "\x0fProviderRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + - "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x12\x14\n" + - "\x05realm\x18\x05 \x01(\tR\x05realm\"\xf0\x01\n" + - "\x0fIdentityRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + - "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + - "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x125\n" + - "\tprincipal\x18\x05 \x01(\v2\x17.google.protobuf.StructR\tprincipal\x12\x14\n" + - "\x05realm\x18\x06 \x01(\tR\x05realm\"@\n" + - "\bProgress\x12\x18\n" + - "\amessage\x18\x01 \x01(\tR\amessage\x12\x1a\n" + - "\bfraction\x18\x02 \x01(\x02R\bfraction\"\xb4\x01\n" + - "\vInteraction\x12\x12\n" + - "\x04kind\x18\x01 \x01(\tR\x04kind\x12\x14\n" + - "\x05title\x18\x02 \x01(\tR\x05title\x12@\n" + - "\x06fields\x18\x03 \x03(\v2(.atmos.plugin.v1.Interaction.FieldsEntryR\x06fields\x1a9\n" + - "\vFieldsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xcf\x01\n" + - "\x11AuthenticateEvent\x127\n" + - "\bprogress\x18\x01 \x01(\v2\x19.atmos.plugin.v1.ProgressH\x00R\bprogress\x12@\n" + - "\vinteraction\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.InteractionH\x00R\vinteraction\x126\n" + - "\x06result\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\x06resultB\a\n" + - "\x05event\"<\n" + - "\n" + - "Diagnostic\x12\x14\n" + - "\x05field\x18\x01 \x01(\tR\x05field\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage\"Q\n" + - "\x10ValidateResponse\x12=\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"C\n" + - "\vUnsupported\x12\x1c\n" + - "\toperation\x18\x01 \x01(\tR\toperation\x12\x16\n" + - "\x06reason\x18\x02 \x01(\tR\x06reason\"\x86\x01\n" + - "\x0eRefreshRequest\x12<\n" + - "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x126\n" + - "\acurrent\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\acurrent\"\x9f\x01\n" + - "\x0fRefreshResponse\x12@\n" + - "\vcredentials\x18\x01 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\vcredentials\x12@\n" + - "\vunsupported\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.UnsupportedH\x00R\vunsupportedB\b\n" + - "\x06result\"\xae\x01\n" + - "\x13EnvironmentResponse\x12W\n" + - "\venvironment\x18\x01 \x03(\v25.atmos.plugin.v1.EnvironmentResponse.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xf8\x01\n" + - "\x19PrepareEnvironmentRequest\x12<\n" + - "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x12]\n" + - "\venvironment\x18\x02 \x03(\v2;.atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"v\n" + - "\x0eCredentialPath\x12\x1a\n" + - "\blocation\x18\x01 \x01(\tR\blocation\x12\x12\n" + - "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + - "\brequired\x18\x03 \x01(\bR\brequired\x12\x18\n" + - "\apurpose\x18\x04 \x01(\tR\apurpose\"F\n" + - "\rPathsResponse\x125\n" + - "\x05paths\x18\x01 \x03(\v2\x1f.atmos.plugin.v1.CredentialPathR\x05paths\"\x95\x01\n" + - "\x1bIdentityAuthenticateRequest\x12<\n" + - "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x128\n" + - "\bupstream\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\bupstream\"\xf2\x01\n" + - "\x16IdentityPrepareRequest\x12<\n" + - "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x12Z\n" + - "\venvironment\x18\x02 \x03(\v28.atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntryR\venvironment\x1a>\n" + - "\x10EnvironmentEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb4\x01\n" + - "\x0eCommandRequest\x12;\n" + - "\n" + - "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + - "invocation\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + - "\targuments\x18\x03 \x03(\tR\targuments\x123\n" + - "\bsettings\x18\x04 \x01(\v2\x17.google.protobuf.StructR\bsettings\"!\n" + - "\vCommandExit\x12\x12\n" + - "\x04code\x18\x01 \x01(\rR\x04code\"\x7f\n" + - "\fCommandEvent\x12\x18\n" + - "\x06stdout\x18\x01 \x01(\fH\x00R\x06stdout\x12\x18\n" + - "\x06stderr\x18\x02 \x01(\fH\x00R\x06stderr\x122\n" + - "\x04exit\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CommandExitH\x00R\x04exitB\a\n" + - "\x05event2\x9f\x01\n" + - "\x04Info\x12O\n" + - "\bDescribe\x12 .atmos.plugin.v1.DescribeRequest\x1a!.atmos.plugin.v1.DescribeResponse\x12F\n" + - "\tConfigure\x12!.atmos.plugin.v1.ConfigureRequest\x1a\x16.google.protobuf.Empty2\xd3\x04\n" + - "\fAuthProvider\x12O\n" + - "\bValidate\x12 .atmos.plugin.v1.ProviderRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12V\n" + - "\fAuthenticate\x12 .atmos.plugin.v1.ProviderRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12L\n" + - "\aRefresh\x12\x1f.atmos.plugin.v1.RefreshRequest\x1a .atmos.plugin.v1.RefreshResponse\x12B\n" + - "\x06Logout\x12 .atmos.plugin.v1.ProviderRequest\x1a\x16.google.protobuf.Empty\x12U\n" + - "\vEnvironment\x12 .atmos.plugin.v1.ProviderRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + - "\x05Paths\x12 .atmos.plugin.v1.ProviderRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12f\n" + - "\x12PrepareEnvironment\x12*.atmos.plugin.v1.PrepareEnvironmentRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2\x8e\x04\n" + - "\fAuthIdentity\x12O\n" + - "\bValidate\x12 .atmos.plugin.v1.IdentityRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12b\n" + - "\fAuthenticate\x12,.atmos.plugin.v1.IdentityAuthenticateRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12B\n" + - "\x06Logout\x12 .atmos.plugin.v1.IdentityRequest\x1a\x16.google.protobuf.Empty\x12U\n" + - "\vEnvironment\x12 .atmos.plugin.v1.IdentityRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + - "\x05Paths\x12 .atmos.plugin.v1.IdentityRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12c\n" + - "\x12PrepareEnvironment\x12'.atmos.plugin.v1.IdentityPrepareRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2S\n" + - "\bCommands\x12G\n" + - "\x03Run\x12\x1f.atmos.plugin.v1.CommandRequest\x1a\x1d.atmos.plugin.v1.CommandEvent0\x01B@Z>github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1;pluginv1b\x06proto3" +// ComponentValue uses cty's JSON type encoding and MessagePack value encoding. +// Unlike protobuf.Struct, it preserves exact numbers, nulls, unknowns, and +// collection types. Marks are removed from MessagePack and carried as paths. +// An empty sensitive path marks the entire value. Never log these payloads. +type ComponentValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeJson []byte `protobuf:"bytes,1,opt,name=type_json,json=typeJson,proto3" json:"type_json,omitempty"` + Msgpack []byte `protobuf:"bytes,2,opt,name=msgpack,proto3" json:"msgpack,omitempty"` + SensitivePaths []*ComponentValuePath `protobuf:"bytes,3,rep,name=sensitive_paths,json=sensitivePaths,proto3" json:"sensitive_paths,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -var ( - file_atmos_plugin_v1_plugin_proto_rawDescOnce sync.Once - file_atmos_plugin_v1_plugin_proto_rawDescData []byte -) +func (x *ComponentValue) Reset() { + *x = ComponentValue{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -func file_atmos_plugin_v1_plugin_proto_rawDescGZIP() []byte { - file_atmos_plugin_v1_plugin_proto_rawDescOnce.Do(func() { - file_atmos_plugin_v1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc))) - }) - return file_atmos_plugin_v1_plugin_proto_rawDescData +func (x *ComponentValue) String() string { + return protoimpl.X.MessageStringOf(x) } -var ( - file_atmos_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 32) - file_atmos_plugin_v1_plugin_proto_goTypes = []any{ - (*Invocation)(nil), // 0: atmos.plugin.v1.Invocation - (*Credentials)(nil), // 1: atmos.plugin.v1.Credentials - (*ServiceVersionRange)(nil), // 2: atmos.plugin.v1.ServiceVersionRange - (*Export)(nil), // 3: atmos.plugin.v1.Export - (*DescribeRequest)(nil), // 4: atmos.plugin.v1.DescribeRequest - (*DescribeResponse)(nil), // 5: atmos.plugin.v1.DescribeResponse - (*ConfigureRequest)(nil), // 6: atmos.plugin.v1.ConfigureRequest - (*ProviderRequest)(nil), // 7: atmos.plugin.v1.ProviderRequest - (*IdentityRequest)(nil), // 8: atmos.plugin.v1.IdentityRequest - (*Progress)(nil), // 9: atmos.plugin.v1.Progress - (*Interaction)(nil), // 10: atmos.plugin.v1.Interaction - (*AuthenticateEvent)(nil), // 11: atmos.plugin.v1.AuthenticateEvent - (*Diagnostic)(nil), // 12: atmos.plugin.v1.Diagnostic - (*ValidateResponse)(nil), // 13: atmos.plugin.v1.ValidateResponse - (*Unsupported)(nil), // 14: atmos.plugin.v1.Unsupported - (*RefreshRequest)(nil), // 15: atmos.plugin.v1.RefreshRequest - (*RefreshResponse)(nil), // 16: atmos.plugin.v1.RefreshResponse - (*EnvironmentResponse)(nil), // 17: atmos.plugin.v1.EnvironmentResponse - (*PrepareEnvironmentRequest)(nil), // 18: atmos.plugin.v1.PrepareEnvironmentRequest - (*CredentialPath)(nil), // 19: atmos.plugin.v1.CredentialPath - (*PathsResponse)(nil), // 20: atmos.plugin.v1.PathsResponse - (*IdentityAuthenticateRequest)(nil), // 21: atmos.plugin.v1.IdentityAuthenticateRequest - (*IdentityPrepareRequest)(nil), // 22: atmos.plugin.v1.IdentityPrepareRequest - (*CommandRequest)(nil), // 23: atmos.plugin.v1.CommandRequest - (*CommandExit)(nil), // 24: atmos.plugin.v1.CommandExit - (*CommandEvent)(nil), // 25: atmos.plugin.v1.CommandEvent - nil, // 26: atmos.plugin.v1.Invocation.EnvironmentEntry - nil, // 27: atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry - nil, // 28: atmos.plugin.v1.Interaction.FieldsEntry - nil, // 29: atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry - nil, // 30: atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry - nil, // 31: atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry - (*timestamppb.Timestamp)(nil), // 32: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 33: google.protobuf.Struct - (*emptypb.Empty)(nil), // 34: google.protobuf.Empty +func (*ComponentValue) ProtoMessage() {} + +func (x *ComponentValue) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } -) + return mi.MessageOf(x) +} -var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ - 32, // 0: atmos.plugin.v1.Invocation.deadline:type_name -> google.protobuf.Timestamp - 26, // 1: atmos.plugin.v1.Invocation.environment:type_name -> atmos.plugin.v1.Invocation.EnvironmentEntry - 32, // 2: atmos.plugin.v1.Credentials.expires_at:type_name -> google.protobuf.Timestamp - 33, // 3: atmos.plugin.v1.Credentials.data:type_name -> google.protobuf.Struct - 2, // 4: atmos.plugin.v1.DescribeRequest.host_supported:type_name -> atmos.plugin.v1.ServiceVersionRange - 2, // 5: atmos.plugin.v1.DescribeResponse.services:type_name -> atmos.plugin.v1.ServiceVersionRange - 3, // 6: atmos.plugin.v1.DescribeResponse.exports:type_name -> atmos.plugin.v1.Export - 27, // 7: atmos.plugin.v1.ConfigureRequest.broker_ids:type_name -> atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry - 33, // 8: atmos.plugin.v1.ConfigureRequest.settings:type_name -> google.protobuf.Struct - 0, // 9: atmos.plugin.v1.ProviderRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 10: atmos.plugin.v1.ProviderRequest.spec:type_name -> google.protobuf.Struct - 0, // 11: atmos.plugin.v1.IdentityRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 12: atmos.plugin.v1.IdentityRequest.spec:type_name -> google.protobuf.Struct - 33, // 13: atmos.plugin.v1.IdentityRequest.principal:type_name -> google.protobuf.Struct - 28, // 14: atmos.plugin.v1.Interaction.fields:type_name -> atmos.plugin.v1.Interaction.FieldsEntry - 9, // 15: atmos.plugin.v1.AuthenticateEvent.progress:type_name -> atmos.plugin.v1.Progress - 10, // 16: atmos.plugin.v1.AuthenticateEvent.interaction:type_name -> atmos.plugin.v1.Interaction - 1, // 17: atmos.plugin.v1.AuthenticateEvent.result:type_name -> atmos.plugin.v1.Credentials - 12, // 18: atmos.plugin.v1.ValidateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 7, // 19: atmos.plugin.v1.RefreshRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest - 1, // 20: atmos.plugin.v1.RefreshRequest.current:type_name -> atmos.plugin.v1.Credentials - 1, // 21: atmos.plugin.v1.RefreshResponse.credentials:type_name -> atmos.plugin.v1.Credentials - 14, // 22: atmos.plugin.v1.RefreshResponse.unsupported:type_name -> atmos.plugin.v1.Unsupported - 29, // 23: atmos.plugin.v1.EnvironmentResponse.environment:type_name -> atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry - 7, // 24: atmos.plugin.v1.PrepareEnvironmentRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest - 30, // 25: atmos.plugin.v1.PrepareEnvironmentRequest.environment:type_name -> atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry - 19, // 26: atmos.plugin.v1.PathsResponse.paths:type_name -> atmos.plugin.v1.CredentialPath - 8, // 27: atmos.plugin.v1.IdentityAuthenticateRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest - 1, // 28: atmos.plugin.v1.IdentityAuthenticateRequest.upstream:type_name -> atmos.plugin.v1.Credentials - 8, // 29: atmos.plugin.v1.IdentityPrepareRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest - 31, // 30: atmos.plugin.v1.IdentityPrepareRequest.environment:type_name -> atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry - 0, // 31: atmos.plugin.v1.CommandRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 33, // 32: atmos.plugin.v1.CommandRequest.settings:type_name -> google.protobuf.Struct - 24, // 33: atmos.plugin.v1.CommandEvent.exit:type_name -> atmos.plugin.v1.CommandExit - 4, // 34: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest - 6, // 35: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest - 7, // 36: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 37: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest - 15, // 38: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest - 7, // 39: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 40: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest - 7, // 41: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest - 18, // 42: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest - 8, // 43: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest - 21, // 44: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest - 8, // 45: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest - 8, // 46: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest - 8, // 47: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest - 22, // 48: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest - 23, // 49: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest - 5, // 50: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse - 34, // 51: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty - 13, // 52: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 11, // 53: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 16, // 54: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse - 34, // 55: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty - 17, // 56: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 20, // 57: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse - 17, // 58: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 13, // 59: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 11, // 60: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 34, // 61: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty - 17, // 62: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 20, // 63: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse - 17, // 64: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 25, // 65: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent - 50, // [50:66] is the sub-list for method output_type - 34, // [34:50] is the sub-list for method input_type - 34, // [34:34] is the sub-list for extension type_name - 34, // [34:34] is the sub-list for extension extendee - 0, // [0:34] is the sub-list for field type_name +// Deprecated: Use ComponentValue.ProtoReflect.Descriptor instead. +func (*ComponentValue) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{26} } -func init() { file_atmos_plugin_v1_plugin_proto_init() } -func file_atmos_plugin_v1_plugin_proto_init() { - if File_atmos_plugin_v1_plugin_proto != nil { - return +func (x *ComponentValue) GetTypeJson() []byte { + if x != nil { + return x.TypeJson } - file_atmos_plugin_v1_plugin_proto_msgTypes[11].OneofWrappers = []any{ - (*AuthenticateEvent_Progress)(nil), - (*AuthenticateEvent_Interaction)(nil), - (*AuthenticateEvent_Result)(nil), + return nil +} + +func (x *ComponentValue) GetMsgpack() []byte { + if x != nil { + return x.Msgpack } - file_atmos_plugin_v1_plugin_proto_msgTypes[16].OneofWrappers = []any{ - (*RefreshResponse_Credentials)(nil), - (*RefreshResponse_Unsupported)(nil), + return nil +} + +func (x *ComponentValue) GetSensitivePaths() []*ComponentValuePath { + if x != nil { + return x.SensitivePaths } - file_atmos_plugin_v1_plugin_proto_msgTypes[25].OneofWrappers = []any{ - (*CommandEvent_Stdout)(nil), - (*CommandEvent_Stderr)(nil), - (*CommandEvent_Exit)(nil), + return nil +} + +type ComponentValuePath struct { + state protoimpl.MessageState `protogen:"open.v1"` + Steps []*ComponentValueStep `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentValuePath) Reset() { + *x = ComponentValuePath{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentValuePath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentValuePath) ProtoMessage() {} + +func (x *ComponentValuePath) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentValuePath.ProtoReflect.Descriptor instead. +func (*ComponentValuePath) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{27} +} + +func (x *ComponentValuePath) GetSteps() []*ComponentValueStep { + if x != nil { + return x.Steps + } + return nil +} + +type ComponentValueStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Selector: + // + // *ComponentValueStep_Attribute + // *ComponentValueStep_Index + Selector isComponentValueStep_Selector `protobuf_oneof:"selector"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentValueStep) Reset() { + *x = ComponentValueStep{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentValueStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentValueStep) ProtoMessage() {} + +func (x *ComponentValueStep) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentValueStep.ProtoReflect.Descriptor instead. +func (*ComponentValueStep) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{28} +} + +func (x *ComponentValueStep) GetSelector() isComponentValueStep_Selector { + if x != nil { + return x.Selector + } + return nil +} + +func (x *ComponentValueStep) GetAttribute() string { + if x != nil { + if x, ok := x.Selector.(*ComponentValueStep_Attribute); ok { + return x.Attribute + } + } + return "" +} + +func (x *ComponentValueStep) GetIndex() *ComponentValue { + if x != nil { + if x, ok := x.Selector.(*ComponentValueStep_Index); ok { + return x.Index + } + } + return nil +} + +type isComponentValueStep_Selector interface { + isComponentValueStep_Selector() +} + +type ComponentValueStep_Attribute struct { + Attribute string `protobuf:"bytes,1,opt,name=attribute,proto3,oneof"` +} + +type ComponentValueStep_Index struct { + Index *ComponentValue `protobuf:"bytes,2,opt,name=index,proto3,oneof"` +} + +func (*ComponentValueStep_Attribute) isComponentValueStep_Selector() {} + +func (*ComponentValueStep_Index) isComponentValueStep_Selector() {} + +// Coordinates are logical identities, independent of generated/cache paths. +// Native HCL adaptation has type terraform and engine terraform or opentofu. +type ComponentAddress struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stack string `protobuf:"bytes,1,opt,name=stack,proto3" json:"stack,omitempty"` + Component string `protobuf:"bytes,2,opt,name=component,proto3" json:"component,omitempty"` + ComponentType string `protobuf:"bytes,3,opt,name=component_type,json=componentType,proto3" json:"component_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentAddress) Reset() { + *x = ComponentAddress{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentAddress) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentAddress) ProtoMessage() {} + +func (x *ComponentAddress) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentAddress.ProtoReflect.Descriptor instead. +func (*ComponentAddress) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{29} +} + +func (x *ComponentAddress) GetStack() string { + if x != nil { + return x.Stack + } + return "" +} + +func (x *ComponentAddress) GetComponent() string { + if x != nil { + return x.Component + } + return "" +} + +func (x *ComponentAddress) GetComponentType() string { + if x != nil { + return x.ComponentType + } + return "" +} + +// Paths are relative to root_directory in the requested revision. A directory +// watch includes additions/deletions; a file list alone cannot represent it. +type ComponentSource struct { + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Kind ComponentSource_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=atmos.plugin.v1.ComponentSource_Kind" json:"kind,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentSource) Reset() { + *x = ComponentSource{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentSource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentSource) ProtoMessage() {} + +func (x *ComponentSource) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentSource.ProtoReflect.Descriptor instead. +func (*ComponentSource) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{30} +} + +func (x *ComponentSource) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ComponentSource) GetKind() ComponentSource_Kind { + if x != nil { + return x.Kind + } + return ComponentSource_KIND_UNSPECIFIED +} + +func (x *ComponentSource) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type ComponentDependency struct { + state protoimpl.MessageState `protogen:"open.v1"` + Target *ComponentAddress `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Kind ComponentDependency_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=atmos.plugin.v1.ComponentDependency_Kind" json:"kind,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentDependency) Reset() { + *x = ComponentDependency{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentDependency) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentDependency) ProtoMessage() {} + +func (x *ComponentDependency) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentDependency.ProtoReflect.Descriptor instead. +func (*ComponentDependency) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{31} +} + +func (x *ComponentDependency) GetTarget() *ComponentAddress { + if x != nil { + return x.Target + } + return nil +} + +func (x *ComponentDependency) GetKind() ComponentDependency_Kind { + if x != nil { + return x.Kind + } + return ComponentDependency_KIND_UNSPECIFIED +} + +type DiscoveredComponent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Address *ComponentAddress `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Engine string `protobuf:"bytes,3,opt,name=engine,proto3" json:"engine,omitempty"` + Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,5,opt,name=configuration,proto3" json:"configuration,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,6,rep,name=sources,proto3" json:"sources,omitempty"` + Dependencies []*ComponentDependency `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoveredComponent) Reset() { + *x = DiscoveredComponent{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoveredComponent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoveredComponent) ProtoMessage() {} + +func (x *DiscoveredComponent) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoveredComponent.ProtoReflect.Descriptor instead. +func (*DiscoveredComponent) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{32} +} + +func (x *DiscoveredComponent) GetAddress() *ComponentAddress { + if x != nil { + return x.Address + } + return nil +} + +func (x *DiscoveredComponent) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *DiscoveredComponent) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *DiscoveredComponent) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *DiscoveredComponent) GetConfiguration() *ComponentValue { + if x != nil { + return x.Configuration + } + return nil +} + +func (x *DiscoveredComponent) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *DiscoveredComponent) GetDependencies() []*ComponentDependency { + if x != nil { + return x.Dependencies + } + return nil +} + +// Omission denies effects. The host must enforce the same policy on API calls; +// this declaration is not an operating-system sandbox for trusted plugin code. +type ComponentEffects struct { + state protoimpl.MessageState `protogen:"open.v1"` + Commands bool `protobuf:"varint,1,opt,name=commands,proto3" json:"commands,omitempty"` + Network bool `protobuf:"varint,2,opt,name=network,proto3" json:"network,omitempty"` + Secrets bool `protobuf:"varint,3,opt,name=secrets,proto3" json:"secrets,omitempty"` + Writes bool `protobuf:"varint,4,opt,name=writes,proto3" json:"writes,omitempty"` + StateReads bool `protobuf:"varint,5,opt,name=state_reads,json=stateReads,proto3" json:"state_reads,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentEffects) Reset() { + *x = ComponentEffects{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentEffects) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentEffects) ProtoMessage() {} + +func (x *ComponentEffects) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentEffects.ProtoReflect.Descriptor instead. +func (*ComponentEffects) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{33} +} + +func (x *ComponentEffects) GetCommands() bool { + if x != nil { + return x.Commands + } + return false +} + +func (x *ComponentEffects) GetNetwork() bool { + if x != nil { + return x.Network + } + return false +} + +func (x *ComponentEffects) GetSecrets() bool { + if x != nil { + return x.Secrets + } + return false +} + +func (x *ComponentEffects) GetWrites() bool { + if x != nil { + return x.Writes + } + return false +} + +func (x *ComponentEffects) GetStateReads() bool { + if x != nil { + return x.StateReads + } + return false +} + +// Provider options have already passed host parsing/precedence. Map presence +// distinguishes an unset option from an explicit false, zero, or empty value. +// These are not Terraform argv. The provider validates supported semantics. +type ComponentOperation struct { + state protoimpl.MessageState `protogen:"open.v1"` + Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"` + Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` + Options map[string]*ComponentValue `protobuf:"bytes,3,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentOperation) Reset() { + *x = ComponentOperation{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentOperation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentOperation) ProtoMessage() {} + +func (x *ComponentOperation) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentOperation.ProtoReflect.Descriptor instead. +func (*ComponentOperation) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{34} +} + +func (x *ComponentOperation) GetCommand() string { + if x != nil { + return x.Command + } + return "" +} + +func (x *ComponentOperation) GetMode() string { + if x != nil { + return x.Mode + } + return "" +} + +func (x *ComponentOperation) GetOptions() map[string]*ComponentValue { + if x != nil { + return x.Options + } + return nil +} + +type DiscoverComponentsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + RootDirectory string `protobuf:"bytes,3,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Revision string `protobuf:"bytes,4,opt,name=revision,proto3" json:"revision,omitempty"` + IncludePaths []string `protobuf:"bytes,5,rep,name=include_paths,json=includePaths,proto3" json:"include_paths,omitempty"` + ExcludePaths []string `protobuf:"bytes,6,rep,name=exclude_paths,json=excludePaths,proto3" json:"exclude_paths,omitempty"` + // Explicit imports and automatic discovery share one evaluator. + Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoverComponentsRequest) Reset() { + *x = DiscoverComponentsRequest{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoverComponentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoverComponentsRequest) ProtoMessage() {} + +func (x *DiscoverComponentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoverComponentsRequest.ProtoReflect.Descriptor instead. +func (*DiscoverComponentsRequest) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{35} +} + +func (x *DiscoverComponentsRequest) GetInvocation() *Invocation { + if x != nil { + return x.Invocation + } + return nil +} + +func (x *DiscoverComponentsRequest) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *DiscoverComponentsRequest) GetRootDirectory() string { + if x != nil { + return x.RootDirectory + } + return "" +} + +func (x *DiscoverComponentsRequest) GetRevision() string { + if x != nil { + return x.Revision + } + return "" +} + +func (x *DiscoverComponentsRequest) GetIncludePaths() []string { + if x != nil { + return x.IncludePaths + } + return nil +} + +func (x *DiscoverComponentsRequest) GetExcludePaths() []string { + if x != nil { + return x.ExcludePaths + } + return nil +} + +func (x *DiscoverComponentsRequest) GetImports() []string { + if x != nil { + return x.Imports + } + return nil +} + +func (x *DiscoverComponentsRequest) GetOperation() *ComponentOperation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *DiscoverComponentsRequest) GetEffects() *ComponentEffects { + if x != nil { + return x.Effects + } + return nil +} + +type DiscoverComponentsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Components []*DiscoveredComponent `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DiscoverComponentsResponse) Reset() { + *x = DiscoverComponentsResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DiscoverComponentsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DiscoverComponentsResponse) ProtoMessage() {} + +func (x *DiscoverComponentsResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DiscoverComponentsResponse.ProtoReflect.Descriptor instead. +func (*DiscoverComponentsResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{36} +} + +func (x *DiscoverComponentsResponse) GetComponents() []*DiscoveredComponent { + if x != nil { + return x.Components + } + return nil +} + +func (x *DiscoverComponentsResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ComponentRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentRequest) Reset() { + *x = ComponentRequest{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentRequest) ProtoMessage() {} + +func (x *ComponentRequest) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentRequest.ProtoReflect.Descriptor instead. +func (*ComponentRequest) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{37} +} + +func (x *ComponentRequest) GetInvocation() *Invocation { + if x != nil { + return x.Invocation + } + return nil +} + +func (x *ComponentRequest) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *ComponentRequest) GetAddress() *ComponentAddress { + if x != nil { + return x.Address + } + return nil +} + +func (x *ComponentRequest) GetRootDirectory() string { + if x != nil { + return x.RootDirectory + } + return "" +} + +func (x *ComponentRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *ComponentRequest) GetOperation() *ComponentOperation { + if x != nil { + return x.Operation + } + return nil +} + +func (x *ComponentRequest) GetEffects() *ComponentEffects { + if x != nil { + return x.Effects + } + return nil +} + +func (x *ComponentRequest) GetConfiguration() *ComponentValue { + if x != nil { + return x.Configuration + } + return nil +} + +type ComponentStateIdentity struct { + state protoimpl.MessageState `protogen:"open.v1"` + BackendType string `protobuf:"bytes,1,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` + Backend *ComponentValue `protobuf:"bytes,2,opt,name=backend,proto3" json:"backend,omitempty"` + Workspace string `protobuf:"bytes,3,opt,name=workspace,proto3" json:"workspace,omitempty"` + // Relative backend paths are interpreted against this directory. It can be + // different from the directory where Atmos prepares Terraform execution. + WorkingDirectory string `protobuf:"bytes,4,opt,name=working_directory,json=workingDirectory,proto3" json:"working_directory,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentStateIdentity) Reset() { + *x = ComponentStateIdentity{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentStateIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentStateIdentity) ProtoMessage() {} + +func (x *ComponentStateIdentity) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentStateIdentity.ProtoReflect.Descriptor instead. +func (*ComponentStateIdentity) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{38} +} + +func (x *ComponentStateIdentity) GetBackendType() string { + if x != nil { + return x.BackendType + } + return "" +} + +func (x *ComponentStateIdentity) GetBackend() *ComponentValue { + if x != nil { + return x.Backend + } + return nil +} + +func (x *ComponentStateIdentity) GetWorkspace() string { + if x != nil { + return x.Workspace + } + return "" +} + +func (x *ComponentStateIdentity) GetWorkingDirectory() string { + if x != nil { + return x.WorkingDirectory + } + return "" +} + +type ComponentGeneratedFile struct { + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + // The adapter must reject unknown ownership policies, never overwrite by + // default. Content is evaluated bytes, not another template language. + IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` + Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComponentGeneratedFile) Reset() { + *x = ComponentGeneratedFile{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComponentGeneratedFile) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComponentGeneratedFile) ProtoMessage() {} + +func (x *ComponentGeneratedFile) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComponentGeneratedFile.ProtoReflect.Descriptor instead. +func (*ComponentGeneratedFile) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{39} +} + +func (x *ComponentGeneratedFile) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ComponentGeneratedFile) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *ComponentGeneratedFile) GetIfExists() string { + if x != nil { + return x.IfExists + } + return "" +} + +func (x *ComponentGeneratedFile) GetSensitive() bool { + if x != nil { + return x.Sensitive + } + return false +} + +type PrepareComponentResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Engine string `protobuf:"bytes,1,opt,name=engine,proto3" json:"engine,omitempty"` + WorkingDirectory string `protobuf:"bytes,2,opt,name=working_directory,json=workingDirectory,proto3" json:"working_directory,omitempty"` + ModuleSource string `protobuf:"bytes,3,opt,name=module_source,json=moduleSource,proto3" json:"module_source,omitempty"` + Inputs *ComponentValue `protobuf:"bytes,4,opt,name=inputs,proto3" json:"inputs,omitempty"` + State *ComponentStateIdentity `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` + Files []*ComponentGeneratedFile `protobuf:"bytes,6,rep,name=files,proto3" json:"files,omitempty"` + Dependencies []*ComponentDependency `protobuf:"bytes,7,rep,name=dependencies,proto3" json:"dependencies,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,8,rep,name=sources,proto3" json:"sources,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,9,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PrepareComponentResponse) Reset() { + *x = PrepareComponentResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PrepareComponentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrepareComponentResponse) ProtoMessage() {} + +func (x *PrepareComponentResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrepareComponentResponse.ProtoReflect.Descriptor instead. +func (*PrepareComponentResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{40} +} + +func (x *PrepareComponentResponse) GetEngine() string { + if x != nil { + return x.Engine + } + return "" +} + +func (x *PrepareComponentResponse) GetWorkingDirectory() string { + if x != nil { + return x.WorkingDirectory + } + return "" +} + +func (x *PrepareComponentResponse) GetModuleSource() string { + if x != nil { + return x.ModuleSource + } + return "" +} + +func (x *PrepareComponentResponse) GetInputs() *ComponentValue { + if x != nil { + return x.Inputs + } + return nil +} + +func (x *PrepareComponentResponse) GetState() *ComponentStateIdentity { + if x != nil { + return x.State + } + return nil +} + +func (x *PrepareComponentResponse) GetFiles() []*ComponentGeneratedFile { + if x != nil { + return x.Files + } + return nil +} + +func (x *PrepareComponentResponse) GetDependencies() []*ComponentDependency { + if x != nil { + return x.Dependencies + } + return nil +} + +func (x *PrepareComponentResponse) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *PrepareComponentResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ResolveComponentStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + State *ComponentStateIdentity `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` + Sources []*ComponentSource `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,3,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResolveComponentStateResponse) Reset() { + *x = ResolveComponentStateResponse{} + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResolveComponentStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResolveComponentStateResponse) ProtoMessage() {} + +func (x *ResolveComponentStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_atmos_plugin_v1_plugin_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResolveComponentStateResponse.ProtoReflect.Descriptor instead. +func (*ResolveComponentStateResponse) Descriptor() ([]byte, []int) { + return file_atmos_plugin_v1_plugin_proto_rawDescGZIP(), []int{41} +} + +func (x *ResolveComponentStateResponse) GetState() *ComponentStateIdentity { + if x != nil { + return x.State + } + return nil +} + +func (x *ResolveComponentStateResponse) GetSources() []*ComponentSource { + if x != nil { + return x.Sources + } + return nil +} + +func (x *ResolveComponentStateResponse) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +var File_atmos_plugin_v1_plugin_proto protoreflect.FileDescriptor + +const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + + "\n" + + "\x1catmos/plugin/v1/plugin.proto\x12\x0fatmos.plugin.v1\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa8\x03\n" + + "\n" + + "Invocation\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + + "\aattempt\x18\x02 \x01(\rR\aattempt\x126\n" + + "\bdeadline\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\bdeadline\x12+\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\x12N\n" + + "\venvironment\x18\x05 \x03(\v2,.atmos.plugin.v1.Invocation.EnvironmentEntryR\venvironment\x12\x14\n" + + "\x05stack\x18\x06 \x01(\tR\x05stack\x12\x1c\n" + + "\tcomponent\x18\a \x01(\tR\tcomponent\x12%\n" + + "\x0ecomponent_type\x18\b \x01(\tR\rcomponentType\x12 \n" + + "\vinteractive\x18\t \x01(\bR\vinteractive\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb0\x01\n" + + "\vCredentials\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x129\n" + + "\n" + + "expires_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt\x12+\n" + + "\x04data\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04data\x12%\n" + + "\x0esensitive_keys\x18\x04 \x03(\tR\rsensitiveKeys\"S\n" + + "\x13ServiceVersionRange\x12\x18\n" + + "\aservice\x18\x01 \x01(\tR\aservice\x12\x10\n" + + "\x03min\x18\x02 \x01(\rR\x03min\x12\x10\n" + + "\x03max\x18\x03 \x01(\rR\x03max\"6\n" + + "\x06Export\x12\x18\n" + + "\aservice\x18\x01 \x01(\tR\aservice\x12\x12\n" + + "\x04kind\x18\x02 \x01(\tR\x04kind\"\x83\x01\n" + + "\x0fDescribeRequest\x12#\n" + + "\ratmos_version\x18\x01 \x01(\tR\fatmosVersion\x12K\n" + + "\x0ehost_supported\x18\x02 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\rhostSupported\"\x94\x02\n" + + "\x10DescribeResponse\x12\x1f\n" + + "\vplugin_name\x18\x01 \x01(\tR\n" + + "pluginName\x12%\n" + + "\x0eplugin_version\x18\x02 \x01(\tR\rpluginVersion\x12'\n" + + "\x0fmanifest_digest\x18\x03 \x01(\tR\x0emanifestDigest\x12@\n" + + "\bservices\x18\x04 \x03(\v2$.atmos.plugin.v1.ServiceVersionRangeR\bservices\x121\n" + + "\aexports\x18\x05 \x03(\v2\x17.atmos.plugin.v1.ExportR\aexports\x12\x1a\n" + + "\bfeatures\x18\x06 \x03(\tR\bfeatures\"\xf7\x01\n" + + "\x10ConfigureRequest\x12O\n" + + "\n" + + "broker_ids\x18\x01 \x03(\v20.atmos.plugin.v1.ConfigureRequest.BrokerIdsEntryR\tbrokerIds\x123\n" + + "\bsettings\x18\x02 \x01(\v2\x17.google.protobuf.StructR\bsettings\x12\x1f\n" + + "\vpackage_dir\x18\x03 \x01(\tR\n" + + "packageDir\x1a<\n" + + "\x0eBrokerIdsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\rR\x05value:\x028\x01\"\xb9\x01\n" + + "\x0fProviderRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + + "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x12\x14\n" + + "\x05realm\x18\x05 \x01(\tR\x05realm\"\xf0\x01\n" + + "\x0fIdentityRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" + + "\x04kind\x18\x03 \x01(\tR\x04kind\x12+\n" + + "\x04spec\x18\x04 \x01(\v2\x17.google.protobuf.StructR\x04spec\x125\n" + + "\tprincipal\x18\x05 \x01(\v2\x17.google.protobuf.StructR\tprincipal\x12\x14\n" + + "\x05realm\x18\x06 \x01(\tR\x05realm\"@\n" + + "\bProgress\x12\x18\n" + + "\amessage\x18\x01 \x01(\tR\amessage\x12\x1a\n" + + "\bfraction\x18\x02 \x01(\x02R\bfraction\"\xb4\x01\n" + + "\vInteraction\x12\x12\n" + + "\x04kind\x18\x01 \x01(\tR\x04kind\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12@\n" + + "\x06fields\x18\x03 \x03(\v2(.atmos.plugin.v1.Interaction.FieldsEntryR\x06fields\x1a9\n" + + "\vFieldsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xcf\x01\n" + + "\x11AuthenticateEvent\x127\n" + + "\bprogress\x18\x01 \x01(\v2\x19.atmos.plugin.v1.ProgressH\x00R\bprogress\x12@\n" + + "\vinteraction\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.InteractionH\x00R\vinteraction\x126\n" + + "\x06result\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\x06resultB\a\n" + + "\x05event\"<\n" + + "\n" + + "Diagnostic\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"Q\n" + + "\x10ValidateResponse\x12=\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"C\n" + + "\vUnsupported\x12\x1c\n" + + "\toperation\x18\x01 \x01(\tR\toperation\x12\x16\n" + + "\x06reason\x18\x02 \x01(\tR\x06reason\"\x86\x01\n" + + "\x0eRefreshRequest\x12<\n" + + "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x126\n" + + "\acurrent\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\acurrent\"\x9f\x01\n" + + "\x0fRefreshResponse\x12@\n" + + "\vcredentials\x18\x01 \x01(\v2\x1c.atmos.plugin.v1.CredentialsH\x00R\vcredentials\x12@\n" + + "\vunsupported\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.UnsupportedH\x00R\vunsupportedB\b\n" + + "\x06result\"\xae\x01\n" + + "\x13EnvironmentResponse\x12W\n" + + "\venvironment\x18\x01 \x03(\v25.atmos.plugin.v1.EnvironmentResponse.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xf8\x01\n" + + "\x19PrepareEnvironmentRequest\x12<\n" + + "\bprovider\x18\x01 \x01(\v2 .atmos.plugin.v1.ProviderRequestR\bprovider\x12]\n" + + "\venvironment\x18\x02 \x03(\v2;.atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"v\n" + + "\x0eCredentialPath\x12\x1a\n" + + "\blocation\x18\x01 \x01(\tR\blocation\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x1a\n" + + "\brequired\x18\x03 \x01(\bR\brequired\x12\x18\n" + + "\apurpose\x18\x04 \x01(\tR\apurpose\"F\n" + + "\rPathsResponse\x125\n" + + "\x05paths\x18\x01 \x03(\v2\x1f.atmos.plugin.v1.CredentialPathR\x05paths\"\x95\x01\n" + + "\x1bIdentityAuthenticateRequest\x12<\n" + + "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x128\n" + + "\bupstream\x18\x02 \x01(\v2\x1c.atmos.plugin.v1.CredentialsR\bupstream\"\xf2\x01\n" + + "\x16IdentityPrepareRequest\x12<\n" + + "\bidentity\x18\x01 \x01(\v2 .atmos.plugin.v1.IdentityRequestR\bidentity\x12Z\n" + + "\venvironment\x18\x02 \x03(\v28.atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntryR\venvironment\x1a>\n" + + "\x10EnvironmentEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xb4\x01\n" + + "\x0eCommandRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1c\n" + + "\targuments\x18\x03 \x03(\tR\targuments\x123\n" + + "\bsettings\x18\x04 \x01(\v2\x17.google.protobuf.StructR\bsettings\"!\n" + + "\vCommandExit\x12\x12\n" + + "\x04code\x18\x01 \x01(\rR\x04code\"\x7f\n" + + "\fCommandEvent\x12\x18\n" + + "\x06stdout\x18\x01 \x01(\fH\x00R\x06stdout\x12\x18\n" + + "\x06stderr\x18\x02 \x01(\fH\x00R\x06stderr\x122\n" + + "\x04exit\x18\x03 \x01(\v2\x1c.atmos.plugin.v1.CommandExitH\x00R\x04exitB\a\n" + + "\x05event\"\x95\x01\n" + + "\x0eComponentValue\x12\x1b\n" + + "\ttype_json\x18\x01 \x01(\fR\btypeJson\x12\x18\n" + + "\amsgpack\x18\x02 \x01(\fR\amsgpack\x12L\n" + + "\x0fsensitive_paths\x18\x03 \x03(\v2#.atmos.plugin.v1.ComponentValuePathR\x0esensitivePaths\"O\n" + + "\x12ComponentValuePath\x129\n" + + "\x05steps\x18\x01 \x03(\v2#.atmos.plugin.v1.ComponentValueStepR\x05steps\"y\n" + + "\x12ComponentValueStep\x12\x1e\n" + + "\tattribute\x18\x01 \x01(\tH\x00R\tattribute\x127\n" + + "\x05index\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueH\x00R\x05indexB\n" + + "\n" + + "\bselector\"m\n" + + "\x10ComponentAddress\x12\x14\n" + + "\x05stack\x18\x01 \x01(\tR\x05stack\x12\x1c\n" + + "\tcomponent\x18\x02 \x01(\tR\tcomponent\x12%\n" + + "\x0ecomponent_type\x18\x03 \x01(\tR\rcomponentType\"\xb9\x01\n" + + "\x0fComponentSource\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x129\n" + + "\x04kind\x18\x02 \x01(\x0e2%.atmos.plugin.v1.ComponentSource.KindR\x04kind\x12\x16\n" + + "\x06reason\x18\x03 \x01(\tR\x06reason\"?\n" + + "\x04Kind\x12\x14\n" + + "\x10KIND_UNSPECIFIED\x10\x00\x12\b\n" + + "\x04FILE\x10\x01\x12\r\n" + + "\tDIRECTORY\x10\x02\x12\b\n" + + "\x04GLOB\x10\x03\"\xc4\x01\n" + + "\x13ComponentDependency\x129\n" + + "\x06target\x18\x01 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\x06target\x12=\n" + + "\x04kind\x18\x02 \x01(\x0e2).atmos.plugin.v1.ComponentDependency.KindR\x04kind\"3\n" + + "\x04Kind\x12\x14\n" + + "\x10KIND_UNSPECIFIED\x10\x00\x12\t\n" + + "\x05ORDER\x10\x01\x12\n" + + "\n" + + "\x06OUTPUT\x10\x02\"\xeb\x02\n" + + "\x13DiscoveredComponent\x12;\n" + + "\aaddress\x18\x01 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\aaddress\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12\x16\n" + + "\x06engine\x18\x03 \x01(\tR\x06engine\x12\x16\n" + + "\x06source\x18\x04 \x01(\tR\x06source\x12E\n" + + "\rconfiguration\x18\x05 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\x12:\n" + + "\asources\x18\x06 \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12H\n" + + "\fdependencies\x18\a \x03(\v2$.atmos.plugin.v1.ComponentDependencyR\fdependencies\"\x9b\x01\n" + + "\x10ComponentEffects\x12\x1a\n" + + "\bcommands\x18\x01 \x01(\bR\bcommands\x12\x18\n" + + "\anetwork\x18\x02 \x01(\bR\anetwork\x12\x18\n" + + "\asecrets\x18\x03 \x01(\bR\asecrets\x12\x16\n" + + "\x06writes\x18\x04 \x01(\bR\x06writes\x12\x1f\n" + + "\vstate_reads\x18\x05 \x01(\bR\n" + + "stateReads\"\xeb\x01\n" + + "\x12ComponentOperation\x12\x18\n" + + "\acommand\x18\x01 \x01(\tR\acommand\x12\x12\n" + + "\x04mode\x18\x02 \x01(\tR\x04mode\x12J\n" + + "\aoptions\x18\x03 \x03(\v20.atmos.plugin.v1.ComponentOperation.OptionsEntryR\aoptions\x1a[\n" + + "\fOptionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x125\n" + + "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\x9b\x03\n" + + "\x19DiscoverComponentsRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12%\n" + + "\x0eroot_directory\x18\x03 \x01(\tR\rrootDirectory\x12\x1a\n" + + "\brevision\x18\x04 \x01(\tR\brevision\x12#\n" + + "\rinclude_paths\x18\x05 \x03(\tR\fincludePaths\x12#\n" + + "\rexclude_paths\x18\x06 \x03(\tR\fexcludePaths\x12\x18\n" + + "\aimports\x18\a \x03(\tR\aimports\x12A\n" + + "\toperation\x18\b \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + + "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\"\xa1\x01\n" + + "\x1aDiscoverComponentsResponse\x12D\n" + + "\n" + + "components\x18\x01 \x03(\v2$.atmos.plugin.v1.DiscoveredComponentR\n" + + "components\x12=\n" + + "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xae\x03\n" + + "\x10ComponentRequest\x12;\n" + + "\n" + + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + + "invocation\x12\x1a\n" + + "\bprovider\x18\x02 \x01(\tR\bprovider\x12;\n" + + "\aaddress\x18\x03 \x01(\v2!.atmos.plugin.v1.ComponentAddressR\aaddress\x12%\n" + + "\x0eroot_directory\x18\x04 \x01(\tR\rrootDirectory\x12\x16\n" + + "\x06source\x18\x05 \x01(\tR\x06source\x12A\n" + + "\toperation\x18\x06 \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + + "\aeffects\x18\a \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12E\n" + + "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\"\xc1\x01\n" + + "\x16ComponentStateIdentity\x12!\n" + + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + + "\tworkspace\x18\x03 \x01(\tR\tworkspace\x12+\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x81\x01\n" + + "\x16ComponentGeneratedFile\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x12\x18\n" + + "\acontent\x18\x02 \x01(\fR\acontent\x12\x1b\n" + + "\tif_exists\x18\x03 \x01(\tR\bifExists\x12\x1c\n" + + "\tsensitive\x18\x04 \x01(\bR\tsensitive\"\x80\x04\n" + + "\x18PrepareComponentResponse\x12\x16\n" + + "\x06engine\x18\x01 \x01(\tR\x06engine\x12+\n" + + "\x11working_directory\x18\x02 \x01(\tR\x10workingDirectory\x12#\n" + + "\rmodule_source\x18\x03 \x01(\tR\fmoduleSource\x127\n" + + "\x06inputs\x18\x04 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x06inputs\x12=\n" + + "\x05state\x18\x05 \x01(\v2'.atmos.plugin.v1.ComponentStateIdentityR\x05state\x12=\n" + + "\x05files\x18\x06 \x03(\v2'.atmos.plugin.v1.ComponentGeneratedFileR\x05files\x12H\n" + + "\fdependencies\x18\a \x03(\v2$.atmos.plugin.v1.ComponentDependencyR\fdependencies\x12:\n" + + "\asources\x18\b \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12=\n" + + "\vdiagnostics\x18\t \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xd9\x01\n" + + "\x1dResolveComponentStateResponse\x12=\n" + + "\x05state\x18\x01 \x01(\v2'.atmos.plugin.v1.ComponentStateIdentityR\x05state\x12:\n" + + "\asources\x18\x02 \x03(\v2 .atmos.plugin.v1.ComponentSourceR\asources\x12=\n" + + "\vdiagnostics\x18\x03 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics2\x9f\x01\n" + + "\x04Info\x12O\n" + + "\bDescribe\x12 .atmos.plugin.v1.DescribeRequest\x1a!.atmos.plugin.v1.DescribeResponse\x12F\n" + + "\tConfigure\x12!.atmos.plugin.v1.ConfigureRequest\x1a\x16.google.protobuf.Empty2\xd3\x04\n" + + "\fAuthProvider\x12O\n" + + "\bValidate\x12 .atmos.plugin.v1.ProviderRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12V\n" + + "\fAuthenticate\x12 .atmos.plugin.v1.ProviderRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12L\n" + + "\aRefresh\x12\x1f.atmos.plugin.v1.RefreshRequest\x1a .atmos.plugin.v1.RefreshResponse\x12B\n" + + "\x06Logout\x12 .atmos.plugin.v1.ProviderRequest\x1a\x16.google.protobuf.Empty\x12U\n" + + "\vEnvironment\x12 .atmos.plugin.v1.ProviderRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + + "\x05Paths\x12 .atmos.plugin.v1.ProviderRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12f\n" + + "\x12PrepareEnvironment\x12*.atmos.plugin.v1.PrepareEnvironmentRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2\x8e\x04\n" + + "\fAuthIdentity\x12O\n" + + "\bValidate\x12 .atmos.plugin.v1.IdentityRequest\x1a!.atmos.plugin.v1.ValidateResponse\x12b\n" + + "\fAuthenticate\x12,.atmos.plugin.v1.IdentityAuthenticateRequest\x1a\".atmos.plugin.v1.AuthenticateEvent0\x01\x12B\n" + + "\x06Logout\x12 .atmos.plugin.v1.IdentityRequest\x1a\x16.google.protobuf.Empty\x12U\n" + + "\vEnvironment\x12 .atmos.plugin.v1.IdentityRequest\x1a$.atmos.plugin.v1.EnvironmentResponse\x12I\n" + + "\x05Paths\x12 .atmos.plugin.v1.IdentityRequest\x1a\x1e.atmos.plugin.v1.PathsResponse\x12c\n" + + "\x12PrepareEnvironment\x12'.atmos.plugin.v1.IdentityPrepareRequest\x1a$.atmos.plugin.v1.EnvironmentResponse2S\n" + + "\bCommands\x12G\n" + + "\x03Run\x12\x1f.atmos.plugin.v1.CommandRequest\x1a\x1d.atmos.plugin.v1.CommandEvent0\x012y\n" + + "\x12ComponentDiscovery\x12c\n" + + "\bDiscover\x12*.atmos.plugin.v1.DiscoverComponentsRequest\x1a+.atmos.plugin.v1.DiscoverComponentsResponse2g\n" + + "\x13ComponentValidation\x12P\n" + + "\bValidate\x12!.atmos.plugin.v1.ComponentRequest\x1a!.atmos.plugin.v1.ValidateResponse2o\n" + + "\x14ComponentPreparation\x12W\n" + + "\aPrepare\x12!.atmos.plugin.v1.ComponentRequest\x1a).atmos.plugin.v1.PrepareComponentResponse2n\n" + + "\x0eComponentState\x12\\\n" + + "\aResolve\x12!.atmos.plugin.v1.ComponentRequest\x1a..atmos.plugin.v1.ResolveComponentStateResponseB@Z>github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1;pluginv1b\x06proto3" + +var ( + file_atmos_plugin_v1_plugin_proto_rawDescOnce sync.Once + file_atmos_plugin_v1_plugin_proto_rawDescData []byte +) + +func file_atmos_plugin_v1_plugin_proto_rawDescGZIP() []byte { + file_atmos_plugin_v1_plugin_proto_rawDescOnce.Do(func() { + file_atmos_plugin_v1_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc))) + }) + return file_atmos_plugin_v1_plugin_proto_rawDescData +} + +var ( + file_atmos_plugin_v1_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 2) + file_atmos_plugin_v1_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 49) + file_atmos_plugin_v1_plugin_proto_goTypes = []any{ + ComponentSource_Kind(0), // 0: atmos.plugin.v1.ComponentSource.Kind + ComponentDependency_Kind(0), // 1: atmos.plugin.v1.ComponentDependency.Kind + (*Invocation)(nil), // 2: atmos.plugin.v1.Invocation + (*Credentials)(nil), // 3: atmos.plugin.v1.Credentials + (*ServiceVersionRange)(nil), // 4: atmos.plugin.v1.ServiceVersionRange + (*Export)(nil), // 5: atmos.plugin.v1.Export + (*DescribeRequest)(nil), // 6: atmos.plugin.v1.DescribeRequest + (*DescribeResponse)(nil), // 7: atmos.plugin.v1.DescribeResponse + (*ConfigureRequest)(nil), // 8: atmos.plugin.v1.ConfigureRequest + (*ProviderRequest)(nil), // 9: atmos.plugin.v1.ProviderRequest + (*IdentityRequest)(nil), // 10: atmos.plugin.v1.IdentityRequest + (*Progress)(nil), // 11: atmos.plugin.v1.Progress + (*Interaction)(nil), // 12: atmos.plugin.v1.Interaction + (*AuthenticateEvent)(nil), // 13: atmos.plugin.v1.AuthenticateEvent + (*Diagnostic)(nil), // 14: atmos.plugin.v1.Diagnostic + (*ValidateResponse)(nil), // 15: atmos.plugin.v1.ValidateResponse + (*Unsupported)(nil), // 16: atmos.plugin.v1.Unsupported + (*RefreshRequest)(nil), // 17: atmos.plugin.v1.RefreshRequest + (*RefreshResponse)(nil), // 18: atmos.plugin.v1.RefreshResponse + (*EnvironmentResponse)(nil), // 19: atmos.plugin.v1.EnvironmentResponse + (*PrepareEnvironmentRequest)(nil), // 20: atmos.plugin.v1.PrepareEnvironmentRequest + (*CredentialPath)(nil), // 21: atmos.plugin.v1.CredentialPath + (*PathsResponse)(nil), // 22: atmos.plugin.v1.PathsResponse + (*IdentityAuthenticateRequest)(nil), // 23: atmos.plugin.v1.IdentityAuthenticateRequest + (*IdentityPrepareRequest)(nil), // 24: atmos.plugin.v1.IdentityPrepareRequest + (*CommandRequest)(nil), // 25: atmos.plugin.v1.CommandRequest + (*CommandExit)(nil), // 26: atmos.plugin.v1.CommandExit + (*CommandEvent)(nil), // 27: atmos.plugin.v1.CommandEvent + (*ComponentValue)(nil), // 28: atmos.plugin.v1.ComponentValue + (*ComponentValuePath)(nil), // 29: atmos.plugin.v1.ComponentValuePath + (*ComponentValueStep)(nil), // 30: atmos.plugin.v1.ComponentValueStep + (*ComponentAddress)(nil), // 31: atmos.plugin.v1.ComponentAddress + (*ComponentSource)(nil), // 32: atmos.plugin.v1.ComponentSource + (*ComponentDependency)(nil), // 33: atmos.plugin.v1.ComponentDependency + (*DiscoveredComponent)(nil), // 34: atmos.plugin.v1.DiscoveredComponent + (*ComponentEffects)(nil), // 35: atmos.plugin.v1.ComponentEffects + (*ComponentOperation)(nil), // 36: atmos.plugin.v1.ComponentOperation + (*DiscoverComponentsRequest)(nil), // 37: atmos.plugin.v1.DiscoverComponentsRequest + (*DiscoverComponentsResponse)(nil), // 38: atmos.plugin.v1.DiscoverComponentsResponse + (*ComponentRequest)(nil), // 39: atmos.plugin.v1.ComponentRequest + (*ComponentStateIdentity)(nil), // 40: atmos.plugin.v1.ComponentStateIdentity + (*ComponentGeneratedFile)(nil), // 41: atmos.plugin.v1.ComponentGeneratedFile + (*PrepareComponentResponse)(nil), // 42: atmos.plugin.v1.PrepareComponentResponse + (*ResolveComponentStateResponse)(nil), // 43: atmos.plugin.v1.ResolveComponentStateResponse + nil, // 44: atmos.plugin.v1.Invocation.EnvironmentEntry + nil, // 45: atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry + nil, // 46: atmos.plugin.v1.Interaction.FieldsEntry + nil, // 47: atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry + nil, // 48: atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry + nil, // 49: atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry + nil, // 50: atmos.plugin.v1.ComponentOperation.OptionsEntry + (*timestamppb.Timestamp)(nil), // 51: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 52: google.protobuf.Struct + (*emptypb.Empty)(nil), // 53: google.protobuf.Empty + } +) + +var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ + 51, // 0: atmos.plugin.v1.Invocation.deadline:type_name -> google.protobuf.Timestamp + 44, // 1: atmos.plugin.v1.Invocation.environment:type_name -> atmos.plugin.v1.Invocation.EnvironmentEntry + 51, // 2: atmos.plugin.v1.Credentials.expires_at:type_name -> google.protobuf.Timestamp + 52, // 3: atmos.plugin.v1.Credentials.data:type_name -> google.protobuf.Struct + 4, // 4: atmos.plugin.v1.DescribeRequest.host_supported:type_name -> atmos.plugin.v1.ServiceVersionRange + 4, // 5: atmos.plugin.v1.DescribeResponse.services:type_name -> atmos.plugin.v1.ServiceVersionRange + 5, // 6: atmos.plugin.v1.DescribeResponse.exports:type_name -> atmos.plugin.v1.Export + 45, // 7: atmos.plugin.v1.ConfigureRequest.broker_ids:type_name -> atmos.plugin.v1.ConfigureRequest.BrokerIdsEntry + 52, // 8: atmos.plugin.v1.ConfigureRequest.settings:type_name -> google.protobuf.Struct + 2, // 9: atmos.plugin.v1.ProviderRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 10: atmos.plugin.v1.ProviderRequest.spec:type_name -> google.protobuf.Struct + 2, // 11: atmos.plugin.v1.IdentityRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 12: atmos.plugin.v1.IdentityRequest.spec:type_name -> google.protobuf.Struct + 52, // 13: atmos.plugin.v1.IdentityRequest.principal:type_name -> google.protobuf.Struct + 46, // 14: atmos.plugin.v1.Interaction.fields:type_name -> atmos.plugin.v1.Interaction.FieldsEntry + 11, // 15: atmos.plugin.v1.AuthenticateEvent.progress:type_name -> atmos.plugin.v1.Progress + 12, // 16: atmos.plugin.v1.AuthenticateEvent.interaction:type_name -> atmos.plugin.v1.Interaction + 3, // 17: atmos.plugin.v1.AuthenticateEvent.result:type_name -> atmos.plugin.v1.Credentials + 14, // 18: atmos.plugin.v1.ValidateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 9, // 19: atmos.plugin.v1.RefreshRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest + 3, // 20: atmos.plugin.v1.RefreshRequest.current:type_name -> atmos.plugin.v1.Credentials + 3, // 21: atmos.plugin.v1.RefreshResponse.credentials:type_name -> atmos.plugin.v1.Credentials + 16, // 22: atmos.plugin.v1.RefreshResponse.unsupported:type_name -> atmos.plugin.v1.Unsupported + 47, // 23: atmos.plugin.v1.EnvironmentResponse.environment:type_name -> atmos.plugin.v1.EnvironmentResponse.EnvironmentEntry + 9, // 24: atmos.plugin.v1.PrepareEnvironmentRequest.provider:type_name -> atmos.plugin.v1.ProviderRequest + 48, // 25: atmos.plugin.v1.PrepareEnvironmentRequest.environment:type_name -> atmos.plugin.v1.PrepareEnvironmentRequest.EnvironmentEntry + 21, // 26: atmos.plugin.v1.PathsResponse.paths:type_name -> atmos.plugin.v1.CredentialPath + 10, // 27: atmos.plugin.v1.IdentityAuthenticateRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest + 3, // 28: atmos.plugin.v1.IdentityAuthenticateRequest.upstream:type_name -> atmos.plugin.v1.Credentials + 10, // 29: atmos.plugin.v1.IdentityPrepareRequest.identity:type_name -> atmos.plugin.v1.IdentityRequest + 49, // 30: atmos.plugin.v1.IdentityPrepareRequest.environment:type_name -> atmos.plugin.v1.IdentityPrepareRequest.EnvironmentEntry + 2, // 31: atmos.plugin.v1.CommandRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 52, // 32: atmos.plugin.v1.CommandRequest.settings:type_name -> google.protobuf.Struct + 26, // 33: atmos.plugin.v1.CommandEvent.exit:type_name -> atmos.plugin.v1.CommandExit + 29, // 34: atmos.plugin.v1.ComponentValue.sensitive_paths:type_name -> atmos.plugin.v1.ComponentValuePath + 30, // 35: atmos.plugin.v1.ComponentValuePath.steps:type_name -> atmos.plugin.v1.ComponentValueStep + 28, // 36: atmos.plugin.v1.ComponentValueStep.index:type_name -> atmos.plugin.v1.ComponentValue + 0, // 37: atmos.plugin.v1.ComponentSource.kind:type_name -> atmos.plugin.v1.ComponentSource.Kind + 31, // 38: atmos.plugin.v1.ComponentDependency.target:type_name -> atmos.plugin.v1.ComponentAddress + 1, // 39: atmos.plugin.v1.ComponentDependency.kind:type_name -> atmos.plugin.v1.ComponentDependency.Kind + 31, // 40: atmos.plugin.v1.DiscoveredComponent.address:type_name -> atmos.plugin.v1.ComponentAddress + 28, // 41: atmos.plugin.v1.DiscoveredComponent.configuration:type_name -> atmos.plugin.v1.ComponentValue + 32, // 42: atmos.plugin.v1.DiscoveredComponent.sources:type_name -> atmos.plugin.v1.ComponentSource + 33, // 43: atmos.plugin.v1.DiscoveredComponent.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 50, // 44: atmos.plugin.v1.ComponentOperation.options:type_name -> atmos.plugin.v1.ComponentOperation.OptionsEntry + 2, // 45: atmos.plugin.v1.DiscoverComponentsRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 36, // 46: atmos.plugin.v1.DiscoverComponentsRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 47: atmos.plugin.v1.DiscoverComponentsRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 34, // 48: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent + 14, // 49: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 2, // 50: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 31, // 51: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress + 36, // 52: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 53: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 28, // 54: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 55: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue + 28, // 56: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue + 40, // 57: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 41, // 58: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile + 33, // 59: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 32, // 60: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 61: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 40, // 62: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 32, // 63: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 64: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 28, // 65: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue + 6, // 66: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest + 8, // 67: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest + 9, // 68: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 69: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest + 17, // 70: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest + 9, // 71: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 72: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 73: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest + 20, // 74: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest + 10, // 75: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest + 23, // 76: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest + 10, // 77: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 78: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 79: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest + 24, // 80: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest + 25, // 81: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest + 37, // 82: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest + 39, // 83: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 84: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 85: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest + 7, // 86: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse + 53, // 87: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty + 15, // 88: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 89: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 18, // 90: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse + 53, // 91: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty + 19, // 92: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 93: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 94: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 15, // 95: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 96: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 53, // 97: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty + 19, // 98: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 99: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 100: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 27, // 101: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent + 38, // 102: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse + 15, // 103: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 42, // 104: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse + 43, // 105: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse + 86, // [86:106] is the sub-list for method output_type + 66, // [66:86] is the sub-list for method input_type + 66, // [66:66] is the sub-list for extension type_name + 66, // [66:66] is the sub-list for extension extendee + 0, // [0:66] is the sub-list for field type_name +} + +func init() { file_atmos_plugin_v1_plugin_proto_init() } +func file_atmos_plugin_v1_plugin_proto_init() { + if File_atmos_plugin_v1_plugin_proto != nil { + return + } + file_atmos_plugin_v1_plugin_proto_msgTypes[11].OneofWrappers = []any{ + (*AuthenticateEvent_Progress)(nil), + (*AuthenticateEvent_Interaction)(nil), + (*AuthenticateEvent_Result)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[16].OneofWrappers = []any{ + (*RefreshResponse_Credentials)(nil), + (*RefreshResponse_Unsupported)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[25].OneofWrappers = []any{ + (*CommandEvent_Stdout)(nil), + (*CommandEvent_Stderr)(nil), + (*CommandEvent_Exit)(nil), + } + file_atmos_plugin_v1_plugin_proto_msgTypes[28].OneofWrappers = []any{ + (*ComponentValueStep_Attribute)(nil), + (*ComponentValueStep_Index)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_atmos_plugin_v1_plugin_proto_rawDesc), len(file_atmos_plugin_v1_plugin_proto_rawDesc)), - NumEnums: 0, - NumMessages: 32, + NumEnums: 2, + NumMessages: 49, NumExtensions: 0, - NumServices: 4, + NumServices: 8, }, GoTypes: file_atmos_plugin_v1_plugin_proto_goTypes, DependencyIndexes: file_atmos_plugin_v1_plugin_proto_depIdxs, + EnumInfos: file_atmos_plugin_v1_plugin_proto_enumTypes, MessageInfos: file_atmos_plugin_v1_plugin_proto_msgTypes, }.Build() File_atmos_plugin_v1_plugin_proto = out.File diff --git a/sdk/proto/atmos/plugin/v1/plugin_grpc.pb.go b/sdk/proto/atmos/plugin/v1/plugin_grpc.pb.go index 106d410e528..bd48e39bb7b 100644 --- a/sdk/proto/atmos/plugin/v1/plugin_grpc.pb.go +++ b/sdk/proto/atmos/plugin/v1/plugin_grpc.pb.go @@ -906,3 +906,429 @@ var Commands_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "atmos/plugin/v1/plugin.proto", } + +const ( + ComponentDiscovery_Discover_FullMethodName = "/atmos.plugin.v1.ComponentDiscovery/Discover" +) + +// ComponentDiscoveryClient is the client API for ComponentDiscovery service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ComponentDiscoveryClient interface { + Discover(ctx context.Context, in *DiscoverComponentsRequest, opts ...grpc.CallOption) (*DiscoverComponentsResponse, error) +} + +type componentDiscoveryClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentDiscoveryClient(cc grpc.ClientConnInterface) ComponentDiscoveryClient { + return &componentDiscoveryClient{cc} +} + +func (c *componentDiscoveryClient) Discover(ctx context.Context, in *DiscoverComponentsRequest, opts ...grpc.CallOption) (*DiscoverComponentsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DiscoverComponentsResponse) + err := c.cc.Invoke(ctx, ComponentDiscovery_Discover_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentDiscoveryServer is the server API for ComponentDiscovery service. +// All implementations must embed UnimplementedComponentDiscoveryServer +// for forward compatibility. +type ComponentDiscoveryServer interface { + Discover(context.Context, *DiscoverComponentsRequest) (*DiscoverComponentsResponse, error) + mustEmbedUnimplementedComponentDiscoveryServer() +} + +// UnimplementedComponentDiscoveryServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentDiscoveryServer struct{} + +func (UnimplementedComponentDiscoveryServer) Discover(context.Context, *DiscoverComponentsRequest) (*DiscoverComponentsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Discover not implemented") +} +func (UnimplementedComponentDiscoveryServer) mustEmbedUnimplementedComponentDiscoveryServer() {} +func (UnimplementedComponentDiscoveryServer) testEmbeddedByValue() {} + +// UnsafeComponentDiscoveryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentDiscoveryServer will +// result in compilation errors. +type UnsafeComponentDiscoveryServer interface { + mustEmbedUnimplementedComponentDiscoveryServer() +} + +func RegisterComponentDiscoveryServer(s grpc.ServiceRegistrar, srv ComponentDiscoveryServer) { + // If the following call panics, it indicates UnimplementedComponentDiscoveryServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentDiscovery_ServiceDesc, srv) +} + +func _ComponentDiscovery_Discover_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DiscoverComponentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentDiscoveryServer).Discover(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentDiscovery_Discover_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentDiscoveryServer).Discover(ctx, req.(*DiscoverComponentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentDiscovery_ServiceDesc is the grpc.ServiceDesc for ComponentDiscovery service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentDiscovery_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentDiscovery", + HandlerType: (*ComponentDiscoveryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Discover", + Handler: _ComponentDiscovery_Discover_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentValidation_Validate_FullMethodName = "/atmos.plugin.v1.ComponentValidation/Validate" +) + +// ComponentValidationClient is the client API for ComponentValidation service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Validation must precede discovery/preparation effects. It cannot silently +// substitute CLI mode for unsupported native semantics. +type ComponentValidationClient interface { + Validate(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ValidateResponse, error) +} + +type componentValidationClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentValidationClient(cc grpc.ClientConnInterface) ComponentValidationClient { + return &componentValidationClient{cc} +} + +func (c *componentValidationClient) Validate(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ValidateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ValidateResponse) + err := c.cc.Invoke(ctx, ComponentValidation_Validate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentValidationServer is the server API for ComponentValidation service. +// All implementations must embed UnimplementedComponentValidationServer +// for forward compatibility. +// +// Validation must precede discovery/preparation effects. It cannot silently +// substitute CLI mode for unsupported native semantics. +type ComponentValidationServer interface { + Validate(context.Context, *ComponentRequest) (*ValidateResponse, error) + mustEmbedUnimplementedComponentValidationServer() +} + +// UnimplementedComponentValidationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentValidationServer struct{} + +func (UnimplementedComponentValidationServer) Validate(context.Context, *ComponentRequest) (*ValidateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Validate not implemented") +} +func (UnimplementedComponentValidationServer) mustEmbedUnimplementedComponentValidationServer() {} +func (UnimplementedComponentValidationServer) testEmbeddedByValue() {} + +// UnsafeComponentValidationServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentValidationServer will +// result in compilation errors. +type UnsafeComponentValidationServer interface { + mustEmbedUnimplementedComponentValidationServer() +} + +func RegisterComponentValidationServer(s grpc.ServiceRegistrar, srv ComponentValidationServer) { + // If the following call panics, it indicates UnimplementedComponentValidationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentValidation_ServiceDesc, srv) +} + +func _ComponentValidation_Validate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentValidationServer).Validate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentValidation_Validate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentValidationServer).Validate(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentValidation_ServiceDesc is the grpc.ServiceDesc for ComponentValidation service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentValidation_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentValidation", + HandlerType: (*ComponentValidationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Validate", + Handler: _ComponentValidation_Validate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentPreparation_Prepare_FullMethodName = "/atmos.plugin.v1.ComponentPreparation/Prepare" +) + +// ComponentPreparationClient is the client API for ComponentPreparation service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Reevaluate immediately before the selected operation, after its dependencies. +// Preparing configuration does not authorize executing infrastructure commands. +type ComponentPreparationClient interface { + Prepare(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*PrepareComponentResponse, error) +} + +type componentPreparationClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentPreparationClient(cc grpc.ClientConnInterface) ComponentPreparationClient { + return &componentPreparationClient{cc} +} + +func (c *componentPreparationClient) Prepare(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*PrepareComponentResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PrepareComponentResponse) + err := c.cc.Invoke(ctx, ComponentPreparation_Prepare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentPreparationServer is the server API for ComponentPreparation service. +// All implementations must embed UnimplementedComponentPreparationServer +// for forward compatibility. +// +// Reevaluate immediately before the selected operation, after its dependencies. +// Preparing configuration does not authorize executing infrastructure commands. +type ComponentPreparationServer interface { + Prepare(context.Context, *ComponentRequest) (*PrepareComponentResponse, error) + mustEmbedUnimplementedComponentPreparationServer() +} + +// UnimplementedComponentPreparationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentPreparationServer struct{} + +func (UnimplementedComponentPreparationServer) Prepare(context.Context, *ComponentRequest) (*PrepareComponentResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Prepare not implemented") +} +func (UnimplementedComponentPreparationServer) mustEmbedUnimplementedComponentPreparationServer() {} +func (UnimplementedComponentPreparationServer) testEmbeddedByValue() {} + +// UnsafeComponentPreparationServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentPreparationServer will +// result in compilation errors. +type UnsafeComponentPreparationServer interface { + mustEmbedUnimplementedComponentPreparationServer() +} + +func RegisterComponentPreparationServer(s grpc.ServiceRegistrar, srv ComponentPreparationServer) { + // If the following call panics, it indicates UnimplementedComponentPreparationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentPreparation_ServiceDesc, srv) +} + +func _ComponentPreparation_Prepare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentPreparationServer).Prepare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentPreparation_Prepare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentPreparationServer).Prepare(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentPreparation_ServiceDesc is the grpc.ServiceDesc for ComponentPreparation service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentPreparation_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentPreparation", + HandlerType: (*ComponentPreparationServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Prepare", + Handler: _ComponentPreparation_Prepare_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} + +const ( + ComponentState_Resolve_FullMethodName = "/atmos.plugin.v1.ComponentState/Resolve" +) + +// ComponentStateClient is the client API for ComponentState service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Resolve backend identity without preparing a component, running hooks, +// writing generated files, or reading unrelated dependency outputs. +type ComponentStateClient interface { + Resolve(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ResolveComponentStateResponse, error) +} + +type componentStateClient struct { + cc grpc.ClientConnInterface +} + +func NewComponentStateClient(cc grpc.ClientConnInterface) ComponentStateClient { + return &componentStateClient{cc} +} + +func (c *componentStateClient) Resolve(ctx context.Context, in *ComponentRequest, opts ...grpc.CallOption) (*ResolveComponentStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResolveComponentStateResponse) + err := c.cc.Invoke(ctx, ComponentState_Resolve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ComponentStateServer is the server API for ComponentState service. +// All implementations must embed UnimplementedComponentStateServer +// for forward compatibility. +// +// Resolve backend identity without preparing a component, running hooks, +// writing generated files, or reading unrelated dependency outputs. +type ComponentStateServer interface { + Resolve(context.Context, *ComponentRequest) (*ResolveComponentStateResponse, error) + mustEmbedUnimplementedComponentStateServer() +} + +// UnimplementedComponentStateServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedComponentStateServer struct{} + +func (UnimplementedComponentStateServer) Resolve(context.Context, *ComponentRequest) (*ResolveComponentStateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Resolve not implemented") +} +func (UnimplementedComponentStateServer) mustEmbedUnimplementedComponentStateServer() {} +func (UnimplementedComponentStateServer) testEmbeddedByValue() {} + +// UnsafeComponentStateServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ComponentStateServer will +// result in compilation errors. +type UnsafeComponentStateServer interface { + mustEmbedUnimplementedComponentStateServer() +} + +func RegisterComponentStateServer(s grpc.ServiceRegistrar, srv ComponentStateServer) { + // If the following call panics, it indicates UnimplementedComponentStateServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ComponentState_ServiceDesc, srv) +} + +func _ComponentState_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComponentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ComponentStateServer).Resolve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ComponentState_Resolve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ComponentStateServer).Resolve(ctx, req.(*ComponentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ComponentState_ServiceDesc is the grpc.ServiceDesc for ComponentState service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ComponentState_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "atmos.plugin.v1.ComponentState", + HandlerType: (*ComponentStateServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Resolve", + Handler: _ComponentState_Resolve_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "atmos/plugin/v1/plugin.proto", +} From dcd46e5db4ca0d8a017d6ae9b2a283b678e140df Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 29 Oct 2026 13:35:51 -0500 Subject: [PATCH 02/52] feat(plugin): load and adapt component configuration providers --- .../plugins/extensions/component-engines.md | 15 +- docs/prd/plugins/overview.md | 2 +- docs/prd/plugins/platform/interfaces.md | 3 +- docs/prd/plugins/platform/protocol.md | 6 +- docs/prd/terragrunt-support.md | 2 +- pkg/plugin/adapter/component/calls.go | 131 +++++++++++ pkg/plugin/adapter/component/calls_test.go | 167 ++++++++++++++ pkg/plugin/adapter/component/invoke.go | 106 +++++++++ pkg/plugin/adapter/component/main_test.go | 118 ++++++++++ pkg/plugin/adapter/component/registry.go | 147 +++++++++++++ pkg/plugin/adapter/component/registry_test.go | 110 ++++++++++ pkg/plugin/adapter/component/responses.go | 99 +++++++++ .../adapter/component/responses_test.go | 82 +++++++ pkg/plugin/adapter/component/settings.go | 49 +++++ pkg/plugin/bootstrap/components.go | 193 ++++++++++++++++ pkg/plugin/bootstrap/components_test.go | 207 ++++++++++++++++++ pkg/plugin/bootstrap/descriptors.go | 15 ++ pkg/plugin/bootstrap/selection_test.go | 10 +- pkg/plugin/extension/component.go | 47 ++++ pkg/plugin/extension/component_test.go | 44 ++++ pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go | 188 +++++++++------- proto/atmos/plugin/v1/plugin.proto | 3 + sdk/proto/atmos/plugin/v1/plugin.pb.go | 188 +++++++++------- 23 files changed, 1753 insertions(+), 179 deletions(-) create mode 100644 pkg/plugin/adapter/component/calls.go create mode 100644 pkg/plugin/adapter/component/calls_test.go create mode 100644 pkg/plugin/adapter/component/invoke.go create mode 100644 pkg/plugin/adapter/component/main_test.go create mode 100644 pkg/plugin/adapter/component/registry.go create mode 100644 pkg/plugin/adapter/component/registry_test.go create mode 100644 pkg/plugin/adapter/component/responses.go create mode 100644 pkg/plugin/adapter/component/responses_test.go create mode 100644 pkg/plugin/adapter/component/settings.go create mode 100644 pkg/plugin/bootstrap/components.go create mode 100644 pkg/plugin/bootstrap/components_test.go create mode 100644 pkg/plugin/extension/component.go create mode 100644 pkg/plugin/extension/component_test.go diff --git a/docs/prd/plugins/extensions/component-engines.md b/docs/prd/plugins/extensions/component-engines.md index 9aab536f01d..443c48c5a62 100644 --- a/docs/prd/plugins/extensions/component-engines.md +++ b/docs/prd/plugins/extensions/component-engines.md @@ -1,6 +1,6 @@ # Component configuration and engine plugins -**Status:** Implementation in progress. The protocol, SDK registration, native runtime clients, and SDK value codec exist. Installed component activation and stack/execution adapters are not implemented. +**Status:** Implementation in progress. The protocol, SDK, native runtime clients, static component descriptors, explicit package loader, and configuration-service adapters exist. CLI discovery, stack adaptation, and execution integration are not implemented. **Decision:** Separate component type, configuration provider, and execution engine. Negotiate optional capabilities independently. A configuration provider must not need an executor. @@ -33,7 +33,7 @@ The checked-in [protocol](../../../../proto/atmos/plugin/v1/plugin.proto) is aut The following contracts still require implementation: -- Static metadata for types, providers, modes, commands, typed options, schemas, and versions. +- Static metadata for modes, commands, and typed options. Component family, provider export name, package-local settings schema, and service version are implemented. - Optional execution with stdout, stderr, diagnostics/logs, lifecycle events, and one authoritative outcome. - Scoped host process, filesystem, toolchain, and logging APIs. The existing broker does not provide these services yet. - External engine CI reporting. Native Terraform adaptation retains the existing Terraform CI path. @@ -75,11 +75,15 @@ Use static metadata for help without starting plugins. Use `pkg/flags.NewStandar ## Host integration -Add adapters in `pkg/plugin/adapter/component`. Compose configuration providers with registered engines. Keep business logic out of `internal/exec`. +`pkg/plugin/adapter/component` supplies discovery, validation, preparation, and state clients. Its immutable registry is private to the invocation. It does not register or replace execution engines. Compose these providers with registered engines in the stack and execution adapters. Keep business logic out of `internal/exec`. Open remaining closed type lists through registry metadata: `schema.Components.GetComponentConfig`, component auto-detection, stack component processing, component/reverse base paths, list extraction, `list sources`, stack-section validation/inheritance, dependency/affected dispatch, and CI dispatch. -Extend bootstrap to activate explicitly referenced providers. Validate all exports and collisions before registering them. Preserve lazy activation for unrelated operations. +`bootstrap.LoadComponents` accepts explicit capability-qualified provider references. It uses the existing package policy, OCI cache, lock, and restoration paths. An empty reference list does not inspect package manifests. Disabled packages cannot satisfy references. Schema validation and ownership checks precede native startup; a failed batch returns no registry. Activation does not call discovery or execute the engine. + +Declare each service under `spec.capabilities.components.discovery`, `.validation`, `.preparation`, or `.state`. Each export declares `component_type` and a package-local `schema`. All capabilities for one provider must agree on package identity, executable, schema, type, and negotiated description. Keep provider settings separate from resolved component inputs in every request. + +Connect this explicit loader to configuration and command contexts. Preserve lazy activation for unrelated operations. Do not add a process-global discovery callback or cache plugin results without provider/options/revision identity. Distinguish file/directory/glob watches, output dependencies, and ordering-only edges. Compare each Git revision in its own root. Include additions, removals, and renames; evaluating only current HCL is insufficient. @@ -90,7 +94,8 @@ Cancellation must stop invocations, processes, callbacks, and descendants. Test | Layer | Required result | State | |---|---|---| | Protocol and SDK | Independent services, lossless values, optional registration, native transport tests. | Implemented in this branch; not activated by installation. | -| Host composition | Descriptors, schemas/flags, collision rules, scoped services, discovery/import and engine adapters. | Required. | +| Host activation | Static descriptors, provider settings schemas, private registry, package selection, and service adapters. | Implemented; not connected to CLI stack processing. | +| Host composition | Flags, scoped services, discovery/import and engine adapters. | Required. | | Terragrunt plugin | Separately built SDK package runs the advanced native fixture on stock Atmos. | Required. | | Integration | Lists, state functions, affected, dependencies, UI, saved plans, and Pro share instances. | Required. | | Compatibility | Differential tests for supported constructs and explicit failures for unsupported behavior. | Required. | diff --git a/docs/prd/plugins/overview.md b/docs/prd/plugins/overview.md index 85437a9c6bf..10daa24ecae 100644 --- a/docs/prd/plugins/overview.md +++ b/docs/prd/plugins/overview.md @@ -38,7 +38,7 @@ A **plugin** is an installable, independently versioned package managed by `atmo ## Foundation and architectural direction -Atmos's existing registries are the integration points, but they are uneven. The [gap analysis](platform/gap-analysis.md) inventories each one: most replace silently on duplicate registration, two live in Go-internal packages, three interfaces carry no `context.Context`, and several surfaces still dispatch through closed lists rather than a registry. Terraform now uses the component registry. Helmfile and Packer still use legacy execution paths. The [component extension](extensions/component-engines.md) separates configuration providers from engines; its protocol is implemented, while installed host activation remains pending. Other entries in the gap analysis describe the platform design baseline and must be checked against the implemented adapters. +Atmos's existing registries are the integration points, but they are uneven. The [gap analysis](platform/gap-analysis.md) inventories each one: most replace silently on duplicate registration, two live in Go-internal packages, three interfaces carry no `context.Context`, and several surfaces still dispatch through closed lists rather than a registry. Terraform now uses the component registry. Helmfile and Packer still use legacy execution paths. The [component extension](extensions/component-engines.md) separates configuration providers from engines; its protocol and explicit host activation API are implemented, while CLI stack and execution integration remain pending. Other entries in the gap analysis describe the platform design baseline and must be checked against the implemented adapters. Auth now dispatches built-in and plugin provider and identity constructors through `pkg/auth/registry`. Preserve existing configuration and behavior as additional auth adapters are introduced. diff --git a/docs/prd/plugins/platform/interfaces.md b/docs/prd/plugins/platform/interfaces.md index d7b68442eeb..f032052223a 100644 --- a/docs/prd/plugins/platform/interfaces.md +++ b/docs/prd/plugins/platform/interfaces.md @@ -373,7 +373,8 @@ An adapter implements one existing Atmos interface by calling a wire service, so | Extension | Adapter (`pkg/plugin/adapter/...`) | Existing interface implemented | Wire service | API services | Must not cross | Phase 0 | |---|---|---|---|---|---|---| | Auth | `auth.ProviderAdapter`, `auth.IdentityAdapter` | [`types.Provider`](../../../../pkg/auth/types/interfaces.go): `Kind`, `Name`, `PreAuthenticate`, `Authenticate`, `Validate`, `Environment`, `Paths`, `PrepareEnvironment`, `Logout`, `GetFilesDisplayPath`, `SetRealm`. `types.Identity`: `Kind`, `GetProviderName`, `Authenticate`, `Validate`, `Environment`, `Paths`, `PrepareEnvironment`, `PostAuthenticate`, `Logout`, `CredentialsExist`, `LoadCredentials`, `SetRealm`. Optional `Provisioner`, `JustificationConsumer`. | `AuthProvider`, `AuthIdentity` | `api.Credentials`, `api.Prompt`, `api.Browser`, `api.HTTP`, `api.Log` | `types.AuthManager`, `*schema.Provider`, `*schema.Identity`, `*schema.AuthContext` | P0.1, P0.2 | -| Component | `component.Adapter` | [`ComponentProvider`](../../../../pkg/component/provider.go): `GetType`, `GetGroup`, `GetBasePath`, `ListComponents`, `ValidateComponent`, `Execute`, `GenerateArtifacts`, `GetAvailableCommands`. | Independent component configuration services; optional execution follows | `api.Process`, `api.Toolchain`, `api.FS`, `api.Credentials`, `api.Log` | `ExecutionContext` struct, `*schema.AtmosConfiguration`, `schema.ConfigAndStacksInfo` | P0.3, P0.6 | +| Component configuration | `component.Provider`, private `component.Registry` | Discovery, validation, preparation, and state clients; composition with existing engines remains required. | `ComponentDiscovery`, `ComponentValidation`, `ComponentPreparation`, `ComponentState` | No process, filesystem, network, or private-credential grants yet. | `ExecutionContext`, `*schema.AtmosConfiguration`, `schema.ConfigAndStacksInfo` | P0.3, P0.6 | +| Component execution (planned) | Engine adapter | [`ComponentProvider`](../../../../pkg/component/provider.go); external engines must not replace built-in providers. | Optional execution contract | Scoped process, toolchain, filesystem, credentials, and logging services | Host execution structs and callbacks | P0.3, P0.6 | | CI provider | `ci.Adapter` | [`provider.Provider`](../../../../pkg/ci/internal/provider/types.go): `Name`, `Detect`, `Context`, `GetStatus`, `CreateCheckRun`, `UpdateCheckRun`, `PostComment`, `OutputWriter`, `ResolveBase`. Optional `LabelReader`, `DebugModeDetector`, `LogGrouper`. | `CIProvider` | `api.HTTP`, `api.Secrets`, `api.Log` | `OutputWriter`, `io.Writer` | P0.3, P0.7 | | Component CI | `cicomponent.Adapter` | [`plugin.Plugin`](../../../../pkg/ci/internal/plugin/types.go): `GetType`, `GetHookBindings` (`HookBinding{Event, Handler}`). | `CIComponent` | `api.CIReporter`, `api.FS`, `api.Log` | `HookHandler` func, `HookContext.Provider`, `TemplateLoader`, `CreatePlanfileStore` | P0.5 | | Command | `command.Adapter` (lives behind `cmd/plugin`) | [`internal.CommandProvider`](../../../../cmd/internal/command.go): `GetCommand`, `GetName`, `GetGroup`, `GetFlagsBuilder`, `GetPositionalArgsBuilder`, `GetCompatibilityFlags`, `GetAliases`, `IsExperimental`. | `Commands.Run` for native plugins; in-process binding proposed for Starlark | Native command bootstrap currently grants `api.HTTP`; output uses RPC events, not inherited stdio | `*cobra.Command` | P0.3 | diff --git a/docs/prd/plugins/platform/protocol.md b/docs/prd/plugins/platform/protocol.md index c5d481249f9..019994b0272 100644 --- a/docs/prd/plugins/platform/protocol.md +++ b/docs/prd/plugins/platform/protocol.md @@ -256,7 +256,7 @@ The runtime writes events to caller-provided stdout/stderr writers; callers supp ### Component configuration services -The component configuration protocol is now defined in `proto/atmos/plugin/v1/plugin.proto` and generated for the CLI and SDK. Installed host adapters remain pending. These independently negotiated version-1 services replace the earlier proposed monolithic `Component` service: +The component configuration protocol is now defined in `proto/atmos/plugin/v1/plugin.proto` and generated for the CLI and SDK. The host has static descriptors, explicit package loading, and service adapters. CLI stack and execution wiring remain pending. These independently negotiated version-1 services replace the earlier proposed monolithic `Component` service: | Capability | RPC | Result | |---|---|---| @@ -265,11 +265,11 @@ The component configuration protocol is now defined in `proto/atmos/plugin/v1/pl | `component.preparation` | `ComponentPreparation.Prepare` | Fresh inputs, module, backend identity, and literal generated files. | | `component.state` | `ComponentState.Resolve` | Backend/workspace identity without preparation. | -`ComponentRequest` carries explicit invocation, provider, coordinates, root/source, operation/options, effects, and configuration. It does not carry host Go structs or callbacks. `ComponentValue` uses cty type JSON plus MessagePack and sensitivity paths, preserving exact numbers, unknowns, nulls, collection types, and sensitive values. Do not use `protobuf.Struct` for these values. The SDK rejects unsupported marks and sensitivity paths that cannot be applied. +`ComponentRequest` carries explicit invocation, provider, coordinates, root/source, operation/options, effects, resolved component configuration, and separate provider settings. It does not carry host Go structs or callbacks. `ComponentValue` uses cty type JSON plus MessagePack and sensitivity paths, preserving exact numbers, unknowns, nulls, collection types, and sensitive values. Do not use `protobuf.Struct` for these values. The SDK rejects unsupported marks and sensitivity paths that cannot be applied. Configuration providers do not replace execution engines. Native Terragrunt units remain Terraform components executed by Atmos. Optional external execution and component CI services remain follow-on contracts: they must stream output, diagnostics/logs, lifecycle events, then exactly one authoritative outcome. Preserve detailed plan exit 2 as changes. Saved-plan identity must bind the exact applied artifact and effective configuration. -Static metadata/flags, effect enforcement, host services, and installation activation remain required. See the [component plugin PRD](../extensions/component-engines.md) for ownership, integration points, and acceptance. Protocol availability alone does not mean an installed component plugin works. +Static command/flag metadata, effect enforcement, host services, and CLI activation remain required. See the [component plugin PRD](../extensions/component-engines.md) for ownership, integration points, and acceptance. Protocol availability alone does not mean an installed component plugin works. ### CIProvider diff --git a/docs/prd/terragrunt-support.md b/docs/prd/terragrunt-support.md index 19bde8248a5..40d3db05bce 100644 --- a/docs/prd/terragrunt-support.md +++ b/docs/prd/terragrunt-support.md @@ -1,6 +1,6 @@ # Terragrunt component plugin -**Status:** Implementation in progress. Shared component protocol work has started. The installed Terragrunt integration is not available. +**Status:** Implementation in progress. Shared protocol, SDK, and configuration-provider loading/adapters exist. CLI stack and execution integration remain. The installed Terragrunt integration is not available. **Decision:** Ship Terragrunt as a separately versioned native plugin. Use Terragrunt Go modules to interpret HCL and Atmos to execute native Terraform components. Provide executable mode as a separate compatibility path. diff --git a/pkg/plugin/adapter/component/calls.go b/pkg/plugin/adapter/component/calls.go new file mode 100644 index 00000000000..caabe91b79e --- /dev/null +++ b/pkg/plugin/adapter/component/calls.go @@ -0,0 +1,131 @@ +package component + +import ( + "context" + "path/filepath" + + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/plugin/runtime/native" +) + +// Discover resolves instances without replacing their registered execution engine. +func (p *Provider) Discover(ctx context.Context, input *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + defer perf.Track(nil, "componentadapter.Discover")() + + if input == nil || !filepath.IsAbs(input.RootDirectory) || (input.Provider != "" && input.Provider != p.name) { + return nil, errUtils.ErrPluginInvalidConfig + } + if err := p.validateConfiguration(input.ProviderConfiguration); err != nil { + return nil, err + } + request := proto.Clone(input).(*pluginv1.DiscoverComponentsRequest) + request.Provider = p.name + var result *pluginv1.DiscoverComponentsResponse + err := p.invoke(ctx, extension.ComponentDiscovery, func(call context.Context, handle *native.Handle, invocation *pluginv1.Invocation) error { + request.Invocation = scopedInvocation(request.Invocation, invocation) + validation := &pluginv1.ComponentRequest{Invocation: request.Invocation, Provider: request.Provider, RootDirectory: request.RootDirectory, Operation: request.Operation, Effects: request.Effects, ProviderConfiguration: request.ProviderConfiguration} + if err := p.validateOperation(call, handle, validation); err != nil { + return err + } + var err error + result, err = handle.Discovery.Discover(call, request) + if err != nil { + return err + } + return p.checkDiscovery(result) + }) + if err != nil { + return nil, err + } + return result, nil +} + +// Validate returns explicit diagnostics for rendering through the host's masked I/O. +func (p *Provider) Validate(ctx context.Context, input *pluginv1.ComponentRequest) (*pluginv1.ValidateResponse, error) { + defer perf.Track(nil, "componentadapter.Validate")() + + request, err := p.componentRequest(input, false) + if err != nil { + return nil, err + } + var result *pluginv1.ValidateResponse + err = p.invoke(ctx, extension.ComponentValidation, func(call context.Context, handle *native.Handle, invocation *pluginv1.Invocation) error { + request.Invocation = scopedInvocation(request.Invocation, invocation) + var err error + result, err = handle.Validation.Validate(call, request) + return err + }) + if err != nil { + return nil, err + } + return result, nil +} + +// Prepare reevaluates a selected instance after semantic validation. It never +// executes the returned engine or writes the returned artifacts. +func (p *Provider) Prepare(ctx context.Context, input *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + defer perf.Track(nil, "componentadapter.Prepare")() + + request, err := p.componentRequest(input, true) + if err != nil { + return nil, err + } + var result *pluginv1.PrepareComponentResponse + err = p.invoke(ctx, extension.ComponentPreparation, func(call context.Context, handle *native.Handle, invocation *pluginv1.Invocation) error { + request.Invocation = scopedInvocation(request.Invocation, invocation) + if err := p.validateOperation(call, handle, request); err != nil { + return err + } + var err error + result, err = handle.Preparation.Prepare(call, request) + if err != nil { + return err + } + return checkPreparation(result) + }) + if err != nil { + return nil, err + } + return result, nil +} + +// ResolveState obtains backend/workspace identity without discovery or preparation. +func (p *Provider) ResolveState(ctx context.Context, input *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + defer perf.Track(nil, "componentadapter.ResolveState")() + + request, err := p.componentRequest(input, true) + if err != nil { + return nil, err + } + var result *pluginv1.ResolveComponentStateResponse + err = p.invoke(ctx, extension.ComponentState, func(call context.Context, handle *native.Handle, invocation *pluginv1.Invocation) error { + request.Invocation = scopedInvocation(request.Invocation, invocation) + if err := p.validateOperation(call, handle, request); err != nil { + return err + } + var err error + result, err = handle.State.Resolve(call, request) + if err != nil { + return err + } + if result == nil { + return errUtils.ErrPluginProtocol + } + if len(result.Diagnostics) != 0 { + return errUtils.ErrPluginInvalidConfig + } + if !validState(result.State) || !validSources(result.Sources) { + return errUtils.ErrPluginProtocol + } + return nil + }) + if err != nil { + return nil, err + } + return result, nil +} diff --git a/pkg/plugin/adapter/component/calls_test.go b/pkg/plugin/adapter/component/calls_test.go new file mode 100644 index 00000000000..1329c56d25b --- /dev/null +++ b/pkg/plugin/adapter/component/calls_test.go @@ -0,0 +1,167 @@ +package component + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/zclconf/go-cty/cty" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func fixtureProvider(t *testing.T) *Provider { + t.Helper() + registry, err := NewRegistry(fixtureActivations(t)) + require.NoError(t, err) + p, found := registry.Get("fixture/hcl") + require.True(t, found) + return p +} + +func wireValue(t *testing.T, value cty.Value) *pluginv1.ComponentValue { + t.Helper() + typeJSON, err := ctyjson.MarshalType(value.Type()) + require.NoError(t, err) + payload, err := msgpack.Marshal(value, value.Type()) + require.NoError(t, err) + return &pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload} +} + +func TestProviderCallsPreserveValuesAndIsolateInvocations(t *testing.T) { + p := fixtureProvider(t) + root := t.TempDir() + number, err := cty.ParseNumberVal("9007199254740993123456789.123456789") + require.NoError(t, err) + request := &pluginv1.ComponentRequest{ + RootDirectory: root, Address: fixtureAddress(), + Invocation: &pluginv1.Invocation{Id: "caller-id", Interactive: true, Environment: map[string]string{"EXPLICIT": "value"}}, + Operation: &pluginv1.ComponentOperation{Command: "plan", Mode: "native"}, + Configuration: wireValue(t, cty.ObjectVal(map[string]cty.Value{"exact": number, "unknown": cty.UnknownVal(cty.String)})), + ProviderConfiguration: wireValue(t, cty.ObjectVal(map[string]cty.Value{"limit": number})), + } + request.Configuration.SensitivePaths = []*pluginv1.ComponentValuePath{{}} + before := proto.Clone(request) + state, err := p.ResolveState(t.Context(), request) + require.NoError(t, err) + require.Equal(t, "development", state.State.Workspace) + require.NoFileExists(t, filepath.Join(root, "preparation.pb")) + validated, err := p.Validate(t.Context(), request) + require.NoError(t, err) + require.Empty(t, validated.Diagnostics) + discovery, err := p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: root, Operation: request.Operation, ProviderConfiguration: request.ProviderConfiguration}) + require.NoError(t, err) + require.Len(t, discovery.Components, 1) + require.Equal(t, "dev/app", discovery.Components[0].Address.Component) + prepared, err := p.Prepare(t.Context(), request) + require.NoError(t, err) + require.True(t, proto.Equal(request.Configuration, prepared.Inputs)) + require.Len(t, prepared.Files, 1) + require.Equal(t, []byte("$${literal}\n%{ literal }\n"), prepared.Files[0].Content) + require.NoFileExists(t, filepath.Join(root, "backend.tf"), "adapter does not materialize artifacts") + require.True(t, proto.Equal(before, request), "adapter must not mutate caller input") + seen := &pluginv1.ComponentRequest{} + raw, err := os.ReadFile(filepath.Join(root, "preparation.pb")) + require.NoError(t, err) + require.NoError(t, proto.Unmarshal(raw, seen)) + require.NotEmpty(t, seen.Invocation.Id) + require.NotEqual(t, "caller-id", seen.Invocation.Id) + require.False(t, seen.Invocation.Interactive) + require.Equal(t, map[string]string{"EXPLICIT": "value"}, seen.Invocation.Environment) + require.True(t, proto.Equal(request.ProviderConfiguration, seen.ProviderConfiguration)) +} + +func TestValidationRejectsBeforeDiscoveryPreparationOrState(t *testing.T) { + p := fixtureProvider(t) + root := t.TempDir() + request := &pluginv1.ComponentRequest{RootDirectory: root, Address: fixtureAddress(), Operation: &pluginv1.ComponentOperation{Command: "invalid"}} + validation, err := p.Validate(t.Context(), request) + require.NoError(t, err) + require.Len(t, validation.Diagnostics, 1) + require.Equal(t, "operation.command", validation.Diagnostics[0].Field) + _, err = p.Prepare(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = p.ResolveState(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: root, Operation: request.Operation}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + for _, name := range []string{"discovery.pb", "preparation.pb", "state.pb"} { + require.NoFileExists(t, filepath.Join(root, name)) + } +} + +func TestRPCFailuresAndDeadlineAreSafe(t *testing.T) { + p := fixtureProvider(t) + request := &pluginv1.ComponentRequest{RootDirectory: t.TempDir(), Address: fixtureAddress(), Operation: &pluginv1.ComponentOperation{Command: "rpc-error"}} + _, err := p.Prepare(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginAPI) + require.NotContains(t, err.Error(), "secret-value") + request.Operation.Command = "unsupported" + _, err = p.ResolveState(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + request.Operation.Command = "wait" + p.timeout = 50 * time.Millisecond + _, err = p.Prepare(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginTimeout) + require.ErrorIs(t, err, context.DeadlineExceeded) +} + +func TestProviderWithoutValidatorStillHasIndependentStateCapability(t *testing.T) { + items := fixtureActivations(t) + registry, err := NewRegistry(items[3:]) + require.NoError(t, err) + p, _ := registry.Get("fixture/hcl") + require.True(t, p.Supports(extension.ComponentState)) + require.False(t, p.Supports(extension.ComponentValidation)) + result, err := p.ResolveState(t.Context(), &pluginv1.ComponentRequest{RootDirectory: t.TempDir(), Address: fixtureAddress()}) + require.NoError(t, err) + require.Equal(t, "local", result.State.BackendType) +} + +func TestSettingsAndInvalidRequestsFailBeforeStartup(t *testing.T) { + p := fixtureProvider(t) + p.executable = filepath.Join(t.TempDir(), "absent") + for _, value := range []*pluginv1.ComponentValue{ + {}, + wireValue(t, cty.UnknownVal(cty.String)), wireValue(t, cty.NullVal(cty.String)), wireValue(t, cty.True), + wireValue(t, cty.ObjectVal(map[string]cty.Value{"secret-value": cty.StringVal("secret-value")})), + {TypeJson: []byte(`"string"`), Msgpack: []byte{0xc1}}, + } { + _, err := p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: t.TempDir(), ProviderConfiguration: value}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + require.NotContains(t, err.Error(), "secret-value") + } + for _, request := range []*pluginv1.ComponentRequest{ + nil, + {}, + {RootDirectory: t.TempDir()}, + {RootDirectory: t.TempDir(), Address: fixtureAddress(), Provider: "different"}, + {RootDirectory: t.TempDir(), Address: &pluginv1.ComponentAddress{Stack: "live", Component: "app", ComponentType: "different"}}, + {RootDirectory: t.TempDir(), Address: fixtureAddress(), ProviderConfiguration: &pluginv1.ComponentValue{}}, + } { + _, err := p.Prepare(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = p.ResolveState(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + } + _, err := p.Validate(t.Context(), &pluginv1.ComponentRequest{RootDirectory: t.TempDir()}) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol, "a valid request reaches startup") +} + +func TestTransportCancellationAndErrorClassification(t *testing.T) { + t.Parallel() + require.NoError(t, invocationError(nil)) + require.ErrorIs(t, invocationError(status.Error(codes.Canceled, "secret")), context.Canceled) + require.ErrorIs(t, invocationError(status.Error(codes.DeadlineExceeded, "secret")), context.DeadlineExceeded) + require.ErrorIs(t, invocationError(context.Canceled), context.Canceled) +} diff --git a/pkg/plugin/adapter/component/invoke.go b/pkg/plugin/adapter/component/invoke.go new file mode 100644 index 00000000000..bd45902430e --- /dev/null +++ b/pkg/plugin/adapter/component/invoke.go @@ -0,0 +1,106 @@ +package component + +import ( + "context" + "errors" + "path/filepath" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/plugin/bridge" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/plugin/runtime/native" +) + +func (p *Provider) invoke(ctx context.Context, capability string, run func(context.Context, *native.Handle, *pluginv1.Invocation) error) error { + if err := ctx.Err(); err != nil { + return err + } + if !p.Supports(capability) { + return errUtils.ErrPluginUnsupportedExtension + } + handle, err := native.Start(ctx, p.executable, native.WithDirectory(p.directory), native.WithDescription(p.expected), native.WithCallTimeout(p.timeout)) + if err != nil { + return err + } + defer handle.Close() + // No ambient HTTP, browser, secret, or private-credential grants. Future host + // adapters must provide explicit invocation-scoped grants for allowed effects. + scope := bridge.Invocation{Namespace: p.owner + ":component:" + p.name} + err = handle.Invoke(ctx, scope, func(call context.Context, invocation *pluginv1.Invocation) error { + return run(call, handle, invocation) + }) + return invocationError(err) +} + +func invocationError(err error) error { + if err == nil { + return nil + } + for _, sentinel := range []error{errUtils.ErrPluginTimeout, errUtils.ErrPluginInvalidConfig, errUtils.ErrPluginProtocol, errUtils.ErrDuplicatePluginExtension, context.Canceled, context.DeadlineExceeded} { + if errors.Is(err, sentinel) { + return err + } + } + switch status.Code(err) { + case codes.Canceled: + return errors.Join(errUtils.ErrPluginAPI, context.Canceled) + case codes.DeadlineExceeded: + return errors.Join(errUtils.ErrPluginAPI, context.DeadlineExceeded) + case codes.Unimplemented: + return errUtils.ErrPluginUnsupportedExtension + default: + // Arbitrary plugin RPC messages can disclose evaluated credentials. + return errUtils.ErrPluginAPI + } +} + +func scopedInvocation(original, scoped *pluginv1.Invocation) *pluginv1.Invocation { + result := &pluginv1.Invocation{} + if original != nil { + result = proto.Clone(original).(*pluginv1.Invocation) + } + result.Id, result.Attempt, result.Deadline = scoped.Id, scoped.Attempt, scoped.Deadline + // Interactive host services are not granted by this adapter. + result.Interactive = false + return result +} + +func (p *Provider) componentRequest(input *pluginv1.ComponentRequest, requireAddress bool) (*pluginv1.ComponentRequest, error) { + if input == nil || !filepath.IsAbs(input.RootDirectory) || (input.Provider != "" && input.Provider != p.name) { + return nil, errUtils.ErrPluginInvalidConfig + } + if requireAddress && !validAddress(input.Address) { + return nil, errUtils.ErrPluginInvalidConfig + } + if input.Address != nil && input.Address.ComponentType != p.componentType { + return nil, errUtils.ErrPluginInvalidConfig + } + if err := p.validateConfiguration(input.ProviderConfiguration); err != nil { + return nil, err + } + request := proto.Clone(input).(*pluginv1.ComponentRequest) + request.Provider = p.name + return request, nil +} + +func (p *Provider) validateOperation(ctx context.Context, handle *native.Handle, request *pluginv1.ComponentRequest) error { + if !p.Supports(extension.ComponentValidation) { + return nil + } + result, err := handle.Validation.Validate(ctx, request) + if err != nil { + return err + } + if result == nil { + return errUtils.ErrPluginProtocol + } + if len(result.Diagnostics) != 0 { + return errUtils.ErrPluginInvalidConfig + } + return nil +} diff --git a/pkg/plugin/adapter/component/main_test.go b/pkg/plugin/adapter/component/main_test.go new file mode 100644 index 00000000000..1a198dbc9a5 --- /dev/null +++ b/pkg/plugin/adapter/component/main_test.go @@ -0,0 +1,118 @@ +package component + +import ( + "context" + "os" + "path/filepath" + "testing" + + "github.com/hashicorp/go-plugin" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/emptypb" + + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +// The test executable serves a real native protocol fixture, without shell helpers. +func TestMain(m *testing.M) { + if os.Getenv("ATMOS_PLUGIN_MAGIC_COOKIE") != "" { + plugin.Serve(&plugin.ServeConfig{ + HandshakeConfig: plugin.HandshakeConfig{ProtocolVersion: 1, MagicCookieKey: "ATMOS_PLUGIN_MAGIC_COOKIE", MagicCookieValue: "atmos-native-plugin-v1"}, + Plugins: map[string]plugin.Plugin{"atmos": &fixtureProtocol{}}, GRPCServer: plugin.DefaultGRPCServer, + }) + return + } + os.Exit(m.Run()) +} + +type fixtureProtocol struct{ plugin.NetRPCUnsupportedPlugin } + +func (*fixtureProtocol) GRPCServer(_ *plugin.GRPCBroker, server *grpc.Server) error { + fixture := &componentFixture{} + pluginv1.RegisterInfoServer(server, fixture) + pluginv1.RegisterComponentDiscoveryServer(server, fixture) + pluginv1.RegisterComponentValidationServer(server, fixture) + pluginv1.RegisterComponentPreparationServer(server, fixture) + pluginv1.RegisterComponentStateServer(server, fixture) + return nil +} + +func (*fixtureProtocol) GRPCClient(context.Context, *plugin.GRPCBroker, *grpc.ClientConn) (any, error) { + return nil, os.ErrInvalid +} + +type componentFixture struct { + pluginv1.UnimplementedInfoServer + pluginv1.UnimplementedComponentDiscoveryServer + pluginv1.UnimplementedComponentValidationServer + pluginv1.UnimplementedComponentPreparationServer + pluginv1.UnimplementedComponentStateServer +} + +func (*componentFixture) Describe(context.Context, *pluginv1.DescribeRequest) (*pluginv1.DescribeResponse, error) { + raw, err := os.ReadFile("description.pb") + if err != nil { + return nil, err + } + result := &pluginv1.DescribeResponse{} + return result, proto.Unmarshal(raw, result) +} + +func (*componentFixture) Configure(context.Context, *pluginv1.ConfigureRequest) (*emptypb.Empty, error) { + return &emptypb.Empty{}, nil +} + +func (*componentFixture) Validate(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ValidateResponse, error) { + switch request.GetOperation().GetCommand() { + case "invalid": + return &pluginv1.ValidateResponse{Diagnostics: []*pluginv1.Diagnostic{{Field: "operation.command", Message: "unsupported secret-value"}}}, nil + case "wait": + <-ctx.Done() + return nil, status.FromContextError(ctx.Err()).Err() + case "rpc-error": + return nil, status.Error(codes.Internal, "must-not-disclose-secret-value") + case "unsupported": + return nil, status.Error(codes.Unimplemented, "unavailable") + } + return &pluginv1.ValidateResponse{}, nil +} + +func fixtureAddress() *pluginv1.ComponentAddress { + return &pluginv1.ComponentAddress{Stack: "live", Component: "dev/app", ComponentType: "terraform"} +} + +func fixtureState(root string) *pluginv1.ComponentStateIdentity { + return &pluginv1.ComponentStateIdentity{BackendType: "local", Workspace: "development", WorkingDirectory: root} +} + +func (*componentFixture) Discover(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + if err := recordCall(request.RootDirectory, "discovery", request); err != nil { + return nil, err + } + return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{{Address: fixtureAddress(), Provider: request.Provider, Engine: "terraform", Source: "live/app/terragrunt.hcl"}}}, nil +} + +func (*componentFixture) Prepare(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + if err := recordCall(request.RootDirectory, "preparation", request); err != nil { + return nil, err + } + return &pluginv1.PrepareComponentResponse{Engine: "terraform", WorkingDirectory: request.RootDirectory, ModuleSource: "./module", Inputs: request.Configuration, State: fixtureState(request.RootDirectory), Files: []*pluginv1.ComponentGeneratedFile{{Path: "backend.tf", Content: []byte("$${literal}\n%{ literal }\n"), IfExists: "error"}}}, nil +} + +func (*componentFixture) Resolve(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + if err := recordCall(request.RootDirectory, "state", request); err != nil { + return nil, err + } + return &pluginv1.ResolveComponentStateResponse{State: fixtureState(request.RootDirectory)}, nil +} + +func recordCall(root, method string, request proto.Message) error { + raw, err := proto.Marshal(request) + if err != nil { + return err + } + return os.WriteFile(filepath.Join(root, method+".pb"), raw, 0o600) +} diff --git a/pkg/plugin/adapter/component/registry.go b/pkg/plugin/adapter/component/registry.go new file mode 100644 index 00000000000..158d3d7505d --- /dev/null +++ b/pkg/plugin/adapter/component/registry.go @@ -0,0 +1,147 @@ +// Package component adapts native configuration services without replacing component engines. +package component + +import ( + "fmt" + "maps" + "slices" + "time" + + "github.com/santhosh-tekuri/jsonschema/v5" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +// Registry is an immutable invocation-local collection of configuration providers. +// It never mutates the global component execution registry. +type Registry struct{ providers map[string]*Provider } + +// Provider owns the verified definition of one configuration provider. +type Provider struct { + name, componentType, owner, directory, executable, schemaPath string + expected *pluginv1.DescribeResponse + timeout time.Duration + capabilities map[string]bool + schema *jsonschema.Schema +} + +// NewRegistry validates the entire batch before making any provider available. +func NewRegistry(activations []*extension.Activation) (*Registry, error) { + defer perf.Track(nil, "componentadapter.NewRegistry")() + + result := &Registry{providers: make(map[string]*Provider)} + for _, activation := range activations { + if err := result.add(activation); err != nil { + return nil, err + } + } + return result, nil +} + +func (r *Registry) add(activation *extension.Activation) error { + if err := validateActivation(activation); err != nil { + return err + } + componentType := activation.Metadata["component_type"].(string) + schemaPath := activation.Metadata["schema"].(string) + if existing := r.providers[activation.Name]; existing != nil { + if !existing.sameOwner(activation, componentType, schemaPath) || existing.capabilities[activation.Capability] { + return fmt.Errorf("%w: configuration provider %s", errUtils.ErrDuplicatePluginExtension, activation.Name) + } + existing.capabilities[activation.Capability] = true + return nil + } + compiled, err := extension.CompileSchema(activation.Directory, schemaPath) + if err != nil { + return err + } + r.providers[activation.Name] = &Provider{ + name: activation.Name, componentType: componentType, owner: activation.Package, directory: activation.Directory, + executable: activation.Executable, schemaPath: schemaPath, timeout: activation.Timeout, + expected: proto.Clone(activation.Description).(*pluginv1.DescribeResponse), schema: compiled, + capabilities: map[string]bool{activation.Capability: true}, + } + return nil +} + +func validateActivation(activation *extension.Activation) error { + if activation == nil || !extension.IsComponent(activation.Capability) || activation.Name == "" || activation.Package == "" || activation.Executable == "" || activation.Description == nil { + return errUtils.ErrPluginInvalidConfig + } + if err := extension.ValidateComponent(activation.Binding); err != nil { + return err + } + if !declaresCapability(activation) { + return errUtils.ErrPluginProtocol + } + return nil +} + +func declaresCapability(activation *extension.Activation) bool { + if activation.Description.PluginName != activation.Package { + return false + } + exported, versioned := false, false + for _, item := range activation.Description.Exports { + if item.GetService() == activation.Capability && item.GetKind() == activation.Name { + exported = true + } + } + for _, service := range activation.Description.Services { + if service.GetService() == activation.Capability && service.GetMin() == 1 && service.GetMax() == 1 { + versioned = true + } + } + return exported && versioned +} + +func (p *Provider) sameOwner(a *extension.Activation, componentType, schemaPath string) bool { + return p.owner == a.Package && p.directory == a.Directory && p.executable == a.Executable && + p.componentType == componentType && p.schemaPath == schemaPath && p.timeout == a.Timeout && proto.Equal(p.expected, a.Description) +} + +// Get looks up a configuration provider by export name. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func (r *Registry) Get(name string) (*Provider, bool) { + if r == nil { + return nil, false + } + provider, ok := r.providers[name] + return provider, ok +} + +// Names returns a deterministic copy of the registered provider names. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func (r *Registry) Names() []string { + if r == nil { + return nil + } + return slices.Sorted(maps.Keys(r.providers)) +} + +// Supports reports an independently negotiated configuration capability. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func (p *Provider) Supports(capability string) bool { return p.capabilities[capability] } + +// ComponentType identifies the component family this provider supplies. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func (p *Provider) ComponentType() string { return p.componentType } + +// ValidateSettings checks provider settings without starting its executable. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func (p *Provider) ValidateSettings(settings map[string]any) error { + if err := p.schema.Validate(settings); err != nil { + // Schema diagnostics can contain secret field values; do not expose them. + return fmt.Errorf("%w: settings for configuration provider %s", errUtils.ErrPluginInvalidConfig, p.name) + } + return nil +} diff --git a/pkg/plugin/adapter/component/registry_test.go b/pkg/plugin/adapter/component/registry_test.go new file mode 100644 index 00000000000..50d3ba41bab --- /dev/null +++ b/pkg/plugin/adapter/component/registry_test.go @@ -0,0 +1,110 @@ +package component + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" + + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func fixtureActivations(t *testing.T) []*extension.Activation { + t.Helper() + directory := t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(directory, "schema.json"), []byte(`{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"number"}}}`), 0o600)) + executable, err := os.Executable() + require.NoError(t, err) + expected := &pluginv1.DescribeResponse{PluginName: "fixture/components", PluginVersion: "0.1.0", ManifestDigest: "sha256:fixture"} + var result []*extension.Activation + for _, capability := range []string{extension.ComponentDiscovery, extension.ComponentValidation, extension.ComponentPreparation, extension.ComponentState} { + expected.Services = append(expected.Services, &pluginv1.ServiceVersionRange{Service: capability, Min: 1, Max: 1}) + expected.Exports = append(expected.Exports, &pluginv1.Export{Service: capability, Kind: "fixture/hcl"}) + result = append(result, &extension.Activation{Binding: extension.Binding{Capability: capability, Name: "fixture/hcl", Directory: directory, Metadata: map[string]any{"component_type": "terraform", "schema": "schema.json"}}, Package: expected.PluginName, Executable: executable, Description: expected}) + } + raw, err := proto.Marshal(expected) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(directory, "description.pb"), raw, 0o600)) + return result +} + +func TestRegistryGroupsCapabilitiesWithoutReplacingEngines(t *testing.T) { + t.Parallel() + activations := fixtureActivations(t) + registry, err := NewRegistry(activations) + require.NoError(t, err) + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + provider, ok := registry.Get("fixture/hcl") + require.True(t, ok) + require.Equal(t, "terraform", provider.ComponentType()) + require.True(t, provider.Supports(extension.ComponentState)) + require.False(t, provider.Supports("component.execution")) + _, ok = registry.Get("terraform") + require.False(t, ok, "provider names do not occupy the engine namespace") + activations[0].Description.PluginName = "changed" + activations[0].Metadata["component_type"] = "changed" + require.Equal(t, "fixture/components", provider.expected.PluginName) + require.Equal(t, "terraform", provider.ComponentType()) + names := registry.Names() + names[0] = "changed" + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + _, ok = (*Registry)(nil).Get("anything") + require.False(t, ok) + require.Nil(t, (*Registry)(nil).Names()) +} + +func TestRegistryRejectsPartialAndConflictingBatches(t *testing.T) { + t.Parallel() + for name, modify := range map[string]func(*extension.Activation){ + "owner": func(a *extension.Activation) { a.Package = "other/package" }, + "family": func(a *extension.Activation) { a.Metadata["component_type"] = "other" }, + "executable": func(a *extension.Activation) { a.Executable = "other" }, + "timeout": func(a *extension.Activation) { a.Timeout = time.Second }, + "duplicate": func(a *extension.Activation) { a.Capability = extension.ComponentDiscovery }, + "bad schema": func(a *extension.Activation) { a.Metadata["schema"] = "missing.json" }, + "bad type": func(a *extension.Activation) { a.Metadata["component_type"] = "" }, + "unknown key": func(a *extension.Activation) { a.Metadata["typo"] = true }, + "unknown capability": func(a *extension.Activation) { a.Capability = "unknown" }, + "missing handshake": func(a *extension.Activation) { a.Description = nil }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + items := fixtureActivations(t) + modify(items[1]) + registry, err := NewRegistry(items) + require.Error(t, err) + require.Nil(t, registry, "no partial batch may become visible") + }) + } + _, err := NewRegistry([]*extension.Activation{nil}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + empty, err := NewRegistry(nil) + require.NoError(t, err) + require.Empty(t, empty.Names()) +} + +func TestUnsupportedAndInvalidCallsDoNotStartExecutable(t *testing.T) { + t.Parallel() + items := fixtureActivations(t)[:1] + items[0].Executable = filepath.Join(t.TempDir(), "does-not-exist") + registry, err := NewRegistry(items) + require.NoError(t, err) + p, _ := registry.Get("fixture/hcl") + request := &pluginv1.ComponentRequest{RootDirectory: t.TempDir(), Address: fixtureAddress()} + _, err = p.ResolveState(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + _, err = p.Validate(t.Context(), nil) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: "relative"}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + _, err = p.Discover(ctx, &pluginv1.DiscoverComponentsRequest{RootDirectory: request.RootDirectory}) + require.ErrorIs(t, err, context.Canceled) +} diff --git a/pkg/plugin/adapter/component/responses.go b/pkg/plugin/adapter/component/responses.go new file mode 100644 index 00000000000..8827a82cefb --- /dev/null +++ b/pkg/plugin/adapter/component/responses.go @@ -0,0 +1,99 @@ +package component + +import ( + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func validAddress(address *pluginv1.ComponentAddress) bool { + return address != nil && address.Stack != "" && address.Component != "" && address.ComponentType != "" +} + +func validState(state *pluginv1.ComponentStateIdentity) bool { + return state != nil && state.BackendType != "" && state.Workspace != "" && filepath.IsAbs(state.WorkingDirectory) +} + +func validSources(sources []*pluginv1.ComponentSource) bool { + for _, source := range sources { + if source == nil || !filepath.IsLocal(source.Path) { + return false + } + switch source.Kind { + case pluginv1.ComponentSource_FILE, pluginv1.ComponentSource_DIRECTORY, pluginv1.ComponentSource_GLOB: + default: + return false + } + } + return true +} + +func validDependencies(dependencies []*pluginv1.ComponentDependency) bool { + for _, dependency := range dependencies { + if dependency == nil || !validAddress(dependency.Target) { + return false + } + if dependency.Kind != pluginv1.ComponentDependency_ORDER && dependency.Kind != pluginv1.ComponentDependency_OUTPUT { + return false + } + } + return true +} + +func (p *Provider) checkDiscovery(result *pluginv1.DiscoverComponentsResponse) error { + if result == nil { + return errUtils.ErrPluginProtocol + } + if len(result.Diagnostics) != 0 { + return errUtils.ErrPluginInvalidConfig + } + seen := make(map[[3]string]bool) + for _, item := range result.Components { + if !p.validDiscoveredComponent(item) { + return errUtils.ErrPluginProtocol + } + key := [3]string{item.Address.Stack, item.Address.ComponentType, item.Address.Component} + if seen[key] { + return errUtils.ErrDuplicatePluginExtension + } + seen[key] = true + } + return nil +} + +func (p *Provider) validDiscoveredComponent(item *pluginv1.DiscoveredComponent) bool { + if item == nil || !validAddress(item.Address) || item.Address.ComponentType != p.componentType || item.Provider != p.name || item.Engine == "" { + return false + } + return filepath.IsLocal(item.Source) && validSources(item.Sources) && validDependencies(item.Dependencies) +} + +func checkPreparation(result *pluginv1.PrepareComponentResponse) error { + if result == nil { + return errUtils.ErrPluginProtocol + } + if len(result.Diagnostics) != 0 { + return errUtils.ErrPluginInvalidConfig + } + if result.Engine == "" || result.ModuleSource == "" || !filepath.IsAbs(result.WorkingDirectory) || !validState(result.State) || !validSources(result.Sources) || !validDependencies(result.Dependencies) { + return errUtils.ErrPluginProtocol + } + return checkGeneratedFiles(result.Files) +} + +func checkGeneratedFiles(files []*pluginv1.ComponentGeneratedFile) error { + seen := make(map[string]bool) + for _, file := range files { + if file == nil || !filepath.IsLocal(file.Path) || seen[filepath.Clean(file.Path)] { + return errUtils.ErrPluginProtocol + } + seen[filepath.Clean(file.Path)] = true + switch file.IfExists { + case "error", "skip", "overwrite", "overwrite_terragrunt": + default: + return errUtils.ErrPluginProtocol + } + } + return nil +} diff --git a/pkg/plugin/adapter/component/responses_test.go b/pkg/plugin/adapter/component/responses_test.go new file mode 100644 index 00000000000..1a8178cf704 --- /dev/null +++ b/pkg/plugin/adapter/component/responses_test.go @@ -0,0 +1,82 @@ +package component + +import ( + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func TestDiscoveryRejectsInvalidOwnershipIdentityAndProvenance(t *testing.T) { + t.Parallel() + p := fixtureProvider(t) + unit := &pluginv1.DiscoveredComponent{ + Address: fixtureAddress(), Provider: p.name, Engine: "terraform", Source: "live/app.hcl", + Sources: []*pluginv1.ComponentSource{{Path: "root.hcl", Kind: pluginv1.ComponentSource_FILE}}, + Dependencies: []*pluginv1.ComponentDependency{{Target: fixtureAddress(), Kind: pluginv1.ComponentDependency_ORDER}}, + } + require.NoError(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit}})) + for name, change := range map[string]func(*pluginv1.DiscoveredComponent){ + "no address": func(v *pluginv1.DiscoveredComponent) { v.Address = nil }, + "empty identity": func(v *pluginv1.DiscoveredComponent) { v.Address.Component = "" }, + "different type": func(v *pluginv1.DiscoveredComponent) { v.Address.ComponentType = "different" }, + "different provider": func(v *pluginv1.DiscoveredComponent) { v.Provider = "different" }, + "no engine": func(v *pluginv1.DiscoveredComponent) { v.Engine = "" }, + "escaping source": func(v *pluginv1.DiscoveredComponent) { v.Source = "../outside.hcl" }, + "escaping watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Path = "../outside.hcl" }, + "unknown watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Kind = pluginv1.ComponentSource_KIND_UNSPECIFIED }, + "nil watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0] = nil }, + "unknown dependency": func(v *pluginv1.DiscoveredComponent) { + v.Dependencies[0].Kind = pluginv1.ComponentDependency_KIND_UNSPECIFIED + }, + "nil dependency": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0] = nil }, + "no target": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0].Target = nil }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + item := proto.Clone(unit).(*pluginv1.DiscoveredComponent) + change(item) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{item}}), errUtils.ErrPluginProtocol) + }) + } + require.ErrorIs(t, p.checkDiscovery(nil), errUtils.ErrPluginProtocol) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{nil}}), errUtils.ErrPluginProtocol) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit, unit}}), errUtils.ErrDuplicatePluginExtension) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) +} + +func TestPreparationRejectsUnsafeArtifactsAndMissingStateIdentity(t *testing.T) { + t.Parallel() + root := t.TempDir() + valid := &pluginv1.PrepareComponentResponse{Engine: "terraform", WorkingDirectory: root, ModuleSource: "./module", State: fixtureState(root), Files: []*pluginv1.ComponentGeneratedFile{{Path: "backend.tf", IfExists: "error"}}} + require.NoError(t, checkPreparation(valid)) + for name, change := range map[string]func(*pluginv1.PrepareComponentResponse){ + "no engine": func(v *pluginv1.PrepareComponentResponse) { v.Engine = "" }, + "no module": func(v *pluginv1.PrepareComponentResponse) { v.ModuleSource = "" }, + "no workdir": func(v *pluginv1.PrepareComponentResponse) { v.WorkingDirectory = "relative" }, + "no state": func(v *pluginv1.PrepareComponentResponse) { v.State = nil }, + "empty backend": func(v *pluginv1.PrepareComponentResponse) { v.State.BackendType = "" }, + "empty workspace": func(v *pluginv1.PrepareComponentResponse) { v.State.Workspace = "" }, + "relative backend": func(v *pluginv1.PrepareComponentResponse) { v.State.WorkingDirectory = "relative" }, + "escaping artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = "../outside.tf" }, + "absolute artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = filepath.Join(root, "absolute.tf") }, + "unknown ownership": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].IfExists = "unknown" }, + "nil artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0] = nil }, + "duplicate destination": func(v *pluginv1.PrepareComponentResponse) { + v.Files = append(v.Files, &pluginv1.ComponentGeneratedFile{Path: filepath.Join("sub", "..", "backend.tf"), IfExists: "error"}) + }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + value := proto.Clone(valid).(*pluginv1.PrepareComponentResponse) + change(value) + require.ErrorIs(t, checkPreparation(value), errUtils.ErrPluginProtocol) + }) + } + require.ErrorIs(t, checkPreparation(nil), errUtils.ErrPluginProtocol) + require.ErrorIs(t, checkPreparation(&pluginv1.PrepareComponentResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) +} diff --git a/pkg/plugin/adapter/component/settings.go b/pkg/plugin/adapter/component/settings.go new file mode 100644 index 00000000000..74f898ca469 --- /dev/null +++ b/pkg/plugin/adapter/component/settings.go @@ -0,0 +1,49 @@ +package component + +import ( + "bytes" + "encoding/json" + + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + + errUtils "github.com/cloudposse/atmos/errors" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func (p *Provider) validateConfiguration(value *pluginv1.ComponentValue) error { + settings := map[string]any{} + if value != nil { + var err error + settings, err = settingsObject(value) + if err != nil { + return err + } + } + return p.ValidateSettings(settings) +} + +// settingsObject decodes a known provider-settings object only for local schema +// validation. The original typed envelope and sensitivity paths travel unchanged +// to the plugin; resolved component inputs are not converted to JSON here. +func settingsObject(encoded *pluginv1.ComponentValue) (map[string]any, error) { + valueType, err := ctyjson.UnmarshalType(encoded.TypeJson) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + value, err := msgpack.Unmarshal(encoded.Msgpack, valueType) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + data, err := ctyjson.Marshal(value, valueType) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.UseNumber() + var settings map[string]any + if err := decoder.Decode(&settings); err != nil || settings == nil { + return nil, errUtils.ErrPluginInvalidConfig + } + return settings, nil +} diff --git a/pkg/plugin/bootstrap/components.go b/pkg/plugin/bootstrap/components.go new file mode 100644 index 00000000000..4bffbae8c7e --- /dev/null +++ b/pkg/plugin/bootstrap/components.go @@ -0,0 +1,193 @@ +package bootstrap + +import ( + "context" + "fmt" + "maps" + "slices" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + authadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/auth" + componentadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + "github.com/cloudposse/atmos/pkg/plugin/config" + "github.com/cloudposse/atmos/pkg/plugin/extension" + pluginlock "github.com/cloudposse/atmos/pkg/plugin/lock" + "github.com/cloudposse/atmos/pkg/plugin/manifest" + "github.com/cloudposse/atmos/pkg/schema" +) + +// ComponentReference requests one independently negotiated configuration capability. +type ComponentReference struct{ Provider, Capability string } + +// LoadComponents restores only referenced configuration providers and composes a +// private registry. Package installation alone never calls discovery or starts a +// native process. The caller supplies references from explicitly enabled config. +func LoadComponents(ctx context.Context, atmos *schema.AtmosConfiguration, references []ComponentReference, options ...Option) (*componentadapter.Registry, error) { + defer perf.Track(atmos, "pluginbootstrap.LoadComponents")() + + if err := ctx.Err(); err != nil { + return nil, err + } + if len(references) == 0 { + return componentadapter.NewRegistry(nil) + } + if atmos == nil { + return nil, errUtils.ErrPluginInvalidConfig + } + if err := validComponentReferences(references); err != nil { + return nil, err + } + selected, err := componentPackages(ctx, atmos, references) + if err != nil { + return nil, err + } + if len(selected.Plugins.Packages) == 0 { + return nil, errUtils.ErrPluginUnsupportedExtension + } + temporary, err := PrepareAvailable(ctx, atmos, options...) + if err != nil { + return nil, err + } + defer temporary() + registry, err := activateComponentPackages(ctx, selected) + if err != nil { + return nil, err + } + if err := requireComponentReferences(registry, references); err != nil { + return nil, err + } + return registry, nil +} + +func requireComponentReferences(registry *componentadapter.Registry, references []ComponentReference) error { + for _, reference := range references { + provider, exists := registry.Get(reference.Provider) + if !exists || !provider.Supports(reference.Capability) { + return fmt.Errorf("%w: %s (%s)", errUtils.ErrPluginUnsupportedExtension, reference.Provider, reference.Capability) + } + } + return nil +} + +func activateComponentPackages(ctx context.Context, atmos *schema.AtmosConfiguration) (*componentadapter.Registry, error) { + state, err := selectedPackages(ctx, atmos) + if err != nil { + return nil, err + } + announceLocal(atmos, state) + constructors := newConstructors(&authadapter.Services{}) + descriptors, err := descriptors(constructors) + if err != nil { + return nil, err + } + if err := activatePackages(ctx, state, descriptors, atmos.Plugins.Packages); err != nil { + return nil, err + } + registry, err := componentadapter.NewRegistry(constructors.Components) + if err != nil { + return nil, err + } + return registry, nil +} + +func validComponentReferences(references []ComponentReference) error { + for _, reference := range references { + if reference.Provider == "" || !extension.IsComponent(reference.Capability) { + return errUtils.ErrPluginInvalidConfig + } + } + return nil +} + +func componentPackages(ctx context.Context, atmos *schema.AtmosConfiguration, references []ComponentReference) (*schema.AtmosConfiguration, error) { + state, err := readSelections(ctx, atmos) + if err != nil { + return nil, err + } + file, err := pluginlock.Load(ProjectDirectory(atmos)) + if err != nil { + return nil, err + } + selected := *atmos + selected.Plugins.Packages = make(map[string]schema.PluginPackage) + owners := make(map[ComponentReference]string) + var unlocked []string + for _, alias := range slices.Sorted(maps.Keys(atmos.Plugins.Packages)) { + declaration := atmos.Plugins.Packages[alias] + if !enabled(&declaration) { + continue + } + exports, known, err := componentPackageExports(alias, state, file) + if err != nil { + return nil, err + } + if !known { + unlocked = append(unlocked, alias) + continue + } + matched, err := selectComponentOwner(alias, references, exports, owners) + if err != nil { + return nil, err + } + if matched { + selected.Plugins.Packages[alias] = declaration + } + } + selectUnresolvedComponents(atmos, &selected, references, owners, unlocked) + return &selected, nil +} + +func selectUnresolvedComponents(atmos, selected *schema.AtmosConfiguration, references []ComponentReference, owners map[ComponentReference]string, unlocked []string) { + for _, reference := range references { + if owners[reference] != "" { + continue + } + for _, alias := range unlocked { + selected.Plugins.Packages[alias] = atmos.Plugins.Packages[alias] + } + return + } +} + +func selectComponentOwner(alias string, references []ComponentReference, exports map[ComponentReference]bool, owners map[ComponentReference]string) (bool, error) { + matched := false + for _, reference := range references { + if !exports[reference] { + continue + } + if owner := owners[reference]; owner != "" && owner != alias { + return false, errUtils.ErrDuplicatePluginExtension + } + owners[reference] = alias + matched = true + } + return matched, nil +} + +func componentPackageExports(alias string, state *config.Selections, file *pluginlock.File) (map[ComponentReference]bool, bool, error) { + result := make(map[ComponentReference]bool) + if local, exists := state.Packages[alias]; exists { + definition, err := manifest.Load(local.Path) + if err != nil { + return nil, true, err + } + registry, err := Descriptors() + if err != nil { + return nil, true, err + } + bindings, err := registry.Discover(definition.Spec.Capabilities) + if err != nil { + return nil, true, err + } + for _, binding := range bindings { + result[ComponentReference{Provider: binding.Name, Capability: binding.Capability}] = true + } + return result, true, nil + } + entry, exists := file.Spec.Packages[alias] + for _, export := range entry.Exports { + result[ComponentReference{Provider: export.Name, Capability: export.Capability}] = true + } + return result, exists, nil +} diff --git a/pkg/plugin/bootstrap/components_test.go b/pkg/plugin/bootstrap/components_test.go new file mode 100644 index 00000000000..d1fc6859750 --- /dev/null +++ b/pkg/plugin/bootstrap/components_test.go @@ -0,0 +1,207 @@ +package bootstrap + +import ( + "context" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/require" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/component" + "github.com/cloudposse/atmos/pkg/component/terraform" + "github.com/cloudposse/atmos/pkg/plugin/config" + "github.com/cloudposse/atmos/pkg/plugin/extension" + "github.com/cloudposse/atmos/pkg/plugin/install" + pluginlock "github.com/cloudposse/atmos/pkg/plugin/lock" + "github.com/cloudposse/atmos/pkg/schema" +) + +const componentManifest = `apiVersion: atmos/v1 +kind: AtmosPluginConfig +metadata: + name: fixture/components + version: 1.0.0 +spec: + runtime: {type: native, protocol: 1, executable: bin/plugin} + compatibility: {protocol: ">=1 <2"} + platforms: + PLATFORM: {executable: bin/plugin} + capabilities: + components: + discovery: + fixture/hcl: {component_type: terraform, schema: schemas/config.json} + state: + fixture/hcl: {component_type: terraform, schema: schemas/config.json} +` + +func localComponentFixture(t *testing.T) *schema.AtmosConfiguration { + t.Helper() + directory := localPackageFixture(t) + require.NoError(t, os.Mkdir(filepath.Join(directory, "schemas"), 0o700)) + require.NoError(t, os.WriteFile(filepath.Join(directory, "schemas", "config.json"), []byte(`{"type":"object"}`), 0o600)) + require.NoError(t, os.WriteFile(filepath.Join(directory, "plugin.yaml"), []byte(strings.ReplaceAll(componentManifest, "PLATFORM", install.CurrentPlatform())), 0o600)) + return &schema.AtmosConfiguration{BasePathConfigDir: t.TempDir(), Plugins: schema.PluginsConfig{Packages: map[string]schema.PluginPackage{"fixture": {Path: directory}}}} +} + +func componentReferences() []ComponentReference { + return []ComponentReference{{Provider: "fixture/hcl", Capability: extension.ComponentDiscovery}, {Provider: "fixture/hcl", Capability: extension.ComponentState}} +} + +func TestLoadComponentsIsExplicitLazyAndKeepsPrivateRegistries(t *testing.T) { + previous := component.ListProviders() + t.Cleanup(func() { + component.Reset() + for _, providers := range previous { + for _, provider := range providers { + require.NoError(t, component.Register(provider)) + } + } + }) + engine := terraform.New(nil) + require.NoError(t, component.Register(engine)) + atmos := localComponentFixture(t) + registry, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.NoError(t, err, "static non-executable fixture must not run during activation") + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + p, ok := registry.Get("fixture/hcl") + require.True(t, ok) + require.Equal(t, "terraform", p.ComponentType()) + require.True(t, p.Supports(extension.ComponentState)) + requireNoLock(t, atmos) + second, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.NoError(t, err) + p2, _ := second.Get("fixture/hcl") + require.NotSame(t, p, p2, "one invocation must not overwrite another provider registry") + _, ok = registry.Get("terraform") + require.False(t, ok) + after, found := component.GetProvider("terraform") + require.True(t, found) + require.Same(t, engine, after, "configuration activation must not replace the execution engine") +} + +func TestNoComponentReferencesDoNotInspectBrokenPackages(t *testing.T) { + t.Parallel() + atmos := localComponentFixture(t) + require.NoError(t, os.Remove(filepath.Join(atmos.Plugins.Packages["fixture"].Path, "plugin.yaml"))) + registry, err := LoadComponents(t.Context(), atmos, nil) + require.NoError(t, err) + require.Empty(t, registry.Names()) + requireNoLock(t, atmos) + _, err = LoadComponents(t.Context(), atmos, componentReferences()) + require.Error(t, err, "an explicit reference must report a broken enabled package") +} + +func TestDisabledAndMissingCapabilitiesCannotActivate(t *testing.T) { + t.Parallel() + atmos := localComponentFixture(t) + disabled := false + entry := atmos.Plugins.Packages["fixture"] + entry.Enabled = &disabled + atmos.Plugins.Packages["fixture"] = entry + _, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + entry.Enabled = nil + atmos.Plugins.Packages["fixture"] = entry + refs := append(componentReferences(), ComponentReference{Provider: "fixture/hcl", Capability: extension.ComponentPreparation}) + _, err = LoadComponents(t.Context(), atmos, refs) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + _, err = LoadComponents(t.Context(), nil, refs) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = LoadComponents(t.Context(), atmos, []ComponentReference{{Provider: "fixture/hcl", Capability: "auth.provider"}}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + _, err = LoadComponents(ctx, atmos, refs) + require.ErrorIs(t, err, context.Canceled) +} + +func TestDuplicateComponentOwnersFailBeforeRegistration(t *testing.T) { + t.Parallel() + atmos := localComponentFixture(t) + atmos.Plugins.Packages["duplicate"] = atmos.Plugins.Packages["fixture"] + registry, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.ErrorIs(t, err, errUtils.ErrDuplicatePluginExtension) + require.Nil(t, registry) + requireNoLock(t, atmos) +} + +func TestLockedComponentReferencesAreCapabilityQualified(t *testing.T) { + t.Parallel() + file := &pluginlock.File{} + file.Spec.Packages = map[string]pluginlock.Entry{"fixture": {Exports: []pluginlock.Export{{Capability: "auth.provider", Name: "fixture/hcl"}, {Capability: extension.ComponentState, Name: "fixture/hcl"}}}} + exports, known, err := componentPackageExports("fixture", &config.Selections{}, file) + require.NoError(t, err) + require.True(t, known) + require.False(t, exports[ComponentReference{Provider: "fixture/hcl", Capability: extension.ComponentDiscovery}]) + require.True(t, exports[ComponentReference{Provider: "fixture/hcl", Capability: extension.ComponentState}]) + _, known, err = componentPackageExports("missing", &config.Selections{}, file) + require.NoError(t, err) + require.False(t, known) +} + +func TestLoadComponentsRestoresReleasedPackageAndReusesLock(t *testing.T) { + atmos, requests := automaticFixture(t, componentManifest) + registry, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.NoError(t, err) + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + require.Positive(t, requests.Load()) + before, err := os.ReadFile(pluginlock.Path(ProjectDirectory(atmos))) + require.NoError(t, err) + requests.Store(0) + registry, err = LoadComponents(t.Context(), atmos, componentReferences()) + require.NoError(t, err) + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + require.Zero(t, requests.Load(), "cached providers must not contact the registry") + after, err := os.ReadFile(pluginlock.Path(ProjectDirectory(atmos))) + require.NoError(t, err) + require.Equal(t, before, after) + atmos.Plugins.CacheDir = t.TempDir() + _, err = LoadComponents(t.Context(), atmos, componentReferences()) + require.NoError(t, err) + require.Positive(t, requests.Load(), "missing cache is restored from the reviewed lock") +} + +func TestUnreferencedAndUnlockedComponentPackagesDoNotRunInCI(t *testing.T) { + withCI(t, true) + atmos, requests := automaticFixture(t, componentManifest) + registry, err := LoadComponents(t.Context(), atmos, nil) + require.NoError(t, err) + require.Empty(t, registry.Names()) + require.Zero(t, requests.Load()) + _, err = LoadComponents(t.Context(), atmos, componentReferences()) + require.ErrorIs(t, err, errUtils.ErrPluginUnlockedInCI) + require.Zero(t, requests.Load()) + requireNoLock(t, atmos) +} + +func TestMalformedComponentMetadataCannotActivate(t *testing.T) { + t.Parallel() + for name, edit := range map[string]func(*testing.T, string){ + "unknown capability": func(t *testing.T, dir string) { + raw, err := os.ReadFile(filepath.Join(dir, "plugin.yaml")) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(dir, "plugin.yaml"), []byte(strings.ReplaceAll(string(raw), "discovery:", "unknown:")), 0o600)) + }, + "missing executable": func(t *testing.T, dir string) { require.NoError(t, os.Remove(filepath.Join(dir, "bin", "plugin"))) }, + "missing schema": func(t *testing.T, dir string) { + require.NoError(t, os.Remove(filepath.Join(dir, "schemas", "config.json"))) + }, + "inconsistent type": func(t *testing.T, dir string) { + raw, err := os.ReadFile(filepath.Join(dir, "plugin.yaml")) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(dir, "plugin.yaml"), []byte(strings.Replace(string(raw), "component_type: terraform", "component_type: other", 1)), 0o600)) + }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + atmos := localComponentFixture(t) + edit(t, atmos.Plugins.Packages["fixture"].Path) + registry, err := LoadComponents(t.Context(), atmos, componentReferences()) + require.Error(t, err) + require.Nil(t, registry) + }) + } +} diff --git a/pkg/plugin/bootstrap/descriptors.go b/pkg/plugin/bootstrap/descriptors.go index e74bb7ab6f7..fe290168e4f 100644 --- a/pkg/plugin/bootstrap/descriptors.go +++ b/pkg/plugin/bootstrap/descriptors.go @@ -22,11 +22,16 @@ func Descriptors() (*extension.Registry, error) { } func descriptors(constructors *ConstructorSet) (*extension.Registry, error) { + const componentsPath = "components" registry := extension.New() for _, descriptor := range []extension.Descriptor{ {Capability: "auth.provider", Path: []string{"auth", "providers"}, Version: 1, Validate: extension.ValidateAuth, Scaffold: "plugin-oidc"}, {Capability: "command", Path: []string{"commands"}, Version: 1, Validate: extension.ValidateCommand}, {Capability: "auth.identity", Path: []string{"auth", "identities"}, Version: 1, Validate: extension.ValidateAuth, Scaffold: "plugin-oidc"}, + {Capability: extension.ComponentDiscovery, Path: []string{componentsPath, "discovery"}, Version: 1, Validate: extension.ValidateComponent}, + {Capability: extension.ComponentValidation, Path: []string{componentsPath, "validation"}, Version: 1, Validate: extension.ValidateComponent}, + {Capability: extension.ComponentPreparation, Path: []string{componentsPath, "preparation"}, Version: 1, Validate: extension.ValidateComponent}, + {Capability: extension.ComponentState, Path: []string{componentsPath, "state"}, Version: 1, Validate: extension.ValidateComponent}, } { if constructors != nil { descriptor.Activate = constructors.activator(descriptor.Capability) @@ -44,6 +49,7 @@ type ConstructorSet struct { Services adapter.Services Credentials *credential.Registry Commands map[string]*extension.Activation + Components []*extension.Activation } func newConstructors(services *adapter.Services) *ConstructorSet { @@ -87,6 +93,15 @@ func (c *ConstructorSet) identity(binding extension.Binding, definition *adapter } func (c *ConstructorSet) activator(capability string) func(context.Context, *extension.Activation) error { + if extension.IsComponent(capability) { + return func(ctx context.Context, activation *extension.Activation) error { + if err := ctx.Err(); err != nil { + return err + } + c.Components = append(c.Components, activation) + return nil + } + } adapters := map[string]func(extension.Binding, *adapter.Definition) error{"auth.provider": c.provider, "auth.identity": c.identity} if capability == "command" { return c.command diff --git a/pkg/plugin/bootstrap/selection_test.go b/pkg/plugin/bootstrap/selection_test.go index 238e951945d..d7230bae3da 100644 --- a/pkg/plugin/bootstrap/selection_test.go +++ b/pkg/plugin/bootstrap/selection_test.go @@ -197,13 +197,19 @@ func declareLocal(atmos *schema.AtmosConfiguration, alias, directory string) { atmos.Plugins.Packages[alias] = declaration } -func automaticFixture(t *testing.T) (*schema.AtmosConfiguration, *atomic.Int64) { +func automaticFixture(t *testing.T, definitions ...string) (*schema.AtmosConfiguration, *atomic.Int64) { t.Helper() project, directory := t.TempDir(), t.TempDir() require.NoError(t, os.WriteFile(filepath.Join(project, "atmos.yaml"), []byte("# preserve project configuration\n"), 0o600)) require.NoError(t, os.Mkdir(filepath.Join(directory, "bin"), 0o700)) require.NoError(t, os.WriteFile(filepath.Join(directory, "bin", "plugin"), []byte("static fixture; never executed"), 0o700)) - require.NoError(t, os.WriteFile(filepath.Join(directory, "plugin.yaml"), []byte(strings.ReplaceAll(automaticManifest, "PLATFORM", install.CurrentPlatform())), 0o600)) + definition := automaticManifest + if len(definitions) != 0 { + definition = definitions[0] + require.NoError(t, os.Mkdir(filepath.Join(directory, "schemas"), 0o700)) + require.NoError(t, os.WriteFile(filepath.Join(directory, "schemas", "config.json"), []byte(`{"type":"object"}`), 0o600)) + } + require.NoError(t, os.WriteFile(filepath.Join(directory, "plugin.yaml"), []byte(strings.ReplaceAll(definition, "PLATFORM", install.CurrentPlatform())), 0o600)) descriptors, err := Descriptors() require.NoError(t, err) index, err := pluginoci.BuildIndex(directory, descriptors) diff --git a/pkg/plugin/extension/component.go b/pkg/plugin/extension/component.go new file mode 100644 index 00000000000..97b71e5905f --- /dev/null +++ b/pkg/plugin/extension/component.go @@ -0,0 +1,47 @@ +package extension + +import ( + "strings" + + "github.com/cloudposse/atmos/pkg/perf" +) + +const ( + ComponentDiscovery = "component.discovery" + ComponentValidation = "component.validation" + ComponentPreparation = "component.preparation" + ComponentState = "component.state" +) + +// IsComponent reports whether a capability supplies component configuration. +// +//nolint:lintroller // Pure capability lookup; no I/O. +func IsComponent(capability string) bool { + switch capability { + case ComponentDiscovery, ComponentValidation, ComponentPreparation, ComponentState: + return true + default: + return false + } +} + +// ValidateComponent checks configuration-provider metadata without starting code. +func ValidateComponent(binding Binding) error { + defer perf.Track(nil, "extension.ValidateComponent")() + + for key := range binding.Metadata { + if key != "component_type" && key != "schema" { + return invalidMetadata("Unsupported component configuration export metadata.", "Declare only `component_type` and `schema` for this contract version.") + } + } + componentType, ok := binding.Metadata["component_type"].(string) + if !ok || componentType == "" || strings.TrimSpace(componentType) != componentType { + return invalidMetadata("The configuration export has no valid `component_type`.", "Name the component family it supplies, for example `terraform`.") + } + schemaPath, ok := binding.Metadata["schema"].(string) + if !ok { + return invalidMetadata("The configuration export has no `schema` path.", "Declare a package-local JSON Schema for provider settings.") + } + _, err := CompileSchema(binding.Directory, schemaPath) + return err +} diff --git a/pkg/plugin/extension/component_test.go b/pkg/plugin/extension/component_test.go new file mode 100644 index 00000000000..a0aced90288 --- /dev/null +++ b/pkg/plugin/extension/component_test.go @@ -0,0 +1,44 @@ +package extension + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + + errUtils "github.com/cloudposse/atmos/errors" +) + +func TestComponentMetadataRequiresLocalSchemaAndFamily(t *testing.T) { + t.Parallel() + directory := t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(directory, "config.json"), []byte(`{"type":"object"}`), 0o600)) + for name, metadata := range map[string]map[string]any{ + "missing type": {"schema": "config.json"}, + "non-string type": {"component_type": true, "schema": "config.json"}, + "empty type": {"component_type": "", "schema": "config.json"}, + "padded type": {"component_type": " terraform ", "schema": "config.json"}, + "missing schema": {"component_type": "terraform"}, + "non-string schema": {"component_type": "terraform", "schema": true}, + "remote schema": {"component_type": "terraform", "schema": "https://example.invalid/config.json"}, + "undeclared option": {"component_type": "terraform", "schema": "config.json", "execute": true}, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + err := ValidateComponent(Binding{Directory: directory, Metadata: metadata}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + }) + } + require.NoError(t, ValidateComponent(Binding{Directory: directory, Metadata: map[string]any{"component_type": "terraform", "schema": "config.json"}})) +} + +func TestComponentServicesAreIndependentOfExecution(t *testing.T) { + t.Parallel() + for _, capability := range []string{ComponentDiscovery, ComponentValidation, ComponentPreparation, ComponentState} { + require.True(t, IsComponent(capability)) + } + for _, capability := range []string{"", "command", "auth.provider", "component.execution"} { + require.False(t, IsComponent(capability)) + } +} diff --git a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go index 7bfc4bd9c3a..5ec7330748a 100644 --- a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go +++ b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go @@ -2394,11 +2394,13 @@ type DiscoverComponentsRequest struct { IncludePaths []string `protobuf:"bytes,5,rep,name=include_paths,json=includePaths,proto3" json:"include_paths,omitempty"` ExcludePaths []string `protobuf:"bytes,6,rep,name=exclude_paths,json=excludePaths,proto3" json:"exclude_paths,omitempty"` // Explicit imports and automatic discovery share one evaluator. - Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` - Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` - Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` + // Provider settings are distinct from resolved component configuration. + ProviderConfiguration *ComponentValue `protobuf:"bytes,10,opt,name=provider_configuration,json=providerConfiguration,proto3" json:"provider_configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DiscoverComponentsRequest) Reset() { @@ -2494,6 +2496,13 @@ func (x *DiscoverComponentsRequest) GetEffects() *ComponentEffects { return nil } +func (x *DiscoverComponentsRequest) GetProviderConfiguration() *ComponentValue { + if x != nil { + return x.ProviderConfiguration + } + return nil +} + type DiscoverComponentsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Components []*DiscoveredComponent `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` @@ -2547,17 +2556,18 @@ func (x *DiscoverComponentsResponse) GetDiagnostics() []*Diagnostic { } type ComponentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` - Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` - Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` - Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` - Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` + ProviderConfiguration *ComponentValue `protobuf:"bytes,9,opt,name=provider_configuration,json=providerConfiguration,proto3" json:"provider_configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ComponentRequest) Reset() { @@ -2646,6 +2656,13 @@ func (x *ComponentRequest) GetConfiguration() *ComponentValue { return nil } +func (x *ComponentRequest) GetProviderConfiguration() *ComponentValue { + if x != nil { + return x.ProviderConfiguration + } + return nil +} + type ComponentStateIdentity struct { state protoimpl.MessageState `protogen:"open.v1"` BackendType string `protobuf:"bytes,1,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` @@ -3148,7 +3165,7 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\aoptions\x18\x03 \x03(\v20.atmos.plugin.v1.ComponentOperation.OptionsEntryR\aoptions\x1a[\n" + "\fOptionsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x125\n" + - "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\x9b\x03\n" + + "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\xf3\x03\n" + "\x19DiscoverComponentsRequest\x12;\n" + "\n" + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + @@ -3160,12 +3177,14 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\rexclude_paths\x18\x06 \x03(\tR\fexcludePaths\x12\x18\n" + "\aimports\x18\a \x03(\tR\aimports\x12A\n" + "\toperation\x18\b \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + - "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\"\xa1\x01\n" + + "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12V\n" + + "\x16provider_configuration\x18\n" + + " \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x15providerConfiguration\"\xa1\x01\n" + "\x1aDiscoverComponentsResponse\x12D\n" + "\n" + "components\x18\x01 \x03(\v2$.atmos.plugin.v1.DiscoveredComponentR\n" + "components\x12=\n" + - "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xae\x03\n" + + "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\x86\x04\n" + "\x10ComponentRequest\x12;\n" + "\n" + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + @@ -3176,7 +3195,8 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\x06source\x18\x05 \x01(\tR\x06source\x12A\n" + "\toperation\x18\x06 \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + "\aeffects\x18\a \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12E\n" + - "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\"\xc1\x01\n" + + "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\x12V\n" + + "\x16provider_configuration\x18\t \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x15providerConfiguration\"\xc1\x01\n" + "\x16ComponentStateIdentity\x12!\n" + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + @@ -3352,69 +3372,71 @@ var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ 2, // 45: atmos.plugin.v1.DiscoverComponentsRequest.invocation:type_name -> atmos.plugin.v1.Invocation 36, // 46: atmos.plugin.v1.DiscoverComponentsRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation 35, // 47: atmos.plugin.v1.DiscoverComponentsRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects - 34, // 48: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent - 14, // 49: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 2, // 50: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 31, // 51: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress - 36, // 52: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation - 35, // 53: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects - 28, // 54: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue - 28, // 55: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue - 28, // 56: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue - 40, // 57: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity - 41, // 58: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile - 33, // 59: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency - 32, // 60: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource - 14, // 61: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 40, // 62: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity - 32, // 63: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource - 14, // 64: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 28, // 65: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue - 6, // 66: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest - 8, // 67: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest - 9, // 68: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 69: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest - 17, // 70: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest - 9, // 71: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 72: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 73: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest - 20, // 74: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest - 10, // 75: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest - 23, // 76: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest - 10, // 77: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest - 10, // 78: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest - 10, // 79: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest - 24, // 80: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest - 25, // 81: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest - 37, // 82: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest - 39, // 83: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest - 39, // 84: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest - 39, // 85: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest - 7, // 86: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse - 53, // 87: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty - 15, // 88: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 13, // 89: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 18, // 90: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse - 53, // 91: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty - 19, // 92: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 22, // 93: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse - 19, // 94: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 15, // 95: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 13, // 96: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 53, // 97: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty - 19, // 98: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 22, // 99: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse - 19, // 100: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 27, // 101: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent - 38, // 102: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse - 15, // 103: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 42, // 104: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse - 43, // 105: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse - 86, // [86:106] is the sub-list for method output_type - 66, // [66:86] is the sub-list for method input_type - 66, // [66:66] is the sub-list for extension type_name - 66, // [66:66] is the sub-list for extension extendee - 0, // [0:66] is the sub-list for field type_name + 28, // 48: atmos.plugin.v1.DiscoverComponentsRequest.provider_configuration:type_name -> atmos.plugin.v1.ComponentValue + 34, // 49: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent + 14, // 50: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 2, // 51: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 31, // 52: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress + 36, // 53: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 54: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 28, // 55: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 56: atmos.plugin.v1.ComponentRequest.provider_configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 57: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue + 28, // 58: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue + 40, // 59: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 41, // 60: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile + 33, // 61: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 32, // 62: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 63: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 40, // 64: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 32, // 65: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 66: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 28, // 67: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue + 6, // 68: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest + 8, // 69: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest + 9, // 70: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 71: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest + 17, // 72: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest + 9, // 73: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 74: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 75: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest + 20, // 76: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest + 10, // 77: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest + 23, // 78: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest + 10, // 79: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 80: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 81: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest + 24, // 82: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest + 25, // 83: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest + 37, // 84: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest + 39, // 85: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 86: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 87: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest + 7, // 88: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse + 53, // 89: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty + 15, // 90: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 91: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 18, // 92: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse + 53, // 93: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty + 19, // 94: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 95: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 96: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 15, // 97: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 98: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 53, // 99: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty + 19, // 100: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 101: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 102: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 27, // 103: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent + 38, // 104: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse + 15, // 105: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 42, // 106: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse + 43, // 107: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse + 88, // [88:108] is the sub-list for method output_type + 68, // [68:88] is the sub-list for method input_type + 68, // [68:68] is the sub-list for extension type_name + 68, // [68:68] is the sub-list for extension extendee + 0, // [0:68] is the sub-list for field type_name } func init() { file_atmos_plugin_v1_plugin_proto_init() } diff --git a/proto/atmos/plugin/v1/plugin.proto b/proto/atmos/plugin/v1/plugin.proto index 4318b4137e9..3d29a021107 100644 --- a/proto/atmos/plugin/v1/plugin.proto +++ b/proto/atmos/plugin/v1/plugin.proto @@ -206,6 +206,8 @@ message DiscoverComponentsRequest { repeated string imports = 7; ComponentOperation operation = 8; ComponentEffects effects = 9; + // Provider settings are distinct from resolved component configuration. + ComponentValue provider_configuration = 10; } message DiscoverComponentsResponse { repeated DiscoveredComponent components = 1; @@ -224,6 +226,7 @@ message ComponentRequest { ComponentOperation operation = 6; ComponentEffects effects = 7; ComponentValue configuration = 8; + ComponentValue provider_configuration = 9; } // Validation must precede discovery/preparation effects. It cannot silently // substitute CLI mode for unsupported native semantics. diff --git a/sdk/proto/atmos/plugin/v1/plugin.pb.go b/sdk/proto/atmos/plugin/v1/plugin.pb.go index 7bfc4bd9c3a..5ec7330748a 100644 --- a/sdk/proto/atmos/plugin/v1/plugin.pb.go +++ b/sdk/proto/atmos/plugin/v1/plugin.pb.go @@ -2394,11 +2394,13 @@ type DiscoverComponentsRequest struct { IncludePaths []string `protobuf:"bytes,5,rep,name=include_paths,json=includePaths,proto3" json:"include_paths,omitempty"` ExcludePaths []string `protobuf:"bytes,6,rep,name=exclude_paths,json=excludePaths,proto3" json:"exclude_paths,omitempty"` // Explicit imports and automatic discovery share one evaluator. - Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` - Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` - Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Imports []string `protobuf:"bytes,7,rep,name=imports,proto3" json:"imports,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,8,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,9,opt,name=effects,proto3" json:"effects,omitempty"` + // Provider settings are distinct from resolved component configuration. + ProviderConfiguration *ComponentValue `protobuf:"bytes,10,opt,name=provider_configuration,json=providerConfiguration,proto3" json:"provider_configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DiscoverComponentsRequest) Reset() { @@ -2494,6 +2496,13 @@ func (x *DiscoverComponentsRequest) GetEffects() *ComponentEffects { return nil } +func (x *DiscoverComponentsRequest) GetProviderConfiguration() *ComponentValue { + if x != nil { + return x.ProviderConfiguration + } + return nil +} + type DiscoverComponentsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Components []*DiscoveredComponent `protobuf:"bytes,1,rep,name=components,proto3" json:"components,omitempty"` @@ -2547,17 +2556,18 @@ func (x *DiscoverComponentsResponse) GetDiagnostics() []*Diagnostic { } type ComponentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` - Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` - Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` - Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` - Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Invocation *Invocation `protobuf:"bytes,1,opt,name=invocation,proto3" json:"invocation,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Address *ComponentAddress `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + RootDirectory string `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"` + Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"` + Operation *ComponentOperation `protobuf:"bytes,6,opt,name=operation,proto3" json:"operation,omitempty"` + Effects *ComponentEffects `protobuf:"bytes,7,opt,name=effects,proto3" json:"effects,omitempty"` + Configuration *ComponentValue `protobuf:"bytes,8,opt,name=configuration,proto3" json:"configuration,omitempty"` + ProviderConfiguration *ComponentValue `protobuf:"bytes,9,opt,name=provider_configuration,json=providerConfiguration,proto3" json:"provider_configuration,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ComponentRequest) Reset() { @@ -2646,6 +2656,13 @@ func (x *ComponentRequest) GetConfiguration() *ComponentValue { return nil } +func (x *ComponentRequest) GetProviderConfiguration() *ComponentValue { + if x != nil { + return x.ProviderConfiguration + } + return nil +} + type ComponentStateIdentity struct { state protoimpl.MessageState `protogen:"open.v1"` BackendType string `protobuf:"bytes,1,opt,name=backend_type,json=backendType,proto3" json:"backend_type,omitempty"` @@ -3148,7 +3165,7 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\aoptions\x18\x03 \x03(\v20.atmos.plugin.v1.ComponentOperation.OptionsEntryR\aoptions\x1a[\n" + "\fOptionsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x125\n" + - "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\x9b\x03\n" + + "\x05value\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x05value:\x028\x01\"\xf3\x03\n" + "\x19DiscoverComponentsRequest\x12;\n" + "\n" + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + @@ -3160,12 +3177,14 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\rexclude_paths\x18\x06 \x03(\tR\fexcludePaths\x12\x18\n" + "\aimports\x18\a \x03(\tR\aimports\x12A\n" + "\toperation\x18\b \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + - "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\"\xa1\x01\n" + + "\aeffects\x18\t \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12V\n" + + "\x16provider_configuration\x18\n" + + " \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x15providerConfiguration\"\xa1\x01\n" + "\x1aDiscoverComponentsResponse\x12D\n" + "\n" + "components\x18\x01 \x03(\v2$.atmos.plugin.v1.DiscoveredComponentR\n" + "components\x12=\n" + - "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\xae\x03\n" + + "\vdiagnostics\x18\x02 \x03(\v2\x1b.atmos.plugin.v1.DiagnosticR\vdiagnostics\"\x86\x04\n" + "\x10ComponentRequest\x12;\n" + "\n" + "invocation\x18\x01 \x01(\v2\x1b.atmos.plugin.v1.InvocationR\n" + @@ -3176,7 +3195,8 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\x06source\x18\x05 \x01(\tR\x06source\x12A\n" + "\toperation\x18\x06 \x01(\v2#.atmos.plugin.v1.ComponentOperationR\toperation\x12;\n" + "\aeffects\x18\a \x01(\v2!.atmos.plugin.v1.ComponentEffectsR\aeffects\x12E\n" + - "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\"\xc1\x01\n" + + "\rconfiguration\x18\b \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\rconfiguration\x12V\n" + + "\x16provider_configuration\x18\t \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\x15providerConfiguration\"\xc1\x01\n" + "\x16ComponentStateIdentity\x12!\n" + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + @@ -3352,69 +3372,71 @@ var file_atmos_plugin_v1_plugin_proto_depIdxs = []int32{ 2, // 45: atmos.plugin.v1.DiscoverComponentsRequest.invocation:type_name -> atmos.plugin.v1.Invocation 36, // 46: atmos.plugin.v1.DiscoverComponentsRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation 35, // 47: atmos.plugin.v1.DiscoverComponentsRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects - 34, // 48: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent - 14, // 49: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 2, // 50: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation - 31, // 51: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress - 36, // 52: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation - 35, // 53: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects - 28, // 54: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue - 28, // 55: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue - 28, // 56: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue - 40, // 57: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity - 41, // 58: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile - 33, // 59: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency - 32, // 60: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource - 14, // 61: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 40, // 62: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity - 32, // 63: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource - 14, // 64: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic - 28, // 65: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue - 6, // 66: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest - 8, // 67: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest - 9, // 68: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 69: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest - 17, // 70: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest - 9, // 71: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 72: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest - 9, // 73: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest - 20, // 74: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest - 10, // 75: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest - 23, // 76: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest - 10, // 77: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest - 10, // 78: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest - 10, // 79: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest - 24, // 80: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest - 25, // 81: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest - 37, // 82: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest - 39, // 83: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest - 39, // 84: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest - 39, // 85: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest - 7, // 86: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse - 53, // 87: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty - 15, // 88: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 13, // 89: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 18, // 90: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse - 53, // 91: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty - 19, // 92: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 22, // 93: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse - 19, // 94: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 15, // 95: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 13, // 96: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent - 53, // 97: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty - 19, // 98: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse - 22, // 99: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse - 19, // 100: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse - 27, // 101: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent - 38, // 102: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse - 15, // 103: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse - 42, // 104: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse - 43, // 105: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse - 86, // [86:106] is the sub-list for method output_type - 66, // [66:86] is the sub-list for method input_type - 66, // [66:66] is the sub-list for extension type_name - 66, // [66:66] is the sub-list for extension extendee - 0, // [0:66] is the sub-list for field type_name + 28, // 48: atmos.plugin.v1.DiscoverComponentsRequest.provider_configuration:type_name -> atmos.plugin.v1.ComponentValue + 34, // 49: atmos.plugin.v1.DiscoverComponentsResponse.components:type_name -> atmos.plugin.v1.DiscoveredComponent + 14, // 50: atmos.plugin.v1.DiscoverComponentsResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 2, // 51: atmos.plugin.v1.ComponentRequest.invocation:type_name -> atmos.plugin.v1.Invocation + 31, // 52: atmos.plugin.v1.ComponentRequest.address:type_name -> atmos.plugin.v1.ComponentAddress + 36, // 53: atmos.plugin.v1.ComponentRequest.operation:type_name -> atmos.plugin.v1.ComponentOperation + 35, // 54: atmos.plugin.v1.ComponentRequest.effects:type_name -> atmos.plugin.v1.ComponentEffects + 28, // 55: atmos.plugin.v1.ComponentRequest.configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 56: atmos.plugin.v1.ComponentRequest.provider_configuration:type_name -> atmos.plugin.v1.ComponentValue + 28, // 57: atmos.plugin.v1.ComponentStateIdentity.backend:type_name -> atmos.plugin.v1.ComponentValue + 28, // 58: atmos.plugin.v1.PrepareComponentResponse.inputs:type_name -> atmos.plugin.v1.ComponentValue + 40, // 59: atmos.plugin.v1.PrepareComponentResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 41, // 60: atmos.plugin.v1.PrepareComponentResponse.files:type_name -> atmos.plugin.v1.ComponentGeneratedFile + 33, // 61: atmos.plugin.v1.PrepareComponentResponse.dependencies:type_name -> atmos.plugin.v1.ComponentDependency + 32, // 62: atmos.plugin.v1.PrepareComponentResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 63: atmos.plugin.v1.PrepareComponentResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 40, // 64: atmos.plugin.v1.ResolveComponentStateResponse.state:type_name -> atmos.plugin.v1.ComponentStateIdentity + 32, // 65: atmos.plugin.v1.ResolveComponentStateResponse.sources:type_name -> atmos.plugin.v1.ComponentSource + 14, // 66: atmos.plugin.v1.ResolveComponentStateResponse.diagnostics:type_name -> atmos.plugin.v1.Diagnostic + 28, // 67: atmos.plugin.v1.ComponentOperation.OptionsEntry.value:type_name -> atmos.plugin.v1.ComponentValue + 6, // 68: atmos.plugin.v1.Info.Describe:input_type -> atmos.plugin.v1.DescribeRequest + 8, // 69: atmos.plugin.v1.Info.Configure:input_type -> atmos.plugin.v1.ConfigureRequest + 9, // 70: atmos.plugin.v1.AuthProvider.Validate:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 71: atmos.plugin.v1.AuthProvider.Authenticate:input_type -> atmos.plugin.v1.ProviderRequest + 17, // 72: atmos.plugin.v1.AuthProvider.Refresh:input_type -> atmos.plugin.v1.RefreshRequest + 9, // 73: atmos.plugin.v1.AuthProvider.Logout:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 74: atmos.plugin.v1.AuthProvider.Environment:input_type -> atmos.plugin.v1.ProviderRequest + 9, // 75: atmos.plugin.v1.AuthProvider.Paths:input_type -> atmos.plugin.v1.ProviderRequest + 20, // 76: atmos.plugin.v1.AuthProvider.PrepareEnvironment:input_type -> atmos.plugin.v1.PrepareEnvironmentRequest + 10, // 77: atmos.plugin.v1.AuthIdentity.Validate:input_type -> atmos.plugin.v1.IdentityRequest + 23, // 78: atmos.plugin.v1.AuthIdentity.Authenticate:input_type -> atmos.plugin.v1.IdentityAuthenticateRequest + 10, // 79: atmos.plugin.v1.AuthIdentity.Logout:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 80: atmos.plugin.v1.AuthIdentity.Environment:input_type -> atmos.plugin.v1.IdentityRequest + 10, // 81: atmos.plugin.v1.AuthIdentity.Paths:input_type -> atmos.plugin.v1.IdentityRequest + 24, // 82: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:input_type -> atmos.plugin.v1.IdentityPrepareRequest + 25, // 83: atmos.plugin.v1.Commands.Run:input_type -> atmos.plugin.v1.CommandRequest + 37, // 84: atmos.plugin.v1.ComponentDiscovery.Discover:input_type -> atmos.plugin.v1.DiscoverComponentsRequest + 39, // 85: atmos.plugin.v1.ComponentValidation.Validate:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 86: atmos.plugin.v1.ComponentPreparation.Prepare:input_type -> atmos.plugin.v1.ComponentRequest + 39, // 87: atmos.plugin.v1.ComponentState.Resolve:input_type -> atmos.plugin.v1.ComponentRequest + 7, // 88: atmos.plugin.v1.Info.Describe:output_type -> atmos.plugin.v1.DescribeResponse + 53, // 89: atmos.plugin.v1.Info.Configure:output_type -> google.protobuf.Empty + 15, // 90: atmos.plugin.v1.AuthProvider.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 91: atmos.plugin.v1.AuthProvider.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 18, // 92: atmos.plugin.v1.AuthProvider.Refresh:output_type -> atmos.plugin.v1.RefreshResponse + 53, // 93: atmos.plugin.v1.AuthProvider.Logout:output_type -> google.protobuf.Empty + 19, // 94: atmos.plugin.v1.AuthProvider.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 95: atmos.plugin.v1.AuthProvider.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 96: atmos.plugin.v1.AuthProvider.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 15, // 97: atmos.plugin.v1.AuthIdentity.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 13, // 98: atmos.plugin.v1.AuthIdentity.Authenticate:output_type -> atmos.plugin.v1.AuthenticateEvent + 53, // 99: atmos.plugin.v1.AuthIdentity.Logout:output_type -> google.protobuf.Empty + 19, // 100: atmos.plugin.v1.AuthIdentity.Environment:output_type -> atmos.plugin.v1.EnvironmentResponse + 22, // 101: atmos.plugin.v1.AuthIdentity.Paths:output_type -> atmos.plugin.v1.PathsResponse + 19, // 102: atmos.plugin.v1.AuthIdentity.PrepareEnvironment:output_type -> atmos.plugin.v1.EnvironmentResponse + 27, // 103: atmos.plugin.v1.Commands.Run:output_type -> atmos.plugin.v1.CommandEvent + 38, // 104: atmos.plugin.v1.ComponentDiscovery.Discover:output_type -> atmos.plugin.v1.DiscoverComponentsResponse + 15, // 105: atmos.plugin.v1.ComponentValidation.Validate:output_type -> atmos.plugin.v1.ValidateResponse + 42, // 106: atmos.plugin.v1.ComponentPreparation.Prepare:output_type -> atmos.plugin.v1.PrepareComponentResponse + 43, // 107: atmos.plugin.v1.ComponentState.Resolve:output_type -> atmos.plugin.v1.ResolveComponentStateResponse + 88, // [88:108] is the sub-list for method output_type + 68, // [68:88] is the sub-list for method input_type + 68, // [68:68] is the sub-list for extension type_name + 68, // [68:68] is the sub-list for extension extendee + 0, // [0:68] is the sub-list for field type_name } func init() { file_atmos_plugin_v1_plugin_proto_init() } From b26110a28530c513c50852ae0030f0b0ac8232fe Mon Sep 17 00:00:00 2001 From: "atmos-pro[bot]" <173522224+atmos-pro[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:57:43 +0000 Subject: [PATCH 03/52] [autocommit] formatting fixes --- NOTICE | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NOTICE b/NOTICE index 7543289d627..6f3da2078e2 100644 --- a/NOTICE +++ b/NOTICE @@ -1186,6 +1186,14 @@ BSD LICENSED DEPENDENCIES License: BSD-3-Clause URL: https://github.com/virtuald/go-ordered-json/blob/b18e6e673d74/LICENSE + - github.com/vmihailenco/msgpack/v5 + License: BSD-2-Clause + URL: https://github.com/vmihailenco/msgpack/blob/v5.4.1/LICENSE + + - github.com/vmihailenco/tagparser/v2 + License: BSD-2-Clause + URL: https://github.com/vmihailenco/tagparser/blob/v2.0.0/LICENSE + - github.com/yosida95/uritemplate/v3 License: BSD-3-Clause URL: https://github.com/yosida95/uritemplate/blob/v3.0.2/LICENSE From 98c54e23ca06780e8bff74e9da9a52fc8a21d636 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 29 Oct 2026 17:39:41 -0500 Subject: [PATCH 04/52] feat(plugin): wire native Terragrunt discovery and execution --- .github/workflows/plugin-sdk.yml | 24 + cmd/cmd_utils.go | 2 +- cmd/describe_stacks.go | 5 + cmd/internal/validation.go | 2 +- cmd/list/components.go | 2 +- cmd/list/instances.go | 2 +- cmd/list/stacks.go | 2 +- cmd/list/utils.go | 2 +- .../plugins/extensions/component-engines.md | 16 +- docs/prd/terragrunt-support.md | 20 +- internal/exec/configuration_stacks.go | 36 + internal/exec/configuration_stacks_test.go | 84 ++ internal/exec/mock_configuration_test.go | 72 ++ internal/exec/utils.go | 8 +- internal/exec/validate_stacks.go | 9 + pkg/component/configuration/files.go | 77 ++ pkg/component/configuration/files_test.go | 60 ++ pkg/component/configuration/registry.go | 59 ++ pkg/component/configuration/registry_test.go | 50 ++ pkg/component/terraform/all.go | 2 +- pkg/component/terraform/configuration.go | 101 +++ .../configuration_environment_test.go | 188 ++++ pkg/component/terraform/configuration_test.go | 77 ++ .../terraform/configuration_workdir_test.go | 117 +++ pkg/component/terraform/execute.go | 2 +- pkg/component/terraform/execute_pipeline.go | 43 +- pkg/component/terraform/execute_prepare.go | 9 + .../terraform/mock_configuration_test.go | 72 ++ pkg/component/terraform/provider.go | 5 + pkg/component/terraform/query.go | 2 +- pkg/config/component_configuration.go | 41 + pkg/config/component_configuration_test.go | 44 + pkg/config/config.go | 20 +- pkg/config/load.go | 1 + pkg/config/schema/overrides.go | 19 + pkg/config/utils.go | 4 +- pkg/datafetcher/schema/atmos/config/1.0.json | 131 +++ pkg/plugin/adapter/component/objects.go | 171 ++++ pkg/plugin/adapter/component/objects_test.go | 64 ++ pkg/plugin/adapter/configuration/discovery.go | 120 +++ .../adapter/configuration/environment_test.go | 47 + .../configuration/mock_provider_test.go | 86 ++ .../adapter/configuration/preparation.go | 120 +++ pkg/plugin/adapter/configuration/session.go | 157 ++++ .../adapter/configuration/session_test.go | 213 +++++ pkg/plugin/bootstrap/configuration.go | 36 + pkg/schema/component_configuration.go | 102 +++ pkg/schema/component_configuration_test.go | 43 + pkg/schema/schema.go | 6 + plugins/terragrunt/.gitignore | 1 + plugins/terragrunt/README.md | 61 ++ plugins/terragrunt/bridge/bridge.go | 61 ++ plugins/terragrunt/bridge/execution.go | 59 ++ plugins/terragrunt/bridge/execution_test.go | 51 ++ plugins/terragrunt/bridge/go.mod | 231 +++++ plugins/terragrunt/bridge/go.sum | 806 +++++++++++++++++ .../terragrunt/fixtures/advanced/README.md | 21 + plugins/terragrunt/fixtures/advanced/env.hcl | 4 + .../advanced/failures/hook/terragrunt.hcl | 18 + .../advanced/live/dev/app/terragrunt.hcl | 34 + .../advanced/live/dev/cache/terragrunt.hcl | 19 + .../advanced/live/dev/database/terragrunt.hcl | 19 + .../advanced/live/dev/network/terragrunt.hcl | 14 + .../fixtures/advanced/modules/unit/main.tf | 11 + plugins/terragrunt/fixtures/advanced/root.hcl | 32 + .../fixtures/explicit-stack/README.md | 10 + .../stacks/environment/terragrunt.stack.hcl | 19 + .../catalog/units/app/terragrunt.hcl | 31 + .../catalog/units/network/terragrunt.hcl | 17 + .../explicit-stack/live/terragrunt.stack.hcl | 23 + .../explicit-stack/modules/unit/main.tf | 11 + plugins/terragrunt/go.mod | 241 ++++++ plugins/terragrunt/go.sum | 817 ++++++++++++++++++ .../terragrunt/internal/engine/discovery.go | 171 ++++ .../internal/engine/discovery_paths.go | 94 ++ .../internal/engine/discovery_paths_test.go | 89 ++ .../internal/engine/environment_test.go | 94 ++ .../terragrunt/internal/engine/policies.go | 70 ++ plugins/terragrunt/internal/engine/resolve.go | 258 ++++++ .../internal/engine/resolve_test.go | 161 ++++ plugins/terragrunt/internal/model/model.go | 48 + .../internal/provider/boundaries_test.go | 129 +++ .../terragrunt/internal/provider/discovery.go | 93 ++ .../internal/provider/fixtures_test.go | 88 ++ .../internal/provider/preparation.go | 129 +++ .../terragrunt/internal/provider/provider.go | 179 ++++ .../internal/provider/provider_test.go | 105 +++ plugins/terragrunt/main.go | 43 + plugins/terragrunt/main_test.go | 27 + plugins/terragrunt/plugin.yaml | 52 ++ plugins/terragrunt/schemas/config.json | 1 + plugins/terragrunt/scripts/acceptance.py | 70 ++ plugins/terragrunt/scripts/build.py | 33 + ...2026-10-29-native-terragrunt-discovery.mdx | 53 ++ website/src/data/roadmap.js | 3 +- 95 files changed, 7142 insertions(+), 34 deletions(-) create mode 100644 internal/exec/configuration_stacks.go create mode 100644 internal/exec/configuration_stacks_test.go create mode 100644 internal/exec/mock_configuration_test.go create mode 100644 pkg/component/configuration/files.go create mode 100644 pkg/component/configuration/files_test.go create mode 100644 pkg/component/configuration/registry.go create mode 100644 pkg/component/configuration/registry_test.go create mode 100644 pkg/component/terraform/configuration.go create mode 100644 pkg/component/terraform/configuration_environment_test.go create mode 100644 pkg/component/terraform/configuration_test.go create mode 100644 pkg/component/terraform/configuration_workdir_test.go create mode 100644 pkg/component/terraform/mock_configuration_test.go create mode 100644 pkg/config/component_configuration.go create mode 100644 pkg/config/component_configuration_test.go create mode 100644 pkg/plugin/adapter/component/objects.go create mode 100644 pkg/plugin/adapter/component/objects_test.go create mode 100644 pkg/plugin/adapter/configuration/discovery.go create mode 100644 pkg/plugin/adapter/configuration/environment_test.go create mode 100644 pkg/plugin/adapter/configuration/mock_provider_test.go create mode 100644 pkg/plugin/adapter/configuration/preparation.go create mode 100644 pkg/plugin/adapter/configuration/session.go create mode 100644 pkg/plugin/adapter/configuration/session_test.go create mode 100644 pkg/plugin/bootstrap/configuration.go create mode 100644 pkg/schema/component_configuration.go create mode 100644 pkg/schema/component_configuration_test.go create mode 100644 plugins/terragrunt/.gitignore create mode 100644 plugins/terragrunt/README.md create mode 100644 plugins/terragrunt/bridge/bridge.go create mode 100644 plugins/terragrunt/bridge/execution.go create mode 100644 plugins/terragrunt/bridge/execution_test.go create mode 100644 plugins/terragrunt/bridge/go.mod create mode 100644 plugins/terragrunt/bridge/go.sum create mode 100644 plugins/terragrunt/fixtures/advanced/README.md create mode 100644 plugins/terragrunt/fixtures/advanced/env.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/failures/hook/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/live/dev/app/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/live/dev/cache/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/live/dev/database/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/live/dev/network/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/advanced/modules/unit/main.tf create mode 100644 plugins/terragrunt/fixtures/advanced/root.hcl create mode 100644 plugins/terragrunt/fixtures/explicit-stack/README.md create mode 100644 plugins/terragrunt/fixtures/explicit-stack/catalog/stacks/environment/terragrunt.stack.hcl create mode 100644 plugins/terragrunt/fixtures/explicit-stack/catalog/units/app/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/explicit-stack/catalog/units/network/terragrunt.hcl create mode 100644 plugins/terragrunt/fixtures/explicit-stack/live/terragrunt.stack.hcl create mode 100644 plugins/terragrunt/fixtures/explicit-stack/modules/unit/main.tf create mode 100644 plugins/terragrunt/go.mod create mode 100644 plugins/terragrunt/go.sum create mode 100644 plugins/terragrunt/internal/engine/discovery.go create mode 100644 plugins/terragrunt/internal/engine/discovery_paths.go create mode 100644 plugins/terragrunt/internal/engine/discovery_paths_test.go create mode 100644 plugins/terragrunt/internal/engine/environment_test.go create mode 100644 plugins/terragrunt/internal/engine/policies.go create mode 100644 plugins/terragrunt/internal/engine/resolve.go create mode 100644 plugins/terragrunt/internal/engine/resolve_test.go create mode 100644 plugins/terragrunt/internal/model/model.go create mode 100644 plugins/terragrunt/internal/provider/boundaries_test.go create mode 100644 plugins/terragrunt/internal/provider/discovery.go create mode 100644 plugins/terragrunt/internal/provider/fixtures_test.go create mode 100644 plugins/terragrunt/internal/provider/preparation.go create mode 100644 plugins/terragrunt/internal/provider/provider.go create mode 100644 plugins/terragrunt/internal/provider/provider_test.go create mode 100644 plugins/terragrunt/main.go create mode 100644 plugins/terragrunt/main_test.go create mode 100644 plugins/terragrunt/plugin.yaml create mode 100644 plugins/terragrunt/schemas/config.json create mode 100644 plugins/terragrunt/scripts/acceptance.py create mode 100644 plugins/terragrunt/scripts/build.py create mode 100644 website/blog/2026-10-29-native-terragrunt-discovery.mdx diff --git a/.github/workflows/plugin-sdk.yml b/.github/workflows/plugin-sdk.yml index fb29fdaa9e3..c4f92f22157 100644 --- a/.github/workflows/plugin-sdk.yml +++ b/.github/workflows/plugin-sdk.yml @@ -6,6 +6,7 @@ on: - 'sdk/**' - 'proto/**' - 'pkg/plugin/**' + - 'plugins/terragrunt/**' - 'pkg/generator/templates/plugin-oidc/**' - 'cmd/plugin/**' - 'cmd/plugin_oidc_test.go' @@ -19,6 +20,29 @@ permissions: contents: read jobs: + terragrunt-native: + name: Native Terragrunt (${{ matrix.runner }}) + runs-on: ${{ matrix.runner }} + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + runner: [ubuntu-24.04, macos-15, windows-2022] + env: + CGO_ENABLED: "0" + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + with: + go-version-file: plugins/terragrunt/go.mod + cache-dependency-path: | + plugins/terragrunt/go.sum + sdk/go.sum + - name: Build and test native evaluation and invocation isolation + run: python3 plugins/terragrunt/scripts/build.py --test + contracts: runs-on: ubuntu-latest timeout-minutes: 30 diff --git a/cmd/cmd_utils.go b/cmd/cmd_utils.go index 9917115ff82..918e1749309 100644 --- a/cmd/cmd_utils.go +++ b/cmd/cmd_utils.go @@ -1938,7 +1938,7 @@ func validateAtmosConfig(opts ...AtmosValidateOption) error { return err } - if vCfg.CheckStack { + if vCfg.CheckStack && !atmosConfig.HasComponentDiscovery() { atmosConfigExists, err := u.IsDirectory(atmosConfig.StacksBaseAbsolutePath) if !atmosConfigExists || err != nil { // Return an error with context instead of printing and exiting diff --git a/cmd/describe_stacks.go b/cmd/describe_stacks.go index 2d5482df234..10cf861bbbc 100644 --- a/cmd/describe_stacks.go +++ b/cmd/describe_stacks.go @@ -13,6 +13,7 @@ import ( "github.com/cloudposse/atmos/internal/exec" "github.com/cloudposse/atmos/pkg/auth" authdeferred "github.com/cloudposse/atmos/pkg/auth/deferred" + "github.com/cloudposse/atmos/pkg/component/configuration" cfg "github.com/cloudposse/atmos/pkg/config" "github.com/cloudposse/atmos/pkg/flags" "github.com/cloudposse/atmos/pkg/schema" @@ -70,6 +71,10 @@ func getRunnableDescribeStacksCmd( return err } + if err := configuration.Attach(cmd.Context(), &atmosConfig, "stacks"); err != nil { + return err + } + err = g.validateStacks(&atmosConfig) if err != nil { return err diff --git a/cmd/internal/validation.go b/cmd/internal/validation.go index f776a1f4d48..893edb5ce21 100644 --- a/cmd/internal/validation.go +++ b/cmd/internal/validation.go @@ -48,7 +48,7 @@ func ValidateAtmosConfig(opts ...ValidateOption) error { return err } - if vCfg.CheckStack { + if vCfg.CheckStack && !atmosConfig.HasComponentDiscovery() { atmosConfigExists, err := u.IsDirectory(atmosConfig.StacksBaseAbsolutePath) if !atmosConfigExists || err != nil { // Return an error with context instead of printing and exiting. diff --git a/cmd/list/components.go b/cmd/list/components.go index 62b36fd678c..ea58df35398 100644 --- a/cmd/list/components.go +++ b/cmd/list/components.go @@ -229,7 +229,7 @@ func initAndExtractComponents(cmd *cobra.Command, args []string, opts *Component return componentsExtractResult{}, err } - atmosConfig, err := config.InitCliConfig(configAndStacksInfo, true) + atmosConfig, err := config.InitCliConfigWithContext(cmd.Context(), configAndStacksInfo, true) if err != nil { return componentsExtractResult{}, fmt.Errorf("%w: %w", errUtils.ErrInitializingCLIConfig, err) } diff --git a/cmd/list/instances.go b/cmd/list/instances.go index f4d1e888322..9b7a212ad9c 100644 --- a/cmd/list/instances.go +++ b/cmd/list/instances.go @@ -190,7 +190,7 @@ func executeListInstancesCmd(cmd *cobra.Command, args []string, opts *InstancesO configAndStacksInfo.SubCommand = "instances" // Initialize config to create auth manager. - atmosConfig, err := cfg.InitCliConfig(configAndStacksInfo, true) + atmosConfig, err := cfg.InitCliConfigWithContext(cmd.Context(), configAndStacksInfo, true) if err != nil { return err } diff --git a/cmd/list/stacks.go b/cmd/list/stacks.go index 32104d86659..f4c59ab40a6 100644 --- a/cmd/list/stacks.go +++ b/cmd/list/stacks.go @@ -237,7 +237,7 @@ func initStacksConfig( return schema.AtmosConfiguration{}, nil, err } - atmosConfig, err := config.InitCliConfig(configAndStacksInfo, true) + atmosConfig, err := config.InitCliConfigWithContext(cmd.Context(), configAndStacksInfo, true) if err != nil { return schema.AtmosConfiguration{}, nil, fmt.Errorf("%w: %w", errUtils.ErrInitializingCLIConfig, err) } diff --git a/cmd/list/utils.go b/cmd/list/utils.go index 33933e431f7..1adf53c6209 100644 --- a/cmd/list/utils.go +++ b/cmd/list/utils.go @@ -47,7 +47,7 @@ func checkAtmosConfig(cmd *cobra.Command, v *viper.Viper, skipStackCheck ...bool } atmosConfigExists, err := u.IsDirectory(atmosConfig.StacksBaseAbsolutePath) - if !atmosConfigExists || err != nil { + if (!atmosConfigExists || err != nil) && !atmosConfig.HasComponentDiscovery() { return fmt.Errorf("atmos stacks directory not found at: %s", filepath.Join(atmosConfig.BasePath, atmosConfig.Stacks.BasePath)) } diff --git a/docs/prd/plugins/extensions/component-engines.md b/docs/prd/plugins/extensions/component-engines.md index 443c48c5a62..bbcf48d68b9 100644 --- a/docs/prd/plugins/extensions/component-engines.md +++ b/docs/prd/plugins/extensions/component-engines.md @@ -1,6 +1,6 @@ # Component configuration and engine plugins -**Status:** Implementation in progress. The protocol, SDK, native runtime clients, static component descriptors, explicit package loader, and configuration-service adapters exist. CLI discovery, stack adaptation, and execution integration are not implemented. +**Status:** Implementation in progress. The protocol, SDK, native runtime clients, static component descriptors, explicit package loader, and configuration-service adapters exist. CLI discovery, stack adaptation, and native Terraform preparation are wired on this branch. End-to-end validation is limited to local Terragrunt fixtures; the full release gates remain. **Decision:** Separate component type, configuration provider, and execution engine. Negotiate optional capabilities independently. A configuration provider must not need an executor. @@ -94,12 +94,18 @@ Cancellation must stop invocations, processes, callbacks, and descendants. Test | Layer | Required result | State | |---|---|---| | Protocol and SDK | Independent services, lossless values, optional registration, native transport tests. | Implemented in this branch; not activated by installation. | -| Host activation | Static descriptors, provider settings schemas, private registry, package selection, and service adapters. | Implemented; not connected to CLI stack processing. | -| Host composition | Flags, scoped services, discovery/import and engine adapters. | Required. | -| Terragrunt plugin | Separately built SDK package runs the advanced native fixture on stock Atmos. | Required. | -| Integration | Lists, state functions, affected, dependencies, UI, saved plans, and Pro share instances. | Required. | +| Host activation | Static descriptors, provider settings schemas, private registry, package selection, and service adapters. | Implemented; opt-in CLI discovery is wired. | +| Host composition | Flags, scoped services, discovery/import and engine adapters. | Scoped discovery and native preparation are wired. Imports and typed plugin flags remain. | +| Terragrunt plugin | Separately built SDK package runs the advanced native fixture on stock Atmos. | Local package runs advanced and nested-stack fixtures through the CLI. Published installation remains. | +| Integration | Lists, state functions, affected, dependencies, UI, saved plans, and Pro share instances. | Lists and dependency scheduling are wired. Remaining integrations require validation. | | Compatibility | Differential tests for supported constructs and explicit failures for unsupported behavior. | Required. | Require at least 90% patch coverage per layer. Test failures as well as successful calls. A protocol fixture does not prove installed-plugin or Terragrunt compatibility. The first product milestone is an installed Terragrunt plugin running the advanced native fixture through stock Atmos without snapshot patches or temporary callbacks. Port the pilot's field regressions before removing its temporary hooks. + +## Execution-context acceptance gate + +A configuration provider must receive the host execution context before it performs preparation effects. Test sanitized environments, explicit empty environments, identity selection, authentication failure, toolchain executable selection, PATH precedence, managed RC files, registry trust, cache policy, cancellation, and isolation between invocations. + +The provider does not choose the host execution directory. Atmos source/workdir provisioning owns that directory. Test that evaluated source changes preserve provision and metadata settings, that literal artifacts reach the resolved directory, and that backend identity does not change with workdir placement. Test repeated runs and two instances that use the same module. diff --git a/docs/prd/terragrunt-support.md b/docs/prd/terragrunt-support.md index 40d3db05bce..c9e8b199484 100644 --- a/docs/prd/terragrunt-support.md +++ b/docs/prd/terragrunt-support.md @@ -1,6 +1,6 @@ # Terragrunt component plugin -**Status:** Implementation in progress. Shared protocol, SDK, and configuration-provider loading/adapters exist. CLI stack and execution integration remain. The installed Terragrunt integration is not available. +**Status:** Implementation in progress. CLI discovery and native execution are wired to the SDK plugin on this branch. Validation covers local modules and local state. The plugin is not published. The requirements below define the complete target, not a compatibility claim. **Decision:** Ship Terragrunt as a separately versioned native plugin. Use Terragrunt Go modules to interpret HCL and Atmos to execute native Terraform components. Provide executable mode as a separate compatibility path. @@ -94,6 +94,24 @@ Discovery defaults to denying commands, network, secret decryption, writes, and Native plugins are trusted code. Broker grants and evaluator controls are not an OS sandbox. Test actual effect interception through nested includes and stack expansion. +## Atmos execution contracts + +Treat environment, identity, toolchain, and workdir behavior as release gates. + +- Resolve the selected Atmos identity before native preparation can read outputs, decrypt data, or run commands. Honor explicit, default, and disabled identity selection. Stop on authentication failure. +- Pass the sanitized subprocess environment to the evaluator. Do not merge ambient credentials back into it. Distinguish a missing environment from an explicitly empty environment. +- Use the same component environment, toolchain PATH, managed Terraform RC, registry trust, and cache policy for preparation and Terraform execution. Preserve empty overrides and last-value precedence. +- Pass an absolute executable path after toolchain resolution. HCL commands must use the invocation PATH. Never mutate the plugin process environment to switch identities or tools. +- Resolve explicit relative HCL commands from their Terragrunt unit directory. Keep `get_terragrunt_dir()` independent of the Atmos execution workdir. +- Keep credentials and temporary RC files scoped to the operation. Clean temporary files after preparation, provisioning, or execution fails. +- Test two identities and two tool versions in consecutive and concurrent invocations. Test cancellation and auth/tool failures before evaluator effects. +- Preserve configured workdir and source settings when replacing the evaluated module URI. Place generated files, variable files, and plans in the resolved Atmos working directory. +- Isolate discovered instances by stack and component. Do not let two stacks overwrite the same module's generated backend. +- Keep state identity independent of execution workdir. Relative Terragrunt backend paths must retain their upstream base. Workdir refresh must not move, delete, or recreate state. +- Test ordinary placement, automatic workdirs, absolute and project-relative working directory overrides, repeated runs, and conflicting directory ownership. Check both generated bytes and the backend used by Terraform. A rejected second owner must leave the first owner's artifacts and state unchanged. + +Read-only discovery precedes component authentication. If discovery requires an identity-dependent effect, report the unsupported requirement. Do not use ambient credentials as an implicit substitute for the selected identity. + ## State and cache ownership Resolve state independently of preparation. `!terraform.state` must work before a Terraform command runs for the target. Do not run hooks, write files, or read unrelated outputs to locate state. Reject backend expressions requiring those effects. diff --git a/internal/exec/configuration_stacks.go b/internal/exec/configuration_stacks.go new file mode 100644 index 00000000000..14f877ec807 --- /dev/null +++ b/internal/exec/configuration_stacks.go @@ -0,0 +1,36 @@ +package exec + +import ( + "context" + "fmt" + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +// mergeConfigurationStacks feeds provider definitions through the ordinary stack compiler. +// The invocation-owned provider retains the caller's cancellation scope. +func mergeConfigurationStacks(config *schema.AtmosConfiguration, stacks map[string]any, raw map[string]map[string]any, contexts AllStacksDeferredContexts) error { + if config.ComponentConfigurations == nil { + return nil + } + discovered, err := config.ComponentConfigurations.Discover(context.Background()) + if err != nil { + return err + } + for name, definition := range discovered { + for file, value := range stacks { + existing, _ := value.(map[string]any) + if file == name || existing["name"] == name { + return fmt.Errorf("%w: stack %s", errUtils.ErrDuplicatePluginExtension, name) + } + } + processed, deferred, err := ProcessStackConfig(config, config.StacksBaseAbsolutePath, config.TerraformDirAbsolutePath, config.HelmfileDirAbsolutePath, config.PackerDirAbsolutePath, config.AnsibleDirAbsolutePath, filepath.Join(config.StacksBaseAbsolutePath, name+".yaml"), definition, false, true, "", map[string]map[string][]string{}, map[string]map[string]any{}, false) + if err != nil { + return err + } + stacks[name], raw[name], contexts[name] = processed, definition, deferred + } + return nil +} diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go new file mode 100644 index 00000000000..31f4bc03590 --- /dev/null +++ b/internal/exec/configuration_stacks_test.go @@ -0,0 +1,84 @@ +package exec + +import ( + "context" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +//go:generate go run go.uber.org/mock/mockgen -destination=mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime + +func TestConfigurationStacksUseStackCompiler(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: filepath.Join(root, "stacks"), TerraformDirAbsolutePath: filepath.Join(root, "components")} + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + definitions := map[string]map[string]any{"live": {"name": "live", "vars": map[string]any{"shared": "inherited"}, "components": map[string]any{"terraform": map[string]any{"dev/app": map[string]any{"source": "./modules/app", "vars": map[string]any{"own": "value"}}}}}} + provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil) + stacks := map[string]any{} + raw := map[string]map[string]any{} + contexts := AllStacksDeferredContexts{} + require.NoError(t, mergeConfigurationStacks(config, stacks, raw, contexts)) + component := stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"].(map[string]any)["dev/app"].(map[string]any) + require.Equal(t, map[string]any{"shared": "inherited", "own": "value"}, component["vars"]) + require.Equal(t, "live", raw["live"]["name"]) +} + +func TestConfigurationStacksDoNotReuseAnotherInvocationsCache(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}}} + // Seed the ordinary cache with an empty YAML inventory at the same location. + stacks, _, _, err := FindStacksMap(config, false) + require.NoError(t, err) + require.Empty(t, stacks) + for _, revision := range []string{"first", "second"} { + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + definitions := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module", "vars": map[string]any{"revision": revision}}}}}} + provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil).Times(2) + stacks, _, _, err := FindStacksMap(config, false) + require.NoError(t, err) + app := stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"].(map[string]any)["app"].(map[string]any) + require.Equal(t, revision, app["vars"].(map[string]any)["revision"]) + // Validation must not scan atmos.yaml as a stack when discovery is the + // only inventory source, even though the project directory exists. + require.NoError(t, os.WriteFile(filepath.Join(root, "atmos.yaml"), []byte("not: [a stack manifest"), 0o600)) + require.NoError(t, ValidateStacks(config)) + } +} + +func TestConfigurationStacksRejectCollisionsAndErrors(t *testing.T) { + for _, test := range []struct { + name string + existing map[string]any + err error + want error + }{ + {name: "physical", existing: map[string]any{"live": map[string]any{}}, want: errUtils.ErrDuplicatePluginExtension}, + {name: "logical", existing: map[string]any{"deploy/dev": map[string]any{"name": "live"}}, want: errUtils.ErrDuplicatePluginExtension}, + {name: "canceled", existing: map[string]any{}, err: context.Canceled, want: context.Canceled}, + } { + t.Run(test.name, func(t *testing.T) { + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + provider.EXPECT().Discover(gomock.Any()).Return(map[string]map[string]any{"live": {"name": "live"}}, test.err) + err := mergeConfigurationStacks(&schema.AtmosConfiguration{ComponentConfigurations: provider}, test.existing, map[string]map[string]any{}, AllStacksDeferredContexts{}) + require.ErrorIs(t, err, test.want) + }) + } + require.NoError(t, mergeConfigurationStacks(&schema.AtmosConfiguration{}, nil, nil, nil)) + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + provider.EXPECT().Discover(gomock.Any()).Return(nil, context.Canceled) + stacks, raw, deferred, err := FindStacksMap(&schema.AtmosConfiguration{ComponentConfigurations: provider}, false) + require.ErrorIs(t, err, context.Canceled) + require.Nil(t, stacks) + require.Nil(t, raw) + require.Nil(t, deferred) +} diff --git a/internal/exec/mock_configuration_test.go b/internal/exec/mock_configuration_test.go new file mode 100644 index 00000000000..873ac8bd408 --- /dev/null +++ b/internal/exec/mock_configuration_test.go @@ -0,0 +1,72 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/cloudposse/atmos/pkg/schema (interfaces: ComponentConfigurationRuntime) +// +// Generated by this command: +// +// mockgen -destination=internal/exec/mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime +// + +// Package exec is a generated GoMock package. +package exec + +import ( + context "context" + reflect "reflect" + + schema "github.com/cloudposse/atmos/pkg/schema" + gomock "go.uber.org/mock/gomock" +) + +// MockComponentConfigurationRuntime is a mock of ComponentConfigurationRuntime interface. +type MockComponentConfigurationRuntime struct { + ctrl *gomock.Controller + recorder *MockComponentConfigurationRuntimeMockRecorder + isgomock struct{} +} + +// MockComponentConfigurationRuntimeMockRecorder is the mock recorder for MockComponentConfigurationRuntime. +type MockComponentConfigurationRuntimeMockRecorder struct { + mock *MockComponentConfigurationRuntime +} + +// NewMockComponentConfigurationRuntime creates a new mock instance. +func NewMockComponentConfigurationRuntime(ctrl *gomock.Controller) *MockComponentConfigurationRuntime { + mock := &MockComponentConfigurationRuntime{ctrl: ctrl} + mock.recorder = &MockComponentConfigurationRuntimeMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockComponentConfigurationRuntime) EXPECT() *MockComponentConfigurationRuntimeMockRecorder { + return m.recorder +} + +// Discover mocks base method. +func (m *MockComponentConfigurationRuntime) Discover(arg0 context.Context) (map[string]map[string]any, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Discover", arg0) + ret0, _ := ret[0].(map[string]map[string]any) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Discover indicates an expected call of Discover. +func (mr *MockComponentConfigurationRuntimeMockRecorder) Discover(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Discover", reflect.TypeOf((*MockComponentConfigurationRuntime)(nil).Discover), arg0) +} + +// Prepare mocks base method. +func (m *MockComponentConfigurationRuntime) Prepare(arg0 context.Context, arg1 *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Prepare", arg0, arg1) + ret0, _ := ret[0].(*schema.PreparedComponentConfiguration) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Prepare indicates an expected call of Prepare. +func (mr *MockComponentConfigurationRuntimeMockRecorder) Prepare(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockComponentConfigurationRuntime)(nil).Prepare), arg0, arg1) +} diff --git a/internal/exec/utils.go b/internal/exec/utils.go index ae58402c721..41299a0a6b3 100644 --- a/internal/exec/utils.go +++ b/internal/exec/utils.go @@ -455,7 +455,7 @@ func FindStacksMap(atmosConfig *schema.AtmosConfiguration, ignoreMissingFiles bo defer perf.Track(atmosConfig, "exec.FindStacksMap")() // Skip cache when provenance tracking is enabled, as we need to capture merge context and positions during processing. - if !atmosConfig.TrackProvenance { + if !atmosConfig.TrackProvenance && atmosConfig.ComponentConfigurations == nil { // Generate cache key. cacheKey := getFindStacksMapCacheKey(atmosConfig, ignoreMissingFiles) @@ -486,8 +486,12 @@ func FindStacksMap(atmosConfig *schema.AtmosConfiguration, ignoreMissingFiles bo return nil, nil, nil, err } + if err := mergeConfigurationStacks(atmosConfig, stacksMap, rawStackConfigs, deferredContexts); err != nil { + return nil, nil, nil, err + } + // Cache the result only when provenance tracking is disabled. - if !atmosConfig.TrackProvenance { + if !atmosConfig.TrackProvenance && atmosConfig.ComponentConfigurations == nil { cacheKey := getFindStacksMapCacheKey(atmosConfig, ignoreMissingFiles) findStacksMapCacheMu.Lock() findStacksMapCache[cacheKey] = &findStacksMapCacheEntry{ diff --git a/internal/exec/validate_stacks.go b/internal/exec/validate_stacks.go index 4916c09a059..bf931622fbb 100644 --- a/internal/exec/validate_stacks.go +++ b/internal/exec/validate_stacks.go @@ -116,6 +116,15 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { } validationErrorMessages = append(validationErrorMessages, errorList...) + // A discovery-only project has no YAML stack directory. Do not treat the + // project root (and atmos.yaml itself) as a directory of stack manifests. + if atmosConfig.HasComponentDiscovery() && atmosConfig.Stacks.BasePath == "" { + if len(validationErrorMessages) > 0 { + return fmt.Errorf("%w: %s", errUtils.ErrStackManifestSchemaValidation, strings.Join(dedupeStrings(validationErrorMessages), "\n\n")) + } + return nil + } + // 2. Check all YAML stack manifests defined in the infrastructure // It will check YAML syntax and all the Atmos sections defined in the manifests diff --git a/pkg/component/configuration/files.go b/pkg/component/configuration/files.go new file mode 100644 index 00000000000..d3bd4fd7235 --- /dev/null +++ b/pkg/component/configuration/files.go @@ -0,0 +1,77 @@ +package configuration + +import ( + "errors" + "fmt" + "os" + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + atmosio "github.com/cloudposse/atmos/pkg/io" + "github.com/cloudposse/atmos/pkg/perf" + "github.com/cloudposse/atmos/pkg/schema" +) + +const ( + fileMode = 0o644 + secretMode = 0o600 + directoryMode = 0o755 +) + +// WriteFiles materializes evaluated bytes under the provisioned module, without templating. +func WriteFiles(directory string, files []schema.ComponentConfigurationFile) error { + defer perf.Track(nil, "configuration.WriteFiles")() + + if len(files) == 0 { + return nil + } + root, err := os.OpenRoot(directory) + if err != nil { + return fmt.Errorf("%w: %w", errUtils.ErrPluginInvalidConfig, err) + } + defer root.Close() + for _, file := range files { + if !filepath.IsLocal(file.Path) { + return errUtils.ErrPluginProtocol + } + if file.IfExists != "error" && file.IfExists != "skip" && file.IfExists != "overwrite" { + return errUtils.ErrPluginUnsupportedExtension + } + } + for _, file := range files { + if err := writeFile(root, file); err != nil { + return err + } + } + return nil +} + +func writeFile(root *os.Root, file schema.ComponentConfigurationFile) error { + mode := os.FileMode(fileMode) + if file.Sensitive { + mode = secretMode + atmosio.RegisterSecretValue(string(file.Content)) + } + if err := root.MkdirAll(filepath.Dir(file.Path), directoryMode); err != nil { + return err + } + flags := os.O_WRONLY | os.O_CREATE | os.O_EXCL + if file.IfExists == "overwrite" { + flags = os.O_WRONLY | os.O_CREATE | os.O_TRUNC + } + output, err := root.OpenFile(file.Path, flags, mode) + if errors.Is(err, os.ErrExist) && file.IfExists == "skip" { + return nil + } + if err != nil { + return fmt.Errorf("%w: generated file %s: %w", errUtils.ErrPluginInvalidConfig, file.Path, err) + } + if file.Sensitive { + if err := output.Chmod(mode); err != nil { + _ = output.Close() + return err + } + } + _, writeErr := output.Write(file.Content) + return errors.Join(writeErr, output.Close()) +} diff --git a/pkg/component/configuration/files_test.go b/pkg/component/configuration/files_test.go new file mode 100644 index 00000000000..fe72930a580 --- /dev/null +++ b/pkg/component/configuration/files_test.go @@ -0,0 +1,60 @@ +package configuration + +import ( + "os" + "path/filepath" + "runtime" + "testing" + + "github.com/stretchr/testify/require" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +func TestWriteFilesOwnershipAndLiteralContent(t *testing.T) { + root := t.TempDir() + file := schema.ComponentConfigurationFile{Path: "nested/context.tf", Content: []byte(`{{ do not render }} ${terraform.expression}`), IfExists: "error"} + require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{file})) + path := filepath.Join(root, file.Path) + content, err := os.ReadFile(path) + require.NoError(t, err) + require.Equal(t, file.Content, content) + require.ErrorIs(t, WriteFiles(root, []schema.ComponentConfigurationFile{file}), errUtils.ErrPluginInvalidConfig) + file.Content = []byte("replacement") + file.IfExists = "skip" + require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{file})) + content, err = os.ReadFile(path) + require.NoError(t, err) + require.NotEqual(t, file.Content, content) + file.IfExists = "overwrite" + file.Sensitive = true + require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{file})) + content, err = os.ReadFile(path) + require.NoError(t, err) + require.Equal(t, file.Content, content) + stat, err := os.Stat(path) + require.NoError(t, err) + if runtime.GOOS != "windows" { + require.Equal(t, os.FileMode(0o600), stat.Mode().Perm()) + } + require.NoError(t, WriteFiles("unavailable", nil)) + require.ErrorIs(t, WriteFiles(filepath.Join(root, "absent"), []schema.ComponentConfigurationFile{file}), errUtils.ErrPluginInvalidConfig) +} + +func TestWriteFilesPreflightAndContainment(t *testing.T) { + root := t.TempDir() + first := schema.ComponentConfigurationFile{Path: "first.tf", Content: []byte("content"), IfExists: "error"} + for _, file := range []schema.ComponentConfigurationFile{{Path: "../escape.tf", IfExists: "overwrite"}, {Path: "bad.tf", IfExists: "unknown"}} { + require.Error(t, WriteFiles(root, []schema.ComponentConfigurationFile{first, file})) + _, err := os.Stat(filepath.Join(root, first.Path)) + require.True(t, os.IsNotExist(err)) + } + outside := t.TempDir() + if err := os.Symlink(outside, filepath.Join(root, "link")); err != nil { + t.Skipf("symlink unavailable: %v", err) + } + require.Error(t, WriteFiles(root, []schema.ComponentConfigurationFile{{Path: "link/escape.tf", IfExists: "overwrite"}})) + _, err := os.Stat(filepath.Join(outside, "escape.tf")) + require.True(t, os.IsNotExist(err)) +} diff --git a/pkg/component/configuration/registry.go b/pkg/component/configuration/registry.go new file mode 100644 index 00000000000..ec27287cac6 --- /dev/null +++ b/pkg/component/configuration/registry.go @@ -0,0 +1,59 @@ +// Package configuration composes alternate configuration formats with built-in component engines. +package configuration + +import ( + "context" + "sync" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + "github.com/cloudposse/atmos/pkg/schema" +) + +// Factory constructs an invocation-local session. Registration stores no invocation state. +type Factory func(context.Context, *schema.AtmosConfiguration, string) (schema.ComponentConfigurationRuntime, error) + +var factories = struct { + sync.RWMutex + values map[string]Factory +}{values: make(map[string]Factory)} + +// Register adds a configuration service factory during host composition. +func Register(name string, factory Factory) error { + defer perf.Track(nil, "configuration.Register")() + + if name == "" || factory == nil { + return errUtils.ErrPluginInvalidConfig + } + factories.Lock() + defer factories.Unlock() + if _, exists := factories.values[name]; exists { + return errUtils.ErrDuplicatePluginExtension + } + factories.values[name] = factory + return nil +} + +// Attach creates private state only when automatic configuration discovery is enabled. +func Attach(ctx context.Context, config *schema.AtmosConfiguration, operation string) error { + defer perf.Track(config, "configuration.Attach")() + + if !config.HasComponentDiscovery() { + return nil + } + if err := ctx.Err(); err != nil { + return err + } + factories.RLock() + factory := factories.values["plugin"] + factories.RUnlock() + if factory == nil { + return errUtils.ErrPluginUnsupportedExtension + } + session, err := factory(ctx, config, operation) + if err != nil { + return err + } + config.ComponentConfigurations = session + return nil +} diff --git a/pkg/component/configuration/registry_test.go b/pkg/component/configuration/registry_test.go new file mode 100644 index 00000000000..ba0a5fb8678 --- /dev/null +++ b/pkg/component/configuration/registry_test.go @@ -0,0 +1,50 @@ +package configuration + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +func TestFactoryRegistrationAndOptIn(t *testing.T) { + factories.Lock() + previous := factories.values + factories.values = make(map[string]Factory) + factories.Unlock() + t.Cleanup(func() { factories.Lock(); factories.values = previous; factories.Unlock() }) + config := &schema.AtmosConfiguration{} + require.NoError(t, Attach(t.Context(), config, "list")) + require.Nil(t, config.ComponentConfigurations) + settings := schema.ComponentConfiguration{Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}} + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"sample": settings} + require.ErrorIs(t, Attach(t.Context(), config, "list"), errUtils.ErrPluginUnsupportedExtension) + require.ErrorIs(t, Register("", func(context.Context, *schema.AtmosConfiguration, string) (schema.ComponentConfigurationRuntime, error) { + return nil, nil + }), errUtils.ErrPluginInvalidConfig) + require.ErrorIs(t, Register("plugin", nil), errUtils.ErrPluginInvalidConfig) + called := false + factory := func(ctx context.Context, got *schema.AtmosConfiguration, operation string) (schema.ComponentConfigurationRuntime, error) { + called = true + require.Same(t, config, got) + require.Equal(t, "list", operation) + return nil, errUtils.ErrPluginInvalidConfig + } + require.NoError(t, Register("plugin", factory)) + require.ErrorIs(t, Register("plugin", factory), errUtils.ErrDuplicatePluginExtension) + require.False(t, called) + require.ErrorIs(t, Attach(t.Context(), config, "list"), errUtils.ErrPluginInvalidConfig) + require.True(t, called) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + require.ErrorIs(t, Attach(ctx, config, "list"), context.Canceled) + factories.Lock() + factories.values["plugin"] = func(context.Context, *schema.AtmosConfiguration, string) (schema.ComponentConfigurationRuntime, error) { + return nil, nil + } + factories.Unlock() + require.NoError(t, Attach(t.Context(), config, "list")) +} diff --git a/pkg/component/terraform/all.go b/pkg/component/terraform/all.go index 5781607e535..792baa0afe2 100644 --- a/pkg/component/terraform/all.go +++ b/pkg/component/terraform/all.go @@ -47,7 +47,7 @@ func (e *Executor) ExecuteTerraformAllWithContext(ctx context.Context, info *sch preflight := spinner.New("Loading stack configuration and resolving templates") preflight.Start() - atmosConfig, err := cfg.InitCliConfig(*info, true) + atmosConfig, err := cfg.InitCliConfigWithContext(ctx, *info, true) if err != nil { preflight.Error("Failed to load Terraform stack configuration") return fmt.Errorf(errWrapFmt, errUtils.ErrInitializeCLIConfig, err) diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go new file mode 100644 index 00000000000..149d4462ad9 --- /dev/null +++ b/pkg/component/terraform/configuration.go @@ -0,0 +1,101 @@ +package terraform + +import ( + "context" + "crypto/sha256" + "fmt" + "maps" + "os/exec" + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/dependencies" + "github.com/cloudposse/atmos/pkg/schema" +) + +func prepareConfiguration(ctx context.Context, config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + return nil, nil + } + if config.ComponentConfigurations == nil { + return nil, errUtils.ErrPluginUnsupportedExtension + } + if err := checkComponentRestrictions(info); err != nil { + return nil, err + } + if info.DryRun { + return nil, nil + } + // Plugins do not inherit PATH. Resolve the selected host executable before + // Terragrunt evaluates version constraints or dependency outputs. + binary, err := exec.LookPath(info.Command) + if err != nil { + return nil, fmt.Errorf("%w: Terraform executable: %w", errUtils.ErrPluginInvalidConfig, err) + } + binary, err = filepath.Abs(binary) + if err != nil { + return nil, fmt.Errorf("%w: %w", errUtils.ErrPluginInvalidConfig, err) + } + info.Command = binary + prepared, err := config.ComponentConfigurations.Prepare(ctx, info) + if err != nil || prepared == nil { + return prepared, err + } + info.ComponentVarsSection = prepared.Inputs + info.ComponentBackendType, info.ComponentBackendSection = prepared.BackendType, prepared.Backend + info.TerraformWorkspace = prepared.Workspace + info.ComponentSection["vars"] = prepared.Inputs + source, _ := info.ComponentSection["source"].(map[string]any) + source = maps.Clone(source) + if source == nil { + source = make(map[string]any) + } + source["uri"] = prepared.Source + info.ComponentSection["source"] = source + info.ComponentSection["backend_type"] = prepared.BackendType + info.ComponentSection["backend"] = prepared.Backend + config.Components.Terraform.AutoGenerateBackendFile = true + return prepared, nil +} + +func configurationArtifactName(info *schema.ConfigAndStacksInfo, suffix string) (string, bool) { + if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + return "", false + } + identity := sha256.Sum256([]byte(info.Stack + "\x00" + info.ComponentFromArg)) + return fmt.Sprintf("atmos-%x%s", identity, suffix), true +} + +// prepareConfigurationEnvironment applies the same authentication, RC, cache, +// and toolchain environment as Terraform before the evaluator can spawn children. +func (e *Executor) prepareConfigurationEnvironment(ctx context.Context, config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, shouldProcess bool) (*dependencies.ToolchainEnvironment, error) { + if _, owned := info.ComponentSettingsSection["configuration"]; !owned || info.DryRun { + return nil, nil + } + if err := checkComponentRestrictions(info); err != nil { + return nil, err + } + if err := ctx.Err(); err != nil { + return nil, err + } + if err := e.prepareAuthEnvironmentFn(config, info); err != nil { + return nil, err + } + if err := ctx.Err(); err != nil { + return nil, err + } + var tenv *dependencies.ToolchainEnvironment + if shouldProcess { + var err error + tenv, err = e.resolveConfigurationToolsFn(config, info) + if err != nil { + return nil, err + } + info.Command = tenv.Resolve(info.Command) + } + disableTerraformPluginCacheForExecution(config, info) + if err := assembleComponentEnvVars(config, info, tenv); err != nil { + return nil, err + } + return tenv, nil +} diff --git a/pkg/component/terraform/configuration_environment_test.go b/pkg/component/terraform/configuration_environment_test.go new file mode 100644 index 00000000000..18265f81895 --- /dev/null +++ b/pkg/component/terraform/configuration_environment_test.go @@ -0,0 +1,188 @@ +package terraform + +import ( + "context" + "os" + "path/filepath" + "runtime" + "strings" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/dependencies" + "github.com/cloudposse/atmos/pkg/schema" + "github.com/cloudposse/atmos/pkg/toolchain" +) + +func configurationExecution(t *testing.T) (*Executor, *schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) { + t.Helper() + config := &schema.AtmosConfiguration{BasePath: t.TempDir()} + binary, err := os.Executable() + require.NoError(t, err) + info := &schema.ConfigAndStacksInfo{Command: binary, SubCommand: "plan", ComponentSection: map[string]any{}, ComponentEnvSection: map[string]any{}, ComponentSettingsSection: map[string]any{"configuration": true}} + return NewExecutor(Services{}), config, info +} + +func TestConfigurationEnvironmentPrecedesEvaluation(t *testing.T) { + for _, identity := range []string{"explicit-production", "default-development", "none"} { + t.Run(identity, func(t *testing.T) { + executor, config, info := configurationExecution(t) + info.Identity = identity + runtime := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = runtime + events := []string{} + executor.prepareAuthEnvironmentFn = func(_ *schema.AtmosConfiguration, got *schema.ConfigAndStacksInfo) error { + events = append(events, "authenticate") + require.Equal(t, identity, got.Identity) + got.SanitizedEnv = []string{"AWS_PROFILE=" + identity, "PATH=identity-path"} + got.ComponentEnvSection["FROM_COMPONENT"] = "override" + return nil + } + executor.resolveConfigurationToolsFn = func(_ *schema.AtmosConfiguration, got *schema.ConfigAndStacksInfo) (*dependencies.ToolchainEnvironment, error) { + events = append(events, "toolchain") + require.Equal(t, []string{"AWS_PROFILE=" + identity, "PATH=identity-path"}, got.SanitizedEnv) + return &dependencies.ToolchainEnvironment{}, nil + } + runtime.EXPECT().Prepare(gomock.Any(), info).DoAndReturn(func(_ context.Context, got *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + events = append(events, "evaluate") + require.Equal(t, "AWS_PROFILE="+identity, got.SanitizedEnv[0]) + require.Contains(t, got.ComponentEnvList, "FROM_COMPONENT=override") + require.Contains(t, got.ComponentEnvList, "TF_IN_AUTOMATION=true") + require.True(t, filepath.IsAbs(got.Command)) + return nil, nil + }) + _, err := executor.prepareConfigurationEnvironment(t.Context(), config, info, true) + require.NoError(t, err) + _, err = prepareConfiguration(t.Context(), config, info) + require.NoError(t, err) + require.Equal(t, []string{"authenticate", "toolchain", "evaluate"}, events) + }) + } +} + +func TestConfigurationEnvironmentStopsBeforeEffects(t *testing.T) { + for _, name := range []string{"auth failure", "toolchain failure", "cancellation", "cancellation during auth", "locked", "dry run", "ordinary"} { + t.Run(name, func(t *testing.T) { + executor, config, info := configurationExecution(t) + ctx, cancel := context.WithCancel(t.Context()) + defer cancel() + events := []string{} + executor.prepareAuthEnvironmentFn = func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) error { + events = append(events, "auth") + if name == "auth failure" { + return errUtils.ErrInvalidAuthConfig + } + if name == "cancellation during auth" { + cancel() + } + return nil + } + executor.resolveConfigurationToolsFn = func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) (*dependencies.ToolchainEnvironment, error) { + events = append(events, "tools") + return nil, errUtils.ErrPluginInvalidConfig + } + switch name { + case "cancellation": + cancel() + case "locked": + info.ComponentIsLocked = true + info.SubCommand = "apply" + case "dry run": + info.DryRun = true + case "ordinary": + info.ComponentSettingsSection = nil + } + _, err := executor.prepareConfigurationEnvironment(ctx, config, info, true) + switch name { + case "dry run", "ordinary": + require.NoError(t, err) + require.Empty(t, events) + case "auth failure": + require.ErrorIs(t, err, errUtils.ErrInvalidAuthConfig) + require.Equal(t, []string{"auth"}, events) + case "toolchain failure": + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + require.Equal(t, []string{"auth", "tools"}, events) + case "cancellation during auth": + require.ErrorIs(t, err, context.Canceled) + require.Equal(t, []string{"auth"}, events) + default: + require.Error(t, err) + require.Empty(t, events) + } + }) + } +} + +func TestConfigurationEnvironmentRCAndCache(t *testing.T) { + executor, config, info := configurationExecution(t) + config.Components.Terraform.RC = &schema.TerraformRCConfig{Enabled: true, Config: map[string]any{"disable_checkpoint": true}} + info.DisablePluginCache = true + executor.prepareAuthEnvironmentFn = func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) error { + info.SanitizedEnv = []string{"AWS_PROFILE=selected", "TF_PLUGIN_CACHE_DIR=/unwanted"} + return nil + } + _, err := executor.prepareConfigurationEnvironment(t.Context(), config, info, false) + require.NoError(t, err) + require.NotContains(t, info.SanitizedEnv, "TF_PLUGIN_CACHE_DIR=/unwanted") + var path string + for _, entry := range info.ComponentEnvList { + if strings.HasPrefix(entry, "TF_CLI_CONFIG_FILE=") { + path = strings.TrimPrefix(entry, "TF_CLI_CONFIG_FILE=") + } + } + require.NotEmpty(t, path) + require.FileExists(t, path) + require.NotNil(t, info.RCCleanup) + require.NoError(t, info.RCCleanup()) + _, err = os.Stat(path) + require.True(t, os.IsNotExist(err)) +} + +func TestConfigurationPreparationUsesSelectedInstalledToolVersion(t *testing.T) { + previous := toolchain.GetAtmosConfig() + t.Cleanup(func() { toolchain.SetAtmosConfig(previous) }) + executor, config, info := configurationExecution(t) + config.BasePathAbsolute = config.BasePath + config.Toolchain = schema.Toolchain{Install: schema.ToolchainInstallNever, InstallPath: filepath.Join(config.BasePath, "tools"), Aliases: map[string]string{"tofu": "opentofu/opentofu"}} + config.Components.Terraform.Command = "tofu" + binary, err := os.Executable() + require.NoError(t, err) + bytes, err := os.ReadFile(binary) + require.NoError(t, err) + name := "tofu" + if runtime.GOOS == "windows" { + name += ".exe" + } + for _, version := range []string{"1.0.0", "2.0.0"} { + target := filepath.Join(config.Toolchain.InstallPath, "bin", "opentofu", "opentofu", version, name) + require.NoError(t, os.MkdirAll(filepath.Dir(target), 0o755)) + require.NoError(t, os.WriteFile(target, bytes, 0o755)) + } + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + executor.prepareAuthEnvironmentFn = func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) error { + info.SanitizedEnv = []string{"AWS_PROFILE=selected"} + return nil + } + for _, version := range []string{"1.0.0", "2.0.0"} { + info.Command = "tofu" + info.ComponentEnvList = nil + info.ComponentSection["dependencies"] = map[string]any{"tools": map[string]any{"tofu": version}} + tenv, err := executor.prepareConfigurationEnvironment(t.Context(), config, info, true) + require.NoError(t, err) + expected := filepath.Join(config.Toolchain.InstallPath, "bin", "opentofu", "opentofu", version, name) + require.Equal(t, expected, info.Command) + require.Contains(t, strings.Split(tenv.PATH(), string(os.PathListSeparator)), filepath.Dir(expected)) + provider.EXPECT().Prepare(gomock.Any(), info).DoAndReturn(func(_ context.Context, got *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + require.Equal(t, expected, got.Command) + require.Contains(t, got.ComponentEnvList, "PATH="+tenv.PATH()) + return nil, nil + }) + _, err = prepareConfiguration(t.Context(), config, info) + require.NoError(t, err) + } +} diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go new file mode 100644 index 00000000000..e0531d271a5 --- /dev/null +++ b/pkg/component/terraform/configuration_test.go @@ -0,0 +1,77 @@ +package terraform + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +//go:generate go run go.uber.org/mock/mockgen -destination=mock_configuration_test.go -package=terraform github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime + +func TestPrepareConfiguration(t *testing.T) { + runtime := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config := &schema.AtmosConfiguration{ComponentConfigurations: runtime} + binary, err := os.Executable() + require.NoError(t, err) + info := &schema.ConfigAndStacksInfo{Command: binary, SubCommand: "apply", Stack: "live/dev", ComponentFromArg: "app", ComponentSection: map[string]any{}, ComponentSettingsSection: map[string]any{"configuration": true}} + expected := &schema.PreparedComponentConfiguration{Engine: "terraform", Source: "/module", Inputs: map[string]any{"fresh": "output"}, BackendType: "local", Backend: map[string]any{"path": "state.tfstate"}, Workspace: "default"} + runtime.EXPECT().Prepare(gomock.Any(), info).Return(expected, nil) + result, err := prepareConfiguration(t.Context(), config, info) + require.NoError(t, err) + require.Same(t, expected, result) + require.True(t, filepath.IsAbs(info.Command)) + require.Equal(t, expected.Inputs, info.ComponentVarsSection) + require.Equal(t, map[string]any{"uri": expected.Source}, info.ComponentSection["source"]) + require.Equal(t, expected.Backend, info.ComponentBackendSection) + require.Equal(t, "default", info.TerraformWorkspace) + require.True(t, config.Components.Terraform.AutoGenerateBackendFile) +} + +func TestPrepareConfigurationGuards(t *testing.T) { + for _, test := range []struct { + name string + info schema.ConfigAndStacksInfo + runtime bool + want error + }{ + {name: "ordinary"}, + {name: "unavailable", info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}}, want: errUtils.ErrPluginUnsupportedExtension}, + {name: "abstract", runtime: true, info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}, SubCommand: "apply", ComponentIsAbstract: true}, want: errUtils.ErrAbstractComponentCantBeProvisioned}, + {name: "dry run", runtime: true, info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}, DryRun: true}}, + {name: "missing binary", runtime: true, info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}, Command: "atmos-no-such-engine-234856"}, want: errUtils.ErrPluginInvalidConfig}, + } { + t.Run(test.name, func(t *testing.T) { + config := &schema.AtmosConfiguration{} + if test.runtime { + config.ComponentConfigurations = NewMockComponentConfigurationRuntime(gomock.NewController(t)) + } + result, err := prepareConfiguration(t.Context(), config, &test.info) + require.ErrorIs(t, err, test.want) + require.Nil(t, result) + }) + } +} + +func TestConfigurationArtifactNames(t *testing.T) { + info := &schema.ConfigAndStacksInfo{Stack: "live/dev", ComponentFromArg: "region/app", ComponentSettingsSection: map[string]any{"configuration": true}} + names := []string{ConstructTerraformComponentVarfileName(info), ConstructTerraformComponentPlanfileName(info), ConstructTerraformComponentTestVarfileName(info)} + for _, name := range names { + require.Equal(t, filepath.Base(name), name) + require.Contains(t, name, "atmos-") + } + first := names[0] + info.Stack = "live/prod" + require.NotEqual(t, first, ConstructTerraformComponentVarfileName(info)) + info.Stack = "live/dev" + info.ComponentFromArg = "other/app" + require.NotEqual(t, first, ConstructTerraformComponentVarfileName(info)) + info.ComponentSettingsSection = nil + _, owned := configurationArtifactName(info, ".plan") + require.False(t, owned) +} diff --git a/pkg/component/terraform/configuration_workdir_test.go b/pkg/component/terraform/configuration_workdir_test.go new file mode 100644 index 00000000000..e9bdd1fa718 --- /dev/null +++ b/pkg/component/terraform/configuration_workdir_test.go @@ -0,0 +1,117 @@ +package terraform + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/provisioner" + provWorkdir "github.com/cloudposse/atmos/pkg/provisioner/workdir" + "github.com/cloudposse/atmos/pkg/schema" +) + +func TestConfigurationWorkdirOwnsArtifactsNotState(t *testing.T) { + for _, mode := range []string{"component directory", "isolated workdir", "explicit workdir", "relative workdir"} { + t.Run(mode, func(t *testing.T) { + root := t.TempDir() + source := filepath.Join(root, "module") + require.NoError(t, os.MkdirAll(source, 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(source, "main.tf"), []byte("variable \"value\" {}\n"), 0o644)) + state := filepath.Join(root, "terragrunt-state", "terraform.tfstate") + require.NoError(t, os.MkdirAll(filepath.Dir(state), 0o755)) + require.NoError(t, os.WriteFile(state, []byte("existing state"), 0o600)) + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Components.Terraform.BasePath = "components" + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + binary, err := os.Executable() + require.NoError(t, err) + paths := map[string]string{} + for _, stack := range []string{"dev", "prod"} { + if mode == "component directory" && stack == "prod" { + continue + } + info := &schema.ConfigAndStacksInfo{Stack: stack, ComponentFromArg: "app", Component: "app", FinalComponent: "app", Command: binary, SubCommand: "plan", ComponentSettingsSection: map[string]any{"configuration": true}, ComponentEnvSection: map[string]any{}, ComponentSection: map[string]any{"component": "app", "atmos_component": "app", "atmos_stack": stack, "source": map[string]any{"uri": "./module"}}} + if mode != "component directory" { + info.ComponentSection["provision"] = map[string]any{"workdir": map[string]any{"enabled": true}} + } + if mode == "explicit workdir" { + info.ComponentSection["metadata"] = map[string]any{"working_directory": filepath.Join(root, "chosen", stack)} + } + if mode == "relative workdir" { + info.ComponentSection["settings"] = map[string]any{"working_directory": filepath.Join("chosen", stack)} + } + for _, revision := range []string{"first", "second"} { + provider.EXPECT().Prepare(gomock.Any(), info).Return(&schema.PreparedComponentConfiguration{Engine: "terraform", Source: source, Inputs: map[string]any{"value": revision}, BackendType: "local", Backend: map[string]any{"path": state}, Workspace: "default", Files: []schema.ComponentConfigurationFile{{Path: "generated.tf", Content: []byte("# {{ literal }} " + revision), IfExists: "overwrite"}}}, nil) + execution, err := testExecutor(t).prepareComponentExecution(context.Background(), provisioner.OutputWriters{}, config, info, false) + require.NoError(t, err) + require.Equal(t, execution.componentPath, execution.workingDir) + if mode != "component directory" { + require.Equal(t, execution.workingDir, info.ComponentSection[provWorkdir.WorkdirPathKey]) + require.NotEqual(t, filepath.Join(root, "components", "app"), execution.workingDir) + } + if mode == "explicit workdir" || mode == "relative workdir" { + require.Equal(t, filepath.Join(root, "chosen", stack), execution.workingDir) + } + generated, err := os.ReadFile(filepath.Join(execution.workingDir, "generated.tf")) + require.NoError(t, err) + require.Equal(t, "# {{ literal }} "+revision, string(generated)) + backend, err := os.ReadFile(filepath.Join(execution.workingDir, "backend.tf.json")) + require.NoError(t, err) + var decoded map[string]any + require.NoError(t, json.Unmarshal(backend, &decoded)) + require.Equal(t, state, decoded["terraform"].(map[string]any)["backend"].(map[string]any)["local"].(map[string]any)["path"]) + contents, err := os.ReadFile(state) + require.NoError(t, err) + require.Equal(t, "existing state", string(contents)) + require.NoFileExists(t, filepath.Join(source, "generated.tf")) + require.NoFileExists(t, filepath.Join(source, "backend.tf.json")) + if previous := paths[stack]; previous != "" { + require.Equal(t, previous, execution.workingDir) + } + paths[stack] = execution.workingDir + } + } + if mode != "component directory" { + require.NotEqual(t, paths["dev"], paths["prod"]) + } + }) + } +} + +func TestConfigurationExplicitWorkdirRejectsAnotherOwner(t *testing.T) { + root := t.TempDir() + source := filepath.Join(root, "module") + require.NoError(t, os.MkdirAll(source, 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(source, "main.tf"), []byte("# source"), 0o644)) + target := filepath.Join(root, "chosen") + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Components.Terraform.BasePath = "components" + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + binary, err := os.Executable() + require.NoError(t, err) + for _, stack := range []string{"dev", "prod"} { + info := &schema.ConfigAndStacksInfo{Stack: stack, ComponentFromArg: "app", Component: "app", FinalComponent: "app", Command: binary, SubCommand: "plan", ComponentSettingsSection: map[string]any{"configuration": true}, ComponentEnvSection: map[string]any{}, ComponentSection: map[string]any{"component": "app", "atmos_component": "app", "atmos_stack": stack, "source": map[string]any{"uri": source}, "provision": map[string]any{"workdir": map[string]any{"enabled": true}}, "metadata": map[string]any{"working_directory": target}}} + provider.EXPECT().Prepare(gomock.Any(), info).Return(&schema.PreparedComponentConfiguration{Engine: "terraform", Source: source, Inputs: map[string]any{}, BackendType: "local", Backend: map[string]any{}, Workspace: "default", Files: []schema.ComponentConfigurationFile{{Path: "generated.tf", Content: []byte(stack), IfExists: "overwrite"}}}, nil) + _, err := testExecutor(t).prepareComponentExecution(t.Context(), provisioner.OutputWriters{}, config, info, false) + if stack == "dev" { + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(target, "terraform.tfstate"), []byte("existing state"), 0o600)) + } else { + require.ErrorIs(t, err, errUtils.ErrWorkdirProvision) + } + generated, err := os.ReadFile(filepath.Join(target, "generated.tf")) + require.NoError(t, err) + require.Equal(t, "dev", string(generated)) + state, err := os.ReadFile(filepath.Join(target, "terraform.tfstate")) + require.NoError(t, err) + require.Equal(t, "existing state", string(state)) + } +} diff --git a/pkg/component/terraform/execute.go b/pkg/component/terraform/execute.go index 2908599c5e0..e6a5c988dd6 100644 --- a/pkg/component/terraform/execute.go +++ b/pkg/component/terraform/execute.go @@ -133,7 +133,7 @@ func (e *Executor) execute(info schema.ConfigAndStacksInfo, opts ...component.Ex return err } - atmosConfig, err := cfg.InitCliConfig(info, true) + atmosConfig, err := cfg.InitCliConfigWithContext(component.ContextFromOptions(opts...), info, true) if err != nil { return err } diff --git a/pkg/component/terraform/execute_pipeline.go b/pkg/component/terraform/execute_pipeline.go index cb80e252945..b643d0f8d15 100644 --- a/pkg/component/terraform/execute_pipeline.go +++ b/pkg/component/terraform/execute_pipeline.go @@ -13,6 +13,7 @@ import ( auth "github.com/cloudposse/atmos/pkg/auth" "github.com/cloudposse/atmos/pkg/ci" "github.com/cloudposse/atmos/pkg/component" + "github.com/cloudposse/atmos/pkg/component/configuration" "github.com/cloudposse/atmos/pkg/dependencies" log "github.com/cloudposse/atmos/pkg/logger" "github.com/cloudposse/atmos/pkg/policy/planfile" @@ -49,17 +50,31 @@ func (e *Executor) prepareComponentExecution( return nil, err } + tenv, err := e.prepareConfigurationEnvironment(ctx, atmosConfig, info, shouldProcess) + if err != nil { + return nil, err + } + prepared, err := prepareConfiguration(ctx, atmosConfig, info) + if err != nil { + return nil, err + } + componentPath, err := e.resolveAndProvisionComponentPath(ctx, writers, atmosConfig, info) if err != nil { return nil, err } + if prepared != nil && !info.DryRun { + if err := configuration.WriteFiles(componentPath, prepared.Files); err != nil { + return nil, err + } + } + if err = checkComponentRestrictions(info); err != nil { return nil, err } - var tenv *dependencies.ToolchainEnvironment - if shouldProcess { + if shouldProcess && tenv == nil { tenv, err = resolveAndInstallToolchainDeps(atmosConfig, info) if err != nil { return nil, err @@ -117,16 +132,18 @@ func (e *Executor) runPreExecutionSteps( return err } - if err := auth.TerraformPreHook(atmosConfig, info); err != nil { - // The error is returned and rendered once by the command boundary, so it is only logged - // at debug level here to avoid printing the same failure twice. - log.Debug("Error executing 'atmos auth terraform pre-hook'", - logFieldComponent, info.ComponentFromArg, "error", err) - // Pre-hook failures terminate execution — this matches the original terraform.go behavior. - // Authentication setup failures must not silently produce unauthenticated terraform commands. - return err + if _, owned := info.ComponentSettingsSection["configuration"]; !owned || info.DryRun { + if err := auth.TerraformPreHook(atmosConfig, info); err != nil { + // The error is returned and rendered once by the command boundary, so it is only logged + // at debug level here to avoid printing the same failure twice. + log.Debug("Error executing 'atmos auth terraform pre-hook'", + logFieldComponent, info.ComponentFromArg, "error", err) + // Pre-hook failures terminate execution — this matches the original terraform.go behavior. + // Authentication setup failures must not silently produce unauthenticated terraform commands. + return err + } + disableTerraformPluginCacheForExecution(atmosConfig, info) } - disableTerraformPluginCacheForExecution(atmosConfig, info) // Generate backend and provider-override files. When AutoGenerateFiles=true, // GenerateFilesForComponent was already called inside resolveAndProvisionComponentPath @@ -138,6 +155,10 @@ func (e *Executor) runPreExecutionSteps( warnOnConflictingEnvVars() + if _, owned := info.ComponentSettingsSection["configuration"]; owned && !info.DryRun { + // Inputs have now been evaluated; append their secret variables after masking. + return appendTerraformSecretEnv(info) + } return assembleComponentEnvVars(atmosConfig, info, tenv) } diff --git a/pkg/component/terraform/execute_prepare.go b/pkg/component/terraform/execute_prepare.go index 6a6b0be4587..e957d7c2e63 100644 --- a/pkg/component/terraform/execute_prepare.go +++ b/pkg/component/terraform/execute_prepare.go @@ -508,6 +508,9 @@ func ConstructTerraformComponentWorkingDir(atmosConfig *schema.AtmosConfiguratio func ConstructTerraformComponentPlanfileName(info *schema.ConfigAndStacksInfo) string { defer perf.Track(nil, "terraform.ConstructTerraformComponentPlanfileName")() + if name, ok := configurationArtifactName(info, ".planfile"); ok { + return name + } var planFile string if len(info.ComponentFolderPrefixReplaced) == 0 { planFile = fmt.Sprintf("%s-%s.planfile", info.ContextPrefix, info.Component) @@ -522,6 +525,9 @@ func ConstructTerraformComponentPlanfileName(info *schema.ConfigAndStacksInfo) s func ConstructTerraformComponentVarfileName(info *schema.ConfigAndStacksInfo) string { defer perf.Track(nil, "terraform.ConstructTerraformComponentVarfileName")() + if name, ok := configurationArtifactName(info, ".terraform.tfvars.json"); ok { + return name + } var varFile string if len(info.ComponentFolderPrefixReplaced) == 0 { varFile = fmt.Sprintf("%s-%s.terraform.tfvars.json", info.ContextPrefix, info.Component) @@ -536,6 +542,9 @@ func ConstructTerraformComponentVarfileName(info *schema.ConfigAndStacksInfo) st func ConstructTerraformComponentTestVarfileName(info *schema.ConfigAndStacksInfo) string { defer perf.Track(nil, "terraform.ConstructTerraformComponentTestVarfileName")() + if name, ok := configurationArtifactName(info, ".terraform.test.tfvars.json"); ok { + return name + } var varFile string if len(info.ComponentFolderPrefixReplaced) == 0 { varFile = fmt.Sprintf("%s-%s.terraform.test.tfvars.json", info.ContextPrefix, info.Component) diff --git a/pkg/component/terraform/mock_configuration_test.go b/pkg/component/terraform/mock_configuration_test.go new file mode 100644 index 00000000000..61d0a255dd6 --- /dev/null +++ b/pkg/component/terraform/mock_configuration_test.go @@ -0,0 +1,72 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/cloudposse/atmos/pkg/schema (interfaces: ComponentConfigurationRuntime) +// +// Generated by this command: +// +// mockgen -destination=pkg/component/terraform/mock_configuration_test.go -package=terraform github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime +// + +// Package terraform is a generated GoMock package. +package terraform + +import ( + context "context" + reflect "reflect" + + schema "github.com/cloudposse/atmos/pkg/schema" + gomock "go.uber.org/mock/gomock" +) + +// MockComponentConfigurationRuntime is a mock of ComponentConfigurationRuntime interface. +type MockComponentConfigurationRuntime struct { + ctrl *gomock.Controller + recorder *MockComponentConfigurationRuntimeMockRecorder + isgomock struct{} +} + +// MockComponentConfigurationRuntimeMockRecorder is the mock recorder for MockComponentConfigurationRuntime. +type MockComponentConfigurationRuntimeMockRecorder struct { + mock *MockComponentConfigurationRuntime +} + +// NewMockComponentConfigurationRuntime creates a new mock instance. +func NewMockComponentConfigurationRuntime(ctrl *gomock.Controller) *MockComponentConfigurationRuntime { + mock := &MockComponentConfigurationRuntime{ctrl: ctrl} + mock.recorder = &MockComponentConfigurationRuntimeMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockComponentConfigurationRuntime) EXPECT() *MockComponentConfigurationRuntimeMockRecorder { + return m.recorder +} + +// Discover mocks base method. +func (m *MockComponentConfigurationRuntime) Discover(arg0 context.Context) (map[string]map[string]any, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Discover", arg0) + ret0, _ := ret[0].(map[string]map[string]any) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Discover indicates an expected call of Discover. +func (mr *MockComponentConfigurationRuntimeMockRecorder) Discover(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Discover", reflect.TypeOf((*MockComponentConfigurationRuntime)(nil).Discover), arg0) +} + +// Prepare mocks base method. +func (m *MockComponentConfigurationRuntime) Prepare(arg0 context.Context, arg1 *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Prepare", arg0, arg1) + ret0, _ := ret[0].(*schema.PreparedComponentConfiguration) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Prepare indicates an expected call of Prepare. +func (mr *MockComponentConfigurationRuntimeMockRecorder) Prepare(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockComponentConfigurationRuntime)(nil).Prepare), arg0, arg1) +} diff --git a/pkg/component/terraform/provider.go b/pkg/component/terraform/provider.go index 897afe4048c..9686e4495da 100644 --- a/pkg/component/terraform/provider.go +++ b/pkg/component/terraform/provider.go @@ -18,6 +18,7 @@ import ( component "github.com/cloudposse/atmos/pkg/component" deferred "github.com/cloudposse/atmos/pkg/deferred" degradation "github.com/cloudposse/atmos/pkg/degradation" + "github.com/cloudposse/atmos/pkg/dependencies" dependency "github.com/cloudposse/atmos/pkg/dependency" generator "github.com/cloudposse/atmos/pkg/generator" providers "github.com/cloudposse/atmos/pkg/generator/providers" @@ -244,6 +245,8 @@ type Services struct { // Executor owns Terraform's execution pipeline and reference lookups. type Executor struct { *Operations + prepareAuthEnvironmentFn func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) error + resolveConfigurationToolsFn func(*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo) (*dependencies.ToolchainEnvironment, error) services Services executeTerraformInitForcedFn func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, componentPath, varFile string, reconfigure, upgrade bool, opts ...component.ExecutionOption) error dispatchAfterInitFn func(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, componentPath string, opts ...component.ExecutionOption) @@ -267,6 +270,8 @@ func NewExecutor(services Services) *Executor { defer perf.Track(nil, "terraform.NewExecutor")() e := &Executor{Operations: NewOperations(services.OperationServices), services: services} + e.prepareAuthEnvironmentFn = auth.TerraformPreHook + e.resolveConfigurationToolsFn = resolveAndInstallToolchainDeps e.executeTerraformInitForcedFn = e.executeTerraformInitForced e.dispatchAfterInitFn = e.dispatchAfterInit e.executeMainTerraformCommandFn = e.executeMainTerraformCommand diff --git a/pkg/component/terraform/query.go b/pkg/component/terraform/query.go index 2c5129cb5ae..cf297a807f5 100644 --- a/pkg/component/terraform/query.go +++ b/pkg/component/terraform/query.go @@ -50,7 +50,7 @@ func (e *Executor) ExecuteTerraformQuery(info *schema.ConfigAndStacksInfo) error // ExecuteTerraformQueryWithContext executes graph-backed multi-component Terraform work. func (e *Executor) ExecuteTerraformQueryWithContext(ctx context.Context, info *schema.ConfigAndStacksInfo) error { defer perf.Track(nil, "exec.ExecuteTerraformQueryWithContext")() - atmosConfig, err := cfg.InitCliConfig(*info, true) + atmosConfig, err := cfg.InitCliConfigWithContext(ctx, *info, true) if err != nil { return err } diff --git a/pkg/config/component_configuration.go b/pkg/config/component_configuration.go new file mode 100644 index 00000000000..9eb54893d15 --- /dev/null +++ b/pkg/config/component_configuration.go @@ -0,0 +1,41 @@ +package config + +import ( + "maps" + "reflect" + "strings" + + "github.com/go-viper/mapstructure/v2" + + "github.com/cloudposse/atmos/pkg/schema" +) + +// Preserve the loader's established handling of unknown scalar Terraform keys. +// Only object-valued unknown keys can declare a configuration provider. +func terraformConfigurationDecodeHook() mapstructure.DecodeHookFuncType { + typ := reflect.TypeOf(schema.Terraform{}) + known := make(map[string]bool) + for i := range typ.NumField() { + name := strings.Split(typ.Field(i).Tag.Get("mapstructure"), ",")[0] + known[name] = true + } + return func(_ reflect.Type, to reflect.Type, value any) (any, error) { + if to != typ { + return value, nil + } + fields, ok := value.(map[string]any) + if !ok { + return value, nil + } + result := maps.Clone(fields) + for key, item := range result { + if known[key] || item == nil { + continue + } + if reflect.TypeOf(item).Kind() != reflect.Map { + delete(result, key) + } + } + return result, nil + } +} diff --git a/pkg/config/component_configuration_test.go b/pkg/config/component_configuration_test.go new file mode 100644 index 00000000000..3ca0a184610 --- /dev/null +++ b/pkg/config/component_configuration_test.go @@ -0,0 +1,44 @@ +package config + +import ( + "strings" + "testing" + + "github.com/spf13/viper" + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/pkg/schema" +) + +var _ = schema.Terraform{ConfigurationProviders: nil} + +func TestComponentConfigurationOptIn(t *testing.T) { + t.Parallel() + v := viper.New() + v.SetConfigType("yaml") + require.NoError(t, v.ReadConfig(strings.NewReader(`components: + terraform: + command: tofu + terragrunt: + enabled: true + mode: native + discovery: + enabled: true + included_paths: [live/**] + excluded_paths: [live/archive/**] + download_dir: .cache +`))) + var config schema.AtmosConfiguration + require.NoError(t, v.Unmarshal(&config, atmosDecodeHook())) + require.True(t, config.HasComponentDiscovery()) + require.Equal(t, "tofu", config.Components.Terraform.Command) + provider := config.Components.Terraform.ConfigurationProviders["terragrunt"] + require.Equal(t, []string{"live/**"}, provider.Discovery.IncludedPaths) + require.Equal(t, []string{"live/archive/**"}, provider.Discovery.ExcludedPaths) + require.Equal(t, map[string]any{"download_dir": ".cache"}, provider.Options) + require.NoError(t, checkConfig(config, true)) + provider.Discovery.Enabled = false + config.Components.Terraform.ConfigurationProviders["terragrunt"] = provider + require.False(t, config.HasComponentDiscovery()) + require.Error(t, checkConfig(config, true)) +} diff --git a/pkg/config/config.go b/pkg/config/config.go index 82a3c1bd5c8..fc65ae2dadb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,15 +1,17 @@ package config import ( + "context" "fmt" "os" "path/filepath" "strings" - log "github.com/cloudposse/atmos/pkg/logger" "github.com/pkg/errors" errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/component/configuration" + log "github.com/cloudposse/atmos/pkg/logger" "github.com/cloudposse/atmos/pkg/perf" "github.com/cloudposse/atmos/pkg/schema" terminalenv "github.com/cloudposse/atmos/pkg/terminal/env" @@ -38,6 +40,15 @@ const ( // //nolint:gocritic func InitCliConfig(configAndStacksInfo schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + return InitCliConfigWithContext(context.Background(), configAndStacksInfo, processStacks) +} + +// InitCliConfigWithContext retains cancellation for invocation-owned configuration providers. +// +//nolint:gocritic // Copy invocation options; initialization must not mutate the caller. +func InitCliConfigWithContext(ctx context.Context, configAndStacksInfo schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + defer perf.Track(nil, "config.InitCliConfigWithContext")() + atmosConfig, err := processAtmosConfigs(&configAndStacksInfo) if err != nil { return atmosConfig, err @@ -79,6 +90,9 @@ func InitCliConfig(configAndStacksInfo schema.ConfigAndStacksInfo, processStacks } } + if err := configuration.Attach(ctx, &atmosConfig, configAndStacksInfo.SubCommand); err != nil { + return atmosConfig, err + } atmosConfig.Initialized = true return atmosConfig, nil } @@ -645,11 +659,11 @@ func processStackConfigs(atmosConfig *schema.AtmosConfiguration, configAndStacks includeStackAbsPaths, excludeStackAbsPaths, ) - if err != nil { + if err != nil && (!atmosConfig.HasComponentDiscovery() || !errors.Is(err, errUtils.ErrNoStackManifestsFound)) { return err } - if len(stackConfigFilesAbsolutePaths) < 1 { + if len(stackConfigFilesAbsolutePaths) < 1 && !atmosConfig.HasComponentDiscovery() { j, err := u.ConvertToYAML(includeStackAbsPaths) if err != nil { return err diff --git a/pkg/config/load.go b/pkg/config/load.go index b7b050a7205..d070dd834ff 100644 --- a/pkg/config/load.go +++ b/pkg/config/load.go @@ -2522,6 +2522,7 @@ func atmosDecodeHook(configs ...*viper.Viper) viper.DecoderConfigOption { func getAtmosDecodeHookFunc(strict ...bool) mapstructure.DecodeHookFunc { return mapstructure.ComposeDecodeHookFunc( duration.DecodeHook(), + terraformConfigurationDecodeHook(), mapstructure.StringToSliceHookFunc(SliceSeparator), commandEnvMapDecodeHook(), schema.SkillRefDecodeHook(), diff --git a/pkg/config/schema/overrides.go b/pkg/config/schema/overrides.go index 180a17ad947..8f9d125c43b 100644 --- a/pkg/config/schema/overrides.go +++ b/pkg/config/schema/overrides.go @@ -128,6 +128,7 @@ func applyOverrides(r *jsonschema.Reflector, root *jsonschema.Schema) { root.Definitions = jsonschema.Definitions{} } overrideSchemasSection(r, root) + overrideComponentConfigurations(r, root) applyPolymorphicOverrides(root) allowYamlFunctions(root) } @@ -464,3 +465,21 @@ func rejectsYamlFunctionString(s *jsonschema.Schema) bool { return false } } + +// Dynamic configuration-provider names are map keys beside built-in Terraform +// fields. Reflection skips inline maps, so describe their value schema explicitly. +func overrideComponentConfigurations(r *jsonschema.Reflector, root *jsonschema.Schema) { + terraform := root.Definitions["Terraform"] + if terraform == nil { + return + } + reflected := r.Reflect(&schema.ComponentConfiguration{}) + for name, definition := range reflected.Definitions { + root.Definitions[name] = definition + } + reflected.Definitions = nil + reflected.Version = "" + reflected.ID = "" + root.Definitions["ComponentConfiguration"] = reflected + terraform.AdditionalProperties = &jsonschema.Schema{If: &jsonschema.Schema{Type: typeObject}, Then: &jsonschema.Schema{Ref: "#/$defs/ComponentConfiguration"}} +} diff --git a/pkg/config/utils.go b/pkg/config/utils.go index dee3fda7396..fbb13d6c450 100644 --- a/pkg/config/utils.go +++ b/pkg/config/utils.go @@ -587,11 +587,11 @@ func normalizeInitEnumValue[T ~string](value string, isValid func(T) bool, senti } func checkConfig(atmosConfig schema.AtmosConfiguration, isProcessStack bool) error { - if isProcessStack && len(atmosConfig.Stacks.BasePath) < 1 { + if isProcessStack && len(atmosConfig.Stacks.BasePath) < 1 && !atmosConfig.HasComponentDiscovery() { return errors.New("stack base path must be provided in 'stacks.base_path' config or ATMOS_STACKS_BASE_PATH' ENV variable") } - if isProcessStack && len(atmosConfig.Stacks.IncludedPaths) < 1 { + if isProcessStack && len(atmosConfig.Stacks.IncludedPaths) < 1 && !atmosConfig.HasComponentDiscovery() { return errors.New("at least one path must be provided in 'stacks.included_paths' config or ATMOS_STACKS_INCLUDED_PATHS' ENV variable") } diff --git a/pkg/datafetcher/schema/atmos/config/1.0.json b/pkg/datafetcher/schema/atmos/config/1.0.json index e0b6957fa34..c03f0b9071a 100644 --- a/pkg/datafetcher/schema/atmos/config/1.0.json +++ b/pkg/datafetcher/schema/atmos/config/1.0.json @@ -4240,6 +4240,58 @@ "type": "object", "description": "CommandFlag defines a flag for a custom command." }, + "ComponentConfiguration": { + "properties": { + "enabled": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + }, + { + "$ref": "#/$defs/yamlFunction" + } + ] + }, + "provider": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "mode": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "discovery": { + "anyOf": [ + { + "$ref": "#/$defs/ComponentDiscoveryConfig" + }, + { + "type": "null" + }, + { + "$ref": "#/$defs/yamlFunction" + } + ] + } + }, + "type": "object", + "description": "ComponentConfiguration enables one separately installed configuration provider.\nThe section name is the provider name unless provider overrides it." + }, "ComponentDependency": { "properties": { "component": { @@ -4315,6 +4367,77 @@ "type": "object", "description": "ComponentDependency represents a single dependency entry. It supports two\nsurfaces simultaneously:\n\n - The canonical (recommended) shape uses `name` for the component instance\n name and an optional `kind` for cross-type dependencies (helmfile, packer,\n plugin). Path-based dependencies should be declared using the sibling\n keys `dependencies.files` / `dependencies.folders` rather than entries\n here.\n\n - The legacy shape uses `component` (instead of `name`) and supports\n `kind: file` / `kind: folder` with `path:` to declare path-based\n dependencies inline. This shape continues to parse for backward\n compatibility with stack configurations from Atmos \u003c v1.211.0.\n\nUse the helpers IsFileDependency / IsFolderDependency / IsComponentDependency\nto discriminate; do not branch on `Kind` directly." }, + "ComponentDiscoveryConfig": { + "properties": { + "enabled": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + }, + { + "$ref": "#/$defs/yamlFunction" + } + ] + }, + "included_paths": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": "array" + }, + { + "type": "null" + }, + { + "$ref": "#/$defs/yamlFunction" + }, + { + "type": "string" + } + ] + }, + "excluded_paths": { + "anyOf": [ + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "type": "array" + }, + { + "type": "null" + }, + { + "$ref": "#/$defs/yamlFunction" + }, + { + "type": "string" + } + ] + } + }, + "type": "object", + "description": "ComponentDiscoveryConfig bounds automatic discovery. Both switches default off." + }, "Components": { "properties": { "terraform": { @@ -13465,6 +13588,14 @@ "description": "Flags holds fleet-wide default values for terraform CLI execution flags\n(e.g. -lock-timeout, -parallelism). Overridable per stack via the\nroot-level `terraform: flags:` block, and per component via a\ncomponent's own `flags:` block. An explicit CLI-typed compat flag\n(e.g. `-lock-timeout=5m` typed on the command line) always wins." } }, + "additionalProperties": { + "if": { + "type": "object" + }, + "then": { + "$ref": "#/$defs/ComponentConfiguration" + } + }, "type": "object" }, "TerraformCI": { diff --git a/pkg/plugin/adapter/component/objects.go b/pkg/plugin/adapter/component/objects.go new file mode 100644 index 00000000000..7f9e4d3794a --- /dev/null +++ b/pkg/plugin/adapter/component/objects.go @@ -0,0 +1,171 @@ +package component + +import ( + "bytes" + "encoding/json" + + "github.com/zclconf/go-cty/cty" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + + errUtils "github.com/cloudposse/atmos/errors" + atmosio "github.com/cloudposse/atmos/pkg/io" + "github.com/cloudposse/atmos/pkg/perf" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +// EncodeObject encodes host settings without passing through protobuf floating point values. +func EncodeObject(input any) (*pluginv1.ComponentValue, error) { + defer perf.Track(nil, "componentadapter.EncodeObject")() + + raw, err := json.Marshal(input) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + typ, err := ctyjson.ImpliedType(raw) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + value, err := ctyjson.Unmarshal(raw, typ) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + payload, err := msgpack.Marshal(value, typ) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + typeJSON, err := ctyjson.MarshalType(typ) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + return &pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload}, nil +} + +// DecodeObject adapts a fully evaluated object for Atmos's existing stack/varfile APIs. +// Unknown values must remain in the evaluator until preparation can resolve them. +// Sensitivity paths are validated and registered with masked I/O before values escape. +func DecodeObject(input *pluginv1.ComponentValue) (map[string]any, error) { + defer perf.Track(nil, "componentadapter.DecodeObject")() + + if input == nil { + return map[string]any{}, nil + } + value, err := decodePlain(input) + if err != nil { + return nil, err + } + if !value.IsWhollyKnown() { + return nil, errUtils.ErrPluginUnsupportedExtension + } + if value.IsNull() || (!value.Type().IsObjectType() && !value.Type().IsMapType()) { + return nil, errUtils.ErrPluginProtocol + } + if err := registerSensitivePaths(value, input.SensitivePaths); err != nil { + return nil, err + } + result, err := objectJSON(value) + if err != nil { + return nil, err + } + object, ok := result.(map[string]any) + if !ok { + return nil, errUtils.ErrPluginProtocol + } + return object, nil +} + +func decodePlain(input *pluginv1.ComponentValue) (cty.Value, error) { + if input == nil { + return cty.NilVal, errUtils.ErrPluginProtocol + } + typ, err := ctyjson.UnmarshalType(input.TypeJson) + if err != nil { + return cty.NilVal, errUtils.ErrPluginProtocol + } + value, err := msgpack.Unmarshal(input.Msgpack, typ) + if err != nil { + return cty.NilVal, errUtils.ErrPluginProtocol + } + return value, nil +} + +func sensitiveValue(value cty.Value, encoded *pluginv1.ComponentValuePath) (cty.Value, error) { + if encoded == nil { + return cty.NilVal, errUtils.ErrPluginProtocol + } + path := cty.Path{} + for _, step := range encoded.Steps { + switch selector := step.GetSelector().(type) { + case *pluginv1.ComponentValueStep_Attribute: + path = path.GetAttr(selector.Attribute) + case *pluginv1.ComponentValueStep_Index: + index, err := sensitiveIndex(selector.Index) + if err != nil { + return cty.NilVal, err + } + path = path.Index(index) + default: + return cty.NilVal, errUtils.ErrPluginProtocol + } + } + result, err := path.Apply(value) + if err != nil { + return cty.NilVal, errUtils.ErrPluginProtocol + } + return result, nil +} + +func objectJSON(value cty.Value) (any, error) { + raw, err := ctyjson.Marshal(value, value.Type()) + if err != nil { + return nil, errUtils.ErrPluginProtocol + } + decoder := json.NewDecoder(bytes.NewReader(raw)) + decoder.UseNumber() + var result any + if err := decoder.Decode(&result); err != nil { + return nil, errUtils.ErrPluginProtocol + } + return result, nil +} + +func registerSensitive(value any) { + switch value := value.(type) { + case map[string]any: + for _, child := range value { + registerSensitive(child) + } + case []any: + for _, child := range value { + registerSensitive(child) + } + default: + atmosio.RegisterSecretValue(value) + } +} + +func registerSensitivePaths(value cty.Value, paths []*pluginv1.ComponentValuePath) error { + for _, path := range paths { + selected, err := sensitiveValue(value, path) + if err != nil { + return err + } + plain, err := objectJSON(selected) + if err != nil { + return err + } + registerSensitive(plain) + } + return nil +} + +func sensitiveIndex(encoded *pluginv1.ComponentValue) (cty.Value, error) { + index, err := decodePlain(encoded) + if err != nil || !index.IsKnown() || index.IsNull() || len(encoded.SensitivePaths) != 0 { + return cty.NilVal, errUtils.ErrPluginProtocol + } + if index.Type() != cty.String && index.Type() != cty.Number { + return cty.NilVal, errUtils.ErrPluginProtocol + } + return index, nil +} diff --git a/pkg/plugin/adapter/component/objects_test.go b/pkg/plugin/adapter/component/objects_test.go new file mode 100644 index 00000000000..fdb2f96f095 --- /dev/null +++ b/pkg/plugin/adapter/component/objects_test.go @@ -0,0 +1,64 @@ +package component + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + "github.com/zclconf/go-cty/cty" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" + + errUtils "github.com/cloudposse/atmos/errors" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func objectWireValue(t *testing.T, value cty.Value) *pluginv1.ComponentValue { + t.Helper() + typ, err := ctyjson.MarshalType(value.Type()) + require.NoError(t, err) + payload, err := msgpack.Marshal(value, value.Type()) + require.NoError(t, err) + return &pluginv1.ComponentValue{TypeJson: typ, Msgpack: payload} +} + +func TestObjectRoundTrip(t *testing.T) { + value := map[string]any{"large": json.Number("9007199254740993"), "nested": []any{nil, true, "literal"}} + encoded, err := EncodeObject(value) + require.NoError(t, err) + decoded, err := DecodeObject(encoded) + require.NoError(t, err) + require.Equal(t, value, decoded) + decoded, err = DecodeObject(nil) + require.NoError(t, err) + require.Empty(t, decoded) + _, err = EncodeObject(make(chan int)) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) +} + +func TestObjectRejectsMalformedAndUnknown(t *testing.T) { + for _, encoded := range []*pluginv1.ComponentValue{{}, {TypeJson: []byte(`"string"`), Msgpack: []byte{0xc1}}, objectWireValue(t, cty.NullVal(cty.EmptyObject)), objectWireValue(t, cty.StringVal("scalar"))} { + _, err := DecodeObject(encoded) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) + } + _, err := DecodeObject(objectWireValue(t, cty.ObjectVal(map[string]cty.Value{"pending": cty.UnknownVal(cty.String)}))) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) +} + +func TestObjectSensitivePaths(t *testing.T) { + value := cty.ObjectVal(map[string]cty.Value{"items": cty.TupleVal([]cty.Value{cty.StringVal("masked-value"), cty.NumberIntVal(12345)})}) + encoded := objectWireValue(t, value) + attr := &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: "items"}} + index := &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.NumberIntVal(0))}} + for _, path := range []*pluginv1.ComponentValuePath{{}, {Steps: []*pluginv1.ComponentValueStep{attr}}, {Steps: []*pluginv1.ComponentValueStep{attr, index}}} { + encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} + decoded, err := DecodeObject(encoded) + require.NoError(t, err) + require.Equal(t, []any{"masked-value", json.Number("12345")}, decoded["items"]) + } + for _, path := range []*pluginv1.ComponentValuePath{nil, {Steps: []*pluginv1.ComponentValueStep{nil}}, {Steps: []*pluginv1.ComponentValueStep{index}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.True)}}}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{}}}}} { + encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} + _, err := DecodeObject(encoded) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) + } +} diff --git a/pkg/plugin/adapter/configuration/discovery.go b/pkg/plugin/adapter/configuration/discovery.go new file mode 100644 index 00000000000..910cfd89796 --- /dev/null +++ b/pkg/plugin/adapter/configuration/discovery.go @@ -0,0 +1,120 @@ +package configuration + +import ( + "context" + "fmt" + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +const ( + componentsKey = "components" + terraformType = "terraform" +) + +func addressKey(a *pluginv1.ComponentAddress) [3]string { + return [3]string{a.Stack, a.ComponentType, a.Component} +} + +func (s *Session) discover(ctx context.Context) error { + names := make([]string, 0, len(s.requests)) + for _, request := range s.requests { + names = append(names, request.Provider) + } + registry, err := s.loader(ctx, names) + if err != nil { + return err + } + definitions := make(map[string]map[string]any) + instances := make(map[[3]string]*pluginv1.DiscoveredComponent) + for _, request := range s.requests { + provider, exists := registry[request.Provider] + if !exists || provider.ComponentType() != terraformType { + return errUtils.ErrPluginUnsupportedExtension + } + discovered, err := provider.Discover(ctx, request) + if err != nil { + return err + } + if err := addDiscovered(definitions, instances, discovered); err != nil { + return err + } + } + if err := checkDependencies(instances); err != nil { + return err + } + + s.registry, s.definitions, s.instances = registry, definitions, instances + return nil +} + +func addInstance(definitions map[string]map[string]any, instance *pluginv1.DiscoveredComponent) error { + address := instance.Address + if !filepath.IsLocal(address.Stack) || !filepath.IsLocal(address.Component) { + return errUtils.ErrPluginProtocol + } + if instance.Engine != terraformType && instance.Engine != "opentofu" { + return errUtils.ErrPluginUnsupportedExtension + } + config, err := adapter.DecodeObject(instance.Configuration) + if err != nil { + return err + } + settings, _ := config["settings"].(map[string]any) + if settings == nil { + settings = make(map[string]any) + } + settings["configuration"] = map[string]any{"provider": instance.Provider, "engine": instance.Engine, "source": instance.Source} + config["settings"] = settings + config["dependencies"] = instanceDependencies(instance) + definition := definitions[address.Stack] + if definition == nil { + definition = map[string]any{"name": address.Stack, componentsKey: map[string]any{terraformType: map[string]any{}}} + definitions[address.Stack] = definition + } + definition[componentsKey].(map[string]any)[terraformType].(map[string]any)[address.Component] = config + return nil +} + +func checkDependencies(instances map[[3]string]*pluginv1.DiscoveredComponent) error { + for _, instance := range instances { + for _, dep := range instance.Dependencies { + if _, exists := instances[addressKey(dep.Target)]; !exists { + return fmt.Errorf("%w: dependency %s/%s is outside discovery scope", errUtils.ErrPluginInvalidConfig, dep.Target.Stack, dep.Target.Component) + } + } + } + return nil +} + +func instanceDependencies(instance *pluginv1.DiscoveredComponent) map[string]any { + deps := map[string]any{"files": []any{}, "folders": []any{}, componentsKey: []any{}} + for _, source := range instance.Sources { + field := "files" + if source.Kind == pluginv1.ComponentSource_DIRECTORY { + field = "folders" + } + deps[field] = append(deps[field].([]any), source.Path) + } + for _, dependency := range instance.Dependencies { + deps[componentsKey] = append(deps[componentsKey].([]any), map[string]any{"name": dependency.Target.Component, "stack": dependency.Target.Stack, "type": dependency.Target.ComponentType}) + } + return deps +} + +func addDiscovered(definitions map[string]map[string]any, instances map[[3]string]*pluginv1.DiscoveredComponent, discovered *pluginv1.DiscoverComponentsResponse) error { + for _, instance := range discovered.Components { + key := addressKey(instance.Address) + if _, exists := instances[key]; exists { + return errUtils.ErrDuplicatePluginExtension + } + if err := addInstance(definitions, instance); err != nil { + return err + } + instances[key] = instance + } + return nil +} diff --git a/pkg/plugin/adapter/configuration/environment_test.go b/pkg/plugin/adapter/configuration/environment_test.go new file mode 100644 index 00000000000..26fd2fe1dbc --- /dev/null +++ b/pkg/plugin/adapter/configuration/environment_test.go @@ -0,0 +1,47 @@ +package configuration + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/pkg/schema" +) + +func TestPreparationEnvironmentPrecedenceAndSanitization(t *testing.T) { + t.Setenv("ATMOS_ENV_AMBIENT_PROBE", "ambient") + t.Setenv("AWS_WEB_IDENTITY_TOKEN_FILE", "must-not-return") + for _, test := range []struct { + name string + sanitized []string + overrides []string + present bool + want string + }{ + {name: "ambient without identity", present: true, want: "ambient"}, + {name: "sanitized identity", sanitized: []string{"AWS_PROFILE=selected", "ATMOS_ENV_AMBIENT_PROBE=identity"}, want: "identity"}, + {name: "explicit empty environment", sanitized: []string{}}, + {name: "component overrides", sanitized: []string{"ATMOS_ENV_AMBIENT_PROBE=identity"}, overrides: []string{"ATMOS_ENV_AMBIENT_PROBE=component"}, want: "component"}, + {name: "explicit empty override", sanitized: []string{"ATMOS_ENV_AMBIENT_PROBE=identity"}, overrides: []string{"ATMOS_ENV_AMBIENT_PROBE="}}, + {name: "last path wins", sanitized: []string{"PATH=ambient"}, overrides: []string{"PATH=component", "PATH=toolchain"}}, + } { + t.Run(test.name, func(t *testing.T) { + info := &schema.ConfigAndStacksInfo{SanitizedEnv: test.sanitized, ComponentEnvList: test.overrides, ComponentEnvSection: map[string]any{"AWS_WEB_IDENTITY_TOKEN_FILE": "stale-section"}} + got := preparationEnvironment(info) + require.Equal(t, test.want, got["ATMOS_ENV_AMBIENT_PROBE"]) + _, present := got["AWS_WEB_IDENTITY_TOKEN_FILE"] + require.Equal(t, test.present, present) + if test.name == "last path wins" { + require.Equal(t, "toolchain", got["PATH"]) + } + got["AWS_PROFILE"] = "mutated" + require.NotEqual(t, "mutated", preparationEnvironment(info)["AWS_PROFILE"]) + if len(info.SanitizedEnv) > 0 { + info.SanitizedEnv[0] = "SOURCE_CHANGED=yes" + require.NotContains(t, got, "SOURCE_CHANGED") + } + require.Equal(t, "must-not-return", os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")) + }) + } +} diff --git a/pkg/plugin/adapter/configuration/mock_provider_test.go b/pkg/plugin/adapter/configuration/mock_provider_test.go new file mode 100644 index 00000000000..8bf10fa5aec --- /dev/null +++ b/pkg/plugin/adapter/configuration/mock_provider_test.go @@ -0,0 +1,86 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/cloudposse/atmos/pkg/plugin/adapter/configuration (interfaces: Provider) +// +// Generated by this command: +// +// mockgen -destination=mock_provider_test.go -package=configuration . Provider +// + +// Package configuration is a generated GoMock package. +package configuration + +import ( + context "context" + reflect "reflect" + + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + gomock "go.uber.org/mock/gomock" +) + +// MockProvider is a mock of Provider interface. +type MockProvider struct { + ctrl *gomock.Controller + recorder *MockProviderMockRecorder + isgomock struct{} +} + +// MockProviderMockRecorder is the mock recorder for MockProvider. +type MockProviderMockRecorder struct { + mock *MockProvider +} + +// NewMockProvider creates a new mock instance. +func NewMockProvider(ctrl *gomock.Controller) *MockProvider { + mock := &MockProvider{ctrl: ctrl} + mock.recorder = &MockProviderMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProvider) EXPECT() *MockProviderMockRecorder { + return m.recorder +} + +// ComponentType mocks base method. +func (m *MockProvider) ComponentType() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ComponentType") + ret0, _ := ret[0].(string) + return ret0 +} + +// ComponentType indicates an expected call of ComponentType. +func (mr *MockProviderMockRecorder) ComponentType() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComponentType", reflect.TypeOf((*MockProvider)(nil).ComponentType)) +} + +// Discover mocks base method. +func (m *MockProvider) Discover(arg0 context.Context, arg1 *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Discover", arg0, arg1) + ret0, _ := ret[0].(*pluginv1.DiscoverComponentsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Discover indicates an expected call of Discover. +func (mr *MockProviderMockRecorder) Discover(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Discover", reflect.TypeOf((*MockProvider)(nil).Discover), arg0, arg1) +} + +// Prepare mocks base method. +func (m *MockProvider) Prepare(arg0 context.Context, arg1 *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Prepare", arg0, arg1) + ret0, _ := ret[0].(*pluginv1.PrepareComponentResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Prepare indicates an expected call of Prepare. +func (mr *MockProviderMockRecorder) Prepare(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockProvider)(nil).Prepare), arg0, arg1) +} diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go new file mode 100644 index 00000000000..84288a68b6f --- /dev/null +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -0,0 +1,120 @@ +package configuration + +import ( + "context" + "fmt" + "os" + "path/filepath" + "strings" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/schema" +) + +// Prepare reevaluates only the selected instance, after the scheduler's dependencies. +func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { + defer perf.Track(nil, "configurationadapter.Prepare")() + + if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + return nil, nil + } + if info.UseTerraformPlan || info.PlanFile != "" || info.StoredPlanFile != "" { + return nil, fmt.Errorf("%w: plugin saved-plan binding is not implemented", errUtils.ErrPluginUnsupportedExtension) + } + if err := s.ensure(ctx); err != nil { + return nil, err + } + instance := s.instances[[3]string{info.Stack, "terraform", info.ComponentFromArg}] + if instance == nil { + return nil, errUtils.ErrPluginInvalidConfig + } + provider, ok := s.registry[instance.Provider] + if !ok { + return nil, errUtils.ErrPluginUnsupportedExtension + } + settings := s.providerSettings(instance.Provider) + env := preparationEnvironment(info) + env["ATMOS_TERRAFORM_BINARY"] = info.Command + env["TF_WORKSPACE"] = info.TerraformWorkspace + result, err := provider.Prepare(ctx, &pluginv1.ComponentRequest{ + Provider: instance.Provider, Address: instance.Address, Source: instance.Source, RootDirectory: s.root, + Configuration: instance.Configuration, ProviderConfiguration: settings, + Invocation: &pluginv1.Invocation{Environment: env}, + Operation: &pluginv1.ComponentOperation{Command: info.SubCommand, Mode: "native"}, + Effects: &pluginv1.ComponentEffects{Commands: true, Network: true, Secrets: true, Writes: true, StateReads: true}, + }) + if err != nil { + return nil, err + } + if result.Engine != instance.Engine { + return nil, errUtils.ErrPluginProtocol + } + return preparedConfiguration(result) +} + +func preparedConfiguration(result *pluginv1.PrepareComponentResponse) (*schema.PreparedComponentConfiguration, error) { + inputs, err := adapter.DecodeObject(result.Inputs) + if err != nil { + return nil, err + } + backend, err := adapter.DecodeObject(result.State.Backend) + if err != nil { + return nil, err + } + if result.State.BackendType == "local" { + resolveLocalBackend(backend, result.State.WorkingDirectory) + } + prepared := &schema.PreparedComponentConfiguration{Engine: result.Engine, Source: result.ModuleSource, Inputs: inputs, BackendType: result.State.BackendType, Backend: backend, Workspace: result.State.Workspace} + for _, file := range result.Files { + if file.IfExists == "overwrite_terragrunt" { + return nil, errUtils.ErrPluginUnsupportedExtension + } + prepared.Files = append(prepared.Files, schema.ComponentConfigurationFile{Path: file.Path, Content: file.Content, IfExists: file.IfExists, Sensitive: file.Sensitive}) + } + return prepared, nil +} + +func resolveLocalBackend(backend map[string]any, root string) { + for key, fallback := range map[string]string{"path": "terraform.tfstate", "workspace_dir": "terraform.tfstate.d"} { + path, _ := backend[key].(string) + if path == "" { + path = fallback + } + if !filepath.IsAbs(path) { + path = filepath.Join(root, path) + } + backend[key] = path + } +} + +// The sanitized base is authoritative, including an explicitly empty slice. +// Never reintroduce ambient credentials removed by the selected identity. +func preparationEnvironment(info *schema.ConfigAndStacksInfo) map[string]string { + base := info.SanitizedEnv + if base == nil { + base = os.Environ() + } + env := make(map[string]string) + for _, entries := range [][]string{base, info.ComponentEnvList} { + for _, entry := range entries { + key, value, ok := strings.Cut(entry, "=") + if ok { + env[key] = value + } + } + } + return env +} + +func (s *Session) providerSettings(name string) *pluginv1.ComponentValue { + var settings *pluginv1.ComponentValue + for _, request := range s.requests { + if request.Provider == name { + settings = request.ProviderConfiguration + } + } + return settings +} diff --git a/pkg/plugin/adapter/configuration/session.go b/pkg/plugin/adapter/configuration/session.go new file mode 100644 index 00000000000..80ada4de149 --- /dev/null +++ b/pkg/plugin/adapter/configuration/session.go @@ -0,0 +1,157 @@ +// Package configuration connects native configuration providers to Atmos stack definitions. +package configuration + +import ( + "context" + "maps" + "os" + "path/filepath" + "slices" + "strings" + "sync" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/merge" + "github.com/cloudposse/atmos/pkg/perf" + adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/schema" +) + +// Provider is the typed component capability boundary used by a discovery session. +// +//go:generate go run go.uber.org/mock/mockgen -destination=mock_provider_test.go -package=configuration . Provider +type Provider interface { + ComponentType() string + Discover(context.Context, *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) + Prepare(context.Context, *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) +} + +// Loader resolves the requested configuration providers through package policy and locks. +type Loader func(context.Context, []string) (map[string]Provider, error) + +// Session holds one command's discovery result; it is never a process-global cache. +type Session struct { + ctx context.Context + root, command string + requests []*pluginv1.DiscoverComponentsRequest + loader Loader + once sync.Once + done chan struct{} + registry map[string]Provider + definitions map[string]map[string]any + instances map[[3]string]*pluginv1.DiscoveredComponent + err error +} + +// New snapshots the explicitly enabled scope without starting plugins or scanning directories. +func New(ctx context.Context, config *schema.AtmosConfiguration, command string, loader Loader) (*Session, error) { + defer perf.Track(config, "configurationadapter.New")() + + if err := ctx.Err(); err != nil { + return nil, err + } + root := config.BasePathAbsolute + if !filepath.IsAbs(root) || loader == nil { + return nil, errUtils.ErrPluginInvalidConfig + } + s := &Session{ctx: ctx, root: root, command: command, loader: loader, done: make(chan struct{})} + seen := make(map[string]bool) + for _, name := range slices.Sorted(maps.Keys(config.Components.Terraform.ConfigurationProviders)) { + settings := config.Components.Terraform.ConfigurationProviders[name] + if !settings.Enabled || !settings.Discovery.Enabled { + continue + } + + if settings.Provider != "" { + name = settings.Provider + } + if seen[name] { + return nil, errUtils.ErrDuplicatePluginExtension + } + seen[name] = true + request, err := discoveryRequest(config, &settings, name, root, command) + if err != nil { + return nil, err + } + s.requests = append(s.requests, request) + } + return s, nil +} + +// Discover returns isolated definitions and shares only immutable evaluator results within this invocation. +func (s *Session) Discover(ctx context.Context) (map[string]map[string]any, error) { + defer perf.Track(nil, "configurationadapter.Discover")() + + if err := s.ensure(ctx); err != nil { + return nil, err + } + result := make(map[string]map[string]any, len(s.definitions)) + for name, definition := range s.definitions { + copy, err := merge.DeepCopyMap(definition) + if err != nil { + return nil, err + } + result[name] = copy + } + return result, nil +} + +func (s *Session) ensure(ctx context.Context) error { + if err := ctx.Err(); err != nil { + return err + } + if err := s.ctx.Err(); err != nil { + return err + } + s.once.Do(func() { + go func() { + defer close(s.done) + call, cancel := context.WithCancel(s.ctx) + stop := context.AfterFunc(ctx, cancel) + defer stop() + defer cancel() + s.err = s.discover(call) + }() + }) + select { + case <-ctx.Done(): + return ctx.Err() + case <-s.ctx.Done(): + return s.ctx.Err() + case <-s.done: + return s.err + } +} + +func environment() map[string]string { + result := make(map[string]string) + for _, entry := range os.Environ() { + key, value, ok := strings.Cut(entry, "=") + if ok { + result[key] = value + } + } + return result +} + +func discoveryRequest(config *schema.AtmosConfiguration, settings *schema.ComponentConfiguration, name, root, command string) (*pluginv1.DiscoverComponentsRequest, error) { + if settings.Mode != "" && settings.Mode != "native" { + return nil, errUtils.ErrPluginUnsupportedExtension + } + if len(settings.Discovery.IncludedPaths) == 0 { + return nil, errUtils.ErrPluginInvalidConfig + } + for _, pattern := range append(slices.Clone(settings.Discovery.IncludedPaths), settings.Discovery.ExcludedPaths...) { + if !filepath.IsLocal(pattern) { + return nil, errUtils.ErrPluginInvalidConfig + } + } + value, err := adapter.EncodeObject(settings) + if err != nil { + return nil, err + } + env := environment() + env["ATMOS_TERRAFORM_BINARY"] = config.Components.Terraform.Command + return &pluginv1.DiscoverComponentsRequest{Provider: name, RootDirectory: root, IncludePaths: slices.Clone(settings.Discovery.IncludedPaths), ExcludePaths: slices.Clone(settings.Discovery.ExcludedPaths), ProviderConfiguration: value, Operation: &pluginv1.ComponentOperation{Command: command, Mode: "native"}, Invocation: &pluginv1.Invocation{Environment: env}}, nil +} diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go new file mode 100644 index 00000000000..72be751707a --- /dev/null +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -0,0 +1,213 @@ +package configuration + +import ( + "context" + "encoding/json" + "errors" + "path/filepath" + "sync" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/schema" +) + +func enabledConfig(t *testing.T) *schema.AtmosConfiguration { + t.Helper() + return &schema.AtmosConfiguration{BasePathAbsolute: t.TempDir(), Components: schema.Components{Terraform: schema.Terraform{Command: "tofu", ConfigurationProviders: map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true, IncludedPaths: []string{"live/**"}}}}}}} +} + +func unit(t *testing.T, name string) *pluginv1.DiscoveredComponent { + t.Helper() + value, err := adapter.EncodeObject(map[string]any{"source": "./modules/unit", "vars": map[string]any{}}) + require.NoError(t, err) + return &pluginv1.DiscoveredComponent{Address: &pluginv1.ComponentAddress{Stack: "live", Component: name, ComponentType: "terraform"}, Provider: "terragrunt", Engine: "opentofu", Source: "live/" + name + "/terragrunt.hcl", Configuration: value, Sources: []*pluginv1.ComponentSource{{Path: "root.hcl", Kind: pluginv1.ComponentSource_FILE}, {Path: "modules", Kind: pluginv1.ComponentSource_DIRECTORY}}} +} + +func TestSessionDiscoveryAndPreparation(t *testing.T) { + config := enabledConfig(t) + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform") + network, app := unit(t, "network"), unit(t, "app") + app.Dependencies = []*pluginv1.ComponentDependency{{Target: network.Address, Kind: pluginv1.ComponentDependency_OUTPUT}} + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + require.Equal(t, []string{"live/**"}, request.IncludePaths) + require.Nil(t, request.Effects) + require.Equal(t, "tofu", request.Invocation.Environment["ATMOS_TERRAFORM_BINARY"]) + return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{network, app}}, nil + }) + calls := 0 + session, err := New(t.Context(), config, "apply", func(_ context.Context, names []string) (map[string]Provider, error) { + calls++ + require.Equal(t, []string{"terragrunt"}, names) + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + require.Zero(t, calls) + // Changing configuration after construction must not alter this invocation. + config.Components.Terraform.ConfigurationProviders["terragrunt"].Discovery.IncludedPaths[0] = "different/**" + first, err := session.Discover(t.Context()) + require.NoError(t, err) + components := first["live"]["components"].(map[string]any)["terraform"].(map[string]any) + appConfig := components["app"].(map[string]any) + require.Equal(t, []any{"root.hcl"}, appConfig["dependencies"].(map[string]any)["files"]) + require.Equal(t, []any{map[string]any{"name": "network", "stack": "live", "type": "terraform"}}, appConfig["dependencies"].(map[string]any)["components"]) + components["app"] = "corrupt" + second, err := session.Discover(t.Context()) + require.NoError(t, err) + require.IsType(t, map[string]any{}, second["live"]["components"].(map[string]any)["terraform"].(map[string]any)["app"]) + require.Equal(t, 1, calls) + inputs, err := adapter.EncodeObject(map[string]any{"large": json.Number("9007199254740993")}) + require.NoError(t, err) + backend, err := adapter.EncodeObject(map[string]any{"path": "state.tfstate"}) + require.NoError(t, err) + provider.EXPECT().Prepare(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + require.Equal(t, "apply", request.Operation.Command) + require.True(t, request.Effects.StateReads) + require.Equal(t, "stage", request.Invocation.Environment["TF_WORKSPACE"]) + require.Equal(t, "override", request.Invocation.Environment["FROM_COMPONENT"]) + return &pluginv1.PrepareComponentResponse{Engine: "opentofu", ModuleSource: "/module", Inputs: inputs, State: &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, Workspace: "stage", WorkingDirectory: config.BasePathAbsolute}, Files: []*pluginv1.ComponentGeneratedFile{{Path: "context.tf", Content: []byte("{{ literal }}"), IfExists: "overwrite"}}}, nil + }) + prepared, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{Stack: "live", ComponentFromArg: "app", Command: "tofu", SubCommand: "apply", TerraformWorkspace: "stage", ComponentSettingsSection: map[string]any{"configuration": true}, ComponentEnvList: []string{"FROM_COMPONENT=original", "FROM_COMPONENT=override"}, ComponentEnvSection: map[string]any{"FROM_COMPONENT": "override"}}) + require.NoError(t, err) + require.Equal(t, json.Number("9007199254740993"), prepared.Inputs["large"]) + require.Equal(t, filepath.Join(config.BasePathAbsolute, "state.tfstate"), prepared.Backend["path"]) + require.Equal(t, "{{ literal }}", string(prepared.Files[0].Content)) +} + +func TestSessionRejectsInvalidScope(t *testing.T) { + for _, test := range []struct { + name string + change func(*schema.ComponentConfiguration) + want error + }{ + {"mode", func(c *schema.ComponentConfiguration) { c.Mode = "cli" }, errUtils.ErrPluginUnsupportedExtension}, + {"empty", func(c *schema.ComponentConfiguration) { c.Discovery.IncludedPaths = nil }, errUtils.ErrPluginInvalidConfig}, + {"escape", func(c *schema.ComponentConfiguration) { c.Discovery.IncludedPaths = []string{"../**"} }, errUtils.ErrPluginInvalidConfig}, + {"options", func(c *schema.ComponentConfiguration) { c.Options = map[string]any{"enabled": false} }, errUtils.ErrPluginInvalidConfig}, + } { + t.Run(test.name, func(t *testing.T) { + config := enabledConfig(t) + settings := config.Components.Terraform.ConfigurationProviders["terragrunt"] + test.change(&settings) + config.Components.Terraform.ConfigurationProviders["terragrunt"] = settings + _, err := New(t.Context(), config, "list", func(context.Context, []string) (map[string]Provider, error) { + t.Fatal("must not load") + return nil, nil + }) + require.ErrorIs(t, err, test.want) + }) + } + config := enabledConfig(t) + _, err := New(t.Context(), config, "list", nil) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + settings := config.Components.Terraform.ConfigurationProviders["terragrunt"] + settings.Provider = "terragrunt" + config.Components.Terraform.ConfigurationProviders["duplicate"] = settings + _, err = New(t.Context(), config, "list", func(context.Context, []string) (map[string]Provider, error) { return nil, nil }) + require.ErrorIs(t, err, errUtils.ErrDuplicatePluginExtension) +} + +func TestSessionCancellationAndFailure(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + started := make(chan struct{}) + finished := make(chan struct{}) + session, err := New(ctx, enabledConfig(t), "list", func(ctx context.Context, _ []string) (map[string]Provider, error) { + close(started) + <-ctx.Done() + close(finished) + return nil, ctx.Err() + }) + require.NoError(t, err) + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + _, err := session.Discover(context.Background()) + require.ErrorIs(t, err, context.Canceled) + }() + <-started + cancel() + wg.Wait() + <-finished + _, err = New(ctx, enabledConfig(t), "list", func(context.Context, []string) (map[string]Provider, error) { return nil, nil }) + require.ErrorIs(t, err, context.Canceled) + session, err = New(t.Context(), enabledConfig(t), "list", func(context.Context, []string) (map[string]Provider, error) { + return nil, errUtils.ErrPluginInvalidConfig + }) + require.NoError(t, err) + _, err = session.Discover(t.Context()) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + prepared, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{}) + require.NoError(t, err) + require.Nil(t, prepared) + _, err = session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{UseTerraformPlan: true, ComponentSettingsSection: map[string]any{"configuration": true}}) + require.True(t, errors.Is(err, errUtils.ErrPluginUnsupportedExtension)) +} + +func TestSessionRejectsConflictingDiscovery(t *testing.T) { + for _, test := range []struct { + name string + change func(*pluginv1.DiscoveredComponent) + duplicate bool + want error + }{ + {name: "unsafe stack", change: func(c *pluginv1.DiscoveredComponent) { c.Address.Stack = "../outside" }, want: errUtils.ErrPluginProtocol}, + {name: "unsupported engine", change: func(c *pluginv1.DiscoveredComponent) { c.Engine = "terragrunt" }, want: errUtils.ErrPluginUnsupportedExtension}, + {name: "invalid values", change: func(c *pluginv1.DiscoveredComponent) { c.Configuration = &pluginv1.ComponentValue{} }, want: errUtils.ErrPluginProtocol}, + {name: "out of scope dependency", change: func(c *pluginv1.DiscoveredComponent) { + c.Dependencies = []*pluginv1.ComponentDependency{{Target: &pluginv1.ComponentAddress{Stack: "other", Component: "network", ComponentType: "terraform"}}} + }, want: errUtils.ErrPluginInvalidConfig}, + {name: "duplicate", duplicate: true, want: errUtils.ErrDuplicatePluginExtension}, + } { + t.Run(test.name, func(t *testing.T) { + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform") + instance := unit(t, "app") + if test.change != nil { + test.change(instance) + } + components := []*pluginv1.DiscoveredComponent{instance} + if test.duplicate { + components = append(components, instance) + } + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).Return(&pluginv1.DiscoverComponentsResponse{Components: components}, nil) + session, err := New(t.Context(), enabledConfig(t), "list", func(context.Context, []string) (map[string]Provider, error) { + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + result, err := session.Discover(t.Context()) + require.ErrorIs(t, err, test.want) + require.Nil(t, result) + }) + } + session, err := New(t.Context(), enabledConfig(t), "list", func(context.Context, []string) (map[string]Provider, error) { return map[string]Provider{}, nil }) + require.NoError(t, err) + _, err = session.Discover(t.Context()) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) +} + +func TestPreparedConfigurationRejectsUnsupportedValues(t *testing.T) { + backend, err := adapter.EncodeObject(map[string]any{}) + require.NoError(t, err) + response := &pluginv1.PrepareComponentResponse{Engine: "terraform", State: &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, WorkingDirectory: t.TempDir(), Workspace: "default"}} + got, err := preparedConfiguration(response) + require.NoError(t, err) + require.Equal(t, filepath.Join(response.State.WorkingDirectory, "terraform.tfstate"), got.Backend["path"]) + response.Files = []*pluginv1.ComponentGeneratedFile{{Path: "generated.tf", IfExists: "overwrite_terragrunt"}} + _, err = preparedConfiguration(response) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + response.Files = nil + response.Inputs = &pluginv1.ComponentValue{} + _, err = preparedConfiguration(response) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) + response.Inputs = nil + response.State.Backend = &pluginv1.ComponentValue{} + _, err = preparedConfiguration(response) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) +} diff --git a/pkg/plugin/bootstrap/configuration.go b/pkg/plugin/bootstrap/configuration.go new file mode 100644 index 00000000000..10a65f16c6f --- /dev/null +++ b/pkg/plugin/bootstrap/configuration.go @@ -0,0 +1,36 @@ +package bootstrap + +import ( + "context" + + "github.com/cloudposse/atmos/pkg/component/configuration" + configurationadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/configuration" + "github.com/cloudposse/atmos/pkg/plugin/extension" + "github.com/cloudposse/atmos/pkg/schema" +) + +func init() { + // Register the constructor, never an invocation's provider or discovered stack map. + if err := configuration.Register("plugin", newConfigurationSession); err != nil { + panic(err) + } +} + +func newConfigurationSession(ctx context.Context, config *schema.AtmosConfiguration, operation string) (schema.ComponentConfigurationRuntime, error) { + snapshot := *config + return configurationadapter.New(ctx, config, operation, func(call context.Context, names []string) (map[string]configurationadapter.Provider, error) { + references := make([]ComponentReference, 0, len(names)) + for _, name := range names { + references = append(references, ComponentReference{Provider: name, Capability: extension.ComponentDiscovery}) + } + registry, err := LoadComponents(call, &snapshot, references) + if err != nil { + return nil, err + } + providers := make(map[string]configurationadapter.Provider) + for _, name := range registry.Names() { + providers[name], _ = registry.Get(name) + } + return providers, nil + }) +} diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go new file mode 100644 index 00000000000..a27942543a0 --- /dev/null +++ b/pkg/schema/component_configuration.go @@ -0,0 +1,102 @@ +package schema + +import ( + "context" + "encoding/json" + "errors" + "fmt" +) + +// ErrComponentConfigurationCollision prevents dynamic settings from overriding built-in fields. +// Declared here because the host errors package depends on schema through perf. +var ErrComponentConfigurationCollision = errors.New("component configuration key collision") + +// ComponentConfiguration enables one separately installed configuration provider. +// The section name is the provider name unless provider overrides it. +type ComponentConfiguration struct { + Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"` + Provider string `yaml:"provider,omitempty" json:"provider,omitempty" mapstructure:"provider"` + Mode string `yaml:"mode,omitempty" json:"mode,omitempty" mapstructure:"mode"` + Discovery ComponentDiscoveryConfig `yaml:"discovery" json:"discovery" mapstructure:"discovery"` + Options map[string]any `yaml:",inline" json:"-" mapstructure:",remain"` +} + +// ComponentDiscoveryConfig bounds automatic discovery. Both switches default off. +type ComponentDiscoveryConfig struct { + Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"` + IncludedPaths []string `yaml:"included_paths,omitempty" json:"included_paths,omitempty" mapstructure:"included_paths"` + ExcludedPaths []string `yaml:"excluded_paths,omitempty" json:"excluded_paths,omitempty" mapstructure:"excluded_paths"` +} + +// ComponentConfigurationRuntime is an invocation-owned host service. It is not a wire contract. +type ComponentConfigurationRuntime interface { + Discover(context.Context) (map[string]map[string]any, error) + Prepare(context.Context, *ConfigAndStacksInfo) (*PreparedComponentConfiguration, error) +} + +// PreparedComponentConfiguration contains evaluated inputs and literal artifacts. +type PreparedComponentConfiguration struct { + Engine string + Source string + Inputs map[string]any + BackendType string + Backend map[string]any + Workspace string + Files []ComponentConfigurationFile +} + +// ComponentConfigurationFile must bypass template rendering. +type ComponentConfigurationFile struct { + Path string + Content []byte + IfExists string + Sensitive bool +} + +// HasComponentDiscovery reports an explicit opt-in without consulting plugins or the filesystem. +func (c *AtmosConfiguration) HasComponentDiscovery() bool { + for _, provider := range c.Components.Terraform.ConfigurationProviders { + if provider.Enabled && provider.Discovery.Enabled { + return true + } + } + return false +} + +// MarshalJSON preserves dynamic provider sections beside built-in Terraform settings. +// +//nolint:gocritic // Value receiver preserves encoding when Terraform is held in an interface. +func (c Terraform) MarshalJSON() ([]byte, error) { + type plain Terraform + return marshalConfiguration(plain(c), c.ConfigurationProviders) +} + +// MarshalJSON preserves provider-owned settings without adding a host-specific options wrapper. +// +//nolint:gocritic // Value receiver preserves encoding when Terraform is held in an interface. +func (c ComponentConfiguration) MarshalJSON() ([]byte, error) { + type plain ComponentConfiguration + return marshalConfiguration(plain(c), c.Options) +} + +func marshalConfiguration[T any](base any, extras map[string]T) ([]byte, error) { + raw, err := json.Marshal(base) + if err != nil { + return nil, err + } + var result map[string]json.RawMessage + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + for name, value := range extras { + if _, exists := result[name]; exists { + return nil, fmt.Errorf("%w: configuration key %s", ErrComponentConfigurationCollision, name) + } + data, err := json.Marshal(value) + if err != nil { + return nil, err + } + result[name] = data + } + return json.Marshal(result) +} diff --git a/pkg/schema/component_configuration_test.go b/pkg/schema/component_configuration_test.go new file mode 100644 index 00000000000..6c2809f3bbf --- /dev/null +++ b/pkg/schema/component_configuration_test.go @@ -0,0 +1,43 @@ +package schema + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v3" +) + +func TestComponentConfigurationSerialization(t *testing.T) { + config := Terraform{Command: "tofu", ConfigurationProviders: map[string]ComponentConfiguration{"terragrunt": {Enabled: true, Mode: "native", Discovery: ComponentDiscoveryConfig{Enabled: true, IncludedPaths: []string{"live/**"}}, Options: map[string]any{"limit": json.Number("9007199254740993")}}}} + raw, err := json.Marshal(config) + require.NoError(t, err) + require.Contains(t, string(raw), `"limit":9007199254740993`) + require.Contains(t, string(raw), `"terragrunt":{`) + require.NotContains(t, string(raw), "ConfigurationProviders") + data, err := yaml.Marshal(config) + require.NoError(t, err) + var decoded Terraform + require.NoError(t, yaml.Unmarshal(data, &decoded)) + require.True(t, decoded.ConfigurationProviders["terragrunt"].Discovery.Enabled) + require.Equal(t, []string{"live/**"}, decoded.ConfigurationProviders["terragrunt"].Discovery.IncludedPaths) + config.ConfigurationProviders["command"] = ComponentConfiguration{} + _, err = json.Marshal(config) + require.ErrorIs(t, err, ErrComponentConfigurationCollision) + _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"enabled": false}}) + require.ErrorIs(t, err, ErrComponentConfigurationCollision) + _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"bad": make(chan int)}}) + require.Error(t, err) +} + +func TestComponentDiscoveryRequiresBothOptIns(t *testing.T) { + for _, enabled := range []bool{false, true} { + for _, discovery := range []bool{false, true} { + config := AtmosConfiguration{Components: Components{Terraform: Terraform{ConfigurationProviders: map[string]ComponentConfiguration{ + "terragrunt": {Enabled: enabled, Discovery: ComponentDiscoveryConfig{Enabled: discovery}}, + }}}} + require.Equal(t, enabled && discovery, config.HasComponentDiscovery()) + } + } + require.False(t, (&AtmosConfiguration{}).HasComponentDiscovery()) +} diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index 0dbe996122b..26d798c3a75 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -112,6 +112,9 @@ type ConfigMetadata struct { // AtmosConfiguration structure represents schema for `atmos.yaml` CLI config. type AtmosConfiguration struct { + // ComponentConfigurations belongs to this invocation and is never serialized. + ComponentConfigurations ComponentConfigurationRuntime `yaml:"-" json:"-" mapstructure:"-"` + Scaffold *ScaffoldConfiguration `yaml:"scaffold,omitempty" json:"scaffold,omitempty" mapstructure:"scaffold"` // ScaffoldConfigLoaded distinguishes an empty effective catalog from a // configuration constructed by a caller that still needs catalog discovery. @@ -751,6 +754,9 @@ type SourceSettings struct { } type Terraform struct { + // ConfigurationProviders contains opt-in configuration formats such as Terragrunt. + ConfigurationProviders map[string]ComponentConfiguration `yaml:",inline" json:"-" mapstructure:",remain"` + BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"` ApplyAutoApprove bool `yaml:"apply_auto_approve" json:"apply_auto_approve" mapstructure:"apply_auto_approve"` AppendUserAgent string `yaml:"append_user_agent" json:"append_user_agent" mapstructure:"append_user_agent"` diff --git a/plugins/terragrunt/.gitignore b/plugins/terragrunt/.gitignore new file mode 100644 index 00000000000..ae3c1726048 --- /dev/null +++ b/plugins/terragrunt/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md new file mode 100644 index 00000000000..8eb5d0274ba --- /dev/null +++ b/plugins/terragrunt/README.md @@ -0,0 +1,61 @@ +# Native Terragrunt configuration plugin + +This development package evaluates Terragrunt HCL with Terragrunt Go modules. Atmos lists the resulting units as Terraform components and executes them with its Terraform/OpenTofu lifecycle. The Terragrunt executable is not used. + +This is an unmerged implementation with limited compatibility. It is not a published plugin release. + +## Build and run + +From the repository root: + +```shell +python3 plugins/terragrunt/scripts/build.py --test +go build -ldflags=-w -o .context/atmos-native . +python3 plugins/terragrunt/scripts/acceptance.py --atmos .context/atmos-native +``` + +The acceptance runner copies both fixtures under `.context/`, saves command logs, applies only built-in `terraform_data` resources with local state, checks unchanged plans and dependency refresh, then destroys those resources. It needs OpenTofu on PATH. Use `--terraform=terraform` to select Terraform instead. It does not call the Terragrunt CLI. + +Configure a project with: + +```yaml +components: + terraform: + base_path: components/terraform + command: tofu + terragrunt: + enabled: true + mode: native + discovery: + enabled: true + included_paths: [live/**] +plugins: + packages: + terragrunt: + path: /absolute/path/to/this/plugins/terragrunt +``` + +Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. + +Preparation receives Atmos's sanitized environment after authentication, the selected executable, toolchain PATH, and managed Terraform RC configuration. Child commands use the invocation PATH. Neither identity changes nor HCL evaluation replace the plugin process environment. + +## Scope + +The fixtures cover local sources, local backend paths, includes, locals, nested stack values, literal generation, order and output dependencies, command-scoped mocks, fresh outputs, and native bulk execution. Unit tests cover absolute and relative workdir overrides, ownership conflicts, repeated provisioning without state loss, concurrent environment isolation, unit-relative child commands, cancellation, and rejected effects. The plugin workflow runs its unit tests on Linux, macOS, and Windows. These checks do not establish a compatibility percentage. + +Current limits include remote module/catalog sources, non-local backends, Terragrunt hooks and extra arguments, IAM options, feature flags, error/retry blocks, prevention/exclusion rules, inline modules without `terraform.source`, named-workspace output dependencies, and saved-plan apply. Unsupported semantics must fail rather than switch executors. Explicit `terragrunt://` imports, state-function host dispatch, affected revision comparison, executable mode, engine table columns, UI/log adapters, and conversion commands remain in the PRDs. + +Only enabled/mode/provider/discovery settings are accepted by this package. Additional plugin settings and typed CLI option handling remain planned. Discovery that needs command execution, decryption, network access, or identity-dependent effects fails. The native plugin is trusted code, not an OS sandbox. + +## Maintained upstream facade + +The package pins Terragrunt v1.2.1. Some required upstream facilities are in `internal` packages. The local `bridge/` module uses the import path `github.com/gruntwork-io/terragrunt/pkg/atmosbridge`, which satisfies Go's internal-package import rule. This is an Atmos-maintained facade, not a public upstream Go API or an upstream-published module. A checked-in relative module replacement resolves it to this package's source. + +The plugin also uses this checkout's SDK through a relative module replacement. Normal Go module commands work without temporary source patches or module-cache changes. Go 1.27.3 is selected by the plugin module: + +```shell +go -C plugins/terragrunt test ./... +go -C plugins/terragrunt/bridge test ./... +``` + +See [the Terragrunt PRD](../../docs/prd/terragrunt-support.md) and [the shared component contract](../../docs/prd/plugins/extensions/component-engines.md) for the release requirements. diff --git a/plugins/terragrunt/bridge/bridge.go b/plugins/terragrunt/bridge/bridge.go new file mode 100644 index 00000000000..03a78dd4f78 --- /dev/null +++ b/plugins/terragrunt/bridge/bridge.go @@ -0,0 +1,61 @@ +// Package atmosbridge is an Atmos-maintained compatibility facade for Terragrunt +// v1.2.1. Its local module path permits access to upstream internal packages. +// This is not an upstream-published package; a relative module replacement selects it. +package atmosbridge + +import ( + "context" + "fmt" + "io" + "path/filepath" + + "github.com/gruntwork-io/terragrunt/internal/stacks/generate" + "github.com/gruntwork-io/terragrunt/internal/tf" + "github.com/gruntwork-io/terragrunt/internal/venv" + "github.com/gruntwork-io/terragrunt/internal/vexec" + "github.com/gruntwork-io/terragrunt/internal/vhttp" + "github.com/gruntwork-io/terragrunt/internal/vsops" + "github.com/gruntwork-io/terragrunt/pkg/log" + "github.com/gruntwork-io/terragrunt/pkg/options" + "github.com/spf13/afero" +) + +// Environment isolates invocation environments and output writers. +func Environment(env map[string]string, stdout, stderr io.Writer) *venv.Venv { + // Invocation environments must not replace the plugin's process-wide environment. + return venv.OSVenv().WithExec(scopedExec{Exec: vexec.NewOSExec(), environment: env}).WithEnv(env).WithReplaceEnviron(func(map[string]string) error { return nil }).WithWriter(stdout).WithErrWriter(stderr) +} + +// Discovery denies process execution, network access, and decryption. Only an +// explicit stack generation phase may write its generated files. +func Discovery(v *venv.Venv, generate bool) *venv.Venv { + v = v.WithHandler(func(_ context.Context, inv vexec.Invocation) vexec.Result { + return vexec.Result{Err: fmt.Errorf("read-only discovery cannot execute %s", inv.Name)} + }).WithHTTP(vhttp.NewNoNetworkClient()).WithSops(vsops.NewMemDecrypter(func(_ map[string]string, path, _ string) ([]byte, error) { + return nil, fmt.Errorf("read-only discovery cannot decrypt %s", path) + })) + if !generate { + v = v.WithFS(afero.NewReadOnlyFs(v.FS)) + } + return v +} + +// WorkingDir uses upstream cache identity without downloading or changing state. +func WorkingDir(logger log.Logger, env *venv.Venv, source, download, directory string) (string, error) { + resolved, err := tf.NewSource(logger, env.FS, source, download, directory, false) + if err != nil { + return "", err + } + return resolved.WorkingDir, nil +} + +// Generate expands nested stacks through Terragrunt's real Go implementation. +// It does not execute the Terragrunt CLI or apply infrastructure. +func Generate(ctx context.Context, logger log.Logger, env *venv.Venv, path, tofu string) error { + opts := options.NewTerragruntOptions(env.Exec) + opts.WorkingDir = filepath.Dir(path) + opts.RootWorkingDir = opts.WorkingDir + opts.TerragruntStackConfigPath = path + opts.TFPath = tofu + return generate.NewGenerator().GenerateStacks(ctx, logger, env, opts, nil) +} diff --git a/plugins/terragrunt/bridge/execution.go b/plugins/terragrunt/bridge/execution.go new file mode 100644 index 00000000000..9b185cadf7e --- /dev/null +++ b/plugins/terragrunt/bridge/execution.go @@ -0,0 +1,59 @@ +package atmosbridge + +import ( + "context" + "os/exec" + "path/filepath" + "runtime" + "strings" + + "github.com/gruntwork-io/terragrunt/internal/vexec" +) + +// scopedExec resolves child commands against the invocation's PATH, never the +// plugin process environment. It does not mutate process-global environment. +type scopedExec struct { + vexec.Exec + environment map[string]string +} + +func (e scopedExec) LookPath(file string) (string, error) { + if filepath.IsAbs(file) || strings.ContainsAny(file, `/\`) { + return e.Exec.LookPath(file) + } + suffixes := []string{""} + if runtime.GOOS == "windows" && filepath.Ext(file) == "" { + extensions := e.environment["PATHEXT"] + if extensions == "" { + extensions = ".COM;.EXE;.BAT;.CMD" + } + suffixes = strings.Split(extensions, ";") + } + for _, directory := range filepath.SplitList(e.environment["PATH"]) { + // Match Go's protection against implicit execution from the working directory. + if !filepath.IsAbs(directory) { + continue + } + for _, suffix := range suffixes { + candidate := filepath.Join(directory, file+suffix) + if resolved, err := e.Exec.LookPath(candidate); err == nil { + return resolved, nil + } + } + } + return "", &exec.Error{Name: file, Err: exec.ErrNotFound} +} + +func (e scopedExec) Command(ctx context.Context, name string, args ...string) vexec.Cmd { + // Explicit relative commands belong to the unit's directory, which upstream + // assigns with SetDir after constructing the command. Let os/exec resolve + // them at start time; looking them up here would use the plugin's directory. + if !filepath.IsAbs(name) && strings.ContainsAny(name, `/\`) { + return e.Exec.Command(ctx, name, args...) + } + path, err := e.LookPath(name) + if err != nil { + return vexec.NewMemExec(func(context.Context, vexec.Invocation) vexec.Result { return vexec.Result{Err: err} }).Command(ctx, name, args...) + } + return e.Exec.Command(ctx, path, args...) +} diff --git a/plugins/terragrunt/bridge/execution_test.go b/plugins/terragrunt/bridge/execution_test.go new file mode 100644 index 00000000000..a1866bc0998 --- /dev/null +++ b/plugins/terragrunt/bridge/execution_test.go @@ -0,0 +1,51 @@ +package atmosbridge + +import ( + "context" + "errors" + "os" + "os/exec" + "path/filepath" + "sync" + "testing" +) + +func TestEnvironmentLookupUsesInvocationPath(t *testing.T) { + executable, err := os.Executable() + if err != nil { + t.Fatal(err) + } + env := map[string]string{"PATH": filepath.Dir(executable), "PROBE": "original"} + scoped := Environment(env, nil, nil) + got, err := scoped.Exec.LookPath(filepath.Base(executable)) + if err != nil || got != executable { + t.Fatalf("lookup = %q, %v", got, err) + } + other := Environment(map[string]string{"PATH": t.TempDir()}, nil, nil) + if _, err := other.Exec.LookPath(filepath.Base(executable)); !errors.Is(err, exec.ErrNotFound) { + t.Fatalf("unexpected fallback: %v", err) + } + if err := other.Exec.Command(context.Background(), filepath.Base(executable)).Run(); !errors.Is(err, exec.ErrNotFound) { + t.Fatalf("unexpected spawn: %v", err) + } + if _, err := other.Exec.LookPath(executable); err != nil { + t.Fatal(err) + } + // Simultaneous providers cannot replace the process environment or each other's PATH. + var wg sync.WaitGroup + for range 10 { + wg.Add(1) + go func() { + defer wg.Done() + for range 10 { + if _, err := scoped.Exec.LookPath(filepath.Base(executable)); err != nil { + t.Error(err) + } + } + }() + } + wg.Wait() + if env["PROBE"] != "original" { + t.Fatal("environment mutated") + } +} diff --git a/plugins/terragrunt/bridge/go.mod b/plugins/terragrunt/bridge/go.mod new file mode 100644 index 00000000000..6a5271b8e95 --- /dev/null +++ b/plugins/terragrunt/bridge/go.mod @@ -0,0 +1,231 @@ +module github.com/gruntwork-io/terragrunt/pkg/atmosbridge + +go 1.27.3 + +require ( + github.com/gruntwork-io/terragrunt v1.2.1 + github.com/spf13/afero v1.15.0 +) + +require ( + cel.dev/expr v0.25.2 // indirect + charm.land/lipgloss/v2 v2.0.6 // indirect + cloud.google.com/go v0.123.0 // indirect + cloud.google.com/go/auth v0.24.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect + cloud.google.com/go/iam v1.12.0 // indirect + cloud.google.com/go/kms v1.32.0 // indirect + cloud.google.com/go/longrunning v1.2.0 // indirect + cloud.google.com/go/monitoring v1.30.0 // indirect + cloud.google.com/go/storage v1.70.0 // indirect + dario.cat/mergo v1.0.2 // indirect + filippo.io/age v1.3.1 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + filippo.io/hpke v0.4.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0 // indirect + github.com/Masterminds/semver/v3 v3.5.0 // indirect + github.com/ProtonMail/go-crypto v1.5.2 // indirect + github.com/agext/levenshtein v1.2.3 // indirect + github.com/apache/arrow-go/v18 v18.7.0 // indirect + github.com/apparentlymart/go-cidr v1.1.1 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/apparentlymart/go-textseg/v17 v17.0.1 // indirect + github.com/apparentlymart/go-versions v1.0.3 // indirect + github.com/aws/aws-sdk-go-v2 v1.47.4 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24 // indirect + github.com/aws/aws-sdk-go-v2/config v1.33.10 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.20.10 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7 // indirect + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1 // indirect + github.com/aws/aws-sdk-go-v2/service/iam v1.64.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7 // indirect + github.com/aws/aws-sdk-go-v2/service/kms v1.54.1 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.10.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.38.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.51.5 // indirect + github.com/aws/smithy-go v1.28.6 // indirect + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect + github.com/blang/semver v3.5.1+incompatible // indirect + github.com/bmatcuk/doublestar/v4 v4.10.2 // indirect + github.com/buger/jsonparser v1.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/charlievieth/fastwalk v1.0.14 // indirect + github.com/charmbracelet/colorprofile v0.4.3 // indirect + github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4 // indirect + github.com/charmbracelet/x/ansi v0.11.9 // indirect + github.com/charmbracelet/x/term v0.2.2 // indirect + github.com/charmbracelet/x/termios v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.2.2 // indirect + github.com/clipperhouse/displaywidth v0.11.0 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect + github.com/cloudflare/circl v1.6.4 // indirect + github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect + github.com/creack/pty v1.1.24 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect + github.com/fatih/color v1.19.0 // indirect + github.com/felixge/httpsnoop v1.1.0 // indirect + github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e // indirect + github.com/getsops/sops/v3 v3.13.3 // indirect + github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.6 // indirect + github.com/goccy/go-yaml v1.19.2 // indirect + github.com/gofrs/flock v0.13.1 // indirect + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/flatbuffers v25.12.19+incompatible // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect + github.com/googleapis/gax-go/v2 v2.26.2 // indirect + github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect + github.com/gruntwork-io/terragrunt-engine-go v0.2.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-getter/gcs/v2 v2.2.6 // indirect + github.com/hashicorp/go-getter/s3/v2 v2.2.6 // indirect + github.com/hashicorp/go-getter/v2 v2.2.6 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.8.0 // indirect + github.com/hashicorp/go-retryablehttp v0.7.8 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.7 // indirect + github.com/hashicorp/go-uuid v1.0.4 // indirect + github.com/hashicorp/go-version v1.9.0 // indirect + github.com/hashicorp/hcl v1.0.1-vault-7 // indirect + github.com/hashicorp/hcl/v2 v2.25.0 // indirect + github.com/hashicorp/terraform-svchost v0.2.1 // indirect + github.com/hashicorp/vault/api v1.23.0 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect + github.com/huandu/go-clone v1.7.3 // indirect + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207 // indirect + github.com/invopop/jsonschema v0.14.0 // indirect + github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect + github.com/klauspost/compress v1.19.2 // indirect + github.com/klauspost/cpuid/v2 v2.4.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/lib/pq v1.12.3 // indirect + github.com/lucasb-eyer/go-colorful v1.4.1 // indirect + github.com/mattn/go-colorable v0.1.15 // indirect + github.com/mattn/go-isatty v0.0.24 // indirect + github.com/mattn/go-runewidth v0.0.31 // indirect + github.com/mattn/go-shellwords v1.0.16 // indirect + github.com/mattn/go-zglob v0.0.8 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/oklog/run v1.2.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect + github.com/pb33f/ordered-map/v2 v2.3.1 // indirect + github.com/pierrec/lz4/v4 v4.1.28 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/sirupsen/logrus v1.10.2 // indirect + github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect + github.com/ulikunitz/xz v0.5.16 // indirect + github.com/urfave/cli v1.22.17 // indirect + github.com/urfave/cli/v2 v2.27.7 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect + github.com/xo/terminfo v1.0.0 // indirect + github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect + github.com/zclconf/go-cty v1.19.0 // indirect + github.com/zclconf/go-cty-yaml v1.2.0 // indirect + github.com/zeebo/xxh3 v1.1.0 // indirect + go.mongodb.org/mongo-driver v1.17.9 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.45.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect + go.opentelemetry.io/otel v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0 // indirect + go.opentelemetry.io/otel/log v1.47.0 // indirect + go.opentelemetry.io/otel/metric v1.47.0 // indirect + go.opentelemetry.io/otel/sdk v1.47.0 // indirect + go.opentelemetry.io/otel/sdk/log v1.47.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.47.0 // indirect + go.opentelemetry.io/otel/trace v1.47.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect + go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/term v0.47.0 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/time v0.16.0 // indirect + golang.org/x/tools v0.51.0 // indirect + google.golang.org/api v0.308.0 // indirect + google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect + google.golang.org/grpc v1.84.0 // indirect + google.golang.org/protobuf v1.36.12 // indirect + gopkg.in/ini.v1 v1.67.3 // indirect + oras.land/oras-go/v2 v2.7.0 // indirect +) diff --git a/plugins/terragrunt/bridge/go.sum b/plugins/terragrunt/bridge/go.sum new file mode 100644 index 00000000000..27ac1b34140 --- /dev/null +++ b/plugins/terragrunt/bridge/go.sum @@ -0,0 +1,806 @@ +c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd h1:ZLsPO6WdZ5zatV4UfVpr7oAwLGRZ+sebTUruuM4Ra3M= +c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo= +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +charm.land/bubbles/v2 v2.2.1 h1:Fq1+qm5hV6GkvzLQDhCBpXXE5tLgvh1PRriCLwSvIQU= +charm.land/bubbles/v2 v2.2.1/go.mod h1:wdMgn+sje1KNXdwFizIWjbf328fIUBxqEmJ/vYPo8yc= +charm.land/bubbletea/v2 v2.1.0 h1:A9fj9h5LFrvQhQHFNggp8K8rvY6CUfgn9dMbb6p2HIw= +charm.land/bubbletea/v2 v2.1.0/go.mod h1:xWHeyxIX9/wiFU2kgPW04ojOZyTzrWf+8lGjUCaftiU= +charm.land/glamour/v2 v2.0.1 h1:xl+r00A4aJWU0z8fgwKd9fQQ4rsphqGUzuEiXZP5n+c= +charm.land/glamour/v2 v2.0.1/go.mod h1:jo9z8XqVKPeEFMVdvCRLGk++RyJ3CdUwgNr7EvXLw3k= +charm.land/lipgloss/v2 v2.0.6 h1:EaGKeuA8FvF+v2BT5VmZd2LoYLaMZJXA5n34th8nCIQ= +charm.land/lipgloss/v2 v2.0.6/go.mod h1:ipDDJNSGa1hlwDtSfW1s2/xR8Vdhbut4PXh2zEKZd0Q= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.24.1 h1:NTmd2iJb4DsGIav0KiqFMYI88nMshA2wnFMBatRmoCs= +cloud.google.com/go/auth v0.24.1/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/kms v1.32.0 h1:s+rEluaaZKhLVjrIWG7uNBsnWbiitElzNzFGyp6+nIg= +cloud.google.com/go/kms v1.32.0/go.mod h1:CSGvW6GnMQbY+1nOHcIzhMtHSbExXlOmCKjWtYVjcpA= +cloud.google.com/go/logging v1.19.0 h1:NCqhdVUg3wQ8Cobdf16FDSuTGi3+6+hdSBHrY5TsR6Q= +cloud.google.com/go/logging v1.19.0/go.mod h1:i40NZCHC9Gqvod4yE+yQfDWwlgwW/SrshkkGibCHxcA= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/monitoring v1.30.0 h1:r/d+JUbyKmJ8b07iznuKfzVzrIXTWxHQ3lBRm3x2LlY= +cloud.google.com/go/monitoring v1.30.0/go.mod h1:htlUR0QWVMrjFzZmN4LGnMAve9xB/eduwjmINxVZ8RM= +cloud.google.com/go/storage v1.70.0 h1:LQNHn0rRF94jVFfF3e416IzdQqIufa5GfF6HilQxb80= +cloud.google.com/go/storage v1.70.0/go.mod h1:W84cNa070TZIegvTW67CBY+f5rxux8EJMb7YyiHdrls= +cloud.google.com/go/trace v1.16.0 h1:GmQovzFc5F0CNfl0VLgL64aoTtu7xsM0YajW2GlG9+E= +cloud.google.com/go/trace v1.16.0/go.mod h1:r+bdAn16dKLSV1G2D5v3e58IlQlizfxWrUfjx7kM7X0= +dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= +dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= +filippo.io/age v1.3.1 h1:hbzdQOJkuaMEpRCLSN1/C5DX74RPcNCk6oqhKMXmZi0= +filippo.io/age v1.3.1/go.mod h1:EZorDTYUxt836i3zdori5IJX/v2Lj6kWFU0cfh6C0D4= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +filippo.io/hpke v0.4.0 h1:p575VVQ6ted4pL+it6M00V/f2qTZITO0zgmdKCkd5+A= +filippo.io/hpke v0.4.0/go.mod h1:EmAN849/P3qdeK+PCMkDpDm83vRHM5cDipBJ8xbQLVY= +github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= +github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3 h1:qgnWTiWs1G7AqcKZegFvkJD1bmXJcaDU3uC0ELSgZ5U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3/go.mod h1:XtxD48QPInqoj+GMlcRlXHEYsoOxFnP6w2JgIZ9rDS4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 h1:w3gDUJlJ0BfBsHH02DCBDwbkmMSXJqBj6nBOCo9iocY= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0/go.mod h1:7scl8mG/IFLVjJ9ef/ltdND2T1z0CkgVSaQoUxLvmeU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 h1:Terj1CMW4+NY5CpWjSRkqLoxh2DkYDdv/FH2z0897Uc= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0/go.mod h1:7Ut2Qw9vcwpLW5Q4MBy43uSxXS7tK2yjs94OJ6j5thE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 h1:Hp+EScFOu9HeCbeW8WU2yQPJd4gGwhMgKxWe+G6jNzw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0/go.mod h1:/pz8dyNQe+Ey3yBp/XuYz7oqX8YDNWVpPB0hH3XWfbc= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1 h1:/Zt+cDPnpC3OVDm/JKLOs7M2DKmLRIIp3XIx9pHHiig= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1/go.mod h1:Ng3urmn6dYe8gnbCMoHHVl5APYz2txho3koEkV2o2HA= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2 h1:tQJdgQjbKKffEiMOKJmcQPkY01eFHRqWIZVefqP44nI= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2/go.mod h1:kTkpJchXAdO7LGkKZP97a+Ou8TgaF4NT6MHwOIy5uSQ= +github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0 h1:X/bTwe0qpvmvPPutc+LWo7T4cKMqDP9JHP4k+Co9ZB4= +github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0/go.mod h1:+kX7ahyFelQ42F3RScM2CFgHJljp0phc/FieKLYVpFI= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 h1:0O6j18nQDoIff6/mtosT5LNU2WehEwp+LqfX6699oqY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0 h1:bN1gA3of5bXtbnLsRPrwfmbbe7A5UWFlcTHseujLnpc= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0/go.mod h1:Yj5vHEz/aAepZGliRJsA6uvHAVAQyEwajq9ORCHPxzM= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0 h1:ZYGajzJNcirVZpT1rltgf9iM+j9zZ4v8V9DrF+xKRJ8= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0/go.mod h1:PDQyYBOzGtQgvshQI//UiXyzuMHCz0ndyu+4W8X82vM= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.58.0 h1:IBF8BbhKJkMsON/eY+LMu3aF3XMiotCb9KvkUmEkOJo= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.58.0/go.mod h1:dzcEjy1WJ0Q4u9twNR3LcLhNoYMRCrMCMafpxa0TjPQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0 h1:SBZzZCiPmDrUV7NSCWY54OnKikO/oTydPCvyEyYaDDE= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0/go.mod h1:YqwkQPrWSC7+byyc1VlKbWLBF5JsW5IoL6xUkemYSXk= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE= +github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/ProtonMail/go-crypto v1.5.2 h1:cucYnvqcY7UOXVD//mSyjeaPY0SSN3v5cDkYPxumINk= +github.com/ProtonMail/go-crypto v1.5.2/go.mod h1:/RaSu30DaKO4RY+XdV/ACcCcZkGr7AhUIduq5sjzzCo= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/chroma/v2 v2.27.0 h1:FodwmyOBgJULFYmDqibcp9pvfDLWdtPRh9v/r5BXYZs= +github.com/alecthomas/chroma/v2 v2.27.0/go.mod h1:NjJ3ciIgrqBNeIkWZ4e46nseoLDslxU1LmfCoL+wcY8= +github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM= +github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/apache/arrow-go/v18 v18.7.0 h1:Vw/i+cJyebUofT7JlqFpe65LrmwxULn166jjwStM4HY= +github.com/apache/arrow-go/v18 v18.7.0/go.mod h1:PM6IigLJkdMwIpeHXnymo+xZ52f42a9EYiLtRel4p/A= +github.com/apache/thrift v0.24.0 h1:zy31L1a49QTNB2bG1BBfMXol3yJrTH975G3pPubQVLQ= +github.com/apache/thrift v0.24.0/go.mod h1:zPt6WxgvTOM6hF92y8C+MkEM5LMxZuk4JcQOiU4Esvs= +github.com/apparentlymart/go-cidr v1.1.1 h1:oEEk8CE0HP0YpHxsegk/TaOtR2FLHdWv4p3eM4ceUwg= +github.com/apparentlymart/go-cidr v1.1.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/apparentlymart/go-textseg/v17 v17.0.1 h1:bpMXRgQ5cEoRNuQke1a80/Nl6w3G5eoIbWo9f3gXkAs= +github.com/apparentlymart/go-textseg/v17 v17.0.1/go.mod h1:fa8X4jgGeevslICIY6LcdjkSecWnXmYd9Lk34z/VxZs= +github.com/apparentlymart/go-versions v1.0.3 h1:T3b8tumoQLuu1dej2Y9v22J4PWV9IzDLh2A9lIPoVSM= +github.com/apparentlymart/go-versions v1.0.3/go.mod h1:YF5j7IQtrOAOnsGkniupEA5bfCjzd7i14yu0shZavyM= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= +github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/aws/aws-sdk-go-v2 v1.47.4 h1:bTvk6UdSSSvaQsfLVj1JRDEEqj/PDRwGf1KanaRzau0= +github.com/aws/aws-sdk-go-v2 v1.47.4/go.mod h1:XkrjAZvr705Nytv6PkPUhoSB2W9+vVHBp5oAWpkh8Ak= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24 h1:t7FxqJ5KHDeKceyD4HtGaG6z7hMSeVGjs5/4c+L5ArM= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24/go.mod h1:5XK6NRVlK8s8yj4zKcM43HLluGA/rAz+azLLvWDMRr0= +github.com/aws/aws-sdk-go-v2/config v1.33.10 h1:RRb0GghYqq2ikMXzfT4r9NO9lVhOld3FIhJJWDIdk+w= +github.com/aws/aws-sdk-go-v2/config v1.33.10/go.mod h1:BDSA7QGh6yrNQA5Z5aBnHWKMWdJDMD4IOlB4QjYSp5E= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10 h1:ItSjcLk+2M15RnRxO105uVIqLiVQn8y3gaeHC7W0iqs= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10/go.mod h1:eO4GlmGXB+gx+zDbhu3IENEFOmjrbVKJtOptJiIhngc= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4 h1:7ksj/zMap9+831SmNQZkcpmfuATp3DKr4BfLNnBdYXM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4/go.mod h1:zhi8vDrD1dj76ysTWS6Ny1y6/EEW1Jrq2y8lzKeoqfs= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34 h1:Pn7OsMwBLbkZ6OnCxWHAjf0L/22H8cnhxZC0uPwtMtg= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34/go.mod h1:eToXR/Gk1uqpn04eSmdgVXwfS0WvH8aG4eBFr8ygbpU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7 h1:fSNAt6hs4qLjb9tMZc6vj3PHlOCYGXK2JjJZ7AW2tf4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7/go.mod h1:TMav+EuXQu5kNpZZz/6rIC8xx4mCsW+6AKHrjvOSAsE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7 h1:7NS6kqBjkWIN8P/AEdmtyq6eQGAhN1oHTZdzXclpH6Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7/go.mod h1:1PFqtAUsIgF1nEVojzRJSf/v88zjzqrGW+w+UAtkXyQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7 h1:wYu55QUHARwu9YzeuY5yEJUTsIu8ahkmp1l3QmbzHn8= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7/go.mod h1:OteEkhFAgFwQtZft/3myWo3tVWxdAo7cwV+7AbcpAtQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1 h1:VQM/FWdRiHWC8khhEQBi7q8KoCiP8T6cDn80+uDm0HQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1/go.mod h1:aJmqDQQzrqt9Fi6KBkVMTTDNhP8YzXCTVoqcAMgbvkU= +github.com/aws/aws-sdk-go-v2/service/iam v1.64.5 h1:14GZ+z05ntZkgfUT/snvrs+hE+SODOflfQPugMAzOlU= +github.com/aws/aws-sdk-go-v2/service/iam v1.64.5/go.mod h1:YWSLkwCkgNF2N/2nGgkGDCiDg1wEVZvJWVZgPu14FbQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22 h1:qHfXn1Tm2Rh8kic/DvdKaiSVlHQRSr5C+rMuBR29D44= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22/go.mod h1:D4ytxJbGXu82l+2XF0q60bibysf+KkIbWfAOldAQwf8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8 h1:Foai7RHOgCNikTS6shP7OxVi4XdgR1z5uiy9NN6tBZs= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8/go.mod h1:R/HyW81sfgXHPOnJRfQGzA6lnNDSJE7KknI7ArvboM4= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7 h1:LaoBY2u56tSAEYqWNB2GZICUg7Yw+R8g+6mAhmUkwy0= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7/go.mod h1:7XyVl4Q5VQilY35Pqoxj6FGlHtK9dri62KQ58LxEiNU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7 h1:6MSlRo7aiUVBftQ8XmW7XIh3EZqCbkN9zI0YlGW8nl0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7/go.mod h1:OqapjZfp6VW4YJKKO4l68UdPvS4FIEYuEoq1JNkxCL0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7 h1:6lQFbSJxvtqn19hbh+2+g5pRV8U4Etrq5x6sL6mD35U= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7/go.mod h1:WAsCkzxO1H7/m1uYtLymru0aDH23BR7CWUA+8MpuUFY= +github.com/aws/aws-sdk-go-v2/service/kms v1.54.1 h1:aeJAJyvWS3gQ679pJbz8ZdOh3MViD1zvEdoZMVEawbg= +github.com/aws/aws-sdk-go-v2/service/kms v1.54.1/go.mod h1:0RXNc6Yf3AvSMldGD6Lcch96Ojlw2TtGnHsqfD/L4u8= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5 h1:97+lZymtcztX5RPNyW+B9pV6e60GQ7RBULVVRKhUTfk= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5/go.mod h1:bku1YUz5FGs4MRhJaLcrpFZAH52/eRS0MQYi6diatGM= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5 h1:oFsZ3u5PPFSO1YZDGKFgyDuwgpbv/sTmVShEZfRnyaE= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5/go.mod h1:P+IzYJeldxO0mHt8fX4cglzexP3akO94C/UuEA2ojP0= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5 h1:EYD6E6CsgRQPazaOfZ6suyTgfZjg07HoT4S3qB9Exkg= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5/go.mod h1:hHg7OZNN1/U62f3Q5mebJYKO4f97vZC+s0fNAsPLnMk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5 h1:v6V0AnJ0aDmivAIie/6iT7sGpjnNmzaAdxZwZ0dhwqI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5/go.mod h1:P2Lqn27Kph9z400MFOYIebFnKjZEwyUIAva6fFFMiRY= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5 h1:OuyNaMncYP4ftrvcnOHJ9j3AxO3zsC5C/ewD0HoHdjQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5/go.mod h1:Bhu66tgvf94uunUSiAc0Ew0avhnpSm0J8Hl1MYocRbo= +github.com/aws/smithy-go v1.28.6 h1:Pj+/sUviNYjow8ELRtNwKHZ9ECeF+7pATX3+shjLIrw= +github.com/aws/smithy-go v1.28.6/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmatcuk/doublestar/v4 v4.10.2 h1:eF7W7HWKg3z9NrWV9pTLnNeoXaqq3Tq9DNKXVMfoCnw= +github.com/bmatcuk/doublestar/v4 v4.10.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= +github.com/buger/jsonparser v1.2.0 h1:4EFcvK1kD4jyj6YqNK6skK6w+y7FHHBR+XBCtxwu/6g= +github.com/buger/jsonparser v1.2.0/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charlievieth/fastwalk v1.0.14 h1:3Eh5uaFGwHZd8EGwTjJnSpBkfwfsak9h6ICgnWlhAyg= +github.com/charlievieth/fastwalk v1.0.14/go.mod h1:diVcUreiU1aQ4/Wu3NbxxH4/KYdKpLDojrQ1Bb2KgNY= +github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q= +github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q= +github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4 h1:hISLzUbwcvJbGoNR6A3L/TpguRRnACBmZOee8LcHLJw= +github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4/go.mod h1:aJDVk+WOVM1K04rdc/71PMPoUGfjxjhvXfP3Pjz1Zio= +github.com/charmbracelet/x/ansi v0.11.9 h1:kIrqLBxtTVbLyyHO2Evoi93EjQo1mylWmpNEsfPxXAM= +github.com/charmbracelet/x/ansi v0.11.9/go.mod h1:DG/hpOnaI2QJ/KMMqLL2h0KVhluuJLazf8973P+Vy5w= +github.com/charmbracelet/x/exp/slice v0.0.0-20260713092006-0d683c34c74b h1:N0srud4Ch13fFAjgMlnKR2h41/2ISRbbzCJpTXGcNR0= +github.com/charmbracelet/x/exp/slice v0.0.0-20260713092006-0d683c34c74b/go.mod h1:vqEfX6xzqW1pKKZUUiFOKg0OQ7bCh54Q2vR/tserrRA= +github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= +github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= +github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY= +github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo= +github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM= +github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= +github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= +github.com/cloudflare/circl v1.6.4 h1:pOXuDTCEYyzydgUpQ0CQz3LsinKjiSk6nNP5Lt5K64U= +github.com/cloudflare/circl v1.6.4/go.mod h1:YxarevkLlbaHuWsxG6vmYNWBEsSp4pnp7j+4VljMavY= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= +github.com/containerd/continuity v0.5.0 h1:7a85HZpCSs+1Zps0Ee3DPSuAWY+0SJM1JNM51nlEVDg= +github.com/containerd/continuity v0.5.0/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= +github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= +github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= +github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/dlclark/regexp2/v2 v2.5.1 h1:E5Ug7Dh264W1ymdySmiHNcDG7fmsR307APCE5R07a20= +github.com/dlclark/regexp2/v2 v2.5.1/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= +github.com/docker/cli v29.6.2+incompatible h1:/bjePvcbbFTnRrMfWJBY7AjfICdsiLVgHn6LwTVOcqw= +github.com/docker/cli v29.6.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/go-connections v0.8.1 h1:JibmG5hULs5qXSr/cp/w3Pw5fZuStt4MOHMUExb29/M= +github.com/docker/go-connections v0.8.1/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/ebitengine/purego v0.10.2 h1:W809HbnvzAxgdm+aOvlSekrM16wGCdT/e76+9tS7gzE= +github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= +github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= +github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI= +github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ= +github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e h1:y/1nzrdF+RPds4lfoEpNhjfmzlgZtPqyO3jMzrqDQws= +github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e/go.mod h1:awFzISqLJoZLm+i9QQ4SgMNHDqljH6jWV0B36V5MrUM= +github.com/getsops/sops/v3 v3.13.3 h1:saYczbT88kD1saNChe1cAbFQe5mrRhTIfEw3TaEcmK0= +github.com/getsops/sops/v3 v3.13.3/go.mod h1:3mUuUtKnJ63IzIvU4LQoDXdp0ZvorY5s2hEc7UVNfx8= +github.com/gitsight/go-vcsurl v1.0.1 h1:wkijKsbVg9R2IBP97U7wOANeIW9WJJKkBwS9XqllzWo= +github.com/gitsight/go-vcsurl v1.0.1/go.mod h1:qRFdKDa/0Lh9MT0xE+qQBYZ/01+mY1H40rZUHR24X9U= +github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= +github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= +github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/gofrs/flock v0.13.1 h1:jjREztyBeSKBZYAC+mgc1laB+xsgy4kYMf3FbKF2UBo= +github.com/gofrs/flock v0.13.1/go.mod h1:sf4BFiHwnvgxa25DlQoDqXQnwRMEOwqxRq37P6MzzmE= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v25.12.19+incompatible h1:haMV2JRRJCe1998HeW/p0X9UaMTK6SDo0ffLn2+DbLs= +github.com/google/flatbuffers v25.12.19+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/go-jsonnet v0.22.0 h1:o0bOAIE+9SIfRZ7FXQPuta0mHLLE0AwbY/L5GTH5CH8= +github.com/google/go-jsonnet v0.22.0/go.mod h1:pLhKpu0/ODjL2Zev4y+CmCoHKAgONT1gSLQyriuYh9w= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0= +github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= +github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= +github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= +github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408 h1:Y9iQJfEqnN3/Nce9cOegemcy/9Ai5k3huT6E80F3zaw= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408/go.mod h1:PE1ycukgRPJ7bJ9a1fdfQ9j8i/cEcRAoLZzbxYpNB/s= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= +github.com/gruntwork-io/boilerplate v0.17.0 h1:ld33t+X6j5wd1ddYKEM3sX0HCiuSPY92a3uAu9EVcQs= +github.com/gruntwork-io/boilerplate v0.17.0/go.mod h1:U/+aiGF/c8GDA/s/y50hBevlo8Bc/0zUCSWfhuWI5w0= +github.com/gruntwork-io/terragrunt v1.2.1 h1:OfrSK65sF2Snuj6vVvrLPP2LuLTNNA6PS0fIXfVVXww= +github.com/gruntwork-io/terragrunt v1.2.1/go.mod h1:WqipBUVEVep1WKhOlfeDOz/S5vJEOrqN55vq0EelSys= +github.com/gruntwork-io/terragrunt-engine-go v0.2.0 h1:LEZelI6sZ4B3L9lEL2Nu1wzw7ZscXSu6KtfJKPlPAZU= +github.com/gruntwork-io/terragrunt-engine-go v0.2.0/go.mod h1:27Gf11JzI/kYS8iq5rNDR7TooMQ5B/N1ce9BZf6HUHA= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74 h1:mymLUKThnV9wFvogOK8NnsMP9/vlhnjXY98gr2QIGW8= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74/go.mod h1:Bh9qYL8ehmDxSg14Tk8oxFCP90XHfs6NxV1D84884xA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-getter v1.8.9 h1:1AOTMUmz/S/GuqOTE6+bg6nwPXTEbKr3Tc/T/lVS7is= +github.com/hashicorp/go-getter v1.8.9/go.mod h1:qI7vH/m552bXutKe4UkWptOJl4bo2KeO/CSOoh4s0ps= +github.com/hashicorp/go-getter/gcs/v2 v2.2.6 h1:cBhbdB75SdwNmAvAdDY0W3PTk8zNT2BGZveCBvMuQJM= +github.com/hashicorp/go-getter/gcs/v2 v2.2.6/go.mod h1:6T3+zDaSTRaLYj/g6w3NYkmU7oQL9INN80Kzt11LZHU= +github.com/hashicorp/go-getter/s3/v2 v2.2.6 h1:56R/AA1spMzAWhZzB0fOuU/DBMe1WgjyYgV12QSMuW8= +github.com/hashicorp/go-getter/s3/v2 v2.2.6/go.mod h1:2B7ayb2xvbw6oQf11OXErpYRPpHiVFiR0xSxpZrDAEc= +github.com/hashicorp/go-getter/v2 v2.2.6 h1:YPh3bAPQPFKYBu0i253xalk/dxZyoUnC4HbwDYPCYZw= +github.com/hashicorp/go-getter/v2 v2.2.6/go.mod h1:ijhzM8T7li5y5Jl3E6FZG7wajPtg/6XCI7w0U0DPo80= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs= +github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= +github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48= +github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 h1:U+kC2dOhMFQctRfhK0gRctKAPTloZdMU5ZJxaesJ/VM= +github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0/go.mod h1:Ll013mhdmsVDuoIXVfBtvgGJsXDYkTw1kooNcoCXuE0= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.7 h1:G+pTkSO01HpR5qCxg7lxfsFEZaG+C0VssTy/9dbT+Fw= +github.com/hashicorp/go-sockaddr v1.0.7/go.mod h1:FZQbEYa1pxkQ7WLpyXJ6cbjpT8q0YgQaK/JakXqGyWw= +github.com/hashicorp/go-uuid v1.0.4 h1:ZrN80XjMzpRYk+2FxMDy2A2zz0d5QjJ7GMFSkZLj12A= +github.com/hashicorp/go-uuid v1.0.4/go.mod h1:x2Ds7vSkQ2n/yQj8Synnxmt0zt1l26uCAjxIhChisLU= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= +github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= +github.com/hashicorp/hcl/v2 v2.25.0 h1:HmmQVYRny4MaBo4b20TjmL46wyuUxpnMWkPZ4+NTbWk= +github.com/hashicorp/hcl/v2 v2.25.0/go.mod h1:vR+FKETxoZAmRlHgFfKmuqivj+C4Izm/c66XkmZ3r7M= +github.com/hashicorp/terraform-svchost v0.2.1 h1:ubvrTFw3Q7CsoEaX7V06PtCTKG3wu7GyyobAoN4eF3Q= +github.com/hashicorp/terraform-svchost v0.2.1/go.mod h1:zDMheBLvNzu7Q6o9TBvPqiZToJcSuCLXjAXxBslSky4= +github.com/hashicorp/vault/api v1.23.0 h1:gXgluBsSECfRWTSW9niY2jwg2e9mMJc4WoHNv4g3h6A= +github.com/hashicorp/vault/api v1.23.0/go.mod h1:zransKiB9ftp+kgY8ydjnvCU7Wk8i9L0DYWpXeMj9ko= +github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/go-clone v1.7.3 h1:rtQODA+ABThEn6J5LBTppJfKmZy/FwfpMUWa8d01TTQ= +github.com/huandu/go-clone v1.7.3/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207 h1:lgMtpjpIWPw0gbCAko23dRKl66ZPUmeAOidjKFkub2E= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207/go.mod h1:M+yna96Fx9o5GbIUnF3OvVvQGjgfVSyeJbV9Yb1z/wI= +github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg= +github.com/invopop/jsonschema v0.14.0/go.mod h1:ygm6C2EaVNMBDPpaPlnOA2pFAxBnxGjFlMZABxm9n2I= +github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= +github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= +github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 h1:9Nu54bhS/H/Kgo2/7xNSUuC5G28VR8ljfrLKU2G4IjU= +github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12/go.mod h1:TBzl5BIHNXfS9+C35ZyJaklL7mLDbgUkcgXzSLa8Tk0= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU= +github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi26R8= +github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw= +github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= +github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss= +github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 h1:eveIIGn4BGM3qknO74omf6HYr30/exH+eVUTuAgwjZ0= +github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= +github.com/magiconair/properties v1.18.11 h1:j5ozYZl0zCjG7ahMDH0GWIobOvvUzT0BdAguG0ViKy0= +github.com/magiconair/properties v1.18.11/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= +github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= +github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mattn/go-runewidth v0.0.31 h1:1oCV4ReTlosDBc6rYRw5cL8S/4y8iv5oRl4SJ5IBgwo= +github.com/mattn/go-runewidth v0.0.31/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8= +github.com/mattn/go-shellwords v1.0.16 h1:RRxAaRzU1YbzOSCj9NJqg2/VIbSWv0dnPoD3EwE8kxI= +github.com/mattn/go-shellwords v1.0.16/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-zglob v0.0.8 h1:g/5T0tizbs+419GtiXvMDkOg+RIBu1qi+B2teiHsnNE= +github.com/mattn/go-zglob v0.0.8/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= +github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME= +github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE= +github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc= +github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.5.1 h1:tYNaJno4c0HXz12y5BiqEDy0rVTYkWzI26lGvnTMiJw= +github.com/moby/moby/client v0.5.1/go.mod h1:odLstlZ6uSnfvAgVxMpvgmb8SUdd+siH2T0GBuxVAlM= +github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= +github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8= +github.com/moby/sys/sequential v0.7.0/go.mod h1:NfSTAp6V3fw4tmkD62PEcOKeZKquXT8VKCkf7aVR79o= +github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= +github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= +github.com/moby/sys/userns v0.2.0 h1:nEtDtp7NCV/6dutSklNe8FrENPwFdc4mXnZqC/JWgXM= +github.com/moby/sys/userns v0.2.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= +github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= +github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= +github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4= +github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= +github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= +github.com/opencontainers/runc v1.3.6 h1:SLGIymCtsk80iNPWgbc8dtjI30r+5mTVV+4dN8/17Sk= +github.com/opencontainers/runc v1.3.6/go.mod h1:o1wyv76EDlTkcf0KTFgN8bMWLPvgF/HfX709lDv+rr4= +github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw= +github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE= +github.com/pb33f/ordered-map/v2 v2.3.1 h1:5319HDO0aw4DA4gzi+zv4FXU9UlSs3xGZ40wcP1nBjY= +github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7VvaHKbd1HnmQ= +github.com/pierrec/lz4/v4 v4.1.28 h1:pPEPwRJ4kybBTfGt28q7lQsRJQHhC08axprdLD5Ppio= +github.com/pierrec/lz4/v4 v4.1.28/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25 h1:S1hI5JiKP7883xBzZAr1ydcxrKNSVNm7+3+JwjxZEsg= +github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25/go.mod h1:ZQntvDG8TkPgljxtA0R9frDoND4QORU1VXz015N5Ks4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 h1:jL3a8soXdzuTCcRnKhOmtcsVOObdDTFf4O2B403HPRU= +github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= +github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sahilm/fuzzy v0.1.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU= +github.com/sahilm/fuzzy v0.1.3/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= +github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= +github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0= +github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0= +github.com/shirou/gopsutil/v4 v4.26.7 h1:IXzpHz/dkMRYAhKkOXr1HB6SuzWU3eoyyeWe7g3bNZc= +github.com/shirou/gopsutil/v4 v4.26.7/go.mod h1:5O9FjBiXoTDFatIWjZZosqj4pV0DRtLx598xGbBehzM= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo= +github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E= +github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/testcontainers/testcontainers-go v0.44.0 h1:/Fwh6HY1mIikhnm9e7HwoxGycx0lzRAE0f5VQpjFxzI= +github.com/testcontainers/testcontainers-go v0.44.0/go.mod h1:IcnwQrYTO86xHXu5bvMaBH7ATlbS3Qn1M1QWW3c66rE= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU= +github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI= +github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4= +github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg= +github.com/ulikunitz/xz v0.5.16 h1:ld6NyySjx5lowVKwJvMRLnW5nxKX/xnpSiFYZ/Lxur0= +github.com/ulikunitz/xz v0.5.16/go.mod h1:H9Rt/W6/Qj27PGauhQc6nfCDy7vHpzsOThBSaYDoEhw= +github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ= +github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo= +github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU= +github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xo/terminfo v1.0.0 h1:2ZpYzqWzyyytjk3TP6aJVDhkMAkc99/1xKQdA3TDTBY= +github.com/xo/terminfo v1.0.0/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= +github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.8.6 h1:d0VcaP1sx9GkFVkoW+KtggpGi2KZ965i14b0+bDQST4= +github.com/yuin/goldmark v1.8.6/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +github.com/yuin/goldmark-emoji v1.0.6 h1:QWfF2FYaXwL74tfGOW5izeiZepUDroDJfWubQI9HTHs= +github.com/yuin/goldmark-emoji v1.0.6/go.mod h1:ukxJDKFpdFb5x0a5HqbdlcKtebh086iJpI31LTKmWuA= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zclconf/go-cty v1.19.0 h1:IV8WdqYZc2c5rLX9bEoLNXKojBAp0MZPBHMIrCoa/s4= +github.com/zclconf/go-cty v1.19.0/go.mod h1:12W89jGn3JCOIQi7infWr9m80rOkb5RNYJqXMZcN4c8= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= +github.com/zclconf/go-cty-yaml v1.2.0 h1:GDyL4+e/Qe/S0B7YaecMLbVvAR/Mp21CXMOSiCTOi1M= +github.com/zclconf/go-cty-yaml v1.2.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= +github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.17.9 h1:IexDdCuuNJ3BHrELgBlyaH9p60JXAvdzWR128q+U5tU= +go.mongodb.org/mongo-driver v1.17.9/go.mod h1:LlOhpH5NUEfhxcAwG0UEkMqwYcc4JU18gtCdGudk/tQ= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0 h1:q9+0sc6cUOTBcEh+hwTGINaFlAOutRBwENORxaIjlKg= +go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0/go.mod h1:qp9G1Uoc+eEnUApc7gCzP9BW5GBuoeU3Pg1WWjqyRfU= +go.opentelemetry.io/contrib/detectors/gcp v1.45.0 h1:9jR0ZPRok9ryaOQ2Wx8rg5F7Aon59mxrqbVI60/vlBk= +go.opentelemetry.io/contrib/detectors/gcp v1.45.0/go.mod h1:VSme3o2fvSg5bVg0dRzyHaj4Z5EVhG+g2Fde6LKzmQA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 h1:oECp5f+hN7nkwjU/8BxQ/q23bGPb8FIrD839owX222E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0/go.mod h1:DqEFwLumhzMBDQv9PcWbyoDxHI/4lAk6CM4nJBH39sc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04= +go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM= +go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0 h1:5Ek4qQ5XX0PSQfY7lMW3CvcR36yy8YFDfGnYnaku8zE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0/go.mod h1:NUKIMOKSexQdTmS1pSxOQBDiVes3DHRier2ePsGW/gQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0 h1:5WVp40k2fJHuc5BtNTgKk+EugKFT8Eg3lywFfCPI/nE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0/go.mod h1:59nH0RYCGHRlwt15WyioeSYINBbuObeBpTowPhEKWHY= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0 h1:LaLVGJtIzHcvHjVs2OftmKcc+M9mdOqS8vZ1fBD1Yes= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0/go.mod h1:vF6H5sNDuQBJWgSX00iZgbIqk2MZZoVMH0ar5t5bOpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0 h1:7kszRN4Ze5GeAkUnBjBSUIunVBMA+mZIG04auueqguM= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0/go.mod h1:CLzakYy8jOdkBfcveCWYkeKJxujcF4xPhh2Z7IfE98U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0 h1:UFpxOpYPmMNUtOWhdb+nC1WELIgVf8z9higURrbzYU4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0/go.mod h1:YBGjxe3lt0jtXoEXxGrGhv/jM7oUBUDVK7zhAvNyEjc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0 h1:PW/E9Tw6ZykC88pey0MZY8hKOUeEw+hX6PU+oXA4A9o= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0/go.mod h1:hUw4VNfiOnQ/yzGgy6ZdWVnudXw7iRfImhd6FjXOnvI= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0 h1:ww5DYBpMKcqLdxjWrhGUIh6O+ZfvZUaMk4niVyNQPEQ= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0/go.mod h1:Av5t+Ezx5S/Ks2dsEfWhny+GK+wrZ1K7NZ6aHSWnX3U= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0 h1:N3YQCxjxQ/bMjyc3heladfRm9t9RTksGQH8z4w6yU/0= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0/go.mod h1:Mp8HOFqcaUyypCuGv9IhDdTHnJ56lSudSHMd+pVSCEA= +go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI= +go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw= +go.opentelemetry.io/otel/log/logtest v0.23.0 h1:XeI2D+/DjUMYzrfmMPXOxnTIkUTCXT/HwQ5QBJSEC/8= +go.opentelemetry.io/otel/log/logtest v0.23.0/go.mod h1:TOVBzNwEZG0vmQUuvE9UHaiKkUN7q3j1d+GeVGs/yQ8= +go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY= +go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU= +go.opentelemetry.io/otel/metric/x v0.69.0 h1:DjRLr15H83v+hCW7JA9NoJvOkYTtmq5YoDRbe9deYpM= +go.opentelemetry.io/otel/metric/x v0.69.0/go.mod h1:uVvsMPMFFyj/HUQfrUnH3JjnOQ1dwFDorgFLRBasM0k= +go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I= +go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0= +go.opentelemetry.io/otel/sdk/log v1.47.0 h1:W4N/ZfgpkRRnmARnqYoQ6BrWA0mrj8IzVDNLlpmUJZY= +go.opentelemetry.io/otel/sdk/log v1.47.0/go.mod h1:Wu74Z2EmOKXi2FleSNAb0Hyau2G+r5kubSEMJw5aAMs= +go.opentelemetry.io/otel/sdk/log/logtest v0.23.0 h1:j3pm42QCrKYYLLkI6OrV1QHFkUfDA6/4EP+Y1PzggLg= +go.opentelemetry.io/otel/sdk/log/logtest v0.23.0/go.mod h1:zt0gEnuTZgDvqvczHwYswz93eqMaIr6upTTsdV/HUlU= +go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw= +go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw= +go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM= +go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U= +go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297 h1:YXnL44eJ77R+ji4/ooy8UsXIhz+lbi2Qgdlc8iRN0gY= +golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297/go.mod h1:Mkmymgv+uMpSQ/XxJ/7GpdrdYoqm3u72jEbpCLiJmNk= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= +golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.308.0 h1:iGb+4qT3nVb3uuIzwor3yP2nyu+rMZr31PvLFiRNJQk= +google.golang.org/api v0.308.0/go.mod h1:4XMH+b/ZEfuTbK7FnrFRY9c4xfFHVflGTKuy/i5wUmE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 h1:NO3LCWyMAM/f/RDLvCC8B/NEvuYqOQAP12XWoyB4os8= +google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc h1:rZHRz0ogq4Pid1IKtA/ivHi8XONVF5tqUQXA2TtgpkE= +google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc/go.mod h1:K/n0XLazCJHjD73YuMyNJsN38BPPy1kfFnKxUXaThFU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b h1:6WNWHZk91dp4gZ25642OALkuG1UVNZbwENJD19DnB8k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.3 h1:iM9Lhz5MRSGhHVGGwCuzG9KO8PoirCXj/m/qTmOJJQw= +gopkg.in/ini.v1 v1.67.3/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +oras.land/oras-go/v2 v2.7.0 h1:0bXRBBSqYgPSjZRrhJbT71Rb465c+rdlft2xdQPxLtQ= +oras.land/oras-go/v2 v2.7.0/go.mod h1:imXEFiYkTZUVVYkfv/r5GVmWeiLkGtNQA8FU4F/sjKs= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/plugins/terragrunt/fixtures/advanced/README.md b/plugins/terragrunt/fixtures/advanced/README.md new file mode 100644 index 00000000000..f4b71782ff7 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/README.md @@ -0,0 +1,21 @@ +# Advanced Terragrunt fixture + +This fixture combines shared HCL configuration with a diamond dependency graph: + +```mermaid +flowchart LR + network --> database + network --> cache + database --> app + cache --> app +``` + +`root.hcl` reads `env.hcl`, generates a Terraform file, and configures a separate local backend for each unit. +Units use deep includes, exposed locals, command-scoped output mocks, and dependency outputs. +The module uses only the built-in `terraform_data` resource. + +The native acceptance runner lists the four units, plans with command-scoped mocks, applies in dependency order, checks unchanged plans, changes the network revision, and verifies fresh downstream outputs. It destroys in reverse order. + +`failures/hook` is an unsupported-hook fixture outside the successful discovery scope. + +Run `python3 plugins/terragrunt/scripts/acceptance.py --atmos ` from the repository root. The runner copies all files before execution. diff --git a/plugins/terragrunt/fixtures/advanced/env.hcl b/plugins/terragrunt/fixtures/advanced/env.hcl new file mode 100644 index 00000000000..e9fc3151431 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/env.hcl @@ -0,0 +1,4 @@ +locals { + region = "us-east-2" + tags = { team = "platform", stage = "shared" } +} diff --git a/plugins/terragrunt/fixtures/advanced/failures/hook/terragrunt.hcl b/plugins/terragrunt/fixtures/advanced/failures/hook/terragrunt.hcl new file mode 100644 index 00000000000..36de9228591 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/failures/hook/terragrunt.hcl @@ -0,0 +1,18 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + merge_strategy = "deep" +} + +terraform { + before_hook "fail_before_apply" { + commands = ["apply"] + execute = ["sh", "-c", "printf 'intentional hook failure\\n' >&2; exit 23"] + } + error_hook "record_failure" { + commands = ["apply"] + on_errors = [".*"] + execute = ["sh", "-c", "printf handled > \"$1\"", "--", "${get_terragrunt_dir()}/error-hook-ran"] + } +} + +inputs = { payload = { unit = "failure" } } diff --git a/plugins/terragrunt/fixtures/advanced/live/dev/app/terragrunt.hcl b/plugins/terragrunt/fixtures/advanced/live/dev/app/terragrunt.hcl new file mode 100644 index 00000000000..c3bf196723b --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/live/dev/app/terragrunt.hcl @@ -0,0 +1,34 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + expose = true + merge_strategy = "deep" +} + +# Order-only edge, separate from the output-bearing database/cache dependencies. +dependencies { + paths = ["../network"] +} + +dependency "database" { + config_path = "../database" + mock_outputs = { value = { unit = "database", revision = "mock" } } + mock_outputs_allowed_terraform_commands = ["plan", "validate"] +} + +dependency "cache" { + config_path = "../cache" + mock_outputs = { value = { unit = "cache", revision = "mock" } } + mock_outputs_allowed_terraform_commands = ["plan", "validate"] +} + +inputs = { + payload = { + unit = "app" + tags = { app = "storefront" } + ports = [8080] + upstream = { + database = dependency.database.outputs.value + cache = dependency.cache.outputs.value + } + } +} diff --git a/plugins/terragrunt/fixtures/advanced/live/dev/cache/terragrunt.hcl b/plugins/terragrunt/fixtures/advanced/live/dev/cache/terragrunt.hcl new file mode 100644 index 00000000000..f6994c0de4a --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/live/dev/cache/terragrunt.hcl @@ -0,0 +1,19 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + expose = true + merge_strategy = "deep" +} + +dependency "network" { + config_path = "../network" + mock_outputs = { value = { unit = "network", revision = "mock" } } + mock_outputs_allowed_terraform_commands = ["plan", "validate"] +} + +inputs = { + payload = { + unit = "cache" + ports = [6379] + upstream = { network = dependency.network.outputs.value } + } +} diff --git a/plugins/terragrunt/fixtures/advanced/live/dev/database/terragrunt.hcl b/plugins/terragrunt/fixtures/advanced/live/dev/database/terragrunt.hcl new file mode 100644 index 00000000000..75d153ec0c0 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/live/dev/database/terragrunt.hcl @@ -0,0 +1,19 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + expose = true + merge_strategy = "deep" +} + +dependency "network" { + config_path = "../network" + mock_outputs = { value = { unit = "network", revision = "mock" } } + mock_outputs_allowed_terraform_commands = ["plan", "validate"] +} + +inputs = { + payload = { + unit = "database" + ports = [5432] + upstream = { network = dependency.network.outputs.value } + } +} diff --git a/plugins/terragrunt/fixtures/advanced/live/dev/network/terragrunt.hcl b/plugins/terragrunt/fixtures/advanced/live/dev/network/terragrunt.hcl new file mode 100644 index 00000000000..99fe55f2608 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/live/dev/network/terragrunt.hcl @@ -0,0 +1,14 @@ +include "root" { + path = find_in_parent_folders("root.hcl") + expose = true + merge_strategy = "deep" +} + +inputs = { + payload = { + unit = "network" + tags = { stage = get_env("POC_ENV", "dev") } + ports = [443] + exposed_region = include.root.locals.environment.locals.region + } +} diff --git a/plugins/terragrunt/fixtures/advanced/modules/unit/main.tf b/plugins/terragrunt/fixtures/advanced/modules/unit/main.tf new file mode 100644 index 00000000000..2d3cc7b6817 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/modules/unit/main.tf @@ -0,0 +1,11 @@ +variable "payload" { + type = any +} + +resource "terraform_data" "unit" { + input = var.payload +} + +output "value" { + value = terraform_data.unit.output +} diff --git a/plugins/terragrunt/fixtures/advanced/root.hcl b/plugins/terragrunt/fixtures/advanced/root.hcl new file mode 100644 index 00000000000..436d1498814 --- /dev/null +++ b/plugins/terragrunt/fixtures/advanced/root.hcl @@ -0,0 +1,32 @@ +locals { + environment = read_terragrunt_config(find_in_parent_folders("env.hcl")) + revision = get_env("POC_REVISION", "r1") +} + +terraform { + source = "${dirname(find_in_parent_folders("root.hcl"))}/modules/unit" +} + +remote_state { + backend = "local" + config = { path = "${get_terragrunt_dir()}/state/terraform.tfstate" } + generate = { path = "backend.tf", if_exists = "overwrite" } +} + +generate "context" { + path = "context.tf" + if_exists = "overwrite" + disable_signature = true + contents = "output \"generated_region\" { value = \"${local.environment.locals.region}\" }\n" +} + +inputs = { + payload = { + region = local.environment.locals.region + tags = local.environment.locals.tags + ports = [80] + revision = local.revision + origin = path_relative_to_include() + upstream = {} + } +} diff --git a/plugins/terragrunt/fixtures/explicit-stack/README.md b/plugins/terragrunt/fixtures/explicit-stack/README.md new file mode 100644 index 00000000000..ffa72956c77 --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/README.md @@ -0,0 +1,10 @@ +# Explicit Terragrunt stacks + +The root `live/terragrunt.stack.hcl` instantiates the same environment stack twice, as `dev` and `prod`. +Each environment creates `network` and `app` units. The app reads its own environment's network output. +Stack values pass through both generation levels into unit inputs. + +State is outside `.terragrunt-stack`, under `state//.tfstate`. +The acceptance runner starts without generated units or state. It lists all four units without writing project files, then applies them through native Atmos, checks unchanged plans, and destroys them in reverse order. The Terragrunt executable is not used. + +Run `python3 plugins/terragrunt/scripts/acceptance.py --atmos ` from the repository root. The runner copies all files before execution. diff --git a/plugins/terragrunt/fixtures/explicit-stack/catalog/stacks/environment/terragrunt.stack.hcl b/plugins/terragrunt/fixtures/explicit-stack/catalog/stacks/environment/terragrunt.stack.hcl new file mode 100644 index 00000000000..eb3de3b01d7 --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/catalog/stacks/environment/terragrunt.stack.hcl @@ -0,0 +1,19 @@ +unit "network" { + source = "${values.project_root}/catalog/units/network" + path = "network" + values = { + project_root = values.project_root + stage = values.stage + revision = values.revision + } +} + +unit "app" { + source = "${values.project_root}/catalog/units/app" + path = "app" + values = { + project_root = values.project_root + stage = values.stage + revision = values.revision + } +} diff --git a/plugins/terragrunt/fixtures/explicit-stack/catalog/units/app/terragrunt.hcl b/plugins/terragrunt/fixtures/explicit-stack/catalog/units/app/terragrunt.hcl new file mode 100644 index 00000000000..03c2320c68c --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/catalog/units/app/terragrunt.hcl @@ -0,0 +1,31 @@ +terraform { + source = "${values.project_root}/modules/unit" +} + +remote_state { + backend = "local" + config = { path = "${values.project_root}/state/${values.stage}/app.tfstate" } + generate = { path = "backend.tf", if_exists = "overwrite" } +} + +dependency "network" { + config_path = "../network" + mock_outputs = { value = { unit = "network", stage = values.stage, revision = "mock" } } + mock_outputs_allowed_terraform_commands = ["plan", "validate"] +} + +generate "stage" { + path = "stage.tf" + if_exists = "overwrite" + disable_signature = true + contents = "output \"stage\" { value = \"${values.stage}\" }\n" +} + +inputs = { + payload = { + unit = "app" + stage = values.stage + revision = values.revision + network = dependency.network.outputs.value + } +} diff --git a/plugins/terragrunt/fixtures/explicit-stack/catalog/units/network/terragrunt.hcl b/plugins/terragrunt/fixtures/explicit-stack/catalog/units/network/terragrunt.hcl new file mode 100644 index 00000000000..a8f92244e0f --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/catalog/units/network/terragrunt.hcl @@ -0,0 +1,17 @@ +terraform { + source = "${values.project_root}/modules/unit" +} + +remote_state { + backend = "local" + config = { path = "${values.project_root}/state/${values.stage}/network.tfstate" } + generate = { path = "backend.tf", if_exists = "overwrite" } +} + +inputs = { + payload = { + unit = "network" + stage = values.stage + revision = values.revision + } +} diff --git a/plugins/terragrunt/fixtures/explicit-stack/live/terragrunt.stack.hcl b/plugins/terragrunt/fixtures/explicit-stack/live/terragrunt.stack.hcl new file mode 100644 index 00000000000..d89c823e293 --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/live/terragrunt.stack.hcl @@ -0,0 +1,23 @@ +locals { + project_root = dirname(get_terragrunt_dir()) +} + +stack "dev" { + source = "../catalog/stacks/environment" + path = "dev" + values = { + project_root = local.project_root + stage = "dev" + revision = get_env("POC_REVISION", "r1") + } +} + +stack "prod" { + source = "../catalog/stacks/environment" + path = "prod" + values = { + project_root = local.project_root + stage = "prod" + revision = get_env("POC_REVISION", "r1") + } +} diff --git a/plugins/terragrunt/fixtures/explicit-stack/modules/unit/main.tf b/plugins/terragrunt/fixtures/explicit-stack/modules/unit/main.tf new file mode 100644 index 00000000000..2d3cc7b6817 --- /dev/null +++ b/plugins/terragrunt/fixtures/explicit-stack/modules/unit/main.tf @@ -0,0 +1,11 @@ +variable "payload" { + type = any +} + +resource "terraform_data" "unit" { + input = var.payload +} + +output "value" { + value = terraform_data.unit.output +} diff --git a/plugins/terragrunt/go.mod b/plugins/terragrunt/go.mod new file mode 100644 index 00000000000..f811afa524a --- /dev/null +++ b/plugins/terragrunt/go.mod @@ -0,0 +1,241 @@ +module github.com/cloudposse/atmos/plugins/terragrunt + +go 1.27.3 + +require ( + github.com/bmatcuk/doublestar/v4 v4.10.2 + github.com/cloudposse/atmos/sdk v0.0.0 + github.com/gruntwork-io/terragrunt v1.2.1 + github.com/gruntwork-io/terragrunt/pkg/atmosbridge v0.0.0-00010101000000-000000000000 + github.com/hashicorp/go-version v1.9.0 + github.com/spf13/afero v1.15.0 + github.com/stretchr/testify v1.12.1 + github.com/zclconf/go-cty v1.19.0 + google.golang.org/grpc v1.84.0 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + cel.dev/expr v0.25.2 // indirect + charm.land/lipgloss/v2 v2.0.6 // indirect + cloud.google.com/go v0.123.0 // indirect + cloud.google.com/go/auth v0.24.1 // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect + cloud.google.com/go/iam v1.12.0 // indirect + cloud.google.com/go/kms v1.32.0 // indirect + cloud.google.com/go/longrunning v1.2.0 // indirect + cloud.google.com/go/monitoring v1.30.0 // indirect + cloud.google.com/go/storage v1.70.0 // indirect + dario.cat/mergo v1.0.2 // indirect + filippo.io/age v1.3.1 // indirect + filippo.io/edwards25519 v1.2.0 // indirect + filippo.io/hpke v0.4.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0 // indirect + github.com/Masterminds/semver/v3 v3.5.0 // indirect + github.com/ProtonMail/go-crypto v1.5.2 // indirect + github.com/agext/levenshtein v1.2.3 // indirect + github.com/apache/arrow-go/v18 v18.7.0 // indirect + github.com/apparentlymart/go-cidr v1.1.1 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/apparentlymart/go-textseg/v17 v17.0.1 // indirect + github.com/apparentlymart/go-versions v1.0.3 // indirect + github.com/aws/aws-sdk-go-v2 v1.47.4 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24 // indirect + github.com/aws/aws-sdk-go-v2/config v1.33.10 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.20.10 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7 // indirect + github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1 // indirect + github.com/aws/aws-sdk-go-v2/service/iam v1.64.5 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7 // indirect + github.com/aws/aws-sdk-go-v2/service/kms v1.54.1 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.10.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.38.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.51.5 // indirect + github.com/aws/smithy-go v1.28.6 // indirect + github.com/bahlo/generic-list-go v0.2.0 // indirect + github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect + github.com/blang/semver v3.5.1+incompatible // indirect + github.com/buger/jsonparser v1.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/charlievieth/fastwalk v1.0.14 // indirect + github.com/charmbracelet/colorprofile v0.4.3 // indirect + github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4 // indirect + github.com/charmbracelet/x/ansi v0.11.9 // indirect + github.com/charmbracelet/x/term v0.2.2 // indirect + github.com/charmbracelet/x/termios v0.1.1 // indirect + github.com/charmbracelet/x/windows v0.2.2 // indirect + github.com/clipperhouse/displaywidth v0.11.0 // indirect + github.com/clipperhouse/uax29/v2 v2.7.0 // indirect + github.com/cloudflare/circl v1.6.4 // indirect + github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect + github.com/creack/pty v1.1.24 // indirect + github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect + github.com/fatih/color v1.19.0 // indirect + github.com/felixge/httpsnoop v1.1.0 // indirect + github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e // indirect + github.com/getsops/sops/v3 v3.13.3 // indirect + github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-logr/logr v1.4.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.6 // indirect + github.com/goccy/go-yaml v1.19.2 // indirect + github.com/gofrs/flock v0.13.1 // indirect + github.com/golang-jwt/jwt/v5 v5.3.1 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/flatbuffers v25.12.19+incompatible // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.23 // indirect + github.com/googleapis/gax-go/v2 v2.26.2 // indirect + github.com/goware/prefixer v0.0.0-20160118172347-395022866408 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect + github.com/gruntwork-io/terragrunt-engine-go v0.2.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-getter/gcs/v2 v2.2.6 // indirect + github.com/hashicorp/go-getter/s3/v2 v2.2.6 // indirect + github.com/hashicorp/go-getter/v2 v2.2.6 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.8.0 // indirect + github.com/hashicorp/go-retryablehttp v0.7.8 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-safetemp v1.0.0 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.7 // indirect + github.com/hashicorp/go-uuid v1.0.4 // indirect + github.com/hashicorp/hcl v1.0.1-vault-7 // indirect + github.com/hashicorp/hcl/v2 v2.25.0 // indirect + github.com/hashicorp/terraform-svchost v0.2.1 // indirect + github.com/hashicorp/vault/api v1.23.0 // indirect + github.com/hashicorp/yamux v0.1.2 // indirect + github.com/huandu/go-clone v1.7.3 // indirect + github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207 // indirect + github.com/invopop/jsonschema v0.14.0 // indirect + github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect + github.com/klauspost/compress v1.19.2 // indirect + github.com/klauspost/cpuid/v2 v2.4.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/lib/pq v1.12.3 // indirect + github.com/lucasb-eyer/go-colorful v1.4.1 // indirect + github.com/mattn/go-colorable v0.1.15 // indirect + github.com/mattn/go-isatty v0.0.24 // indirect + github.com/mattn/go-runewidth v0.0.31 // indirect + github.com/mattn/go-shellwords v1.0.16 // indirect + github.com/mattn/go-zglob v0.0.8 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/oklog/run v1.2.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect + github.com/pb33f/ordered-map/v2 v2.3.1 // indirect + github.com/pierrec/lz4/v4 v4.1.28 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/rivo/uniseg v0.4.7 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/sirupsen/logrus v1.10.2 // indirect + github.com/spiffe/go-spiffe/v2 v2.8.1 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect + github.com/ulikunitz/xz v0.5.16 // indirect + github.com/urfave/cli v1.22.17 // indirect + github.com/urfave/cli/v2 v2.27.7 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/xeipuuv/gojsonschema v1.2.0 // indirect + github.com/xo/terminfo v1.0.0 // indirect + github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect + github.com/zclconf/go-cty-yaml v1.2.0 // indirect + github.com/zeebo/xxh3 v1.1.0 // indirect + go.mongodb.org/mongo-driver v1.17.9 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0 // indirect + go.opentelemetry.io/contrib/detectors/gcp v1.45.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect + go.opentelemetry.io/otel v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0 // indirect + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0 // indirect + go.opentelemetry.io/otel/log v1.47.0 // indirect + go.opentelemetry.io/otel/metric v1.47.0 // indirect + go.opentelemetry.io/otel/sdk v1.47.0 // indirect + go.opentelemetry.io/otel/sdk/log v1.47.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.47.0 // indirect + go.opentelemetry.io/otel/trace v1.47.0 // indirect + go.opentelemetry.io/proto/otlp v1.11.0 // indirect + go.yaml.in/yaml/v3 v3.0.5 // indirect + go.yaml.in/yaml/v4 v4.0.0-rc.4 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/term v0.47.0 // indirect + golang.org/x/text v0.43.0 // indirect + golang.org/x/time v0.16.0 // indirect + golang.org/x/tools v0.51.0 // indirect + google.golang.org/api v0.308.0 // indirect + google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect + google.golang.org/protobuf v1.36.12 // indirect + gopkg.in/ini.v1 v1.67.3 // indirect + oras.land/oras-go/v2 v2.7.0 // indirect +) + +replace github.com/cloudposse/atmos/sdk => ../../sdk + +replace github.com/gruntwork-io/terragrunt/pkg/atmosbridge => ./bridge diff --git a/plugins/terragrunt/go.sum b/plugins/terragrunt/go.sum new file mode 100644 index 00000000000..890b0287e6b --- /dev/null +++ b/plugins/terragrunt/go.sum @@ -0,0 +1,817 @@ +c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd h1:ZLsPO6WdZ5zatV4UfVpr7oAwLGRZ+sebTUruuM4Ra3M= +c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo= +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +charm.land/bubbles/v2 v2.2.1 h1:Fq1+qm5hV6GkvzLQDhCBpXXE5tLgvh1PRriCLwSvIQU= +charm.land/bubbles/v2 v2.2.1/go.mod h1:wdMgn+sje1KNXdwFizIWjbf328fIUBxqEmJ/vYPo8yc= +charm.land/bubbletea/v2 v2.1.0 h1:A9fj9h5LFrvQhQHFNggp8K8rvY6CUfgn9dMbb6p2HIw= +charm.land/bubbletea/v2 v2.1.0/go.mod h1:xWHeyxIX9/wiFU2kgPW04ojOZyTzrWf+8lGjUCaftiU= +charm.land/glamour/v2 v2.0.1 h1:xl+r00A4aJWU0z8fgwKd9fQQ4rsphqGUzuEiXZP5n+c= +charm.land/glamour/v2 v2.0.1/go.mod h1:jo9z8XqVKPeEFMVdvCRLGk++RyJ3CdUwgNr7EvXLw3k= +charm.land/lipgloss/v2 v2.0.6 h1:EaGKeuA8FvF+v2BT5VmZd2LoYLaMZJXA5n34th8nCIQ= +charm.land/lipgloss/v2 v2.0.6/go.mod h1:ipDDJNSGa1hlwDtSfW1s2/xR8Vdhbut4PXh2zEKZd0Q= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= +cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= +cloud.google.com/go/auth v0.24.1 h1:NTmd2iJb4DsGIav0KiqFMYI88nMshA2wnFMBatRmoCs= +cloud.google.com/go/auth v0.24.1/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= +cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= +cloud.google.com/go/kms v1.32.0 h1:s+rEluaaZKhLVjrIWG7uNBsnWbiitElzNzFGyp6+nIg= +cloud.google.com/go/kms v1.32.0/go.mod h1:CSGvW6GnMQbY+1nOHcIzhMtHSbExXlOmCKjWtYVjcpA= +cloud.google.com/go/logging v1.19.0 h1:NCqhdVUg3wQ8Cobdf16FDSuTGi3+6+hdSBHrY5TsR6Q= +cloud.google.com/go/logging v1.19.0/go.mod h1:i40NZCHC9Gqvod4yE+yQfDWwlgwW/SrshkkGibCHxcA= +cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= +cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/monitoring v1.30.0 h1:r/d+JUbyKmJ8b07iznuKfzVzrIXTWxHQ3lBRm3x2LlY= +cloud.google.com/go/monitoring v1.30.0/go.mod h1:htlUR0QWVMrjFzZmN4LGnMAve9xB/eduwjmINxVZ8RM= +cloud.google.com/go/storage v1.70.0 h1:LQNHn0rRF94jVFfF3e416IzdQqIufa5GfF6HilQxb80= +cloud.google.com/go/storage v1.70.0/go.mod h1:W84cNa070TZIegvTW67CBY+f5rxux8EJMb7YyiHdrls= +cloud.google.com/go/trace v1.16.0 h1:GmQovzFc5F0CNfl0VLgL64aoTtu7xsM0YajW2GlG9+E= +cloud.google.com/go/trace v1.16.0/go.mod h1:r+bdAn16dKLSV1G2D5v3e58IlQlizfxWrUfjx7kM7X0= +dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= +dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= +filippo.io/age v1.3.1 h1:hbzdQOJkuaMEpRCLSN1/C5DX74RPcNCk6oqhKMXmZi0= +filippo.io/age v1.3.1/go.mod h1:EZorDTYUxt836i3zdori5IJX/v2Lj6kWFU0cfh6C0D4= +filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= +filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= +filippo.io/hpke v0.4.0 h1:p575VVQ6ted4pL+it6M00V/f2qTZITO0zgmdKCkd5+A= +filippo.io/hpke v0.4.0/go.mod h1:EmAN849/P3qdeK+PCMkDpDm83vRHM5cDipBJ8xbQLVY= +github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= +github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3 h1:qgnWTiWs1G7AqcKZegFvkJD1bmXJcaDU3uC0ELSgZ5U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.3/go.mod h1:XtxD48QPInqoj+GMlcRlXHEYsoOxFnP6w2JgIZ9rDS4= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0 h1:w3gDUJlJ0BfBsHH02DCBDwbkmMSXJqBj6nBOCo9iocY= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.15.0/go.mod h1:7scl8mG/IFLVjJ9ef/ltdND2T1z0CkgVSaQoUxLvmeU= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0 h1:xFaZZ+IubdftrDHnGGwZ6QvQ3KHTtWl2MCK+GMt2vxs= +github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.4.0/go.mod h1:mCBhUhlMjLLJKr5aqw2TNS/VqJOie8MzWq3DAMJeKso= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 h1:Terj1CMW4+NY5CpWjSRkqLoxh2DkYDdv/FH2z0897Uc= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0/go.mod h1:7Ut2Qw9vcwpLW5Q4MBy43uSxXS7tK2yjs94OJ6j5thE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 h1:Hp+EScFOu9HeCbeW8WU2yQPJd4gGwhMgKxWe+G6jNzw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0/go.mod h1:/pz8dyNQe+Ey3yBp/XuYz7oqX8YDNWVpPB0hH3XWfbc= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 h1:PTFGRSlMKCQelWwxUyYVEUqseBJVemLyqWJjvMyt0do= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0/go.mod h1:LRr2FzBTQlONPPa5HREE5+RjSCTXl7BwOvYOaWTqCaI= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 h1:2qsIIvxVT+uE6yrNldntJKlLRgxGbZ85kgtz5SNBhMw= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0/go.mod h1:AW8VEadnhw9xox+VaVd9sP7NjzOAnaZBLRH6Tq3cJ38= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0/go.mod h1:mLfWfj8v3jfWKsL9G4eoBoXVcsqcIUTapmdKy7uGOp0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 h1:Dd+RhdJn0OTtVGaeDLZpcumkIVCtA/3/Fo42+eoYvVM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1 h1:/Zt+cDPnpC3OVDm/JKLOs7M2DKmLRIIp3XIx9pHHiig= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1/go.mod h1:Ng3urmn6dYe8gnbCMoHHVl5APYz2txho3koEkV2o2HA= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 h1:MaKvxE6D0KkjOg6Wd9M00iqP5PR0kUxCfiezes4JweM= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0/go.mod h1:i2h9fsTFKZorh8RdV2IcSUf/Qj98GlTkrTvUbX/s8as= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 h1:nCYfgcSyHZXJI8J0IWE5MsCGlb2xp9fJiXyxWgmOFg4= +github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0/go.mod h1:ucUjca2JtSZboY8IoUqyQyuuXvwbMBVwFOm0vdQPNhA= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2 h1:tQJdgQjbKKffEiMOKJmcQPkY01eFHRqWIZVefqP44nI= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.8.2/go.mod h1:kTkpJchXAdO7LGkKZP97a+Ou8TgaF4NT6MHwOIy5uSQ= +github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0 h1:X/bTwe0qpvmvPPutc+LWo7T4cKMqDP9JHP4k+Co9ZB4= +github.com/Azure/azure-sdk-for-go/sdk/storage/internal v0.1.0/go.mod h1:+kX7ahyFelQ42F3RScM2CFgHJljp0phc/FieKLYVpFI= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= +github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 h1:0O6j18nQDoIff6/mtosT5LNU2WehEwp+LqfX6699oqY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0 h1:bN1gA3of5bXtbnLsRPrwfmbbe7A5UWFlcTHseujLnpc= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.35.0/go.mod h1:Yj5vHEz/aAepZGliRJsA6uvHAVAQyEwajq9ORCHPxzM= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0 h1:ZYGajzJNcirVZpT1rltgf9iM+j9zZ4v8V9DrF+xKRJ8= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.58.0/go.mod h1:PDQyYBOzGtQgvshQI//UiXyzuMHCz0ndyu+4W8X82vM= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.58.0 h1:IBF8BbhKJkMsON/eY+LMu3aF3XMiotCb9KvkUmEkOJo= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.58.0/go.mod h1:dzcEjy1WJ0Q4u9twNR3LcLhNoYMRCrMCMafpxa0TjPQ= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0 h1:SBZzZCiPmDrUV7NSCWY54OnKikO/oTydPCvyEyYaDDE= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.58.0/go.mod h1:YqwkQPrWSC7+byyc1VlKbWLBF5JsW5IoL6xUkemYSXk= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE= +github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= +github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= +github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= +github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= +github.com/ProtonMail/go-crypto v1.5.2 h1:cucYnvqcY7UOXVD//mSyjeaPY0SSN3v5cDkYPxumINk= +github.com/ProtonMail/go-crypto v1.5.2/go.mod h1:/RaSu30DaKO4RY+XdV/ACcCcZkGr7AhUIduq5sjzzCo= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/chroma/v2 v2.27.0 h1:FodwmyOBgJULFYmDqibcp9pvfDLWdtPRh9v/r5BXYZs= +github.com/alecthomas/chroma/v2 v2.27.0/go.mod h1:NjJ3ciIgrqBNeIkWZ4e46nseoLDslxU1LmfCoL+wcY8= +github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM= +github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/apache/arrow-go/v18 v18.7.0 h1:Vw/i+cJyebUofT7JlqFpe65LrmwxULn166jjwStM4HY= +github.com/apache/arrow-go/v18 v18.7.0/go.mod h1:PM6IigLJkdMwIpeHXnymo+xZ52f42a9EYiLtRel4p/A= +github.com/apache/thrift v0.24.0 h1:zy31L1a49QTNB2bG1BBfMXol3yJrTH975G3pPubQVLQ= +github.com/apache/thrift v0.24.0/go.mod h1:zPt6WxgvTOM6hF92y8C+MkEM5LMxZuk4JcQOiU4Esvs= +github.com/apparentlymart/go-cidr v1.1.1 h1:oEEk8CE0HP0YpHxsegk/TaOtR2FLHdWv4p3eM4ceUwg= +github.com/apparentlymart/go-cidr v1.1.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/apparentlymart/go-textseg/v17 v17.0.1 h1:bpMXRgQ5cEoRNuQke1a80/Nl6w3G5eoIbWo9f3gXkAs= +github.com/apparentlymart/go-textseg/v17 v17.0.1/go.mod h1:fa8X4jgGeevslICIY6LcdjkSecWnXmYd9Lk34z/VxZs= +github.com/apparentlymart/go-versions v1.0.3 h1:T3b8tumoQLuu1dej2Y9v22J4PWV9IzDLh2A9lIPoVSM= +github.com/apparentlymart/go-versions v1.0.3/go.mod h1:YF5j7IQtrOAOnsGkniupEA5bfCjzd7i14yu0shZavyM= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= +github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/aws/aws-sdk-go-v2 v1.47.4 h1:bTvk6UdSSSvaQsfLVj1JRDEEqj/PDRwGf1KanaRzau0= +github.com/aws/aws-sdk-go-v2 v1.47.4/go.mod h1:XkrjAZvr705Nytv6PkPUhoSB2W9+vVHBp5oAWpkh8Ak= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24 h1:t7FxqJ5KHDeKceyD4HtGaG6z7hMSeVGjs5/4c+L5ArM= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.24/go.mod h1:5XK6NRVlK8s8yj4zKcM43HLluGA/rAz+azLLvWDMRr0= +github.com/aws/aws-sdk-go-v2/config v1.33.10 h1:RRb0GghYqq2ikMXzfT4r9NO9lVhOld3FIhJJWDIdk+w= +github.com/aws/aws-sdk-go-v2/config v1.33.10/go.mod h1:BDSA7QGh6yrNQA5Z5aBnHWKMWdJDMD4IOlB4QjYSp5E= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10 h1:ItSjcLk+2M15RnRxO105uVIqLiVQn8y3gaeHC7W0iqs= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10/go.mod h1:eO4GlmGXB+gx+zDbhu3IENEFOmjrbVKJtOptJiIhngc= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4 h1:7ksj/zMap9+831SmNQZkcpmfuATp3DKr4BfLNnBdYXM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4/go.mod h1:zhi8vDrD1dj76ysTWS6Ny1y6/EEW1Jrq2y8lzKeoqfs= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34 h1:Pn7OsMwBLbkZ6OnCxWHAjf0L/22H8cnhxZC0uPwtMtg= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.34/go.mod h1:eToXR/Gk1uqpn04eSmdgVXwfS0WvH8aG4eBFr8ygbpU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7 h1:fSNAt6hs4qLjb9tMZc6vj3PHlOCYGXK2JjJZ7AW2tf4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.7/go.mod h1:TMav+EuXQu5kNpZZz/6rIC8xx4mCsW+6AKHrjvOSAsE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7 h1:7NS6kqBjkWIN8P/AEdmtyq6eQGAhN1oHTZdzXclpH6Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.7/go.mod h1:1PFqtAUsIgF1nEVojzRJSf/v88zjzqrGW+w+UAtkXyQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7 h1:wYu55QUHARwu9YzeuY5yEJUTsIu8ahkmp1l3QmbzHn8= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7/go.mod h1:OteEkhFAgFwQtZft/3myWo3tVWxdAo7cwV+7AbcpAtQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1 h1:VQM/FWdRiHWC8khhEQBi7q8KoCiP8T6cDn80+uDm0HQ= +github.com/aws/aws-sdk-go-v2/service/dynamodb v1.72.1/go.mod h1:aJmqDQQzrqt9Fi6KBkVMTTDNhP8YzXCTVoqcAMgbvkU= +github.com/aws/aws-sdk-go-v2/service/iam v1.64.5 h1:14GZ+z05ntZkgfUT/snvrs+hE+SODOflfQPugMAzOlU= +github.com/aws/aws-sdk-go-v2/service/iam v1.64.5/go.mod h1:YWSLkwCkgNF2N/2nGgkGDCiDg1wEVZvJWVZgPu14FbQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22 h1:qHfXn1Tm2Rh8kic/DvdKaiSVlHQRSr5C+rMuBR29D44= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22/go.mod h1:D4ytxJbGXu82l+2XF0q60bibysf+KkIbWfAOldAQwf8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8 h1:Foai7RHOgCNikTS6shP7OxVi4XdgR1z5uiy9NN6tBZs= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.8/go.mod h1:R/HyW81sfgXHPOnJRfQGzA6lnNDSJE7KknI7ArvboM4= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7 h1:LaoBY2u56tSAEYqWNB2GZICUg7Yw+R8g+6mAhmUkwy0= +github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.13.7/go.mod h1:7XyVl4Q5VQilY35Pqoxj6FGlHtK9dri62KQ58LxEiNU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7 h1:6MSlRo7aiUVBftQ8XmW7XIh3EZqCbkN9zI0YlGW8nl0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7/go.mod h1:OqapjZfp6VW4YJKKO4l68UdPvS4FIEYuEoq1JNkxCL0= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7 h1:6lQFbSJxvtqn19hbh+2+g5pRV8U4Etrq5x6sL6mD35U= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.7/go.mod h1:WAsCkzxO1H7/m1uYtLymru0aDH23BR7CWUA+8MpuUFY= +github.com/aws/aws-sdk-go-v2/service/kms v1.54.1 h1:aeJAJyvWS3gQ679pJbz8ZdOh3MViD1zvEdoZMVEawbg= +github.com/aws/aws-sdk-go-v2/service/kms v1.54.1/go.mod h1:0RXNc6Yf3AvSMldGD6Lcch96Ojlw2TtGnHsqfD/L4u8= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5 h1:97+lZymtcztX5RPNyW+B9pV6e60GQ7RBULVVRKhUTfk= +github.com/aws/aws-sdk-go-v2/service/s3 v1.114.5/go.mod h1:bku1YUz5FGs4MRhJaLcrpFZAH52/eRS0MQYi6diatGM= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5 h1:oFsZ3u5PPFSO1YZDGKFgyDuwgpbv/sTmVShEZfRnyaE= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5/go.mod h1:P+IzYJeldxO0mHt8fX4cglzexP3akO94C/UuEA2ojP0= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5 h1:EYD6E6CsgRQPazaOfZ6suyTgfZjg07HoT4S3qB9Exkg= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5/go.mod h1:hHg7OZNN1/U62f3Q5mebJYKO4f97vZC+s0fNAsPLnMk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5 h1:v6V0AnJ0aDmivAIie/6iT7sGpjnNmzaAdxZwZ0dhwqI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5/go.mod h1:P2Lqn27Kph9z400MFOYIebFnKjZEwyUIAva6fFFMiRY= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5 h1:OuyNaMncYP4ftrvcnOHJ9j3AxO3zsC5C/ewD0HoHdjQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5/go.mod h1:Bhu66tgvf94uunUSiAc0Ew0avhnpSm0J8Hl1MYocRbo= +github.com/aws/smithy-go v1.28.6 h1:Pj+/sUviNYjow8ELRtNwKHZ9ECeF+7pATX3+shjLIrw= +github.com/aws/smithy-go v1.28.6/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= +github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= +github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= +github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmatcuk/doublestar/v4 v4.10.2 h1:eF7W7HWKg3z9NrWV9pTLnNeoXaqq3Tq9DNKXVMfoCnw= +github.com/bmatcuk/doublestar/v4 v4.10.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= +github.com/buger/jsonparser v1.2.0 h1:4EFcvK1kD4jyj6YqNK6skK6w+y7FHHBR+XBCtxwu/6g= +github.com/buger/jsonparser v1.2.0/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/charlievieth/fastwalk v1.0.14 h1:3Eh5uaFGwHZd8EGwTjJnSpBkfwfsak9h6ICgnWlhAyg= +github.com/charlievieth/fastwalk v1.0.14/go.mod h1:diVcUreiU1aQ4/Wu3NbxxH4/KYdKpLDojrQ1Bb2KgNY= +github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q= +github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q= +github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4 h1:hISLzUbwcvJbGoNR6A3L/TpguRRnACBmZOee8LcHLJw= +github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4/go.mod h1:aJDVk+WOVM1K04rdc/71PMPoUGfjxjhvXfP3Pjz1Zio= +github.com/charmbracelet/x/ansi v0.11.9 h1:kIrqLBxtTVbLyyHO2Evoi93EjQo1mylWmpNEsfPxXAM= +github.com/charmbracelet/x/ansi v0.11.9/go.mod h1:DG/hpOnaI2QJ/KMMqLL2h0KVhluuJLazf8973P+Vy5w= +github.com/charmbracelet/x/exp/slice v0.0.0-20260713092006-0d683c34c74b h1:N0srud4Ch13fFAjgMlnKR2h41/2ISRbbzCJpTXGcNR0= +github.com/charmbracelet/x/exp/slice v0.0.0-20260713092006-0d683c34c74b/go.mod h1:vqEfX6xzqW1pKKZUUiFOKg0OQ7bCh54Q2vR/tserrRA= +github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= +github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= +github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY= +github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo= +github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM= +github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8= +github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0= +github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= +github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= +github.com/cloudflare/circl v1.6.4 h1:pOXuDTCEYyzydgUpQ0CQz3LsinKjiSk6nNP5Lt5K64U= +github.com/cloudflare/circl v1.6.4/go.mod h1:YxarevkLlbaHuWsxG6vmYNWBEsSp4pnp7j+4VljMavY= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik= +github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4= +github.com/containerd/continuity v0.5.0 h1:7a85HZpCSs+1Zps0Ee3DPSuAWY+0SJM1JNM51nlEVDg= +github.com/containerd/continuity v0.5.0/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= +github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= +github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= +github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= +github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/dlclark/regexp2/v2 v2.5.1 h1:E5Ug7Dh264W1ymdySmiHNcDG7fmsR307APCE5R07a20= +github.com/dlclark/regexp2/v2 v2.5.1/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= +github.com/docker/cli v29.6.2+incompatible h1:/bjePvcbbFTnRrMfWJBY7AjfICdsiLVgHn6LwTVOcqw= +github.com/docker/cli v29.6.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/go-connections v0.8.1 h1:JibmG5hULs5qXSr/cp/w3Pw5fZuStt4MOHMUExb29/M= +github.com/docker/go-connections v0.8.1/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/ebitengine/purego v0.10.2 h1:W809HbnvzAxgdm+aOvlSekrM16wGCdT/e76+9tS7gzE= +github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA= +github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU= +github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ= +github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI= +github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds= +github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= +github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= +github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI= +github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ= +github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e h1:y/1nzrdF+RPds4lfoEpNhjfmzlgZtPqyO3jMzrqDQws= +github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e/go.mod h1:awFzISqLJoZLm+i9QQ4SgMNHDqljH6jWV0B36V5MrUM= +github.com/getsops/sops/v3 v3.13.3 h1:saYczbT88kD1saNChe1cAbFQe5mrRhTIfEw3TaEcmK0= +github.com/getsops/sops/v3 v3.13.3/go.mod h1:3mUuUtKnJ63IzIvU4LQoDXdp0ZvorY5s2hEc7UVNfx8= +github.com/gitsight/go-vcsurl v1.0.1 h1:wkijKsbVg9R2IBP97U7wOANeIW9WJJKkBwS9XqllzWo= +github.com/gitsight/go-vcsurl v1.0.1/go.mod h1:qRFdKDa/0Lh9MT0xE+qQBYZ/01+mY1H40rZUHR24X9U= +github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= +github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= +github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/GeYW1cILu7Nuuj1N3BBkE= +github.com/go-ozzo/ozzo-validation v3.6.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= +github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/gofrs/flock v0.13.1 h1:jjREztyBeSKBZYAC+mgc1laB+xsgy4kYMf3FbKF2UBo= +github.com/gofrs/flock v0.13.1/go.mod h1:sf4BFiHwnvgxa25DlQoDqXQnwRMEOwqxRq37P6MzzmE= +github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= +github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v25.12.19+incompatible h1:haMV2JRRJCe1998HeW/p0X9UaMTK6SDo0ffLn2+DbLs= +github.com/google/flatbuffers v25.12.19+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/go-jsonnet v0.22.0 h1:o0bOAIE+9SIfRZ7FXQPuta0mHLLE0AwbY/L5GTH5CH8= +github.com/google/go-jsonnet v0.22.0/go.mod h1:pLhKpu0/ODjL2Zev4y+CmCoHKAgONT1gSLQyriuYh9w= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0= +github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= +github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= +github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= +github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.3.23 h1:J+VGF1wjAM2dU2kKUXZxJdDppRLReWP7KWcclfngQhc= +github.com/googleapis/enterprise-certificate-proxy v0.3.23/go.mod h1:Y8NO/15GNLkrXI3OR5xOFmeU3XLX1sLSdtlXgJ0zmIw= +github.com/googleapis/gax-go/v2 v2.26.2 h1:ydkmNXxj7bEmmeK5AihkKnWxyOyBR9TDebvp5L5izk8= +github.com/googleapis/gax-go/v2 v2.26.2/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= +github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408 h1:Y9iQJfEqnN3/Nce9cOegemcy/9Ai5k3huT6E80F3zaw= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408/go.mod h1:PE1ycukgRPJ7bJ9a1fdfQ9j8i/cEcRAoLZzbxYpNB/s= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= +github.com/gruntwork-io/boilerplate v0.17.0 h1:ld33t+X6j5wd1ddYKEM3sX0HCiuSPY92a3uAu9EVcQs= +github.com/gruntwork-io/boilerplate v0.17.0/go.mod h1:U/+aiGF/c8GDA/s/y50hBevlo8Bc/0zUCSWfhuWI5w0= +github.com/gruntwork-io/terragrunt v1.2.1 h1:OfrSK65sF2Snuj6vVvrLPP2LuLTNNA6PS0fIXfVVXww= +github.com/gruntwork-io/terragrunt v1.2.1/go.mod h1:WqipBUVEVep1WKhOlfeDOz/S5vJEOrqN55vq0EelSys= +github.com/gruntwork-io/terragrunt-engine-go v0.2.0 h1:LEZelI6sZ4B3L9lEL2Nu1wzw7ZscXSu6KtfJKPlPAZU= +github.com/gruntwork-io/terragrunt-engine-go v0.2.0/go.mod h1:27Gf11JzI/kYS8iq5rNDR7TooMQ5B/N1ce9BZf6HUHA= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74 h1:mymLUKThnV9wFvogOK8NnsMP9/vlhnjXY98gr2QIGW8= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.74/go.mod h1:Bh9qYL8ehmDxSg14Tk8oxFCP90XHfs6NxV1D84884xA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-getter v1.8.9 h1:1AOTMUmz/S/GuqOTE6+bg6nwPXTEbKr3Tc/T/lVS7is= +github.com/hashicorp/go-getter v1.8.9/go.mod h1:qI7vH/m552bXutKe4UkWptOJl4bo2KeO/CSOoh4s0ps= +github.com/hashicorp/go-getter/gcs/v2 v2.2.6 h1:cBhbdB75SdwNmAvAdDY0W3PTk8zNT2BGZveCBvMuQJM= +github.com/hashicorp/go-getter/gcs/v2 v2.2.6/go.mod h1:6T3+zDaSTRaLYj/g6w3NYkmU7oQL9INN80Kzt11LZHU= +github.com/hashicorp/go-getter/s3/v2 v2.2.6 h1:56R/AA1spMzAWhZzB0fOuU/DBMe1WgjyYgV12QSMuW8= +github.com/hashicorp/go-getter/s3/v2 v2.2.6/go.mod h1:2B7ayb2xvbw6oQf11OXErpYRPpHiVFiR0xSxpZrDAEc= +github.com/hashicorp/go-getter/v2 v2.2.6 h1:YPh3bAPQPFKYBu0i253xalk/dxZyoUnC4HbwDYPCYZw= +github.com/hashicorp/go-getter/v2 v2.2.6/go.mod h1:ijhzM8T7li5y5Jl3E6FZG7wajPtg/6XCI7w0U0DPo80= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs= +github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= +github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48= +github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 h1:U+kC2dOhMFQctRfhK0gRctKAPTloZdMU5ZJxaesJ/VM= +github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0/go.mod h1:Ll013mhdmsVDuoIXVfBtvgGJsXDYkTw1kooNcoCXuE0= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= +github.com/hashicorp/go-sockaddr v1.0.7 h1:G+pTkSO01HpR5qCxg7lxfsFEZaG+C0VssTy/9dbT+Fw= +github.com/hashicorp/go-sockaddr v1.0.7/go.mod h1:FZQbEYa1pxkQ7WLpyXJ6cbjpT8q0YgQaK/JakXqGyWw= +github.com/hashicorp/go-uuid v1.0.4 h1:ZrN80XjMzpRYk+2FxMDy2A2zz0d5QjJ7GMFSkZLj12A= +github.com/hashicorp/go-uuid v1.0.4/go.mod h1:x2Ds7vSkQ2n/yQj8Synnxmt0zt1l26uCAjxIhChisLU= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= +github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= +github.com/hashicorp/hcl/v2 v2.25.0 h1:HmmQVYRny4MaBo4b20TjmL46wyuUxpnMWkPZ4+NTbWk= +github.com/hashicorp/hcl/v2 v2.25.0/go.mod h1:vR+FKETxoZAmRlHgFfKmuqivj+C4Izm/c66XkmZ3r7M= +github.com/hashicorp/terraform-svchost v0.2.1 h1:ubvrTFw3Q7CsoEaX7V06PtCTKG3wu7GyyobAoN4eF3Q= +github.com/hashicorp/terraform-svchost v0.2.1/go.mod h1:zDMheBLvNzu7Q6o9TBvPqiZToJcSuCLXjAXxBslSky4= +github.com/hashicorp/vault/api v1.23.0 h1:gXgluBsSECfRWTSW9niY2jwg2e9mMJc4WoHNv4g3h6A= +github.com/hashicorp/vault/api v1.23.0/go.mod h1:zransKiB9ftp+kgY8ydjnvCU7Wk8i9L0DYWpXeMj9ko= +github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= +github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/go-clone v1.7.3 h1:rtQODA+ABThEn6J5LBTppJfKmZy/FwfpMUWa8d01TTQ= +github.com/huandu/go-clone v1.7.3/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207 h1:lgMtpjpIWPw0gbCAko23dRKl66ZPUmeAOidjKFkub2E= +github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.207/go.mod h1:M+yna96Fx9o5GbIUnF3OvVvQGjgfVSyeJbV9Yb1z/wI= +github.com/invopop/jsonschema v0.14.0 h1:MHQqLhvpNUZfw+hM3AZDYK7jxO8FZoQeQM77g8iyZjg= +github.com/invopop/jsonschema v0.14.0/go.mod h1:ygm6C2EaVNMBDPpaPlnOA2pFAxBnxGjFlMZABxm9n2I= +github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= +github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= +github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 h1:9Nu54bhS/H/Kgo2/7xNSUuC5G28VR8ljfrLKU2G4IjU= +github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12/go.mod h1:TBzl5BIHNXfS9+C35ZyJaklL7mLDbgUkcgXzSLa8Tk0= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU= +github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.19.2 h1:hMRETovs/pu/dVWN7zIT1PGG8t509MwT6bO7XSi26R8= +github.com/klauspost/compress v1.19.2/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw= +github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ= +github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= +github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss= +github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 h1:eveIIGn4BGM3qknO74omf6HYr30/exH+eVUTuAgwjZ0= +github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= +github.com/magiconair/properties v1.18.11 h1:j5ozYZl0zCjG7ahMDH0GWIobOvvUzT0BdAguG0ViKy0= +github.com/magiconair/properties v1.18.11/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= +github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= +github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mattn/go-runewidth v0.0.31 h1:1oCV4ReTlosDBc6rYRw5cL8S/4y8iv5oRl4SJ5IBgwo= +github.com/mattn/go-runewidth v0.0.31/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8= +github.com/mattn/go-shellwords v1.0.16 h1:RRxAaRzU1YbzOSCj9NJqg2/VIbSWv0dnPoD3EwE8kxI= +github.com/mattn/go-shellwords v1.0.16/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-zglob v0.0.8 h1:g/5T0tizbs+419GtiXvMDkOg+RIBu1qi+B2teiHsnNE= +github.com/mattn/go-zglob v0.0.8/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= +github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME= +github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE= +github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc= +github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs= +github.com/moby/moby/client v0.5.1 h1:tYNaJno4c0HXz12y5BiqEDy0rVTYkWzI26lGvnTMiJw= +github.com/moby/moby/client v0.5.1/go.mod h1:odLstlZ6uSnfvAgVxMpvgmb8SUdd+siH2T0GBuxVAlM= +github.com/moby/patternmatcher v0.6.1 h1:qlhtafmr6kgMIJjKJMDmMWq7WLkKIo23hsrpR3x084U= +github.com/moby/patternmatcher v0.6.1/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8= +github.com/moby/sys/sequential v0.7.0/go.mod h1:NfSTAp6V3fw4tmkD62PEcOKeZKquXT8VKCkf7aVR79o= +github.com/moby/sys/user v0.4.1 h1:RgjRlaDKi/Xmyrz4t8lyzXT6v2ooFeO/7xtchmhVWE0= +github.com/moby/sys/user v0.4.1/go.mod h1:E9QsW5WRe1kUAf7kW8hXKwu1uhsZEAdPLYHYSDudF4Y= +github.com/moby/sys/userns v0.2.0 h1:nEtDtp7NCV/6dutSklNe8FrENPwFdc4mXnZqC/JWgXM= +github.com/moby/sys/userns v0.2.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= +github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= +github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= +github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4= +github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= +github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= +github.com/opencontainers/runc v1.3.6 h1:SLGIymCtsk80iNPWgbc8dtjI30r+5mTVV+4dN8/17Sk= +github.com/opencontainers/runc v1.3.6/go.mod h1:o1wyv76EDlTkcf0KTFgN8bMWLPvgF/HfX709lDv+rr4= +github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw= +github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE= +github.com/pb33f/ordered-map/v2 v2.3.1 h1:5319HDO0aw4DA4gzi+zv4FXU9UlSs3xGZ40wcP1nBjY= +github.com/pb33f/ordered-map/v2 v2.3.1/go.mod h1:qxFQgd0PkVUtOMCkTapqotNgzRhMPL7VvaHKbd1HnmQ= +github.com/pierrec/lz4/v4 v4.1.28 h1:pPEPwRJ4kybBTfGt28q7lQsRJQHhC08axprdLD5Ppio= +github.com/pierrec/lz4/v4 v4.1.28/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25 h1:S1hI5JiKP7883xBzZAr1ydcxrKNSVNm7+3+JwjxZEsg= +github.com/planetscale/vtprotobuf v0.6.1-0.20250313105119-ba97887b0a25/go.mod h1:ZQntvDG8TkPgljxtA0R9frDoND4QORU1VXz015N5Ks4= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 h1:jL3a8soXdzuTCcRnKhOmtcsVOObdDTFf4O2B403HPRU= +github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g= +github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/sahilm/fuzzy v0.1.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU= +github.com/sahilm/fuzzy v0.1.3/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8= +github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= +github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0= +github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0= +github.com/shirou/gopsutil/v4 v4.26.7 h1:IXzpHz/dkMRYAhKkOXr1HB6SuzWU3eoyyeWe7g3bNZc= +github.com/shirou/gopsutil/v4 v4.26.7/go.mod h1:5O9FjBiXoTDFatIWjZZosqj4pV0DRtLx598xGbBehzM= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo= +github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= +github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= +github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= +github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= +github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= +github.com/spiffe/go-spiffe/v2 v2.8.1 h1:eXZMLsu+3MLEPJyGJkolqtVrteZfQdUpOWj6LTiDl/E= +github.com/spiffe/go-spiffe/v2 v2.8.1/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/testcontainers/testcontainers-go v0.44.0 h1:/Fwh6HY1mIikhnm9e7HwoxGycx0lzRAE0f5VQpjFxzI= +github.com/testcontainers/testcontainers-go v0.44.0/go.mod h1:IcnwQrYTO86xHXu5bvMaBH7ATlbS3Qn1M1QWW3c66rE= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU= +github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI= +github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4= +github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg= +github.com/ulikunitz/xz v0.5.16 h1:ld6NyySjx5lowVKwJvMRLnW5nxKX/xnpSiFYZ/Lxur0= +github.com/ulikunitz/xz v0.5.16/go.mod h1:H9Rt/W6/Qj27PGauhQc6nfCDy7vHpzsOThBSaYDoEhw= +github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ= +github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo= +github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU= +github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xo/terminfo v1.0.0 h1:2ZpYzqWzyyytjk3TP6aJVDhkMAkc99/1xKQdA3TDTBY= +github.com/xo/terminfo v1.0.0/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg= +github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= +github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.8.6 h1:d0VcaP1sx9GkFVkoW+KtggpGi2KZ965i14b0+bDQST4= +github.com/yuin/goldmark v1.8.6/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +github.com/yuin/goldmark-emoji v1.0.6 h1:QWfF2FYaXwL74tfGOW5izeiZepUDroDJfWubQI9HTHs= +github.com/yuin/goldmark-emoji v1.0.6/go.mod h1:ukxJDKFpdFb5x0a5HqbdlcKtebh086iJpI31LTKmWuA= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zclconf/go-cty v1.19.0 h1:IV8WdqYZc2c5rLX9bEoLNXKojBAp0MZPBHMIrCoa/s4= +github.com/zclconf/go-cty v1.19.0/go.mod h1:12W89jGn3JCOIQi7infWr9m80rOkb5RNYJqXMZcN4c8= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= +github.com/zclconf/go-cty-yaml v1.2.0 h1:GDyL4+e/Qe/S0B7YaecMLbVvAR/Mp21CXMOSiCTOi1M= +github.com/zclconf/go-cty-yaml v1.2.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= +github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= +github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= +github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= +github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= +go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.17.9 h1:IexDdCuuNJ3BHrELgBlyaH9p60JXAvdzWR128q+U5tU= +go.mongodb.org/mongo-driver v1.17.9/go.mod h1:LlOhpH5NUEfhxcAwG0UEkMqwYcc4JU18gtCdGudk/tQ= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0 h1:q9+0sc6cUOTBcEh+hwTGINaFlAOutRBwENORxaIjlKg= +go.opentelemetry.io/contrib/bridges/otellogrus v0.21.0/go.mod h1:qp9G1Uoc+eEnUApc7gCzP9BW5GBuoeU3Pg1WWjqyRfU= +go.opentelemetry.io/contrib/detectors/gcp v1.45.0 h1:9jR0ZPRok9ryaOQ2Wx8rg5F7Aon59mxrqbVI60/vlBk= +go.opentelemetry.io/contrib/detectors/gcp v1.45.0/go.mod h1:VSme3o2fvSg5bVg0dRzyHaj4Z5EVhG+g2Fde6LKzmQA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 h1:oECp5f+hN7nkwjU/8BxQ/q23bGPb8FIrD839owX222E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0/go.mod h1:DqEFwLumhzMBDQv9PcWbyoDxHI/4lAk6CM4nJBH39sc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04= +go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM= +go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0 h1:5Ek4qQ5XX0PSQfY7lMW3CvcR36yy8YFDfGnYnaku8zE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.23.0/go.mod h1:NUKIMOKSexQdTmS1pSxOQBDiVes3DHRier2ePsGW/gQ= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0 h1:5WVp40k2fJHuc5BtNTgKk+EugKFT8Eg3lywFfCPI/nE= +go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.23.0/go.mod h1:59nH0RYCGHRlwt15WyioeSYINBbuObeBpTowPhEKWHY= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0 h1:LaLVGJtIzHcvHjVs2OftmKcc+M9mdOqS8vZ1fBD1Yes= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.47.0/go.mod h1:vF6H5sNDuQBJWgSX00iZgbIqk2MZZoVMH0ar5t5bOpw= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0 h1:7kszRN4Ze5GeAkUnBjBSUIunVBMA+mZIG04auueqguM= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.47.0/go.mod h1:CLzakYy8jOdkBfcveCWYkeKJxujcF4xPhh2Z7IfE98U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0 h1:UFpxOpYPmMNUtOWhdb+nC1WELIgVf8z9higURrbzYU4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.47.0/go.mod h1:YBGjxe3lt0jtXoEXxGrGhv/jM7oUBUDVK7zhAvNyEjc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0 h1:PW/E9Tw6ZykC88pey0MZY8hKOUeEw+hX6PU+oXA4A9o= +go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.23.0/go.mod h1:hUw4VNfiOnQ/yzGgy6ZdWVnudXw7iRfImhd6FjXOnvI= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0 h1:ww5DYBpMKcqLdxjWrhGUIh6O+ZfvZUaMk4niVyNQPEQ= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.47.0/go.mod h1:Av5t+Ezx5S/Ks2dsEfWhny+GK+wrZ1K7NZ6aHSWnX3U= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0 h1:N3YQCxjxQ/bMjyc3heladfRm9t9RTksGQH8z4w6yU/0= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.47.0/go.mod h1:Mp8HOFqcaUyypCuGv9IhDdTHnJ56lSudSHMd+pVSCEA= +go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI= +go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw= +go.opentelemetry.io/otel/log/logtest v0.23.0 h1:XeI2D+/DjUMYzrfmMPXOxnTIkUTCXT/HwQ5QBJSEC/8= +go.opentelemetry.io/otel/log/logtest v0.23.0/go.mod h1:TOVBzNwEZG0vmQUuvE9UHaiKkUN7q3j1d+GeVGs/yQ8= +go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY= +go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU= +go.opentelemetry.io/otel/metric/x v0.69.0 h1:DjRLr15H83v+hCW7JA9NoJvOkYTtmq5YoDRbe9deYpM= +go.opentelemetry.io/otel/metric/x v0.69.0/go.mod h1:uVvsMPMFFyj/HUQfrUnH3JjnOQ1dwFDorgFLRBasM0k= +go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I= +go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0= +go.opentelemetry.io/otel/sdk/log v1.47.0 h1:W4N/ZfgpkRRnmARnqYoQ6BrWA0mrj8IzVDNLlpmUJZY= +go.opentelemetry.io/otel/sdk/log v1.47.0/go.mod h1:Wu74Z2EmOKXi2FleSNAb0Hyau2G+r5kubSEMJw5aAMs= +go.opentelemetry.io/otel/sdk/log/logtest v0.23.0 h1:j3pm42QCrKYYLLkI6OrV1QHFkUfDA6/4EP+Y1PzggLg= +go.opentelemetry.io/otel/sdk/log/logtest v0.23.0/go.mod h1:zt0gEnuTZgDvqvczHwYswz93eqMaIr6upTTsdV/HUlU= +go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw= +go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw= +go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM= +go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0= +go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= +go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +go.yaml.in/yaml/v4 v4.0.0-rc.4 h1:UP4+v6fFrBIb1l934bDl//mmnoIZEDK0idg1+AIvX5U= +go.yaml.in/yaml/v4 v4.0.0-rc.4/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297 h1:YXnL44eJ77R+ji4/ooy8UsXIhz+lbi2Qgdlc8iRN0gY= +golang.org/x/exp v0.0.0-20260813180055-c1d0aacb2297/go.mod h1:Mkmymgv+uMpSQ/XxJ/7GpdrdYoqm3u72jEbpCLiJmNk= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= +golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/api v0.308.0 h1:iGb+4qT3nVb3uuIzwor3yP2nyu+rMZr31PvLFiRNJQk= +google.golang.org/api v0.308.0/go.mod h1:4XMH+b/ZEfuTbK7FnrFRY9c4xfFHVflGTKuy/i5wUmE= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 h1:NO3LCWyMAM/f/RDLvCC8B/NEvuYqOQAP12XWoyB4os8= +google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= +google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc h1:rZHRz0ogq4Pid1IKtA/ivHi8XONVF5tqUQXA2TtgpkE= +google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc/go.mod h1:K/n0XLazCJHjD73YuMyNJsN38BPPy1kfFnKxUXaThFU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b h1:6WNWHZk91dp4gZ25642OALkuG1UVNZbwENJD19DnB8k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0= +google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.3 h1:iM9Lhz5MRSGhHVGGwCuzG9KO8PoirCXj/m/qTmOJJQw= +gopkg.in/ini.v1 v1.67.3/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +oras.land/oras-go/v2 v2.7.0 h1:0bXRBBSqYgPSjZRrhJbT71Rb465c+rdlft2xdQPxLtQ= +oras.land/oras-go/v2 v2.7.0/go.mod h1:imXEFiYkTZUVVYkfv/r5GVmWeiLkGtNQA8FU4F/sjKs= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/plugins/terragrunt/internal/engine/discovery.go b/plugins/terragrunt/internal/engine/discovery.go new file mode 100644 index 00000000000..2dcde3c262f --- /dev/null +++ b/plugins/terragrunt/internal/engine/discovery.go @@ -0,0 +1,171 @@ +package engine + +import ( + "context" + "fmt" + "os" + "path/filepath" + "slices" + "strings" + + "github.com/spf13/afero" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +// canonicalPath preserves physical ancestor identity for files generated only in +// the discovery overlay. Actual existence is checked through the active FS. +func canonicalPath(path string) (string, error) { + resolved, err := filepath.EvalSymlinks(path) + if err == nil { + return resolved, nil + } + if !os.IsNotExist(err) { + return "", err + } + parent := filepath.Dir(path) + if parent == path { + return "", err + } + resolved, err = canonicalPath(parent) + if err != nil { + return "", err + } + return filepath.Join(resolved, filepath.Base(path)), nil +} + +func within(path, directory string) bool { + rel, err := filepath.Rel(directory, path) + return err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) +} + +// discoverProject uses an invocation-local copy-on-write overlay. Generated HCL +// retains its original virtual path; no source files or state are moved/written. +func discoverProject(ctx context.Context, request model.Request) (*model.Resolution, error) { + root, err := canonicalPath(request.BasePath) + if err != nil { + return nil, err + } + overlay := afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) + stacks, units, err := discoveryPaths(root, request.IncludedPaths, request.ExcludedPaths) + if err != nil { + return nil, err + } + result := &model.Resolution{} + templates := map[string]bool{} + skipped := func(path string) bool { + for dir := range templates { + if within(path, dir) { + return true + } + } + return false + } + nameFor := func(dir string) string { + rel, _ := filepath.Rel(root, dir) + if rel == "." { + return "default" + } + return filepath.ToSlash(rel) + } + parse := func(path string, generate bool) (*model.Resolution, error) { + req := request + req.Path, req.Phase = path, "discover" + if generate { + req.Command = "generate" + } + return resolve(ctx, req, overlay) + } + var visit func(string, string, string, string, []string, []string, int) error + visit = func(path, stack, name, generationRoot string, files, folders []string, depth int) error { + if depth > 32 { + return fmt.Errorf("nested-stack discovery depth exceeded at %s", path) + } + resolved, err := parse(path, false) + if err != nil { + return err + } + if filepath.Base(path) == "terragrunt.stack.hcl" { + files = append(append([]string{}, files...), resolved.Files...) + for child, childPath := range resolved.StackConfigs { + source := resolved.StackSources[child] + templates[source] = true + if err := visit(childPath, stack, filepath.Join(name, resolved.Stacks[child]), generationRoot, files, append(append([]string{}, folders...), source), depth+1); err != nil { + return err + } + } + for child, childPath := range resolved.UnitConfigs { + source := resolved.UnitSources[child] + templates[source] = true + if err := visit(childPath, stack, filepath.Join(name, child), generationRoot, files, append(append([]string{}, folders...), source), depth+1); err != nil { + return err + } + } + return nil + } + if len(resolved.Folders) == 0 { + entries, err := afero.ReadDir(overlay, filepath.Dir(path)) + if err != nil { + return err + } + for _, entry := range entries { + if !entry.IsDir() && (strings.HasSuffix(entry.Name(), ".tf") || strings.HasSuffix(entry.Name(), ".tf.json")) { + return fmt.Errorf("discovery of inline Terraform modules without terraform.source is not implemented: %s", path) + } + } + return nil + } // Shared include, not a runnable local-source unit. + if !plainLocalSource(resolved.Folders[0]) { + return fmt.Errorf("discovery only supports local sources: %s", path) + } + resolved.Files = append(resolved.Files, files...) + resolved.Folders = append(resolved.Folders, folders...) + result.Inventory = append(result.Inventory, model.DiscoveredUnit{Stack: stack, Name: filepath.ToSlash(name), GenerationRoot: generationRoot, Config: *resolved}) + return nil + } + // Catalog stack templates may require values supplied by a live stack. Delay + // their errors until successful roots have identified the referenced templates. + failures := map[string]error{} + for _, path := range stacks { + if skipped(path) { + continue + } + if _, err := parse(path, true); err != nil { + failures[path] = err + continue + } + if err := visit(path, nameFor(filepath.Dir(path)), "", path, nil, nil, 0); err != nil { + failures[path] = err + } + } + for _, path := range stacks { + if err := failures[path]; err != nil && !skipped(path) { + return nil, fmt.Errorf("discover %s: %w", path, err) + } + } + // A template that parsed independently is still a template, not another live stack. + result.Inventory = slices.DeleteFunc(result.Inventory, func(unit model.DiscoveredUnit) bool { return skipped(unit.GenerationRoot) }) + for _, path := range units { + if skipped(path) { + continue + } + dir := filepath.Dir(path) + stack, name := nameFor(filepath.Dir(dir)), filepath.Base(dir) + if dir == root { + stack, name = "default", "root" + } + if err := visit(path, stack, name, "", nil, nil, 0); err != nil { + return nil, fmt.Errorf("discover %s: %w", path, err) + } + } + slices.SortFunc(result.Inventory, func(a, b model.DiscoveredUnit) int { return strings.Compare(a.Stack+"/"+a.Name, b.Stack+"/"+b.Name) }) + identities := map[string]string{} + for _, unit := range result.Inventory { + key := unit.Stack + "\x00" + unit.Name + if previous, exists := identities[key]; exists { + return nil, fmt.Errorf("discovered instance collision %s/%s: %s and %s", unit.Stack, unit.Name, previous, unit.Config.Path) + } + identities[key] = unit.Config.Path + } + return result, nil +} diff --git a/plugins/terragrunt/internal/engine/discovery_paths.go b/plugins/terragrunt/internal/engine/discovery_paths.go new file mode 100644 index 00000000000..b0b53794f7d --- /dev/null +++ b/plugins/terragrunt/internal/engine/discovery_paths.go @@ -0,0 +1,94 @@ +package engine + +import ( + "fmt" + "io/fs" + "os" + "path/filepath" + "slices" + "strings" + + "github.com/bmatcuk/doublestar/v4" +) + +// discoveryPaths walks only the literal prefixes of included patterns and prunes +// excluded directories. Paths select entry points; HCL references are resolved later. +func discoveryPaths(root string, includes, excludes []string) ([]string, []string, error) { + if len(includes) == 0 { + includes = []string{"**"} + } + for _, pattern := range append(slices.Clone(includes), excludes...) { + if pattern == "" || filepath.IsAbs(pattern) || strings.Contains(pattern, "\\") || !doublestar.ValidatePattern(pattern) { + return nil, nil, fmt.Errorf("invalid discovery path pattern: %q", pattern) + } + for _, part := range strings.Split(pattern, "/") { + if part == ".." { + return nil, nil, fmt.Errorf("discovery paths must stay within the Atmos base path: %q", pattern) + } + } + } + matches := func(patterns []string, path string) bool { + for _, pattern := range patterns { + if ok, _ := doublestar.Match(pattern, path); ok { + return true + } + } + return false + } + seen := map[string]bool{} + var stacks, units []string + for _, pattern := range includes { + prefix := pattern + if index := strings.IndexAny(pattern, "*?[{"); index >= 0 { + prefix = pattern[:index] + if !strings.HasSuffix(prefix, "/") { + prefix = filepath.Dir(prefix) + } + } + start := filepath.Join(root, filepath.FromSlash(prefix)) + // Do not follow a configured root symlink outside the project. + resolved, err := canonicalPath(start) + if err != nil || !within(resolved, root) { + return nil, nil, fmt.Errorf("discovery root is outside the Atmos base path or unavailable: %s", start) + } + err = filepath.WalkDir(start, func(path string, entry fs.DirEntry, walkErr error) error { + if os.IsNotExist(walkErr) && path == start { + return nil + } + if walkErr != nil { + return walkErr + } + rel, _ := filepath.Rel(root, path) + rel = filepath.ToSlash(rel) + if matches(excludes, rel) { + if entry.IsDir() { + return filepath.SkipDir + } + return nil + } + if entry.IsDir() { + if path != root && (strings.HasPrefix(entry.Name(), ".") || entry.Name() == "node_modules") { + return filepath.SkipDir + } + return nil + } + if seen[path] || !matches(includes, rel) { + return nil + } + seen[path] = true + switch entry.Name() { + case "terragrunt.stack.hcl": + stacks = append(stacks, path) + case "terragrunt.hcl": + units = append(units, path) + } + return nil + }) + if err != nil { + return nil, nil, err + } + } + slices.Sort(stacks) + slices.Sort(units) + return stacks, units, nil +} diff --git a/plugins/terragrunt/internal/engine/discovery_paths_test.go b/plugins/terragrunt/internal/engine/discovery_paths_test.go new file mode 100644 index 00000000000..3a6e188b094 --- /dev/null +++ b/plugins/terragrunt/internal/engine/discovery_paths_test.go @@ -0,0 +1,89 @@ +package engine + +import ( + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +func TestDiscoveryScopeAndPruning(t *testing.T) { + root, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + for _, name := range []string{"live/terragrunt.stack.hcl", "live/unit/terragrunt.hcl", "live/excluded/terragrunt.hcl", "live/.terragrunt-cache/terragrunt.hcl", "live/node_modules/terragrunt.hcl", "catalog/terragrunt.hcl"} { + path := filepath.Join(root, name) + require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755)) + require.NoError(t, os.WriteFile(path, nil, 0o644)) + } + stacks, units, err := discoveryPaths(root, []string{"live/**", "live/unit/**"}, []string{"live/excluded/**"}) + require.NoError(t, err) + require.Equal(t, []string{filepath.Join(root, "live/terragrunt.stack.hcl")}, stacks) + require.Equal(t, []string{filepath.Join(root, "live/unit/terragrunt.hcl")}, units) + _, _, err = discoveryPaths(root, []string{"absent/**"}, nil) + require.NoError(t, err) + for _, pattern := range []string{"", "[", "../**", `live\**`, filepath.Join(root, "**")} { + _, _, err := discoveryPaths(root, []string{pattern}, nil) + require.Error(t, err) + } + _, units, err = discoveryPaths(root, nil, nil) + require.NoError(t, err) + require.Contains(t, units, filepath.Join(root, "catalog/terragrunt.hcl")) +} + +func TestDiscoveryRejectsOutsideSymlink(t *testing.T) { + root := t.TempDir() + outside := t.TempDir() + if err := os.Symlink(outside, filepath.Join(root, "external")); err != nil { + t.Skipf("symlink unavailable: %v", err) + } + _, _, err := discoveryPaths(root, []string{"external/**"}, nil) + require.ErrorContains(t, err, "outside the Atmos base path") +} + +func TestDiscoveryDistinguishesIncludesFromInlineModules(t *testing.T) { + root := t.TempDir() + path := filepath.Join(root, "terragrunt.hcl") + require.NoError(t, os.WriteFile(path, []byte("locals { shared = true }"), 0o644)) + request := model.Request{Phase: "inventory", BasePath: root, Environment: map[string]string{}} + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Empty(t, result.Inventory) + require.NoError(t, os.WriteFile(filepath.Join(root, "main.tf"), []byte("terraform {}"), 0o644)) + _, err = Resolve(t.Context(), request) + require.ErrorContains(t, err, "inline Terraform modules") +} + +func TestDiscoveryReportsBrokenStacksAndMissingDependencies(t *testing.T) { + for _, name := range []string{"broken stack", "missing dependency", "named workspace outputs"} { + t.Run(name, func(t *testing.T) { + req := nativeUnit(t, "") + switch name { + case "broken stack": + require.NoError(t, os.WriteFile(filepath.Join(req.BasePath, "terragrunt.stack.hcl"), []byte("unit {"), 0o644)) + case "missing dependency": + f, err := os.OpenFile(req.Path, os.O_APPEND|os.O_WRONLY, 0o644) + require.NoError(t, err) + _, err = f.WriteString("\ndependencies { paths = [\"./absent\"] }\n") + require.NoError(t, err) + require.NoError(t, f.Close()) + case "named workspace outputs": + dep := filepath.Join(req.BasePath, "network") + require.NoError(t, os.MkdirAll(dep, 0o755)) + content, err := os.ReadFile(req.Path) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(dep, "terragrunt.hcl"), content, 0o644)) + require.NoError(t, os.WriteFile(req.Path, append(content, []byte("\ndependency \"network\" { config_path = \"./network\" }\n")...), 0o644)) + req.Environment["TF_WORKSPACE"] = "stage" + } + req.Phase = "inventory" + _, err := Resolve(t.Context(), req) + require.Error(t, err) + if name == "named workspace outputs" { + require.ErrorContains(t, err, "non-default workspaces") + } + }) + } +} diff --git a/plugins/terragrunt/internal/engine/environment_test.go b/plugins/terragrunt/internal/engine/environment_test.go new file mode 100644 index 00000000000..87bccab478d --- /dev/null +++ b/plugins/terragrunt/internal/engine/environment_test.go @@ -0,0 +1,94 @@ +package engine + +import ( + "encoding/json" + "os" + "path/filepath" + "runtime" + "sync" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +func TestMain(m *testing.M) { + if os.Getenv("ATMOS_TERRAGRUNT_VERSION_CHILD") != "" { + _, _ = os.Stdout.WriteString(os.Getenv("ATMOS_TERRAGRUNT_VERSION_CHILD")) + os.Exit(0) + } + if os.Getenv("ATMOS_TERRAGRUNT_ENV_CHILD") == "1" { + cwd, _ := os.Getwd() + _ = json.NewEncoder(os.Stdout).Encode(map[string]string{"cwd": cwd, "profile": os.Getenv("AWS_PROFILE"), "token": os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE"), "custom": os.Getenv("CUSTOM_VALUE"), "path": os.Getenv("PATH")}) + os.Exit(0) + } + os.Exit(m.Run()) +} + +func TestEvaluatorUsesScopedEnvironmentForFunctionsAndCommands(t *testing.T) { + root := t.TempDir() + bin := filepath.Join(root, "bin") + module := filepath.Join(root, "module") + require.NoError(t, os.MkdirAll(bin, 0o755)) + require.NoError(t, os.MkdirAll(module, 0o755)) + executable, err := os.Executable() + require.NoError(t, err) + content, err := os.ReadFile(executable) + require.NoError(t, err) + name := "fixture-environment-helper" + if runtime.GOOS == "windows" { + name += ".exe" + } + require.NoError(t, os.WriteFile(filepath.Join(bin, name), content, 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, name), content, 0o755)) + sourceJSON, err := json.Marshal(filepath.ToSlash(module)) + require.NoError(t, err) + config := `terraform { source = ` + string(sourceJSON) + ` } +inputs = { + direct = get_env("CUSTOM_VALUE") + child = jsondecode(run_cmd("` + name + `")) + relative = jsondecode(run_cmd("./` + name + `")) + directory = get_terragrunt_dir() +} +` + path := filepath.Join(root, "terragrunt.hcl") + require.NoError(t, os.WriteFile(path, []byte(config), 0o644)) + t.Setenv("AWS_WEB_IDENTITY_TOKEN_FILE", "ambient-token-must-not-return") + t.Setenv("CUSTOM_VALUE", "ambient") + physical, err := filepath.EvalSymlinks(root) + require.NoError(t, err) + type outcome struct { + profile string + result *model.Resolution + err error + } + outcomes := make(chan outcome, 2) + var workers sync.WaitGroup + for _, profile := range []string{"development", "production"} { + workers.Add(1) + go func() { + defer workers.Done() + env := map[string]string{"PATH": bin, "AWS_PROFILE": profile, "CUSTOM_VALUE": profile, "ATMOS_TERRAGRUNT_ENV_CHILD": "1"} + result, err := Resolve(t.Context(), model.Request{Path: path, BasePath: root, Command: "plan", Tofu: executable, Environment: env}) + outcomes <- outcome{profile: profile, result: result, err: err} + }() + } + workers.Wait() + close(outcomes) + for outcome := range outcomes { + require.NoError(t, outcome.err) + result, profile := outcome.result, outcome.profile + require.Equal(t, filepath.ToSlash(physical), result.Inputs["directory"]) + require.Equal(t, profile, result.Inputs["direct"]) + child := result.Inputs["child"].(map[string]any) + require.Equal(t, filepath.Clean(physical), filepath.Clean(child["cwd"].(string))) + require.Equal(t, child, result.Inputs["relative"]) + require.Equal(t, profile, child["profile"]) + require.Equal(t, profile, child["custom"]) + require.Equal(t, "", child["token"]) + require.Equal(t, bin, child["path"]) + require.Equal(t, "ambient", os.Getenv("CUSTOM_VALUE")) + require.Equal(t, "ambient-token-must-not-return", os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")) + } +} diff --git a/plugins/terragrunt/internal/engine/policies.go b/plugins/terragrunt/internal/engine/policies.go new file mode 100644 index 00000000000..bc8478443de --- /dev/null +++ b/plugins/terragrunt/internal/engine/policies.go @@ -0,0 +1,70 @@ +package engine + +import ( + "context" + "encoding/json" + "fmt" + "os/exec" + "path/filepath" + "strings" + + "github.com/hashicorp/go-version" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +func localPath(base, path string) string { + if filepath.IsAbs(path) { + return filepath.Clean(path) + } + return filepath.Join(base, path) +} + +// plainLocalSource accepts native absolute paths, including Windows drive +// letters, while rejecting URL/query and module subdirectory syntax. +func plainLocalSource(source string) bool { + path := strings.TrimPrefix(source, filepath.VolumeName(source)) + return !strings.ContainsAny(path, "?:") && !strings.Contains(filepath.ToSlash(path), "//") +} + +func checkVersions(ctx context.Context, request model.Request, terraform, terragrunt string) error { + check := func(name, constraint, actual string) error { + if constraint == "" { + return nil + } + rules, err := version.NewConstraint(constraint) + if err != nil { + return fmt.Errorf("%s: %w", name, err) + } + v, err := version.NewVersion(actual) + if err != nil { + return err + } + if !rules.Check(v) { + return fmt.Errorf("%s %q rejects version %s", name, constraint, actual) + } + return nil + } + if err := check("terragrunt_version_constraint", terragrunt, "1.2.1"); err != nil { + return err + } + if terraform == "" { + return nil + } + cmd := exec.CommandContext(ctx, request.Tofu, "version", "-json") + cmd.Env = make([]string, 0, len(request.Environment)) + for key, value := range request.Environment { + cmd.Env = append(cmd.Env, key+"="+value) + } + data, err := cmd.Output() + if err != nil { + return fmt.Errorf("terraform_version_constraint: cannot inspect selected executable: %w", err) + } + var result struct { + Version string `json:"terraform_version"` + } + if err := json.Unmarshal(data, &result); err != nil { + return err + } + return check("terraform_version_constraint", terraform, result.Version) +} diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go new file mode 100644 index 00000000000..265d4b5cfad --- /dev/null +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -0,0 +1,258 @@ +// Package engine evaluates Terragrunt configuration outside Atmos core. +package engine + +import ( + "context" + "fmt" + "io" + "os" + "path/filepath" + "strings" + + "github.com/gruntwork-io/terragrunt/pkg/atmosbridge" + "github.com/gruntwork-io/terragrunt/pkg/config" + "github.com/gruntwork-io/terragrunt/pkg/log" + "github.com/gruntwork-io/terragrunt/pkg/log/format" + "github.com/gruntwork-io/terragrunt/pkg/options" + "github.com/spf13/afero" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +// Resolve evaluates HCL using the pinned Terragrunt parser. +func Resolve(ctx context.Context, request model.Request) (*model.Resolution, error) { + return resolve(ctx, request, nil) +} + +func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (*model.Resolution, error) { + if request.Phase == "inventory" { + return discoverProject(ctx, request) + } + if request.Phase == "backend" && request.GenerationRoot != "" { + filesystem = afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) + generation := request + generation.Path, generation.Phase, generation.Command = request.GenerationRoot, "discover", "generate" + if _, err := resolve(ctx, generation, filesystem); err != nil { + return nil, err + } + } + path, err := filepath.Abs(strings.TrimPrefix(request.Path, "terragrunt://")) + if err != nil { + return nil, err + } + // Use one physical path identity for parsing and CLI execution. On macOS, + // mixing /var and /private/var breaks upstream diamond dependency reads. + path, err = canonicalPath(path) + if err != nil { + return nil, err + } + ctx = config.WithCaches(ctx) + formatter := format.NewFormatter(format.NewKeyValueFormatPlaceholders()) + formatter.SetDisabledColors(true) + logger := log.New(log.WithOutput(io.Discard), log.WithFormatter(formatter)) + if request.LogLevel != "" { + if err := logger.SetLevel(request.LogLevel); err != nil { + return nil, err + } + } + + // The local maintained facade exposes the pinned upstream virtual environment + // and recursive stack generation without modifying upstream source. + environment := atmosbridge.Environment(request.Environment, io.Discard, io.Discard) + if filesystem != nil { + environment = environment.WithFS(filesystem) + } + if _, err := environment.FS.Stat(path); err != nil { + return nil, err + } + discover := request.Phase == "discover" || request.Command == "discover" + if discover || request.Phase == "backend" || request.Command == "generate" { + environment = atmosbridge.Discovery(environment, request.Command == "generate") + } + command := request.Command + if command == "" || command == "discover" || command == "generate" { + command = "plan" + } + pctx := config.NewParsingContext().WithFileReadTracking() + pctx.WorkingDir, pctx.RootWorkingDir = filepath.Dir(path), filepath.Dir(path) + pctx.TerragruntConfigPath, pctx.OriginalTerragruntConfigPath = path, path + pctx.TFPath, pctx.TerraformCommand = request.Tofu, command + pctx.OriginalTerraformCommand = command + pctx.TerraformCliArgs.SetCommand(command).AppendArgument(request.Arguments...) + pctx.DownloadDir = filepath.Join(filepath.Dir(path), ".terragrunt-cache") + pctx.AutoInit = true + pctx.MaxFoldersToCheck = options.DefaultMaxFoldersToCheck + if filepath.Base(path) == "terragrunt.stack.hcl" { + if request.Command == "generate" { + if err := atmosbridge.Generate(ctx, logger, environment, path, request.Tofu); err != nil { + return nil, err + } + } + values, err := config.ReadValues(ctx, logger, environment, pctx, filepath.Dir(path)) + if err != nil { + return nil, err + } + stack, err := config.ReadStackConfigFile(ctx, logger, environment, pctx, path, values) + if err != nil { + return nil, err + } + units := map[string]string{} + unitSources := map[string]string{} + unitConfigs := map[string]string{} + for _, unit := range stack.Units { + if !unit.IsEnabled() { + continue + } + units[unit.Name] = unit.Path + unitSources[unit.Name] = localPath(filepath.Dir(path), unit.Source) + unitConfigs[unit.Name] = filepath.Join(unit.GeneratedPath(filepath.Dir(path)), "terragrunt.hcl") + } + stacks := map[string]string{} + stackSources := map[string]string{} + stackConfigs := map[string]string{} + for _, child := range stack.Stacks { + if !child.IsEnabled() { + continue + } + stacks[child.Name] = child.Path + stackSources[child.Name] = localPath(filepath.Dir(path), child.Source) + stackConfigs[child.Name] = filepath.Join(child.GeneratedPath(filepath.Dir(path)), "terragrunt.stack.hcl") + } + return &model.Resolution{Path: path, Files: append(pctx.FilesRead.Paths(), path), Units: units, Stacks: stacks, UnitConfigs: unitConfigs, StackConfigs: stackConfigs, UnitSources: unitSources, StackSources: stackSources}, nil + } + if discover { + cfg, err := config.PartialParseConfigFile(ctx, logger, environment, + pctx.WithDecodeList(config.DependenciesBlock, config.DependencyBlock, config.TerraformSource), path, nil) + if err != nil { + return nil, err + } + result := &model.Resolution{Path: path, Files: append(pctx.FilesRead.Paths(), path)} + if workspace := request.Environment["TF_WORKSPACE"]; workspace != "" && workspace != "default" && len(cfg.TerragruntDependencies) > 0 && cfg.Dependencies != nil && len(cfg.Dependencies.Paths) > 0 { + return nil, fmt.Errorf("native output dependencies with non-default workspaces require a dependency backend adapter: %s", path) + } + if cfg.Terraform != nil && cfg.Terraform.Source != nil { + result.Folders = []string{localPath(filepath.Dir(path), *cfg.Terraform.Source)} + } + for _, dep := range cfg.TerragruntDependencies { + if dep.Enabled != nil && !*dep.Enabled { + continue + } + if dep.SkipOutputs != nil && *dep.SkipOutputs { + continue + } + if dep.ConfigPath.IsKnown() && !dep.ConfigPath.IsNull() { + dependency := localPath(filepath.Dir(path), dep.ConfigPath.AsString()) + if filepath.Ext(dependency) != ".hcl" { + dependency = filepath.Join(dependency, "terragrunt.hcl") + } + physical, err := canonicalPath(dependency) + if err != nil { + return nil, err + } + result.OutputDependencies = append(result.OutputDependencies, physical) + } + } + if cfg.Dependencies != nil { + for _, dependency := range cfg.Dependencies.Paths { + if !filepath.IsAbs(dependency) { + dependency = filepath.Join(filepath.Dir(path), dependency) + } + info, err := environment.FS.Stat(dependency) + if err != nil { + return nil, err + } + if info.IsDir() { + dependency = filepath.Join(dependency, "terragrunt.hcl") + } + physical, err := canonicalPath(dependency) + if err != nil { + return nil, fmt.Errorf("native adapter dependency must target a unit: %w", err) + } + result.Dependencies = append(result.Dependencies, physical) + } + } + return result, nil + } + var cfg *config.TerragruntConfig + if request.Phase == "backend" { + cfg, err = config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) + } else { + cfg, err = config.ParseConfigFile(ctx, logger, environment, pctx, path, nil) + } + if err != nil { + return nil, err + } + if cfg.Terraform == nil || cfg.Terraform.Source == nil { + return nil, fmt.Errorf("native adapter requires terraform.source") + } + if request.Phase != "backend" { + if err := checkVersions(ctx, request, cfg.TerraformVersionConstraint, cfg.TerragruntVersionConstraint); err != nil { + return nil, err + } + } + if cfg.TerraformBinary != "" { + return nil, fmt.Errorf("native adaptation of terraform_binary is not implemented") + } + if len(cfg.Terraform.BeforeHooks)+len(cfg.Terraform.AfterHooks)+len(cfg.Terraform.ErrorHooks)+len(cfg.Terraform.ExtraArgs) > 0 { + return nil, fmt.Errorf("native adaptation of hooks/extra_arguments is not implemented") + } + if cfg.PreventDestroy != nil && *cfg.PreventDestroy { + return nil, fmt.Errorf("native adaptation of prevent_destroy is not implemented") + } + if cfg.Errors != nil || cfg.Exclude != nil || len(cfg.FeatureFlags) > 0 || cfg.IamRole != "" || cfg.IamWebIdentityToken != "" { + return nil, fmt.Errorf("native adaptation of errors, exclude, feature flags, or IAM settings is not implemented") + } + result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)} + if !plainLocalSource(result.Source) { + return nil, fmt.Errorf("native adapter only adapts plain local directory sources") + } + if !filepath.IsAbs(result.Source) { + result.Source = filepath.Join(filepath.Dir(path), result.Source) + } + if info, err := os.Stat(result.Source); err != nil || !info.IsDir() { + return nil, fmt.Errorf("native adapter source must be an existing local directory: %s", result.Source) + } + download := pctx.DownloadDir + if cfg.DownloadDir != "" { + download = localPath(filepath.Dir(path), cfg.DownloadDir) + } + if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { + download = localPath(filepath.Dir(path), configured) + } + result.WorkingDir, err = atmosbridge.WorkingDir(logger, environment, result.Source, download, filepath.Dir(path)) + if err != nil { + return nil, err + } + result.Folders = []string{result.Source} + result.Files = append(result.Files, request.OriginFiles...) + result.Folders = append(result.Folders, request.OriginFolders...) + if cfg.RemoteState != nil { + result.BackendType = cfg.RemoteState.BackendName + result.Backend = cfg.RemoteState.BackendConfig + if result.BackendType != "local" { + return nil, fmt.Errorf("native adapter only adapts the local backend") + } + // Local backend paths are relative to Terragrunt's working directory, + // including the separate non-default-workspace state directory. + for key, fallback := range map[string]string{"path": "terraform.tfstate", "workspace_dir": "terraform.tfstate.d"} { + value, _ := result.Backend[key].(string) + if value == "" { + value = fallback + } + result.Backend[key] = localPath(result.WorkingDir, value) + } + } + for _, generated := range cfg.GenerateConfigs { + if generated.Disable { + continue + } + if filepath.Base(generated.Path) != generated.Path || !strings.HasSuffix(generated.Path, ".tf") { + return nil, fmt.Errorf("unsupported generated path: %s", generated.Path) + } + if generated.IfExistsStr != "overwrite" || !generated.DisableSignature { + return nil, fmt.Errorf("native adapter generation requires overwrite and disable_signature") + } + result.Generated[generated.Path] = generated.Contents + } + return result, nil +} diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go new file mode 100644 index 00000000000..48af1d022cc --- /dev/null +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -0,0 +1,161 @@ +package engine + +import ( + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" +) + +func nativeUnit(t *testing.T, extra string) model.Request { + t.Helper() + root := t.TempDir() + module := filepath.Join(root, "module") + require.NoError(t, os.MkdirAll(module, 0o755)) + source, err := json.Marshal(filepath.ToSlash(module)) + require.NoError(t, err) + path := filepath.Join(root, "terragrunt.hcl") + require.NoError(t, os.WriteFile(path, []byte("terraform { source = "+string(source)+" }\n"+extra), 0o644)) + return model.Request{Path: path, BasePath: root, Command: "plan", Tofu: "must-not-execute", Environment: map[string]string{}} +} + +func TestNativeLocalBackendAndLiteralGeneration(t *testing.T) { + request := nativeUnit(t, `remote_state { + backend = "local" + config = { path = "relative/state.tfstate" } +} +generate "literal" { + path = "literal.tf" + if_exists = "overwrite" + disable_signature = true + contents = "# {{ keep }} $${literal}\n" +} +inputs = { large = 9007199254740993, nested = { nullable = null, enabled = false } } +`) + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, filepath.Join(result.WorkingDir, "relative/state.tfstate"), result.Backend["path"]) + require.Equal(t, "# {{ keep }} ${literal}\n", result.Generated["literal.tf"]) + require.Equal(t, json.Number("9007199254740993"), result.Inputs["large"]) + require.NoFileExists(t, filepath.Join(filepath.Dir(request.Path), "literal.tf")) +} + +func TestNativeRejectsUnsupportedSemantics(t *testing.T) { + for _, test := range []struct{ name, extra, message string }{ + {"remote backend", `remote_state { + backend = "s3" + config = { bucket = "unsupported" } +}`, "only adapts the local backend"}, + {"prevent destroy", `prevent_destroy = true`, "prevent_destroy"}, + {"binary override", `terraform_binary = "another-tool"`, "terraform_binary"}, + {"IAM role", `iam_role = "unsupported"`, "IAM settings"}, + {"generation policy", `generate "x" { + path = "x.tf" + if_exists = "overwrite_terragrunt" + contents = "" +}`, "generation requires"}, + {"generation escape", `generate "x" { + path = "../x.tf" + if_exists = "overwrite" + disable_signature = true + contents = "" +}`, "unsupported generated path"}, + {"version constraint", `terragrunt_version_constraint = "> 99.0.0"`, "rejects version"}, + } { + t.Run(test.name, func(t *testing.T) { + _, err := Resolve(t.Context(), nativeUnit(t, test.extra)) + require.ErrorContains(t, err, test.message) + }) + } +} + +func TestBackendIdentityDoesNotExecuteVersionProbe(t *testing.T) { + request := nativeUnit(t, `terraform_version_constraint = "> 99.0.0" +remote_state { + backend = "local" + config = { path = "state.tfstate" } +} +`) + request.Phase = "backend" + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, "local", result.BackendType) + request.Phase = "" + _, err = Resolve(t.Context(), request) + require.ErrorContains(t, err, "cannot inspect selected executable") +} + +func TestDiscoveryDeniesCommands(t *testing.T) { + request := nativeUnit(t, `locals { value = run_cmd("must-not-execute") } +inputs = { value = local.value } +`) + request.Phase = "discover" + _, err := Resolve(t.Context(), request) + require.ErrorContains(t, err, "read-only discovery cannot execute") +} + +func TestVersionConstraintsUseSelectedExecutable(t *testing.T) { + executable, err := os.Executable() + require.NoError(t, err) + for _, test := range []struct { + name, actual, constraint string + want string + }{ + {"accepted", `{"terraform_version":"1.9.0"}`, ">= 1.8.0", ""}, + {"rejected", `{"terraform_version":"1.7.0"}`, ">= 1.8.0", "rejects version"}, + {"invalid version", `{"terraform_version":"invalid"}`, ">= 1.8.0", "malformed version"}, + {"invalid output", `not-json`, ">= 1.8.0", "invalid character"}, + {"invalid constraint", `{"terraform_version":"1.9.0"}`, "this is not a constraint", "malformed constraint"}, + } { + t.Run(test.name, func(t *testing.T) { + request := model.Request{Tofu: executable, Environment: map[string]string{"ATMOS_TERRAGRUNT_VERSION_CHILD": test.actual}} + err := checkVersions(t.Context(), request, test.constraint, "") + if test.want == "" { + require.NoError(t, err) + } else { + require.ErrorContains(t, err, test.want) + } + }) + } +} + +func TestResolveGuardsAndDownloadDirectory(t *testing.T) { + request := nativeUnit(t, `download_dir = "custom-cache" +inputs = { value = "constant" } +generate "disabled" { + path = "not-valid" + disable = true + if_exists = "overwrite" + contents = "ignored" +} +`) + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, result.WorkingDir, "custom-cache") + require.Empty(t, result.Generated) + request.Environment["TG_DOWNLOAD_DIR"] = "environment-cache" + result, err = Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, result.WorkingDir, "environment-cache") + request.LogLevel = "not-a-level" + _, err = Resolve(t.Context(), request) + require.Error(t, err) + request.LogLevel = "" + request.Path = filepath.Join(request.BasePath, "missing.hcl") + _, err = Resolve(t.Context(), request) + require.Error(t, err) + require.NoError(t, os.WriteFile(request.Path, []byte("inputs = {}"), 0o644)) + _, err = Resolve(t.Context(), request) + require.ErrorContains(t, err, "requires terraform.source") + for _, source := range []string{"git::https://example.invalid/repo", "./absent"} { + encoded, err := json.Marshal(source) + require.NoError(t, err) + require.NoError(t, os.WriteFile(request.Path, []byte("terraform { source = "+string(encoded)+" }"), 0o644)) + _, err = Resolve(t.Context(), request) + require.Error(t, err) + } +} diff --git a/plugins/terragrunt/internal/model/model.go b/plugins/terragrunt/internal/model/model.go new file mode 100644 index 00000000000..adae75d9a9d --- /dev/null +++ b/plugins/terragrunt/internal/model/model.go @@ -0,0 +1,48 @@ +// Package model contains evaluator data, independent of the plugin transport. +package model + +type Request struct { + IncludedPaths []string `json:"included_paths,omitempty"` + ExcludedPaths []string `json:"excluded_paths,omitempty"` + Phase string `json:"phase,omitempty"` + GenerationRoot string `json:"generation_root,omitempty"` + BasePath string `json:"base_path,omitempty"` + OriginFiles []string `json:"origin_files,omitempty"` + OriginFolders []string `json:"origin_folders,omitempty"` + LogLevel string `json:"log_level,omitempty"` + Path string `json:"path"` + Mode string `json:"mode"` + Command string `json:"command"` + Arguments []string `json:"arguments"` + Tofu string `json:"tofu"` + Environment map[string]string `json:"environment"` +} + +type Resolution struct { + Inventory []DiscoveredUnit `json:"inventory,omitempty"` + Path string `json:"path,omitempty"` + OutputDependencies []string `json:"output_dependencies,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` + Files []string `json:"files,omitempty"` + Folders []string `json:"folders,omitempty"` + WorkingDir string `json:"working_dir,omitempty"` + UnitSources map[string]string `json:"unit_sources,omitempty"` + StackSources map[string]string `json:"stack_sources,omitempty"` + UnitConfigs map[string]string `json:"unit_configs,omitempty"` + StackConfigs map[string]string `json:"stack_configs,omitempty"` + Inputs map[string]any `json:"inputs"` + Source string `json:"source"` + BackendType string `json:"backend_type"` + Backend map[string]any `json:"backend"` + Generated map[string]string `json:"generated"` + Units map[string]string `json:"units,omitempty"` + Stacks map[string]string `json:"stacks,omitempty"` +} + +// DiscoveredUnit carries source identity independently from its Atmos name. +type DiscoveredUnit struct { + Stack string `json:"stack"` + Name string `json:"name"` + GenerationRoot string `json:"generation_root,omitempty"` + Config Resolution `json:"config"` +} diff --git a/plugins/terragrunt/internal/provider/boundaries_test.go b/plugins/terragrunt/internal/provider/boundaries_test.go new file mode 100644 index 00000000000..87f31b5cbfb --- /dev/null +++ b/plugins/terragrunt/internal/provider/boundaries_test.go @@ -0,0 +1,129 @@ +package provider + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + "github.com/cloudposse/atmos/sdk/component" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func TestDiscoveryRejectsScopeAndConfiguration(t *testing.T) { + for _, name := range []string{"provider", "settings", "empty scope", "imports", "unknown option", "non-native mode"} { + t.Run(name, func(t *testing.T) { + base := componentRequest(t) + req := &pluginv1.DiscoverComponentsRequest{RootDirectory: base.RootDirectory, Provider: base.Provider, ProviderConfiguration: base.ProviderConfiguration, Operation: base.Operation, IncludePaths: []string{"live/**"}} + switch name { + case "provider": + req.Provider = "other" + case "settings": + req.ProviderConfiguration = nil + case "empty scope": + req.IncludePaths = nil + case "imports": + req.Imports = []string{"terragrunt://live"} + case "unknown option": + req.ProviderConfiguration, _ = encode(map[string]any{"binary": "terragrunt"}) + case "non-native mode": + req.ProviderConfiguration, _ = encode(map[string]any{"mode": "cli"}) + } + p := New(func(context.Context, model.Request) (*model.Resolution, error) { + t.Fatal("invalid requests must not evaluate HCL") + return nil, nil + }) + _, err := p.Discover(t.Context(), req) + require.Error(t, err) + }) + } +} + +func TestDiscoveryRejectsUnrepresentableInventory(t *testing.T) { + for _, name := range []string{"unit outside root", "module outside root", "missing module", "generation outside root", "watch outside root", "dependency outside scope", "evaluator failure"} { + t.Run(name, func(t *testing.T) { + base := componentRequest(t) + outside := t.TempDir() + unit := model.DiscoveredUnit{Stack: "live", Name: "app", Config: model.Resolution{Path: filepath.Join(base.RootDirectory, "live", "app", "terragrunt.hcl"), Folders: []string{filepath.Join(base.RootDirectory, "module")}}} + switch name { + case "unit outside root": + unit.Config.Path = filepath.Join(outside, "terragrunt.hcl") + case "module outside root": + unit.Config.Folders = []string{outside} + case "missing module": + unit.Config.Folders = nil + case "generation outside root": + unit.GenerationRoot = filepath.Join(outside, "terragrunt.stack.hcl") + case "watch outside root": + unit.Config.Files = []string{filepath.Join(outside, "secret.hcl")} + case "dependency outside scope": + unit.Config.Dependencies = []string{filepath.Join(base.RootDirectory, "other", "terragrunt.hcl")} + } + p := New(func(context.Context, model.Request) (*model.Resolution, error) { + if name == "evaluator failure" { + return nil, context.Canceled + } + return &model.Resolution{Inventory: []model.DiscoveredUnit{unit}}, nil + }) + result, err := p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: base.RootDirectory, Provider: base.Provider, ProviderConfiguration: base.ProviderConfiguration, Operation: base.Operation, IncludePaths: []string{"live/**"}}) + require.Nil(t, result) + if name == "evaluator failure" { + require.Equal(t, codes.Canceled, status.Code(err)) + } else { + require.Equal(t, codes.Unimplemented, status.Code(err)) + } + }) + } +} + +func TestPreparationWithoutInputsAndDefaultState(t *testing.T) { + req := componentRequest(t) + req.Invocation = nil + var err error + req.Configuration, err = encode(map[string]any{}) + require.NoError(t, err) + p := New(func(_ context.Context, request model.Request) (*model.Resolution, error) { + require.Equal(t, "terraform", request.Tofu) + require.Empty(t, request.Environment) + return &model.Resolution{Source: filepath.Join(req.RootDirectory, "module"), WorkingDir: filepath.Join(req.RootDirectory, "cache")}, nil + }) + result, err := p.Prepare(t.Context(), req) + require.NoError(t, err) + inputs, err := component.Decode(result.Inputs) + require.NoError(t, err) + require.False(t, inputs.IsNull()) + require.True(t, inputs.Type().IsObjectType()) + require.Empty(t, inputs.AsValueMap()) + require.Equal(t, "terraform", result.Engine) + require.Equal(t, "default", result.State.Workspace) + require.Equal(t, "local", result.State.BackendType) +} + +func TestStateAndPreparationRejectEscapedProvenance(t *testing.T) { + req := componentRequest(t) + var err error + req.Configuration, err = encode(map[string]any{}) + require.NoError(t, err) + p := New(func(context.Context, model.Request) (*model.Resolution, error) { + return &model.Resolution{Inputs: map[string]any{}, Files: []string{filepath.Join(filepath.Dir(req.RootDirectory), "outside.hcl")}}, nil + }) + _, err = p.Prepare(t.Context(), req) + require.Equal(t, codes.Unimplemented, status.Code(err)) + _, err = p.Resolve(t.Context(), req) + require.Equal(t, codes.Unimplemented, status.Code(err)) + req.Source = "../outside" + _, err = p.Resolve(t.Context(), req) + require.Equal(t, codes.Unimplemented, status.Code(err)) + p = New(func(context.Context, model.Request) (*model.Resolution, error) { return nil, context.Canceled }) + req.Source = "live/unit/terragrunt.hcl" + _, err = p.Resolve(t.Context(), req) + require.Equal(t, codes.Canceled, status.Code(err)) + req.Configuration, err = encode(map[string]any{"settings": map[string]any{"terragrunt": map[string]any{"generation_root": "../escape"}}}) + require.NoError(t, err) + _, err = p.Prepare(t.Context(), req) + require.Equal(t, codes.Unimplemented, status.Code(err)) +} diff --git a/plugins/terragrunt/internal/provider/discovery.go b/plugins/terragrunt/internal/provider/discovery.go new file mode 100644 index 00000000000..676e087e344 --- /dev/null +++ b/plugins/terragrunt/internal/provider/discovery.go @@ -0,0 +1,93 @@ +package provider + +import ( + "context" + "slices" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +// Discover expands local stacks in an isolated overlay without preparing units. +func (p *Provider) Discover(ctx context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + req, err := operation(request.GetRootDirectory(), request.GetProvider(), request.GetOperation(), request.GetInvocation()) + if err != nil { + return nil, rpcError(err) + } + if err := settings(request.GetProviderConfiguration()); err != nil { + return nil, rpcError(err) + } + if len(request.IncludePaths) == 0 || len(request.Imports) != 0 { + return nil, rpcError(ErrUnsupported) + } + req.Phase, req.IncludedPaths, req.ExcludedPaths = "inventory", request.IncludePaths, request.ExcludePaths + result, err := p.evaluate(ctx, req) + if err != nil { + return nil, rpcError(err) + } + addresses := map[string]*pluginv1.ComponentAddress{} + for _, unit := range result.Inventory { + addresses[unit.Config.Path] = &pluginv1.ComponentAddress{Stack: unit.Stack, Component: unit.Name, ComponentType: "terraform"} + } + response := &pluginv1.DiscoverComponentsResponse{} + for _, unit := range result.Inventory { + discovered, err := discoveredUnit(req, unit, addresses) + if err != nil { + return nil, rpcError(err) + } + response.Components = append(response.Components, discovered) + } + return response, nil +} + +func discoveredUnit(req model.Request, unit model.DiscoveredUnit, addresses map[string]*pluginv1.ComponentAddress) (*pluginv1.DiscoveredComponent, error) { + source, err := relative(req.BasePath, unit.Config.Path) + if err != nil { + return nil, err + } + if len(unit.Config.Folders) == 0 { + return nil, ErrUnsupported + } + module, err := relative(req.BasePath, unit.Config.Folders[0]) + if err != nil { + return nil, err + } + generation := "" + if unit.GenerationRoot != "" { + generation, err = relative(req.BasePath, unit.GenerationRoot) + if err != nil { + return nil, err + } + } + workspace := req.Environment["TF_WORKSPACE"] + if workspace == "" { + workspace = "default" + } + config, err := encode(map[string]any{ + "source": "./" + module, "vars": map[string]any{}, + "provision": map[string]any{"workdir": map[string]any{"enabled": true}}, + "backend_type": "local", "backend": map[string]any{"local": map[string]any{}}, + "metadata": map[string]any{"terraform_workspace": workspace}, + "settings": map[string]any{"terragrunt": map[string]any{"generation_root": generation}}, + }) + if err != nil { + return nil, err + } + watched, err := sources(req.BasePath, &unit.Config) + if err != nil { + return nil, err + } + instance := &pluginv1.DiscoveredComponent{Address: addresses[unit.Config.Path], Provider: "terragrunt", Engine: engineName(req.Tofu), Source: source, Configuration: config, Sources: watched} + for _, path := range unit.Config.Dependencies { + target := addresses[path] + if target == nil { + return nil, ErrUnsupported + } + kind := pluginv1.ComponentDependency_ORDER + if slices.Contains(unit.Config.OutputDependencies, path) { + kind = pluginv1.ComponentDependency_OUTPUT + } + instance.Dependencies = append(instance.Dependencies, &pluginv1.ComponentDependency{Target: target, Kind: kind}) + } + return instance, nil +} diff --git a/plugins/terragrunt/internal/provider/fixtures_test.go b/plugins/terragrunt/internal/provider/fixtures_test.go new file mode 100644 index 00000000000..d13c5fa781c --- /dev/null +++ b/plugins/terragrunt/internal/provider/fixtures_test.go @@ -0,0 +1,88 @@ +package provider + +import ( + "context" + "io/fs" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/engine" + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func fixture(t *testing.T, name string) string { + t.Helper() + source, err := filepath.Abs(filepath.Join("../../fixtures", name)) + require.NoError(t, err) + root := t.TempDir() + require.NoError(t, os.CopyFS(root, os.DirFS(source))) + root, err = filepath.EvalSymlinks(root) + require.NoError(t, err) + return root +} + +func TestDiscoveryFixtures(t *testing.T) { + for _, test := range []struct { + name, scope string + names []string + }{{"advanced", "live/dev/**", []string{"app", "cache", "database", "network"}}, {"explicit-stack", "live/**", []string{"dev/app", "dev/network", "prod/app", "prod/network"}}, {"explicit-stack", "**", []string{"dev/app", "dev/network", "prod/app", "prod/network"}}} { + t.Run(test.name, func(t *testing.T) { + root := fixture(t, test.name) + opts, err := encode(map[string]any{"enabled": true, "mode": "native", "discovery": map[string]any{"enabled": true, "included_paths": []string{test.scope}}}) + require.NoError(t, err) + // Exercise the real evaluator; include its diagnostics only inside local tests. + p := New(func(ctx context.Context, req model.Request) (*model.Resolution, error) { + result, err := engine.Resolve(ctx, req) + require.NoError(t, err) + return result, err + }) + request := &pluginv1.DiscoverComponentsRequest{RootDirectory: root, Provider: "terragrunt", ProviderConfiguration: opts, IncludePaths: []string{test.scope}, Operation: &pluginv1.ComponentOperation{Mode: "native", Command: "list"}, Invocation: &pluginv1.Invocation{Environment: map[string]string{"ATMOS_TERRAFORM_BINARY": "must-not-execute"}}} + response, err := p.Discover(t.Context(), request) + require.NoError(t, err) + names := []string{} + for _, instance := range response.Components { + names = append(names, instance.Address.Component) + require.Equal(t, "terraform", instance.Address.ComponentType) + require.NotEmpty(t, instance.Sources) + } + require.Equal(t, test.names, names) + require.NoError(t, filepath.WalkDir(root, func(path string, entry fs.DirEntry, err error) error { + require.NoError(t, err) + require.NotEqual(t, ".terragrunt-stack", entry.Name()) + require.NotEqual(t, ".terragrunt-cache", entry.Name()) + return nil + })) + }) + } +} + +func TestExplicitStackStateAndPreparation(t *testing.T) { + root := fixture(t, "explicit-stack") + opts, err := encode(map[string]any{"enabled": true, "mode": "native", "discovery": map[string]any{"enabled": true, "included_paths": []string{"live/**"}}}) + require.NoError(t, err) + provider := New(nil) + inventory, err := provider.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: root, Provider: "terragrunt", ProviderConfiguration: opts, IncludePaths: []string{"live/**"}, Operation: &pluginv1.ComponentOperation{Mode: "native", Command: "plan"}, Invocation: &pluginv1.Invocation{Environment: map[string]string{"ATMOS_TERRAFORM_BINARY": "must-not-execute"}}}) + require.NoError(t, err) + network := inventory.Components[1] + require.Equal(t, "dev/network", network.Address.Component) + request := &pluginv1.ComponentRequest{RootDirectory: root, Provider: "terragrunt", ProviderConfiguration: opts, Address: network.Address, Source: network.Source, Configuration: network.Configuration, Operation: &pluginv1.ComponentOperation{Mode: "native", Command: "plan"}, Invocation: &pluginv1.Invocation{Environment: map[string]string{"ATMOS_TERRAFORM_BINARY": "must-not-execute"}}} + state, err := provider.Resolve(t.Context(), request) + require.NoError(t, err) + require.NoDirExists(t, filepath.Join(root, "live/.terragrunt-stack")) + request.Effects = &pluginv1.ComponentEffects{Commands: true, Network: true, Secrets: true, Writes: true, StateReads: true} + prepared, err := provider.Prepare(t.Context(), request) + require.NoError(t, err) + require.DirExists(t, filepath.Join(root, "live/.terragrunt-stack")) + require.Equal(t, state.State.WorkingDirectory, prepared.State.WorkingDirectory) + var before, after map[string]any + require.NoError(t, decode(state.State.Backend, &before)) + require.NoError(t, decode(prepared.State.Backend, &after)) + require.Equal(t, before, after) + require.Equal(t, filepath.Join(root, "state/dev/network.tfstate"), after["path"]) + require.Empty(t, prepared.Files) + require.NotNil(t, prepared.Inputs) +} diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go new file mode 100644 index 00000000000..5bdef4b4e92 --- /dev/null +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -0,0 +1,129 @@ +package provider + +import ( + "context" + "maps" + "path/filepath" + "slices" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func (p *Provider) componentRequest(ctx context.Context, request *pluginv1.ComponentRequest) (model.Request, error) { + if _, err := p.Validate(ctx, request); err != nil { + return model.Request{}, err + } + req, err := operation(request.RootDirectory, request.Provider, request.Operation, request.Invocation) + if err != nil { + return req, err + } + if !filepath.IsLocal(request.Source) { + return req, ErrUnsupported + } + req.Path = filepath.Join(request.RootDirectory, filepath.FromSlash(request.Source)) + var config struct { + Settings struct { + Terragrunt struct { + GenerationRoot string `json:"generation_root"` + } `json:"terragrunt"` + } `json:"settings"` + } + if err := decode(request.Configuration, &config); err != nil { + return req, err + } + if generation := config.Settings.Terragrunt.GenerationRoot; generation != "" { + if !filepath.IsLocal(generation) { + return req, ErrUnsupported + } + req.GenerationRoot = filepath.Join(req.BasePath, filepath.FromSlash(generation)) + } + return req, nil +} + +// Prepare resolves current inputs after dependencies and returns literal files. +// Terraform execution remains owned by Atmos. +func (p *Provider) Prepare(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { + req, err := p.componentRequest(ctx, request) + if err != nil { + return nil, rpcError(err) + } + effects := request.GetEffects() + if !effects.GetCommands() || !effects.GetWrites() || !effects.GetStateReads() || !effects.GetNetwork() || !effects.GetSecrets() { + return nil, rpcError(ErrUnsupported) + } + if req.GenerationRoot != "" { + generation := req + generation.Path, generation.Phase, generation.Command = req.GenerationRoot, "discover", "generate" + if _, err := p.evaluate(ctx, generation); err != nil { + return nil, rpcError(err) + } + } + result, err := p.evaluate(ctx, req) + if err != nil { + return nil, rpcError(err) + } + values := result.Inputs + if values == nil { + values = map[string]any{} + } + inputs, err := encode(values) + if err != nil { + return nil, rpcError(err) + } + state, err := stateIdentity(req, result) + if err != nil { + return nil, rpcError(err) + } + watched, err := sources(req.BasePath, result) + if err != nil { + return nil, rpcError(err) + } + response := &pluginv1.PrepareComponentResponse{Engine: engineName(req.Tofu), ModuleSource: result.Source, WorkingDirectory: result.WorkingDir, Inputs: inputs, State: state, Sources: watched} + for _, name := range slices.Sorted(maps.Keys(result.Generated)) { + response.Files = append(response.Files, &pluginv1.ComponentGeneratedFile{Path: name, Content: []byte(result.Generated[name]), IfExists: "overwrite"}) + } + return response, nil +} + +func stateIdentity(req model.Request, result *model.Resolution) (*pluginv1.ComponentStateIdentity, error) { + backend := result.Backend + if backend == nil { + backend = map[string]any{} + } + backendType := result.BackendType + if backendType == "" { + backendType = "local" + } + encoded, err := encode(backend) + if err != nil { + return nil, err + } + workspace := req.Environment["TF_WORKSPACE"] + if workspace == "" { + workspace = "default" + } + return &pluginv1.ComponentStateIdentity{BackendType: backendType, Backend: encoded, Workspace: workspace, WorkingDirectory: result.WorkingDir}, nil +} + +// Resolve reads backend identity in an overlay, independently of dependency outputs. +func (p *Provider) Resolve(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + req, err := p.componentRequest(ctx, request) + if err != nil { + return nil, rpcError(err) + } + req.Phase = "backend" + result, err := p.evaluate(ctx, req) + if err != nil { + return nil, rpcError(err) + } + state, err := stateIdentity(req, result) + if err != nil { + return nil, rpcError(err) + } + watched, err := sources(req.BasePath, result) + if err != nil { + return nil, rpcError(err) + } + return &pluginv1.ResolveComponentStateResponse{State: state, Sources: watched}, nil +} diff --git a/plugins/terragrunt/internal/provider/provider.go b/plugins/terragrunt/internal/provider/provider.go new file mode 100644 index 00000000000..4debfa3bbaf --- /dev/null +++ b/plugins/terragrunt/internal/provider/provider.go @@ -0,0 +1,179 @@ +// Package provider adapts Terragrunt evaluation to Atmos component services. +package provider + +import ( + "context" + "encoding/json" + "errors" + "maps" + "path/filepath" + "strings" + + ctyjson "github.com/zclconf/go-cty/cty/json" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/engine" + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + "github.com/cloudposse/atmos/sdk/component" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +var ErrUnsupported = errors.New("unsupported native Terragrunt configuration") + +// Evaluator is the only dependency that reads or evaluates HCL. +type Evaluator func(context.Context, model.Request) (*model.Resolution, error) + +// Provider implements the four independent configuration services. +type Provider struct { + pluginv1.UnimplementedComponentDiscoveryServer + pluginv1.UnimplementedComponentValidationServer + pluginv1.UnimplementedComponentPreparationServer + pluginv1.UnimplementedComponentStateServer + evaluate Evaluator +} + +// New constructs a provider with the pinned evaluator when none is supplied. +func New(evaluate Evaluator) *Provider { + if evaluate == nil { + evaluate = engine.Resolve + } + return &Provider{evaluate: evaluate} +} + +func encode(value any) (*pluginv1.ComponentValue, error) { + data, err := json.Marshal(value) + if err != nil { + return nil, component.ErrInvalidValue + } + typ, err := ctyjson.ImpliedType(data) + if err != nil { + return nil, component.ErrInvalidValue + } + v, err := ctyjson.Unmarshal(data, typ) + if err != nil { + return nil, component.ErrInvalidValue + } + return component.Encode(v) +} + +func decode(encoded *pluginv1.ComponentValue, target any) error { + value, err := component.Decode(encoded) + if err != nil || !value.IsWhollyKnown() || value.IsNull() { + return component.ErrInvalidValue + } + plain, _ := value.UnmarkDeep() + data, err := ctyjson.Marshal(plain, plain.Type()) + if err != nil { + return component.ErrInvalidValue + } + decoder := json.NewDecoder(strings.NewReader(string(data))) + decoder.UseNumber() + if err := decoder.Decode(target); err != nil { + return component.ErrInvalidValue + } + return nil +} + +func settings(value *pluginv1.ComponentValue) error { + var config map[string]any + if err := decode(value, &config); err != nil { + return err + } + for key := range config { + switch key { + case "enabled", "provider", "mode", "discovery": + default: + return ErrUnsupported + } + } + if mode, _ := config["mode"].(string); mode != "" && mode != "native" { + return ErrUnsupported + } + return nil +} + +func operation(root, name string, op *pluginv1.ComponentOperation, invocation *pluginv1.Invocation) (model.Request, error) { + if name != "terragrunt" || !filepath.IsAbs(root) || op == nil || op.Mode != "native" || len(op.Options) != 0 { + return model.Request{}, ErrUnsupported + } + env := maps.Clone(invocation.GetEnvironment()) + if env == nil { + env = map[string]string{} + } + binary := env["ATMOS_TERRAFORM_BINARY"] + if binary == "" { + binary = "terraform" + } + return model.Request{BasePath: root, Mode: "native", Command: op.Command, Tofu: binary, Environment: env}, nil +} + +func engineName(binary string) string { + if strings.TrimSuffix(filepath.Base(binary), ".exe") == "tofu" { + return "opentofu" + } + return "terraform" +} + +func relative(root, path string) (string, error) { + // Preserve one identity on platforms where temporary directories use symlinks. + if resolved, err := filepath.EvalSymlinks(root); err == nil { + root = resolved + } + rel, err := filepath.Rel(root, path) + if err != nil || !filepath.IsLocal(rel) { + return "", ErrUnsupported + } + return filepath.ToSlash(rel), nil +} + +func sources(root string, resolved *model.Resolution) ([]*pluginv1.ComponentSource, error) { + result := []*pluginv1.ComponentSource{} + seen := map[string]bool{} + for _, group := range []struct { + paths []string + kind pluginv1.ComponentSource_Kind + }{{resolved.Files, pluginv1.ComponentSource_FILE}, {resolved.Folders, pluginv1.ComponentSource_DIRECTORY}} { + for _, path := range group.paths { + rel, err := relative(root, path) + if err != nil { + return nil, err + } + key := group.kind.String() + ":" + rel + if seen[key] { + continue + } + seen[key] = true + result = append(result, &pluginv1.ComponentSource{Path: rel, Kind: group.kind, Reason: "Terragrunt configuration"}) + } + } + return result, nil +} + +func rpcError(err error) error { + if errors.Is(err, context.Canceled) { + return status.Error(codes.Canceled, "Terragrunt evaluation canceled") + } + if errors.Is(err, context.DeadlineExceeded) { + return status.Error(codes.DeadlineExceeded, "Terragrunt evaluation timed out") + } + // HCL diagnostics can contain secrets. Do not copy evaluator payloads into RPC errors. + if errors.Is(err, ErrUnsupported) { + return status.Error(codes.Unimplemented, ErrUnsupported.Error()) + } + return status.Error(codes.InvalidArgument, "Terragrunt evaluation failed") +} + +// Validate rejects unsupported operation and provider settings without evaluating HCL. +func (p *Provider) Validate(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ValidateResponse, error) { + if err := ctx.Err(); err != nil { + return nil, rpcError(err) + } + if _, err := operation(request.GetRootDirectory(), request.GetProvider(), request.GetOperation(), request.GetInvocation()); err != nil { + return nil, rpcError(err) + } + if err := settings(request.GetProviderConfiguration()); err != nil { + return nil, rpcError(err) + } + return &pluginv1.ValidateResponse{}, nil +} diff --git a/plugins/terragrunt/internal/provider/provider_test.go b/plugins/terragrunt/internal/provider/provider_test.go new file mode 100644 index 00000000000..a2d8f16f7f1 --- /dev/null +++ b/plugins/terragrunt/internal/provider/provider_test.go @@ -0,0 +1,105 @@ +package provider + +import ( + "context" + "errors" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +func componentRequest(t *testing.T) *pluginv1.ComponentRequest { + t.Helper() + config, err := encode(map[string]any{"settings": map[string]any{"terragrunt": map[string]any{"generation_root": "live/terragrunt.stack.hcl"}}}) + require.NoError(t, err) + options, err := encode(map[string]any{"enabled": true, "discovery": map[string]any{"enabled": true}}) + require.NoError(t, err) + root, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + return &pluginv1.ComponentRequest{Provider: "terragrunt", RootDirectory: root, Source: "live/.terragrunt-stack/app/terragrunt.hcl", Configuration: config, ProviderConfiguration: options, Operation: &pluginv1.ComponentOperation{Mode: "native", Command: "apply"}, Effects: &pluginv1.ComponentEffects{Commands: true, Network: true, Secrets: true, Writes: true, StateReads: true}, Invocation: &pluginv1.Invocation{Environment: map[string]string{"ATMOS_TERRAFORM_BINARY": "tofu", "TF_WORKSPACE": "stage"}}} +} + +func TestPreparationAndStateUseSeparatePhases(t *testing.T) { + request := componentRequest(t) + phases := []string{} + p := New(func(_ context.Context, req model.Request) (*model.Resolution, error) { + require.Equal(t, "stage", req.Environment["TF_WORKSPACE"]) + require.Equal(t, "tofu", req.Tofu) + phases = append(phases, req.Phase) + if req.Phase == "discover" { + require.Equal(t, "generate", req.Command) + require.Equal(t, filepath.Join(request.RootDirectory, "live/terragrunt.stack.hcl"), req.Path) + } + return &model.Resolution{Source: filepath.Join(request.RootDirectory, "module"), WorkingDir: filepath.Join(request.RootDirectory, "cache"), Inputs: map[string]any{"payload": "fresh"}, BackendType: "local", Backend: map[string]any{"path": "relative.tfstate"}, Generated: map[string]string{"z.tf": "{{ literal }}", "a.tf": "${expression}"}, Files: []string{filepath.Join(request.RootDirectory, "root.hcl")}}, nil + }) + result, err := p.Prepare(t.Context(), request) + require.NoError(t, err) + require.Equal(t, []string{"discover", ""}, phases) + require.Equal(t, "opentofu", result.Engine) + require.Equal(t, "stage", result.State.Workspace) + require.Equal(t, "a.tf", result.Files[0].Path) + require.Equal(t, "z.tf", result.Files[1].Path) + require.Equal(t, "{{ literal }}", string(result.Files[1].Content)) + phases = nil + state, err := p.Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, []string{"backend"}, phases) + require.Equal(t, result.State.WorkingDirectory, state.State.WorkingDirectory) +} + +func TestRequestsRejectUnsupportedBeforeEvaluation(t *testing.T) { + for _, test := range []struct { + name string + change func(*pluginv1.ComponentRequest) + }{ + {"provider", func(r *pluginv1.ComponentRequest) { r.Provider = "other" }}, + {"relative root", func(r *pluginv1.ComponentRequest) { r.RootDirectory = "relative" }}, + {"missing operation", func(r *pluginv1.ComponentRequest) { r.Operation = nil }}, + {"cli fallback", func(r *pluginv1.ComponentRequest) { r.Operation.Mode = "cli" }}, + {"options", func(r *pluginv1.ComponentRequest) { + r.Operation.Options = map[string]*pluginv1.ComponentValue{"unsupported": {}} + }}, + {"source traversal", func(r *pluginv1.ComponentRequest) { r.Source = "../escape" }}, + {"missing effects", func(r *pluginv1.ComponentRequest) { r.Effects = nil }}, + {"partial effects", func(r *pluginv1.ComponentRequest) { r.Effects.StateReads = false }}, + {"bad settings", func(r *pluginv1.ComponentRequest) { r.ProviderConfiguration = &pluginv1.ComponentValue{} }}, + {"bad configuration", func(r *pluginv1.ComponentRequest) { r.Configuration = &pluginv1.ComponentValue{} }}, + } { + t.Run(test.name, func(t *testing.T) { + r := componentRequest(t) + test.change(r) + p := New(func(context.Context, model.Request) (*model.Resolution, error) { + t.Fatal("evaluation must not start") + return nil, nil + }) + _, err := p.Prepare(t.Context(), r) + require.Error(t, err) + }) + } + p := New(func(context.Context, model.Request) (*model.Resolution, error) { + t.Fatal("evaluation must not start") + return nil, nil + }) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + _, err := p.Validate(ctx, componentRequest(t)) + require.Equal(t, codes.Canceled, status.Code(err)) +} + +func TestEvaluatorErrorsDoNotExposePayloads(t *testing.T) { + for _, test := range []struct { + err error + code codes.Code + }{{errors.New("secret-evaluated-value"), codes.InvalidArgument}, {context.Canceled, codes.Canceled}, {context.DeadlineExceeded, codes.DeadlineExceeded}, {ErrUnsupported, codes.Unimplemented}} { + p := New(func(context.Context, model.Request) (*model.Resolution, error) { return nil, test.err }) + _, err := p.Prepare(t.Context(), componentRequest(t)) + require.Equal(t, test.code, status.Code(err)) + require.NotContains(t, err.Error(), "secret-evaluated-value") + } +} diff --git a/plugins/terragrunt/main.go b/plugins/terragrunt/main.go new file mode 100644 index 00000000000..e5e4356992d --- /dev/null +++ b/plugins/terragrunt/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "crypto/sha256" + _ "embed" + "encoding/hex" + + "gopkg.in/yaml.v3" + + "github.com/cloudposse/atmos/plugins/terragrunt/internal/provider" + "github.com/cloudposse/atmos/sdk/api" + "github.com/cloudposse/atmos/sdk/plugin" + pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" +) + +//go:embed plugin.yaml +var manifestData []byte + +func description() *pluginv1.DescribeResponse { + var manifest struct { + Metadata struct { + Name string `yaml:"name"` + Version string `yaml:"version"` + } `yaml:"metadata"` + } + if err := yaml.Unmarshal(manifestData, &manifest); err != nil { + panic("invalid embedded manifest") + } + digest := sha256.Sum256(manifestData) + return &pluginv1.DescribeResponse{ + PluginName: manifest.Metadata.Name, PluginVersion: manifest.Metadata.Version, + ManifestDigest: "sha256:" + hex.EncodeToString(digest[:]), + Services: []*pluginv1.ServiceVersionRange{{Service: "component.discovery", Min: 1, Max: 1}, {Service: "component.validation", Min: 1, Max: 1}, {Service: "component.preparation", Min: 1, Max: 1}, {Service: "component.state", Min: 1, Max: 1}}, + Exports: []*pluginv1.Export{{Service: "component.discovery", Kind: "terragrunt"}, {Service: "component.validation", Kind: "terragrunt"}, {Service: "component.preparation", Kind: "terragrunt"}, {Service: "component.state", Kind: "terragrunt"}}, + } +} + +func main() { + plugin.Main(plugin.Config{Description: description(), Build: func(_ *api.Client) plugin.Services { + service := provider.New(nil) + return plugin.Services{Discovery: service, Validation: service, Preparation: service, State: service} + }}) +} diff --git a/plugins/terragrunt/main_test.go b/plugins/terragrunt/main_test.go new file mode 100644 index 00000000000..8288113afc1 --- /dev/null +++ b/plugins/terragrunt/main_test.go @@ -0,0 +1,27 @@ +package main + +import ( + "crypto/sha256" + "encoding/hex" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestDescriptionMatchesManifestAndIndependentServices(t *testing.T) { + got := description() + digest := sha256.Sum256(manifestData) + require.Equal(t, "sha256:"+hex.EncodeToString(digest[:]), got.ManifestDigest) + require.Equal(t, "cloudposse/terragrunt", got.PluginName) + services := []string{} + for _, service := range got.Services { + require.EqualValues(t, 1, service.Min) + require.EqualValues(t, 1, service.Max) + services = append(services, service.Service) + } + require.Equal(t, []string{"component.discovery", "component.validation", "component.preparation", "component.state"}, services) + for _, export := range got.Exports { + require.Equal(t, "terragrunt", export.Kind) + require.Contains(t, services, export.Service) + } +} diff --git a/plugins/terragrunt/plugin.yaml b/plugins/terragrunt/plugin.yaml new file mode 100644 index 00000000000..4cb32a20527 --- /dev/null +++ b/plugins/terragrunt/plugin.yaml @@ -0,0 +1,52 @@ +apiVersion: atmos/v1 +kind: AtmosPluginConfig +metadata: + name: cloudposse/terragrunt + version: 0.1.0 + display_name: Terragrunt configuration + description: Evaluate local Terragrunt stacks and units for native Atmos execution + author: Cloud Posse + repository: https://github.com/cloudposse/atmos +spec: + runtime: + type: native + protocol: 1 + executable: bin/plugin.exe + platforms: + linux/amd64: + executable: bin/linux-amd64/plugin + linux/arm64: + executable: bin/linux-arm64/plugin + darwin/amd64: + executable: bin/darwin-amd64/plugin + darwin/arm64: + executable: bin/darwin-arm64/plugin + windows/amd64: + executable: bin/windows-amd64/plugin.exe + windows/arm64: + executable: bin/windows-arm64/plugin.exe + compatibility: + protocol: '>=1 <2' + contracts: + component.discovery: '>=1' + component.validation: '>=1' + component.preparation: '>=1' + component.state: '>=1' + capabilities: + components: + discovery: + terragrunt: + component_type: terraform + schema: schemas/config.json + validation: + terragrunt: + component_type: terraform + schema: schemas/config.json + preparation: + terragrunt: + component_type: terraform + schema: schemas/config.json + state: + terragrunt: + component_type: terraform + schema: schemas/config.json diff --git a/plugins/terragrunt/schemas/config.json b/plugins/terragrunt/schemas/config.json new file mode 100644 index 00000000000..c8ba9b95ae0 --- /dev/null +++ b/plugins/terragrunt/schemas/config.json @@ -0,0 +1 @@ +{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"enabled":{"type":"boolean"},"provider":{"const":"terragrunt"},"mode":{"const":"native"},"discovery":{"type":"object","properties":{"enabled":{"type":"boolean"},"included_paths":{"type":"array","items":{"type":"string"},"minItems":1},"excluded_paths":{"type":"array","items":{"type":"string"}}},"required":["enabled","included_paths"],"additionalProperties":false}},"required":["enabled","discovery"],"additionalProperties":false} diff --git a/plugins/terragrunt/scripts/acceptance.py b/plugins/terragrunt/scripts/acceptance.py new file mode 100644 index 00000000000..e6377d462af --- /dev/null +++ b/plugins/terragrunt/scripts/acceptance.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Exercise the installed native plugin through the real Atmos CLI (local state only).""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import shutil +import subprocess +import tempfile + +parser = argparse.ArgumentParser() +parser.add_argument("--atmos", required=True, type=Path) +parser.add_argument("--terraform", default="tofu") +args = parser.parse_args() +atmos = args.atmos.resolve() +package = Path(__file__).resolve().parents[1] +repository = package.parents[1] +work = Path(tempfile.mkdtemp(prefix="terragrunt-native-", dir=repository / ".context")) +print(f"Evidence and local state: {work}", flush=True) + +def snapshot(root): + return {str(p.relative_to(root)): hashlib.sha256(p.read_bytes()).hexdigest() + for p in root.rglob("*") if p.is_file()} + +def run(root, label, *command, revision="r1", success=True): + environment = dict(os.environ, POC_REVISION=revision, TF_IN_AUTOMATION="true", NO_COLOR="1") + result = subprocess.run([str(atmos), f"--chdir={root}", *command], env=environment, + text=True, capture_output=True, timeout=180) + (work / f"{root.name}-{label}.log").write_text(result.stdout + result.stderr) + if (result.returncode == 0) != success: + raise RuntimeError(f"{label}: exit {result.returncode}\n{result.stdout}\n{result.stderr}") + return result.stdout + +for name, scope, stack, expected in [ + ("advanced", "live/dev/**", "live/dev", ["app", "cache", "database", "network"]), + ("explicit-stack", "live/**", "live", ["dev/app", "dev/network", "prod/app", "prod/network"]), +]: + root = work / name + shutil.copytree(package / "fixtures" / name, root) + config = {"base_path": str(root), "components": {"terraform": { + "base_path": "components/terraform", "command": args.terraform, + "terragrunt": {"enabled": True, "mode": "native", "discovery": { + "enabled": True, "included_paths": [scope]}}}}, + "plugins": {"packages": {"terragrunt": {"path": str(package)}}}} + (root / "atmos.yaml").write_text(json.dumps(config, indent=2)) + before = snapshot(root) + instances = json.loads(run(root, "instances", "list", "instances", "--format=json")) + assert [row["Component"] for row in instances] == expected, instances + assert {row["Stack"] for row in instances} == {stack}, instances + run(root, "stacks", "list", "stacks", "--format=json") + described = json.loads(run(root, "describe", "describe", "stacks", "--format=json")) + assert stack in described, described.keys() + assert before == snapshot(root), "Discovery changed project files" + if name == "advanced": + run(root, "mock-plan", "terraform", "plan", "--all", "-s", stack, "--", "-no-color") + run(root, "apply", "terraform", "apply", "--all", "-s", stack, "--", "-auto-approve", "-no-color") + plan = run(root, "unchanged", "terraform", "plan", "--all", "-s", stack, "--", "-detailed-exitcode", "-no-color") + assert plan.count("No changes.") == 4, plan + state_files = list(root.glob("live/dev/*/state/terraform.tfstate")) if name == "advanced" else list(root.glob("state/*/*.tfstate")) + assert len(state_files) == 4, state_files + if name == "advanced": + run(root, "refresh", "terraform", "apply", "--all", "-s", stack, "--", "-auto-approve", "-no-color", revision="r2") + states = [json.loads(path.read_text()) for path in state_files] + app = next(state["outputs"]["value"]["value"] for state in states if state["outputs"]["value"]["value"]["unit"] == "app") + assert app["upstream"]["database"]["upstream"]["network"]["revision"] == "r2", app + run(root, "destroy", "terraform", "destroy", "--all", "-s", stack, "--", "-auto-approve", "-no-color") + for path in state_files: + assert not json.loads(path.read_text())["resources"], path + print(f"PASS {name}: inventory, read-only discovery, native apply, unchanged plans, dependency state, reverse destroy", flush=True) diff --git a/plugins/terragrunt/scripts/build.py b/plugins/terragrunt/scripts/build.py new file mode 100644 index 00000000000..df2cf979785 --- /dev/null +++ b/plugins/terragrunt/scripts/build.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +"""Build and test the native plugin with its pinned, locally maintained facade.""" +import argparse +import json +from pathlib import Path +import subprocess + +parser = argparse.ArgumentParser() +parser.add_argument("--test", action="store_true", help="Run the plugin and facade tests after building") +args = parser.parse_args() +package = Path(__file__).resolve().parents[1] +repository = package.parents[1] +work = repository / ".context" / "terragrunt-plugin-build" +work.mkdir(parents=True, exist_ok=True) + + +def go(*arguments, cwd=package, capture=False): + return subprocess.run(["go", *arguments], cwd=cwd, check=True, + text=True, capture_output=capture).stdout + + +platform = json.loads(go("env", "-json", "GOOS", "GOARCH", capture=True)) +suffix = ".exe" if platform["GOOS"] == "windows" else "" +output = package / "bin" / f"{platform['GOOS']}-{platform['GOARCH']}" / f"plugin{suffix}" +output.parent.mkdir(parents=True, exist_ok=True) +go("build", "-p=2", "-ldflags=-w", "-o", str(output), ".") +print(output, flush=True) +if args.test: + go("test", "-p=2", "-ldflags=-w", "./...", + "-coverpkg=./...,github.com/gruntwork-io/terragrunt/pkg/atmosbridge", + f"-coverprofile={work / 'plugin.cover'}") + go("test", "-p=2", "-ldflags=-w", "./...", + f"-coverprofile={work / 'bridge.cover'}", cwd=package / "bridge") diff --git a/website/blog/2026-10-29-native-terragrunt-discovery.mdx b/website/blog/2026-10-29-native-terragrunt-discovery.mdx new file mode 100644 index 00000000000..7e085f71357 --- /dev/null +++ b/website/blog/2026-10-29-native-terragrunt-discovery.mdx @@ -0,0 +1,53 @@ +--- +slug: native-terragrunt-discovery +title: "Experimental Native Terragrunt Discovery" +authors: [osterman] +tags: [feature, experimental] +--- +Adopting another infrastructure orchestrator can require rewriting an existing Terragrunt hierarchy before running a single plan. Experimental native Terragrunt discovery lets Atmos list local units and execute them through its Terraform lifecycle while retaining their HCL configuration. + + + +## The Problem + +Terragrunt units can share includes, depend on each other's outputs, and originate from nested stack templates. Adopting those units requires preserving their relationships and state locations as well as their input values. + +## The Fix + +An explicitly enabled configuration plugin exposes discovered units as Terraform components. Atmos owns execution order, authentication setup, toolchain selection, and working directories. The native path evaluates HCL without launching the Terragrunt executable. + +Discovery uses an in-memory expansion for explicit stacks. Planning and applying use isolated Atmos workdirs while preserving the local backend's state path. Projects that do not enable discovery do not scan for Terragrunt configuration. + +## How to Use It + +This implementation requires a local development build; the Terragrunt plugin is not yet published. Follow the [package setup and fixture instructions](https://github.com/cloudposse/atmos/tree/feat/component-plugin-contracts/plugins/terragrunt#build-and-run) before enabling discovery: + +```yaml +components: + terraform: + base_path: components/terraform + command: tofu + terragrunt: + enabled: true + mode: native + discovery: + enabled: true + included_paths: [live/**] +plugins: + packages: + terragrunt: + path: /absolute/path/to/plugins/terragrunt +``` + +Use [list instances](/cli/commands/list/list-instances) to inspect the discovered units and [Terraform plan](/cli/commands/terraform/plan) to plan them: + +```shell +atmos list instances +atmos terraform plan --all +``` + +The current scope covers local module sources and local backends. Remote sources and backends, Terragrunt hooks, saved-plan apply, state-function integration, and Terragrunt-aware affected selection remain incomplete. Do not assume full Terragrunt compatibility. The package instructions list the supported and rejected constructs. + +## Get Involved + +Review the [Terragrunt integration requirements](https://github.com/cloudposse/atmos/blob/feat/component-plugin-contracts/docs/prd/terragrunt-support.md) and help identify configurations that need additional compatibility tests. diff --git a/website/src/data/roadmap.js b/website/src/data/roadmap.js index 9fa0068cff9..64c7ca41dbe 100644 --- a/website/src/data/roadmap.js +++ b/website/src/data/roadmap.js @@ -505,9 +505,10 @@ export const roadmapConfig = { tagline: 'Truly extensible architecture', description: 'Modern infrastructure spans Terraform, Kubernetes, serverless, and custom tooling. A single orchestration layer should manage all of it consistently, not just a subset.', - progress: 85, + progress: 84, status: 'in-progress', milestones: [ + { label: 'Native Terragrunt unit and stack discovery', status: 'in-progress', quarter: 'q4-2026', experimental: true, pr: 3571, prd: 'terragrunt-support', changelog: 'native-terragrunt-discovery', description: 'Opt into local HCL discovery and native Terraform execution with preserved dependency ordering, state paths, scoped environments, and isolated workdirs. Published installation, affected selection, and broader compatibility remain in progress.' }, { label: 'Configurable concurrent YAML exec evaluation', status: 'shipped', quarter: 'q4-2026', changelog: 'parallel-yaml-exec', docs: '/cli/configuration/settings/functions/exec', description: 'Run ordinary !exec expressions concurrently within a document evaluation with a configurable limit, preserving result placement and serial execution by default.', benefits: 'Reduce time spent waiting on independent configuration lookups without new tags or grouping syntax.' }, { label: 'Native Go authentication plugins and OIDC starter', status: 'in-progress', quarter: 'q4-2026', experimental: true, changelog: 'native-auth-plugins', docs: '/cli/commands/plugin/usage', description: 'Scaffold and test a Go OIDC provider, chain its broker credentials into built-in identities, and distribute compiled plugins through OCI with explicit installation and release locks.' }, { label: 'Official public plugin catalog and secret-store authentication', status: 'in-progress', quarter: 'q4-2026', experimental: true, changelog: 'official-auth-secrets-plugins', docs: '/cli/configuration/plugins#official-secret-store-authentication', description: 'Discover official plugins through the default Cloud Posse OCI catalog and use auth-secrets to read explicitly configured secret-store credentials into an environment identity. Plugin manifests control independent package versions, with native platform validation and public OCI publication before catalog updates.', benefits: 'Install official plugins without configuring a registry, map selected secret values into child-process environment variables, and update individual plugins independently of Atmos releases.' }, From 1ddc34e29f47597adfa7dbd01908bafcc92035d4 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 29 Oct 2026 19:17:45 -0500 Subject: [PATCH 05/52] feat(terragrunt): add revision-aware affected selection and Starlark fixtures --- .github/workflows/plugin-sdk.yml | 13 +- docs/prd/terragrunt-support.md | 2 + internal/exec/describe_affected_components.go | 1 + .../exec/describe_affected_configuration.go | 41 +++++ .../describe_affected_configuration_test.go | 126 +++++++++++++ internal/exec/describe_affected_utils.go | 20 +- pkg/plugin/adapter/configuration/discovery.go | 2 +- pkg/plugin/adapter/configuration/revision.go | 33 ++++ .../adapter/configuration/revision_test.go | 60 ++++++ .../adapter/configuration/session_test.go | 2 +- pkg/schema/component_configuration.go | 6 + pkg/script/starlark/filesystem_directories.go | 77 ++++++++ .../starlark/filesystem_directories_test.go | 93 ++++++++++ pkg/script/starlark/filesystem_metadata.go | 3 + plugins/terragrunt/README.md | 21 ++- .../terragrunt/fixtures/advanced/README.md | 2 +- .../fixtures/explicit-stack/README.md | 2 +- plugins/terragrunt/plugin.tests.yaml | 18 ++ plugins/terragrunt/scripts/acceptance.py | 70 ------- plugins/terragrunt/scripts/affected.star | 172 ++++++++++++++++++ plugins/terragrunt/scripts/build.py | 33 ---- plugins/terragrunt/scripts/fixtures.star | 96 ++++++++++ plugins/terragrunt/scripts/native.star | 117 ++++++++++++ ...2026-10-29-native-terragrunt-discovery.mdx | 37 ++-- 24 files changed, 907 insertions(+), 140 deletions(-) create mode 100644 internal/exec/describe_affected_configuration.go create mode 100644 internal/exec/describe_affected_configuration_test.go create mode 100644 pkg/plugin/adapter/configuration/revision.go create mode 100644 pkg/plugin/adapter/configuration/revision_test.go create mode 100644 pkg/script/starlark/filesystem_directories.go create mode 100644 pkg/script/starlark/filesystem_directories_test.go create mode 100644 plugins/terragrunt/plugin.tests.yaml delete mode 100644 plugins/terragrunt/scripts/acceptance.py create mode 100644 plugins/terragrunt/scripts/affected.star delete mode 100644 plugins/terragrunt/scripts/build.py create mode 100644 plugins/terragrunt/scripts/fixtures.star create mode 100644 plugins/terragrunt/scripts/native.star diff --git a/.github/workflows/plugin-sdk.yml b/.github/workflows/plugin-sdk.yml index c4f92f22157..66f9b4be718 100644 --- a/.github/workflows/plugin-sdk.yml +++ b/.github/workflows/plugin-sdk.yml @@ -7,6 +7,9 @@ on: - 'proto/**' - 'pkg/plugin/**' - 'plugins/terragrunt/**' + - 'internal/exec/describe_affected*' + - 'pkg/schema/component_configuration.go' + - 'pkg/script/starlark/**' - 'pkg/generator/templates/plugin-oidc/**' - 'cmd/plugin/**' - 'cmd/plugin_oidc_test.go' @@ -38,10 +41,16 @@ jobs: with: go-version-file: plugins/terragrunt/go.mod cache-dependency-path: | + go.sum plugins/terragrunt/go.sum + plugins/terragrunt/bridge/go.sum sdk/go.sum - - name: Build and test native evaluation and invocation isolation - run: python3 plugins/terragrunt/scripts/build.py --test + - name: Bootstrap Atmos + run: go build -p=2 -ldflags=-w -o build/atmos.exe . + - name: Build the native Terragrunt plugin + run: ./build/atmos.exe plugin build plugins/terragrunt + - name: Test native evaluation and affected revision discovery + run: ./build/atmos.exe plugin test plugins/terragrunt contracts: runs-on: ubuntu-latest diff --git a/docs/prd/terragrunt-support.md b/docs/prd/terragrunt-support.md index c9e8b199484..2be1fbad38e 100644 --- a/docs/prd/terragrunt-support.md +++ b/docs/prd/terragrunt-support.md @@ -126,6 +126,8 @@ The pilot found a separate named-workspace dependency gap: Terragrunt output rea `describe affected` and `terraform --affected` must share identities and source relationships. +The current native implementation creates separate discovery sessions for HEAD and BASE. It retains the invocation's trusted plugin, scope, environment, and cancellation. It restores HEAD before dependent expansion and execution. Acceptance covers local HCL and module watches, nested stack provenance, changed dependency targets, additions, removals, renames, mixed YAML/HCL graphs, stack filters, and dependent depth. Reads in unevaluated input expressions and arbitrary dynamic glob membership remain open requirements below. + - Track primary HCL, includes, cross-directory reads, `file`, `mark_as_read`, modules, and optional reads. - Watch directories and glob membership to detect new/deleted files. - Track root/nested stacks, values, catalog sources, generated origins, and changed remote references. diff --git a/internal/exec/describe_affected_components.go b/internal/exec/describe_affected_components.go index 2633df541c6..4e5d00b7c0c 100644 --- a/internal/exec/describe_affected_components.go +++ b/internal/exec/describe_affected_components.go @@ -1173,6 +1173,7 @@ func checkDependencyChangesIndexed( ) error { // Get file/folder dependencies from dependencies.components or settings.depends_on. deps := getFileFolderDependencies(*componentSection, settingsSection) + configurationWatchPaths(atmosConfig, settingsSection, deps) if len(deps) > 0 { isFolderOrFileChanged, changedType, changedFileOrFolder, err := isComponentDependentFolderOrFileChangedIndexed( filesIndex, diff --git a/internal/exec/describe_affected_configuration.go b/internal/exec/describe_affected_configuration.go new file mode 100644 index 00000000000..8e48eb9c743 --- /dev/null +++ b/internal/exec/describe_affected_configuration.go @@ -0,0 +1,41 @@ +package exec + +import ( + "fmt" + "path/filepath" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +// rebaseConfigurationDiscovery replaces only the inventory session. Plugin code +// and policy still come from the trusted invocation, not the historical checkout. +func rebaseConfigurationDiscovery(config *schema.AtmosConfiguration) error { + if config.ComponentConfigurations == nil { + return nil + } + revisions, ok := config.ComponentConfigurations.(schema.ComponentConfigurationRevisionRuntime) + if !ok { + return fmt.Errorf("%w: configuration provider does not support revision discovery", errUtils.ErrPluginUnsupportedExtension) + } + session, err := revisions.ForRevision(config.BasePathAbsolute) + if err != nil { + return err + } + config.ComponentConfigurations = session + return nil +} + +// configurationWatchPaths resolves provider-owned watches against the project +// root without putting checkout-specific absolute paths into stack comparisons. +// Existing YAML dependency path semantics remain unchanged. +func configurationWatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) { + if _, provider := settings["configuration"]; !provider { + return + } + for i := range deps { + if !filepath.IsAbs(deps[i].Path) { + deps[i].Path = filepath.Join(config.BasePathAbsolute, deps[i].Path) + } + } +} diff --git a/internal/exec/describe_affected_configuration_test.go b/internal/exec/describe_affected_configuration_test.go new file mode 100644 index 00000000000..d3257971836 --- /dev/null +++ b/internal/exec/describe_affected_configuration_test.go @@ -0,0 +1,126 @@ +package exec + +import ( + "context" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/schema" +) + +type revisionConfigurationRuntime struct { + *MockComponentConfigurationRuntime + revision func(string) (schema.ComponentConfigurationRuntime, error) +} + +func (r *revisionConfigurationRuntime) ForRevision(root string) (schema.ComponentConfigurationRuntime, error) { + return r.revision(root) +} + +func affectedConfigurationDefinitions(names ...string) map[string]map[string]any { + components := map[string]any{} + for _, name := range names { + components[name] = map[string]any{"source": "./modules/unit", "vars": map[string]any{}} + } + return map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": components}}} +} + +func TestAffectedConfigurationRevisions(t *testing.T) { + for _, tc := range []struct { + name string + before, after []string + want string + deleted bool + forkErr, discoverErr error + }{ + {name: "addition", before: []string{"network", "app"}, after: []string{"network", "network-v2", "app"}, want: "network-v2"}, + {name: "removal", before: []string{"network", "old"}, after: []string{"network"}, want: "old", deleted: true}, + {name: "fork canceled", after: []string{"network"}, forkErr: context.Canceled}, + {name: "BASE discovery failed", after: []string{"network"}, discoverErr: errUtils.ErrPluginProtocol}, + {name: "unchanged", before: []string{"network", "app"}, after: []string{"network", "app"}}, + } { + t.Run(tc.name, func(t *testing.T) { + headRoot, head := affectedPolicyRepo(t, map[string]string{"README": "unchanged"}) + baseRoot, base := affectedPolicyRepo(t, map[string]string{"README": "unchanged"}) + config := affectedPolicyTestConfig(headRoot) + config.TerraformDirAbsolutePath = filepath.Join(headRoot, "components", "terraform") + config.HelmfileDirAbsolutePath = filepath.Join(headRoot, "components", "helmfile") + config.PackerDirAbsolutePath = filepath.Join(headRoot, "components", "packer") + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}}} + ctrl := gomock.NewController(t) + current := NewMockComponentConfigurationRuntime(ctrl) + current.EXPECT().Discover(gomock.Any()).Return(affectedConfigurationDefinitions(tc.after...), nil).AnyTimes() + previous := NewMockComponentConfigurationRuntime(ctrl) + previous.EXPECT().Discover(gomock.Any()).Return(affectedConfigurationDefinitions(tc.before...), tc.discoverErr).AnyTimes() + forked := false + runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: current, revision: func(root string) (schema.ComponentConfigurationRuntime, error) { + require.Equal(t, baseRoot, root) + forked = true + return previous, tc.forkErr + }} + config.ComponentConfigurations = runtime + affected, _, _, err := executeDescribeAffected(config, headRoot, baseRoot, head, base, false, false, "", false, false, nil, AffectedFilter{}, nil, true, DescribeStacksErrorOptions{}) + require.True(t, forked, "BASE must discover independently") + require.Same(t, runtime, config.ComponentConfigurations, "restore HEAD for dependent expansion and execution") + require.Equal(t, headRoot, config.BasePathAbsolute) + if tc.forkErr != nil { + require.ErrorIs(t, err, tc.forkErr) + return + } + if tc.discoverErr != nil { + require.ErrorIs(t, err, tc.discoverErr) + return + } + require.NoError(t, err) + if tc.want == "" { + require.Empty(t, affected) + } else { + require.Len(t, affected, 1) + require.Equal(t, tc.want, affected[0].Component) + require.Equal(t, tc.deleted, affected[0].Deleted) + } + }) + } +} + +func TestAffectedConfigurationForkErrors(t *testing.T) { + require.NoError(t, rebaseConfigurationDiscovery(&schema.AtmosConfiguration{})) + original := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config := &schema.AtmosConfiguration{ComponentConfigurations: original} + require.ErrorIs(t, rebaseConfigurationDiscovery(config), errUtils.ErrPluginUnsupportedExtension) + require.Same(t, original, config.ComponentConfigurations) + for _, failure := range []error{context.Canceled, errUtils.ErrPluginInvalidConfig} { + runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: original, revision: func(string) (schema.ComponentConfigurationRuntime, error) { return nil, failure }} + config.ComponentConfigurations = runtime + require.ErrorIs(t, rebaseConfigurationDiscovery(config), failure) + require.Same(t, runtime, config.ComponentConfigurations) + } +} + +func TestAffectedConfigurationWatchRoot(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePathAbsolute: root} + for _, provider := range []bool{true, false} { + settings := map[string]any{} + if provider { + settings["configuration"] = map[string]any{"provider": "terragrunt"} + } + absolute := filepath.Join(root, "module") + deps := []schema.ComponentDependency{{Kind: "file", Path: "root.hcl"}, {Kind: "folder", Path: absolute}} + configurationWatchPaths(config, settings, deps) + require.Equal(t, absolute, deps[1].Path) + if provider { + require.Equal(t, filepath.Join(root, "root.hcl"), deps[0].Path) + changed, kind, _, err := isComponentDependentFolderOrFileChangedIndexed(newChangedFilesIndex(config, []string{"root.hcl"}, root), deps) + require.NoError(t, err) + require.True(t, changed) + require.Equal(t, "file", kind) + } else { + require.Equal(t, "root.hcl", deps[0].Path) + } + } +} diff --git a/internal/exec/describe_affected_utils.go b/internal/exec/describe_affected_utils.go index 8c5f8ce1b8c..50642194058 100644 --- a/internal/exec/describe_affected_utils.go +++ b/internal/exec/describe_affected_utils.go @@ -153,6 +153,7 @@ func executeDescribeAffected( } // Save current paths before modification. + currentConfigurations := atmosConfig.ComponentConfigurations currentBasePath := atmosConfig.BasePath currentBasePathAbsolute := atmosConfig.BasePathAbsolute currentStacksBaseAbsolutePath := atmosConfig.StacksBaseAbsolutePath @@ -168,6 +169,7 @@ func executeDescribeAffected( // This is redundant with (but does not replace) the explicit restore further below, // which must run before findAffected is called with the original (HEAD) paths. defer func() { + atmosConfig.ComponentConfigurations = currentConfigurations atmosConfig.BasePath = currentBasePath atmosConfig.BasePathAbsolute = currentBasePathAbsolute atmosConfig.StacksBaseAbsolutePath = currentStacksBaseAbsolutePath @@ -187,6 +189,10 @@ func executeDescribeAffected( return nil, nil, nil, err } + if err := rebaseConfigurationDiscovery(atmosConfig); err != nil { + return nil, nil, nil, err + } + // Re-scan the BASE (remote) directory for stack config files. // This is necessary to detect deleted stacks - files that exist in BASE but not in HEAD. // We cannot simply convert HEAD's file paths to BASE paths, as that would miss files @@ -213,11 +219,14 @@ func executeDescribeAffected( } // No stack manifests found in BASE (e.g. greenfield branch introducing Atmos for the first time, // or BASE branch uses a different stack structure). Treat BASE as empty: all HEAD stacks are new. - log.Warn( - "No Atmos stack manifests found in BASE; treating BASE as empty (all HEAD components will be reported as affected)", - "hint", "This is expected for greenfield branches or when the base branch does not yet use Atmos", - "error", err, - ) + // A provider-only project can still have a complete BASE inventory. + if atmosConfig.ComponentConfigurations == nil { + log.Warn( + "No Atmos stack manifests found in BASE; treating BASE as empty (all HEAD components will be reported as affected)", + "hint", "This is expected for greenfield branches or when the base branch does not yet use Atmos", + "error", err, + ) + } remoteStackConfigFilesAbsolutePaths = []string{} } atmosConfig.StackConfigFilesAbsolutePaths = remoteStackConfigFilesAbsolutePaths @@ -254,6 +263,7 @@ func executeDescribeAffected( } // Restore atmosConfig. + atmosConfig.ComponentConfigurations = currentConfigurations atmosConfig.BasePath = currentBasePath atmosConfig.BasePathAbsolute = currentBasePathAbsolute atmosConfig.StacksBaseAbsolutePath = currentStacksBaseAbsolutePath diff --git a/pkg/plugin/adapter/configuration/discovery.go b/pkg/plugin/adapter/configuration/discovery.go index 910cfd89796..7a84bfea731 100644 --- a/pkg/plugin/adapter/configuration/discovery.go +++ b/pkg/plugin/adapter/configuration/discovery.go @@ -100,7 +100,7 @@ func instanceDependencies(instance *pluginv1.DiscoveredComponent) map[string]any deps[field] = append(deps[field].([]any), source.Path) } for _, dependency := range instance.Dependencies { - deps[componentsKey] = append(deps[componentsKey].([]any), map[string]any{"name": dependency.Target.Component, "stack": dependency.Target.Stack, "type": dependency.Target.ComponentType}) + deps[componentsKey] = append(deps[componentsKey].([]any), map[string]any{"name": dependency.Target.Component, "stack": dependency.Target.Stack, "kind": dependency.Target.ComponentType}) } return deps } diff --git a/pkg/plugin/adapter/configuration/revision.go b/pkg/plugin/adapter/configuration/revision.go new file mode 100644 index 00000000000..9ccf5733e3d --- /dev/null +++ b/pkg/plugin/adapter/configuration/revision.go @@ -0,0 +1,33 @@ +package configuration + +import ( + "path/filepath" + + "google.golang.org/protobuf/proto" + + errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/perf" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" + "github.com/cloudposse/atmos/pkg/schema" +) + +// ForRevision creates an independent inventory in a different checkout. The host's +// trusted plugin selection, discovery scope, environment, and cancellation remain +// fixed for the invocation; no cached definitions or evaluated HCL are reused. +func (s *Session) ForRevision(root string) (schema.ComponentConfigurationRuntime, error) { + defer perf.Track(nil, "configurationadapter.ForRevision")() + + if err := s.ctx.Err(); err != nil { + return nil, err + } + if !filepath.IsAbs(root) { + return nil, errUtils.ErrPluginInvalidConfig + } + revision := &Session{ctx: s.ctx, root: root, command: s.command, loader: s.loader, done: make(chan struct{})} + for _, request := range s.requests { + cloned := proto.Clone(request).(*pluginv1.DiscoverComponentsRequest) + cloned.RootDirectory = root + revision.requests = append(revision.requests, cloned) + } + return revision, nil +} diff --git a/pkg/plugin/adapter/configuration/revision_test.go b/pkg/plugin/adapter/configuration/revision_test.go new file mode 100644 index 00000000000..079ab176b72 --- /dev/null +++ b/pkg/plugin/adapter/configuration/revision_test.go @@ -0,0 +1,60 @@ +package configuration + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" +) + +func TestRevisionDiscoveryIsolated(t *testing.T) { + config := enabledConfig(t) + baseRoot := t.TempDir() + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform").Times(2) + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + require.Nil(t, request.Effects, "revision discovery cannot read state or run commands") + require.Equal(t, "plan", request.Operation.Command) + name := "head" + if request.RootDirectory == baseRoot { + name = "base" + } else { + require.Equal(t, config.BasePathAbsolute, request.RootDirectory) + } + return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit(t, name)}}, nil + }).Times(2) + ctx, cancel := context.WithCancel(t.Context()) + defer cancel() + head, err := New(ctx, config, "plan", func(context.Context, []string) (map[string]Provider, error) { + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + headDefinitions, err := head.Discover(t.Context()) + require.NoError(t, err) + revision, err := head.ForRevision(baseRoot) + require.NoError(t, err) + baseDefinitions, err := revision.Discover(t.Context()) + require.NoError(t, err) + require.Contains(t, baseDefinitions["live"]["components"].(map[string]any)["terraform"], "base") + again, err := head.Discover(t.Context()) + require.NoError(t, err) + require.Equal(t, headDefinitions, again) + require.Contains(t, again["live"]["components"].(map[string]any)["terraform"], "head") + // A revision's request data must not alias the HEAD request in either direction. + base := revision.(*Session) + base.requests[0].IncludePaths[0] = "base/**" + require.Equal(t, "live/**", head.requests[0].IncludePaths[0]) + head.requests[0].Invocation.Environment["REVISION"] = "head" + require.NotContains(t, base.requests[0].Invocation.Environment, "REVISION") + _, err = head.ForRevision("relative") + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + cancel() + _, err = head.ForRevision(baseRoot) + require.ErrorIs(t, err, context.Canceled) + _, err = revision.Discover(t.Context()) + require.ErrorIs(t, err, context.Canceled) +} diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index 72be751707a..bf9649591db 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -56,7 +56,7 @@ func TestSessionDiscoveryAndPreparation(t *testing.T) { components := first["live"]["components"].(map[string]any)["terraform"].(map[string]any) appConfig := components["app"].(map[string]any) require.Equal(t, []any{"root.hcl"}, appConfig["dependencies"].(map[string]any)["files"]) - require.Equal(t, []any{map[string]any{"name": "network", "stack": "live", "type": "terraform"}}, appConfig["dependencies"].(map[string]any)["components"]) + require.Equal(t, []any{map[string]any{"name": "network", "stack": "live", "kind": "terraform"}}, appConfig["dependencies"].(map[string]any)["components"]) components["app"] = "corrupt" second, err := session.Discover(t.Context()) require.NoError(t, err) diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go index a27942543a0..7ae1c4fcd16 100644 --- a/pkg/schema/component_configuration.go +++ b/pkg/schema/component_configuration.go @@ -34,6 +34,12 @@ type ComponentConfigurationRuntime interface { Prepare(context.Context, *ConfigAndStacksInfo) (*PreparedComponentConfiguration, error) } +// ComponentConfigurationRevisionRuntime supplies isolated discovery for Git comparisons. +// Providers without this capability must fail affected selection rather than reuse HEAD. +type ComponentConfigurationRevisionRuntime interface { + ForRevision(root string) (ComponentConfigurationRuntime, error) +} + // PreparedComponentConfiguration contains evaluated inputs and literal artifacts. type PreparedComponentConfiguration struct { Engine string diff --git a/pkg/script/starlark/filesystem_directories.go b/pkg/script/starlark/filesystem_directories.go new file mode 100644 index 00000000000..e23feaa192a --- /dev/null +++ b/pkg/script/starlark/filesystem_directories.go @@ -0,0 +1,77 @@ +package starlark + +import ( + "os" + "path/filepath" + + "go.starlark.net/starlark" + + errUtils "github.com/cloudposse/atmos/errors" +) + +const defaultDirectoryMode = 0o700 + +func (s *session) mkdir(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + var path string + parents, mode := false, defaultDirectoryMode + if err := starlark.UnpackArgs(b.Name(), args, kwargs, "path", &path, "parents?", &parents, "mode?", &mode); err != nil { + return nil, err + } + if err := threadContext(t).Err(); err != nil { + return nil, err + } + if path == "" || mode < 0 || mode > maxWriteMode { + return nil, invalidArg("fs.mkdir: nonempty path and mode between 0o000 and 0o777 required") + } + create := os.Mkdir + if parents { + create = os.MkdirAll + } + if err := create(s.filesystemPath(t, path), os.FileMode(mode)); err != nil { + return nil, failWith(errUtils.ErrStarlark, err, "cannot create directory: %s", err) + } + return starlark.None, nil +} + +func (s *session) mkdtemp(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + prefix, directory := "atmos-", "" + if err := starlark.UnpackArgs(b.Name(), args, kwargs, "prefix?", &prefix, "dir?", &directory); err != nil { + return nil, err + } + if err := threadContext(t).Err(); err != nil { + return nil, err + } + if directory != "" { + directory = s.filesystemPath(t, directory) + } + path, err := os.MkdirTemp(directory, prefix) + if err != nil { + return nil, failWith(errUtils.ErrStarlark, err, "cannot create temporary directory: %s", err) + } + return starlark.String(path), nil +} + +// remove does not follow a final symlink. Recursive deletion must be explicit; +// rejecting empty paths and filesystem roots protects against missing arguments. +func (s *session) remove(t *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + var path string + recursive := false + if err := starlark.UnpackArgs(b.Name(), args, kwargs, "path", &path, "recursive?", &recursive); err != nil { + return nil, err + } + if err := threadContext(t).Err(); err != nil { + return nil, err + } + target := s.filesystemPath(t, path) + if path == "" || filepath.Dir(target) == target { + return nil, invalidArg("fs.remove: path must not be empty or a filesystem root") + } + remove := os.Remove + if recursive { + remove = os.RemoveAll + } + if err := remove(target); err != nil { + return nil, failWith(errUtils.ErrStarlark, err, "cannot remove path: %s", err) + } + return starlark.None, nil +} diff --git a/pkg/script/starlark/filesystem_directories_test.go b/pkg/script/starlark/filesystem_directories_test.go new file mode 100644 index 00000000000..5c89fb7f2cc --- /dev/null +++ b/pkg/script/starlark/filesystem_directories_test.go @@ -0,0 +1,93 @@ +package starlark + +import ( + "context" + "os" + "path/filepath" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudposse/atmos/pkg/script" +) + +func TestDirectoryOperations(t *testing.T) { + t.Parallel() + root := t.TempDir() + run := func(source string) (script.Result, error) { + return New().Execute(t.Context(), script.Spec{WorkingDirectory: root, Source: source}) + } + _, err := run(`fs.mkdir("nested/child", parents=True) +fs.mkdir("nested/child", parents=True) +fs.write_file("nested/child/data", "payload") +fs.mkdir("single", mode=0o755) +fs.remove("single")`) + require.NoError(t, err) + require.FileExists(t, filepath.Join(root, "nested", "child", "data")) + for _, source := range []string{ + `fs.mkdir(42)`, `fs.mkdir("")`, `fs.mkdir("bad", mode=-1)`, `fs.mkdir("bad", mode=0o1000)`, + `fs.mkdir("missing/child")`, `fs.mkdir("nested")`, + `fs.mkdtemp(prefix=42)`, `fs.mkdtemp(dir="missing")`, `fs.mkdtemp(prefix="bad/name")`, + `fs.remove(42)`, `fs.remove("")`, `fs.remove("missing")`, `fs.remove("nested")`, + } { + _, err := run(source) + require.Error(t, err, source) + } + _, err = run(`fs.remove("nested", recursive=True) +fs.remove("nested", recursive=True)`) + require.NoError(t, err) + require.NoDirExists(t, filepath.Join(root, "nested")) + volumeRoot := filepath.VolumeName(root) + string(filepath.Separator) + _, err = New().Execute(t.Context(), script.Spec{WorkingDirectory: root, Env: map[string]string{"ROOT": volumeRoot}, Source: `fs.remove(env["ROOT"], recursive=True)`}) + require.ErrorContains(t, err, "filesystem root") +} + +func TestTemporaryDirectoryCleanupAfterFailure(t *testing.T) { + t.Parallel() + root := t.TempDir() + _, err := New().Execute(t.Context(), script.Spec{WorkingDirectory: root, Source: `path = fs.mkdtemp(prefix="fixture-", dir=".") +defer(fs.remove, path, recursive=True) +fs.write_file(path + "/data", "payload") +fail("intentional fixture failure")`}) + require.ErrorContains(t, err, "intentional fixture failure") + entries, err := os.ReadDir(root) + require.NoError(t, err) + require.Empty(t, entries, "deferred cleanup runs even after a failing assertion") + result, err := New().Execute(t.Context(), script.Spec{Source: `path = fs.mkdtemp() +defer(fs.remove, path, recursive=True) +output = fs.stat(path).is_dir`}) + require.NoError(t, err) + require.Equal(t, "true", result.Value) +} + +func TestDirectoryOperationsDoNotFollowRemovalSymlink(t *testing.T) { + t.Parallel() + root, target := t.TempDir(), t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(target, "keep"), []byte("keep"), 0o600)) + if err := os.Symlink(target, filepath.Join(root, "link")); err != nil { + t.Skipf("symlink unavailable: %v", err) + } + _, err := New().Execute(t.Context(), script.Spec{WorkingDirectory: root, Source: `fs.remove("link", recursive=True)`}) + require.NoError(t, err) + require.FileExists(t, filepath.Join(target, "keep")) + _, err = os.Lstat(filepath.Join(root, "link")) + require.ErrorIs(t, err, os.ErrNotExist) +} + +func TestDirectoryOperationsDryRunAndCancellation(t *testing.T) { + t.Parallel() + for _, source := range []string{`fs.mkdir("unexpected")`, `fs.mkdtemp(dir=".")`, `fs.remove("keep", recursive=True)`} { + root := t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(root, "keep"), nil, 0o600)) + _, err := New().Execute(t.Context(), script.Spec{WorkingDirectory: root, Source: source, DryRun: true}) + require.NoError(t, err) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + _, err = New().Execute(ctx, script.Spec{WorkingDirectory: root, Source: source}) + require.ErrorIs(t, err, context.Canceled) + entries, err := os.ReadDir(root) + require.NoError(t, err) + require.Len(t, entries, 1) + require.Equal(t, "keep", entries[0].Name()) + } +} diff --git a/pkg/script/starlark/filesystem_metadata.go b/pkg/script/starlark/filesystem_metadata.go index 2ea9a173e4e..b171da48a64 100644 --- a/pkg/script/starlark/filesystem_metadata.go +++ b/pkg/script/starlark/filesystem_metadata.go @@ -21,6 +21,9 @@ func (s *session) filesystemModule() starlark.Value { return module("fs", starlark.StringDict{ "read_file": starlark.NewBuiltin("fs.read_file", s.readFile), "write_file": starlark.NewBuiltin("fs.write_file", s.writeFile), + "mkdir": starlark.NewBuiltin("fs.mkdir", s.mkdir), + "mkdtemp": starlark.NewBuiltin("fs.mkdtemp", s.mkdtemp), + "remove": starlark.NewBuiltin("fs.remove", s.remove), "glob": starlark.NewBuiltin("fs.glob", s.glob), "stat": starlark.NewBuiltin("fs.stat", s.stat), "exists": starlark.NewBuiltin("fs.exists", s.exists), diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md index 8eb5d0274ba..f2bb0dd0ec2 100644 --- a/plugins/terragrunt/README.md +++ b/plugins/terragrunt/README.md @@ -9,12 +9,15 @@ This is an unmerged implementation with limited compatibility. It is not a publi From the repository root: ```shell -python3 plugins/terragrunt/scripts/build.py --test -go build -ldflags=-w -o .context/atmos-native . -python3 plugins/terragrunt/scripts/acceptance.py --atmos .context/atmos-native +atmos build +./build/atmos plugin build plugins/terragrunt +./build/atmos plugin test plugins/terragrunt +./build/atmos plugin test plugins/terragrunt --integration ``` -The acceptance runner copies both fixtures under `.context/`, saves command logs, applies only built-in `terraform_data` resources with local state, checks unchanged plans and dependency refresh, then destroys those resources. It needs OpenTofu on PATH. Use `--terraform=terraform` to select Terraform instead. It does not call the Terragrunt CLI. +On Windows, use `build/atmos.exe`. CI bootstraps the host with `go build -o build/atmos.exe .`, then uses the same plugin commands. + +The default suite runs Go unit tests and Starlark affected-selection fixtures. It requires Go and Git, but no Python, shell, Terraform, or Terragrunt executable. The integration suite requires OpenTofu or Terraform on PATH. It copies both fixtures into temporary directories, applies only built-in `terraform_data` resources with local state, checks unchanged plans and dependency refresh, then destroys those resources. Deferred cleanup removes the temporary directories even when an assertion fails. Neither suite calls the Terragrunt CLI. Configure a project with: @@ -39,11 +42,19 @@ Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan - Preparation receives Atmos's sanitized environment after authentication, the selected executable, toolchain PATH, and managed Terraform RC configuration. Child commands use the invocation PATH. Neither identity changes nor HCL evaluation replace the plugin process environment. +## Affected selection + +The `describe affected --base ` and `terraform plan --affected --ref ` paths discover HEAD and BASE independently. Both checkouts use the invocation's trusted plugin and discovery scope. Historical HCL never reuses the current inventory or reads dependency state. + +The affected acceptance runner uses temporary Git repositories and dry runs. It checks additions, deletions, renames, changed dependency targets, shared includes, local module files, nested explicit stacks, mixed YAML/HCL graphs, stack filters, and dependent depth. Both output and ordering edges participate in `--include-dependents`. The runner requires Git but no Terraform or Terragrunt executable. + +Source tracking currently covers files read during partial discovery, declared HCL, local module directories, and stack template provenance. Reads in unevaluated input expressions, arbitrary dynamic globs, and effect-dependent discovery need further work. This is not a claim that every Terragrunt expression has complete affected provenance. + ## Scope The fixtures cover local sources, local backend paths, includes, locals, nested stack values, literal generation, order and output dependencies, command-scoped mocks, fresh outputs, and native bulk execution. Unit tests cover absolute and relative workdir overrides, ownership conflicts, repeated provisioning without state loss, concurrent environment isolation, unit-relative child commands, cancellation, and rejected effects. The plugin workflow runs its unit tests on Linux, macOS, and Windows. These checks do not establish a compatibility percentage. -Current limits include remote module/catalog sources, non-local backends, Terragrunt hooks and extra arguments, IAM options, feature flags, error/retry blocks, prevention/exclusion rules, inline modules without `terraform.source`, named-workspace output dependencies, and saved-plan apply. Unsupported semantics must fail rather than switch executors. Explicit `terragrunt://` imports, state-function host dispatch, affected revision comparison, executable mode, engine table columns, UI/log adapters, and conversion commands remain in the PRDs. +Current limits include remote module/catalog sources, non-local backends, Terragrunt hooks and extra arguments, IAM options, feature flags, error/retry blocks, prevention/exclusion rules, inline modules without `terraform.source`, named-workspace output dependencies, and saved-plan apply. Unsupported semantics must fail rather than switch executors. Explicit `terragrunt://` imports, state-function host dispatch, executable mode, engine table columns, UI/log adapters, and conversion commands remain in the PRDs. Only enabled/mode/provider/discovery settings are accepted by this package. Additional plugin settings and typed CLI option handling remain planned. Discovery that needs command execution, decryption, network access, or identity-dependent effects fails. The native plugin is trusted code, not an OS sandbox. diff --git a/plugins/terragrunt/fixtures/advanced/README.md b/plugins/terragrunt/fixtures/advanced/README.md index f4b71782ff7..d89f3930498 100644 --- a/plugins/terragrunt/fixtures/advanced/README.md +++ b/plugins/terragrunt/fixtures/advanced/README.md @@ -18,4 +18,4 @@ The native acceptance runner lists the four units, plans with command-scoped moc `failures/hook` is an unsupported-hook fixture outside the successful discovery scope. -Run `python3 plugins/terragrunt/scripts/acceptance.py --atmos ` from the repository root. The runner copies all files before execution. +Run `atmos plugin build plugins/terragrunt`, then `atmos plugin test plugins/terragrunt --integration` from the repository root using a development build of Atmos. The Starlark runner copies the fixture into a temporary directory before execution and cleans it up afterward. diff --git a/plugins/terragrunt/fixtures/explicit-stack/README.md b/plugins/terragrunt/fixtures/explicit-stack/README.md index ffa72956c77..1d23e9a6bf9 100644 --- a/plugins/terragrunt/fixtures/explicit-stack/README.md +++ b/plugins/terragrunt/fixtures/explicit-stack/README.md @@ -7,4 +7,4 @@ Stack values pass through both generation levels into unit inputs. State is outside `.terragrunt-stack`, under `state//.tfstate`. The acceptance runner starts without generated units or state. It lists all four units without writing project files, then applies them through native Atmos, checks unchanged plans, and destroys them in reverse order. The Terragrunt executable is not used. -Run `python3 plugins/terragrunt/scripts/acceptance.py --atmos ` from the repository root. The runner copies all files before execution. +Run `atmos plugin build plugins/terragrunt`, then `atmos plugin test plugins/terragrunt --integration` from the repository root using a development build of Atmos. The Starlark runner copies the fixture into a temporary directory before execution and cleans it up afterward. diff --git a/plugins/terragrunt/plugin.tests.yaml b/plugins/terragrunt/plugin.tests.yaml new file mode 100644 index 00000000000..e8035a8606b --- /dev/null +++ b/plugins/terragrunt/plugin.tests.yaml @@ -0,0 +1,18 @@ +version: 1 +steps: + - name: native-unit-tests + type: script + interpreter: starlark + script: | + exec.run(["go", "test", "-p=2", "./..."]) + exec.run(["go", "test", "-p=2", "./..."], working_directory=fs.resolve("bridge")) + - name: affected-revisions + type: script + interpreter: starlark + script: | + affected = module.load("scripts/affected.star") + affected.main() +integration: + - name: native-lifecycle + type: script + source: scripts/native.star diff --git a/plugins/terragrunt/scripts/acceptance.py b/plugins/terragrunt/scripts/acceptance.py deleted file mode 100644 index e6377d462af..00000000000 --- a/plugins/terragrunt/scripts/acceptance.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python3 -"""Exercise the installed native plugin through the real Atmos CLI (local state only).""" -import argparse -import hashlib -import json -import os -from pathlib import Path -import shutil -import subprocess -import tempfile - -parser = argparse.ArgumentParser() -parser.add_argument("--atmos", required=True, type=Path) -parser.add_argument("--terraform", default="tofu") -args = parser.parse_args() -atmos = args.atmos.resolve() -package = Path(__file__).resolve().parents[1] -repository = package.parents[1] -work = Path(tempfile.mkdtemp(prefix="terragrunt-native-", dir=repository / ".context")) -print(f"Evidence and local state: {work}", flush=True) - -def snapshot(root): - return {str(p.relative_to(root)): hashlib.sha256(p.read_bytes()).hexdigest() - for p in root.rglob("*") if p.is_file()} - -def run(root, label, *command, revision="r1", success=True): - environment = dict(os.environ, POC_REVISION=revision, TF_IN_AUTOMATION="true", NO_COLOR="1") - result = subprocess.run([str(atmos), f"--chdir={root}", *command], env=environment, - text=True, capture_output=True, timeout=180) - (work / f"{root.name}-{label}.log").write_text(result.stdout + result.stderr) - if (result.returncode == 0) != success: - raise RuntimeError(f"{label}: exit {result.returncode}\n{result.stdout}\n{result.stderr}") - return result.stdout - -for name, scope, stack, expected in [ - ("advanced", "live/dev/**", "live/dev", ["app", "cache", "database", "network"]), - ("explicit-stack", "live/**", "live", ["dev/app", "dev/network", "prod/app", "prod/network"]), -]: - root = work / name - shutil.copytree(package / "fixtures" / name, root) - config = {"base_path": str(root), "components": {"terraform": { - "base_path": "components/terraform", "command": args.terraform, - "terragrunt": {"enabled": True, "mode": "native", "discovery": { - "enabled": True, "included_paths": [scope]}}}}, - "plugins": {"packages": {"terragrunt": {"path": str(package)}}}} - (root / "atmos.yaml").write_text(json.dumps(config, indent=2)) - before = snapshot(root) - instances = json.loads(run(root, "instances", "list", "instances", "--format=json")) - assert [row["Component"] for row in instances] == expected, instances - assert {row["Stack"] for row in instances} == {stack}, instances - run(root, "stacks", "list", "stacks", "--format=json") - described = json.loads(run(root, "describe", "describe", "stacks", "--format=json")) - assert stack in described, described.keys() - assert before == snapshot(root), "Discovery changed project files" - if name == "advanced": - run(root, "mock-plan", "terraform", "plan", "--all", "-s", stack, "--", "-no-color") - run(root, "apply", "terraform", "apply", "--all", "-s", stack, "--", "-auto-approve", "-no-color") - plan = run(root, "unchanged", "terraform", "plan", "--all", "-s", stack, "--", "-detailed-exitcode", "-no-color") - assert plan.count("No changes.") == 4, plan - state_files = list(root.glob("live/dev/*/state/terraform.tfstate")) if name == "advanced" else list(root.glob("state/*/*.tfstate")) - assert len(state_files) == 4, state_files - if name == "advanced": - run(root, "refresh", "terraform", "apply", "--all", "-s", stack, "--", "-auto-approve", "-no-color", revision="r2") - states = [json.loads(path.read_text()) for path in state_files] - app = next(state["outputs"]["value"]["value"] for state in states if state["outputs"]["value"]["value"]["unit"] == "app") - assert app["upstream"]["database"]["upstream"]["network"]["revision"] == "r2", app - run(root, "destroy", "terraform", "destroy", "--all", "-s", stack, "--", "-auto-approve", "-no-color") - for path in state_files: - assert not json.loads(path.read_text())["resources"], path - print(f"PASS {name}: inventory, read-only discovery, native apply, unchanged plans, dependency state, reverse destroy", flush=True) diff --git a/plugins/terragrunt/scripts/affected.star b/plugins/terragrunt/scripts/affected.star new file mode 100644 index 00000000000..b6353716040 --- /dev/null +++ b/plugins/terragrunt/scripts/affected.star @@ -0,0 +1,172 @@ +# Read-only Git comparison scenarios. No Terraform binary, state, or cloud resources. +fixtures = module.load("fixtures.star") + + +def unit(dependency=None): + text = 'terraform { source = "../../../modules/unit" }\n' + if dependency: + text += 'dependency "network" { config_path = "../' + dependency + '" }\n' + return text + + +def seed_units(root): + fixtures.write(root, "modules/unit/main.tf", 'output "vpc_id" { value = "fixture" }\n') + fixtures.write(root, "live/prod/network/terragrunt.hcl", unit()) + fixtures.write(root, "live/prod/app/terragrunt.hcl", unit("network")) + return fixtures.commit(root, "initial units") + + +def affected(root, ref, *flags): + result = fixtures.run(root, [ + "describe", "affected", "--base", ref, "--format=json", + ] + list(flags)) + fixtures.check("treating BASE as empty" not in result.stderr, result.stderr) + return json.decode(result.stdout) + + +def expect_components(rows, expected): + actual = sorted([row["component"] for row in rows]) + fixtures.check(actual == sorted(expected), "Unexpected affected components: " + str(actual)) + + +def dry_plan(root, base, *flags): + return fixtures.run(root, [ + "terraform", "plan", "--affected", "--ref", base, "--dry-run", + ] + list(flags)).stderr + + +def test_rewired_dependency(root): + # BASE must retain the old inventory and graph; expansion must use HEAD. + base = seed_units(root) + fixtures.check(not affected(root, base), "Unchanged units were selected") + fixtures.write(root, "live/prod/network-v2/terragrunt.hcl", unit()) + fixtures.write(root, "live/prod/app/terragrunt.hcl", unit("network-v2")) + fixtures.commit(root, "replace app dependency") + expect_components(affected(root, base), ["app", "network-v2"]) + + base = fixtures.git(root, "rev-parse", "HEAD") + fixtures.write(root, "live/prod/network-v2/terragrunt.hcl", unit() + "# changed input\n") + fixtures.commit(root, "change only new network") + expect_components(affected(root, base), ["network-v2"]) + expanded = affected(root, base, "--include-dependents", "--flatten") + expect_components(expanded, ["app", "network-v2"]) + + plan = dry_plan(root, base, "--include-dependents") + fixtures.check("Would plan network-v2 in live/prod" in plan, plan) + fixtures.check("Would plan app in live/prod" in plan, plan) + fixtures.check("Would plan network in" not in plan, plan) + + +def test_deleted_unit(root): + # Removed identities belong in the report, but must never be executed. + base = seed_units(root) + fixtures.git(root, "rm", "-r", "live/prod/app") + fixtures.commit(root, "remove app") + removed = affected(root, base) + expect_components(removed, ["app"]) + fixtures.check(removed[0]["deleted"], "Removed unit was not marked deleted") + fixtures.check("Would plan" not in dry_plan(root, base), "Deleted unit selected for execution") + + +def test_file_watches_and_rename(root): + # Shared HCL and module files must select all consumers, even when unit HCL is unchanged. + seed_units(root) + fixtures.write(root, "shared.hcl", 'locals { region = "east" }\n') + for name in ["network", "app"]: + path = "live/prod/" + name + "/terragrunt.hcl" + content = 'include "shared" { path = "../../../shared.hcl" }\n' + fixtures.write(root, path, content + fs.read_file(root + "/" + path)) + base = fixtures.commit(root, "include shared configuration") + fixtures.write(root, "shared.hcl", 'locals { region = "west" }\n') + fixtures.commit(root, "change shared configuration") + expect_components(affected(root, base), ["app", "network"]) + + base = fixtures.git(root, "rev-parse", "HEAD") + fixtures.write(root, "modules/unit/main.tf", 'output "vpc_id" { value = "changed" }\n') + fixtures.commit(root, "change module") + expect_components(affected(root, base), ["app", "network"]) + + base = fixtures.git(root, "rev-parse", "HEAD") + fixtures.git(root, "mv", "live/prod/app", "live/prod/application") + fixtures.commit(root, "rename unit") + renamed = affected(root, base) + expect_components(renamed, ["app", "application"]) + old = [row for row in renamed if row["component"] == "app"][0] + fixtures.check(old["deleted"], "Rename must remove the old identity") + + +def test_nested_stacks(root, package): + # Generated units retain provenance to the checked-in stack, on both revisions. + fixtures.copy_tree(package + "/fixtures/explicit-stack", root) + base = fixtures.commit(root, "explicit stacks") + fixtures.check(not affected(root, base), "Unchanged explicit stacks selected") + path = "live/terragrunt.stack.hcl" + fixtures.write(root, path, fs.read_file(root + "/" + path) + "\n# changed definition\n") + fixtures.commit(root, "change explicit root") + expect_components(affected(root, base), [ + "dev/app", "dev/network", "prod/app", "prod/network", + ]) + fixtures.check(not fs.exists(root + "/live/.terragrunt-stack"), "Discovery wrote generated stacks") + fixtures.check(not fs.glob(root + "/**/*.tfstate"), "Discovery created state") + + +def test_mixed_graph(root, configuration): + # Output and ordering edges compose with YAML consumers and existing selection flags. + seed_units(root) + configuration["stacks"] = {"base_path": "stacks", "included_paths": ["**/*.yaml"]} + fixtures.write(root, "atmos.yaml", json.encode(configuration)) + fixtures.write(root, "live/prod/api/terragrunt.hcl", unit() + 'dependencies { paths = ["../app"] }\n') + consumer = { + "source": "./modules/unit", + "dependencies": { + "components": [{"name": "api", "stack": "live/prod", "kind": "terraform"}], + }, + } + stack = {"name": "native", "components": {"terraform": {"native": consumer}}} + fixtures.write(root, "stacks/native.yaml", json.encode(stack)) + base = fixtures.commit(root, "mixed YAML and HCL dependency chain") + fixtures.check(not affected(root, base), "Unchanged mixed inventory selected") + fixtures.write(root, "live/prod/network/terragrunt.hcl", unit() + "# changed upstream\n") + fixtures.commit(root, "change upstream in mixed graph") + + expect_components(affected(root, base), ["network"]) + expanded = affected(root, base, "--include-dependents", "--flatten") + expect_components(expanded, ["api", "app", "native", "network"]) + filtered = affected(root, base, "--stack=live/prod", "--include-dependents", "--flatten") + expect_components(filtered, ["api", "app", "network"]) + plan = dry_plan(root, base, "--include-dependents=1") + fixtures.check("Would plan network in" in plan and "Would plan app in" in plan, plan) + fixtures.check("Would plan api in" not in plan and "Would plan native in" not in plan, plan) + + +def test_project_root(root): + # Watch paths use Atmos base_path, not the CLI's working directory. + fixtures.write(root, "project/live/prod/network/terragrunt.hcl", unit()) + fixtures.write(root, "project/modules/unit/main.tf", 'output "vpc_id" { value = "fixture" }\n') + base = fixtures.commit(root, "project under base_path") + fixtures.check(not affected(root, base), "Unchanged subdirectory inventory selected") + fixtures.write(root, "project/modules/unit/main.tf", 'output "vpc_id" { value = "changed" }\n') + fixtures.commit(root, "change module under base_path") + expect_components(affected(root, base), ["network"]) + + +def main(): + package = fs.resolve(".") + work = fixtures.workspace("atmos-terragrunt-affected-") + for name, scenario in [ + ("rewired-dependency", test_rewired_dependency), + ("deleted-unit", test_deleted_unit), + ("file-watches-and-rename", test_file_watches_and_rename), + ]: + root = work + "/" + name + fixtures.project(root, package) + scenario(root) + ui.success(name) + + fixtures.project(work + "/nested", package) + test_nested_stacks(work + "/nested", package) + config = fixtures.project(work + "/mixed", package) + test_mixed_graph(work + "/mixed", config) + fixtures.project(work + "/subdirectory", package, base_path="project") + test_project_root(work + "/subdirectory") + ui.success("Nested stacks, mixed graphs, and project-relative watches") diff --git a/plugins/terragrunt/scripts/build.py b/plugins/terragrunt/scripts/build.py deleted file mode 100644 index df2cf979785..00000000000 --- a/plugins/terragrunt/scripts/build.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -"""Build and test the native plugin with its pinned, locally maintained facade.""" -import argparse -import json -from pathlib import Path -import subprocess - -parser = argparse.ArgumentParser() -parser.add_argument("--test", action="store_true", help="Run the plugin and facade tests after building") -args = parser.parse_args() -package = Path(__file__).resolve().parents[1] -repository = package.parents[1] -work = repository / ".context" / "terragrunt-plugin-build" -work.mkdir(parents=True, exist_ok=True) - - -def go(*arguments, cwd=package, capture=False): - return subprocess.run(["go", *arguments], cwd=cwd, check=True, - text=True, capture_output=capture).stdout - - -platform = json.loads(go("env", "-json", "GOOS", "GOARCH", capture=True)) -suffix = ".exe" if platform["GOOS"] == "windows" else "" -output = package / "bin" / f"{platform['GOOS']}-{platform['GOARCH']}" / f"plugin{suffix}" -output.parent.mkdir(parents=True, exist_ok=True) -go("build", "-p=2", "-ldflags=-w", "-o", str(output), ".") -print(output, flush=True) -if args.test: - go("test", "-p=2", "-ldflags=-w", "./...", - "-coverpkg=./...,github.com/gruntwork-io/terragrunt/pkg/atmosbridge", - f"-coverprofile={work / 'plugin.cover'}") - go("test", "-p=2", "-ldflags=-w", "./...", - f"-coverprofile={work / 'bridge.cover'}", cwd=package / "bridge") diff --git a/plugins/terragrunt/scripts/fixtures.star b/plugins/terragrunt/scripts/fixtures.star new file mode 100644 index 00000000000..2b757f8cf10 --- /dev/null +++ b/plugins/terragrunt/scripts/fixtures.star @@ -0,0 +1,96 @@ +# Shared helpers for disposable CLI fixtures. Importing this module has no effects. + +def check(condition, message): + # Preserve captured CLI diagnostics in the Atmos test report on failure. + if not condition: + fail(message) + + +def workspace(prefix): + root = fs.mkdtemp(prefix=prefix) + # Cleanup runs even when a later command or assertion fails. + defer(fs.remove, root, recursive=True) + return root + + +def copy_tree(source, target): + # Use native filesystem operations rather than platform-specific shell tools. + fs.mkdir(target, parents=True) + for path in fs.glob(source + "/*"): + name = path.replace("\\", "/").rsplit("/", 1)[1] + destination = target + "/" + name + if fs.stat(path).is_dir: + copy_tree(path, destination) + else: + fs.write_file(destination, fs.read_file(path)) + + +def configuration(package, scope="live/**", binary="terraform", base_path="."): + return { + "base_path": base_path, + "components": { + "terraform": { + "base_path": "components/terraform", + "command": binary, + "terragrunt": { + "enabled": True, + "mode": "native", + "discovery": { + "enabled": True, + "included_paths": [scope], + }, + }, + }, + }, + "plugins": {"packages": {"terragrunt": {"path": package}}}, + } + + +def write(root, path, content): + target = root + "/" + path + fs.mkdir(target.rsplit("/", 1)[0], parents=True) + fs.write_file(target, content, overwrite=True) + + +def run(root, arguments, revision="r1"): + # Call the running Atmos binary with its normal process and output handling. + result = atmos.run( + arguments, + working_directory=root, + env={ + "NO_COLOR": "1", + "ATMOS_TELEMETRY_ENABLED": "false", + "TF_IN_AUTOMATION": "true", + "POC_REVISION": revision, + }, + output="capture", + check=False, + ) + check(result.exit_code == 0, " ".join(arguments) + ":\n" + result.stdout + result.stderr) + return result + + +def git(root, *arguments): + # Disable signing only for disposable fixture commits, never the source repo. + result = exec.run( + ["git", "-c", "commit.gpgsign=false"] + list(arguments), + working_directory=root, + output="capture", + ) + return result.stdout.strip() + + +def commit(root, label): + git(root, "add", ".") + git(root, "commit", "-m", label) + return git(root, "rev-parse", "HEAD") + + +def project(root, package, base_path="."): + fs.mkdir(root, parents=True) + git(root, "init", "-b", "main") + git(root, "config", "user.name", "Atmos fixture") + git(root, "config", "user.email", "fixture@example.invalid") + config = configuration(package, base_path=base_path) + write(root, "atmos.yaml", json.encode(config)) + return config diff --git a/plugins/terragrunt/scripts/native.star b/plugins/terragrunt/scripts/native.star new file mode 100644 index 00000000000..b6bd531d421 --- /dev/null +++ b/plugins/terragrunt/scripts/native.star @@ -0,0 +1,117 @@ +# Opt-in CLI integration tests with real Terraform/OpenTofu and local state. +# Fixtures use built-in terraform_data resources, never cloud resources. +fixtures = module.load("fixtures.star") + + +def snapshot(root): + # Detect any project writes by inventory commands before execution begins. + return { + path: digest.sha256(fs.read_file(path)) + for path in fs.glob(root + "/**/*") + if fs.stat(path).is_file + } + + +def prepare_fixture(work, package, binary, case): + root = work + "/" + case.name + fixtures.copy_tree(package + "/fixtures/" + case.name, root) + config = fixtures.configuration(package, scope=case.scope, binary=binary) + fixtures.write(root, "atmos.yaml", json.encode(config)) + return struct(root=root, case=case) + + +def terraform(fixture, operation, arguments=[], revision="r1"): + command = ["terraform", operation, "--all", "-s", fixture.case.stack, "--"] + result = fixtures.run( + fixture.root, + command + arguments + ["-no-color"], + revision=revision, + ) + return result.stdout + + +def verify_read_only_inventory(fixture): + before = snapshot(fixture.root) + result = fixtures.run(fixture.root, ["list", "instances", "--format=json"]) + instances = json.decode(result.stdout) + components = [row["Component"] for row in instances] + stacks_match = all([row["Stack"] == fixture.case.stack for row in instances]) + fixtures.check(components == fixture.case.expected, "Unexpected instances") + fixtures.check(stacks_match, "Unexpected stack names") + + fixtures.run(fixture.root, ["list", "stacks", "--format=json"]) + result = fixtures.run(fixture.root, ["describe", "stacks", "--format=json"]) + fixtures.check(fixture.case.stack in json.decode(result.stdout), "Stack not described") + fixtures.check(before == snapshot(fixture.root), "Discovery changed project files") + + +def apply_and_verify_unchanged_plan(fixture): + terraform(fixture, "apply", ["-auto-approve"]) + # Exit two indicates drift; fixtures.run requires zero from this plan. + plan = terraform(fixture, "plan", ["-detailed-exitcode"]) + fixtures.check(plan.count("No changes.") == 4, plan) + state_files = fs.glob(fixture.root + fixture.case.state_pattern) + fixtures.check(len(state_files) == 4, "Expected four local state files") + return state_files + + +def verify_fresh_dependency_outputs(fixture, state_files): + # A changed network input must reach app through database in this same apply. + terraform(fixture, "apply", ["-auto-approve"], revision="r2") + values = [ + json.decode(fs.read_file(path))["outputs"]["value"]["value"] + for path in state_files + ] + app = [value for value in values if value["unit"] == "app"][0] + database = app["upstream"]["database"] + network = database["upstream"]["network"] + fixtures.check(network["revision"] == "r2", "Dependency outputs were stale") + + +def destroy_and_verify_empty_state(fixture, state_files): + # Exercise reverse dependency ordering, then inspect every unit's local state. + terraform(fixture, "destroy", ["-auto-approve"]) + for path in state_files: + state = json.decode(fs.read_file(path)) + fixtures.check(not state["resources"], "Destroy left local resources") + + +def run_fixture(work, package, binary, case): + fixture = prepare_fixture(work, package, binary, case) + verify_read_only_inventory(fixture) + if case.name == "advanced": + # Command-scoped mocks permit a plan before the dependencies are applied. + terraform(fixture, "plan") + state_files = apply_and_verify_unchanged_plan(fixture) + if case.name == "advanced": + verify_fresh_dependency_outputs(fixture, state_files) + destroy_and_verify_empty_state(fixture, state_files) + ui.success(case.name + ": inventory, apply, unchanged plans, outputs, reverse destroy") + + +def main(): + package = fs.resolve(".") + # Prefer OpenTofu and pass the absolute executable through Atmos preparation. + binary = exec.which("tofu") or exec.which("terraform") + fixtures.check(binary != None, "Install OpenTofu or Terraform for integration tests") + work = fixtures.workspace("atmos-terragrunt-native-") + cases = [ + struct( + name="advanced", + scope="live/dev/**", + stack="live/dev", + expected=["app", "cache", "database", "network"], + state_pattern="/live/dev/*/state/terraform.tfstate", + ), + struct( + name="explicit-stack", + scope="live/**", + stack="live", + expected=["dev/app", "dev/network", "prod/app", "prod/network"], + state_pattern="/state/*/*.tfstate", + ), + ] + for case in cases: + run_fixture(work, package, binary, case) + +main() diff --git a/website/blog/2026-10-29-native-terragrunt-discovery.mdx b/website/blog/2026-10-29-native-terragrunt-discovery.mdx index 7e085f71357..79fb6fcedae 100644 --- a/website/blog/2026-10-29-native-terragrunt-discovery.mdx +++ b/website/blog/2026-10-29-native-terragrunt-discovery.mdx @@ -4,15 +4,17 @@ title: "Experimental Native Terragrunt Discovery" authors: [osterman] tags: [feature, experimental] --- -Adopting another infrastructure orchestrator can require rewriting an existing Terragrunt hierarchy before running a single plan. Experimental native Terragrunt discovery lets Atmos list local units and execute them through its Terraform lifecycle while retaining their HCL configuration. +Teams with working Terragrunt configurations should be able to use Atmos without refactoring those configurations into Atmos conventions. Experimental native Terragrunt support is a step toward that: keep the HCL, units, and stacks you have, and adopt the Atmos capabilities you need alongside them. ## The Problem -Terragrunt units can share includes, depend on each other's outputs, and originate from nested stack templates. Adopting those units requires preserving their relationships and state locations as well as their input values. +You already use Terragrunt to manage Terraform. Now you want Atmos for toolchain management, vendoring, scaffolding, authentication, Kubernetes, Helm, and the rest of your infrastructure. You want to use what you have, without first translating every Terragrunt unit into Atmos YAML. -## The Fix +Supporting existing Terragrunt configuration makes Atmos easier to get started with. Teams can adopt it incrementally, without choosing between Atmos and Terragrunt. + +## Use Atmos with Your Existing Terragrunt Configuration An explicitly enabled configuration plugin exposes discovered units as Terraform components. Atmos owns execution order, authentication setup, toolchain selection, and working directories. The native path evaluates HCL without launching the Terragrunt executable. @@ -20,23 +22,14 @@ Discovery uses an in-memory expansion for explicit stacks. Planning and applying ## How to Use It -This implementation requires a local development build; the Terragrunt plugin is not yet published. Follow the [package setup and fixture instructions](https://github.com/cloudposse/atmos/tree/feat/component-plugin-contracts/plugins/terragrunt#build-and-run) before enabling discovery: - -```yaml -components: - terraform: - base_path: components/terraform - command: tofu - terragrunt: - enabled: true - mode: native - discovery: - enabled: true - included_paths: [live/**] -plugins: - packages: - terragrunt: - path: /absolute/path/to/plugins/terragrunt +This implementation requires a local development build; the Terragrunt plugin is not yet published. Follow the [package setup and fixture instructions](https://github.com/cloudposse/atmos/tree/feat/component-plugin-contracts/plugins/terragrunt#build-and-run) then enable discovery with [config set](/cli/commands/config/config-set): + +```shell +atmos config set plugins.packages.terragrunt.path /absolute/path/to/plugins/terragrunt +atmos config set components.terraform.terragrunt.enabled true +atmos config set components.terraform.terragrunt.mode native +atmos config set --type=yaml components.terraform.terragrunt.discovery.included_paths '["live/**"]' +atmos config set components.terraform.terragrunt.discovery.enabled true ``` Use [list instances](/cli/commands/list/list-instances) to inspect the discovered units and [Terraform plan](/cli/commands/terraform/plan) to plan them: @@ -46,7 +39,9 @@ atmos list instances atmos terraform plan --all ``` -The current scope covers local module sources and local backends. Remote sources and backends, Terragrunt hooks, saved-plan apply, state-function integration, and Terragrunt-aware affected selection remain incomplete. Do not assume full Terragrunt compatibility. The package instructions list the supported and rejected constructs. +Affected selection compares units and dependency relationships at both Git revisions. Shared includes, local module files, and explicit stack definitions can mark their consuming units affected; `--include-dependents` also follows the dependency graph. Reads inside unevaluated input expressions and arbitrary dynamic glob patterns still need additional source tracking. + +The current scope covers local module sources and local backends. Remote sources and backends, Terragrunt hooks, saved-plan apply, and state-function integration remain incomplete. Do not assume full Terragrunt compatibility. The package instructions list the supported and rejected constructs. ## Get Involved From f5ab66381fff667849d915f4fcb06a09f42a1c53 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 31 Oct 2026 18:41:15 -0500 Subject: [PATCH 06/52] test(describe): refresh describe snapshots for the merged Terraform config key order Terraform settings now marshal through a merge that places provider-owned sections beside the built-in keys, so the keys print in sorted order. Only the order of keys changes; every key and value is the same. Regenerated with -regenerate-snapshots. --- ...-s_dev_(stack-names_example).stdout.golden | 24 +++++++------- ...uction_(stack-names_example).stdout.golden | 24 +++++++------- ...v_(native-terraform_example).stdout.golden | 26 +++++++-------- ..._vpc_-s_my-legacy-prod-stack.stdout.golden | 24 +++++++------- ...omponent_vpc_-s_no-name-prod.stdout.golden | 24 +++++++------- ...n_(native-terraform_example).stdout.golden | 26 +++++++-------- ...mmands_atmos_describe_config.stdout.golden | 24 +++++++------- ...rets-masking_describe_config.stdout.golden | 32 +++++++++---------- 8 files changed, 102 insertions(+), 102 deletions(-) diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_dev_(stack-names_example).stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_dev_(stack-names_example).stdout.golden index 0226c5c5bc1..403e9ad0053 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_dev_(stack-names_example).stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_dev_(stack-names_example).stdout.golden @@ -3,22 +3,23 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": true, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": true, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,21 +27,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_production_(stack-names_example).stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_production_(stack-names_example).stdout.golden index aad2beba161..c232871d729 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_production_(stack-names_example).stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_mock_-s_production_(stack-names_example).stdout.golden @@ -3,22 +3,23 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": true, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": true, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,21 +27,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_dev_(native-terraform_example).stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_dev_(native-terraform_example).stdout.golden index e2be9f43c91..8ba984642bd 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_dev_(native-terraform_example).stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_dev_(native-terraform_example).stdout.golden @@ -3,22 +3,25 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": true, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" + "deploy_run_init": true, + "flags": { + "lock_timeout": "5m" }, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,23 +29,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": { - "lock_timeout": "5m" - } + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden index 7bbeb593c76..db6d5ca38b5 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_my-legacy-prod-stack.stdout.golden @@ -3,22 +3,23 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": false, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": false, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,21 +27,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden index c1ceb66a462..dc97553cc29 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_no-name-prod.stdout.golden @@ -3,22 +3,23 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": false, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": false, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,21 +27,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_production_(native-terraform_example).stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_production_(native-terraform_example).stdout.golden index 858a7b9018e..fff1ac6ba5e 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_production_(native-terraform_example).stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_component_vpc_-s_production_(native-terraform_example).stdout.golden @@ -3,22 +3,25 @@ "base_path": "./", "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": true, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" + "deploy_run_init": true, + "flags": { + "lock_timeout": "5m" }, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -26,23 +29,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": { - "lock_timeout": "5m" - } + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden index 94d5d061aab..c48e6babc32 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden @@ -12,22 +12,23 @@ }, "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": true, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": true, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -35,21 +36,20 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", diff --git a/tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden b/tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden index 8516cad17b1..369bc3f500b 100644 --- a/tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_secrets-masking_describe_config.stdout.golden @@ -12,22 +12,23 @@ }, "components": { "terraform": { - "base_path": "components/terraform", - "apply_auto_approve": false, "append_user_agent": "Atmos/test (Cloud Posse; +https://atmos.tools)", - "deploy_run_init": false, - "init_run_reconfigure": true, + "apply_auto_approve": false, "auto_generate_backend_file": false, "auto_generate_files": false, + "auto_provision_workdir_for_outputs": true, + "base_path": "components/terraform", + "ci": {}, "command": "tofu", - "shell": { - "prompt": "" - }, + "deploy_run_init": false, + "flags": {}, "init": { "pass_vars": false, "mode": "auto", "upgrade": "auto" }, + "init_run_reconfigure": true, + "lint": {}, "mocks": { "mode": "fallback" }, @@ -35,25 +36,24 @@ "skip_planfile": false }, "plan_diff": {}, - "lint": {}, "planfiles": { "default": "" }, + "platforms": [ + "darwin_arm64", + "linux_amd64" + ], "plugin_cache": true, + "shell": { + "prompt": "" + }, "ui": { "enabled": false, "compact": null, "show_attribute_bar": null, "max_lines": 0 }, - "auto_provision_workdir_for_outputs": true, - "ci": {}, - "workspace": {}, - "platforms": [ - "darwin_arm64", - "linux_amd64" - ], - "flags": {} + "workspace": {} }, "helmfile": { "base_path": "", From b0bbf3a2b42c736d915c6e972ef6fec0438b5d2b Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 1 Nov 2026 07:53:04 -0600 Subject: [PATCH 07/52] fix(terragrunt): repair CI for the plugin contracts layer - Use the newest Go any module requires in the pre-commit workflow, so go mod tidy can process plugins/terragrunt, and in the plugin package workflow so plugin builds get the same toolchain. - Compare stacked pull requests with the merge base of the default branch in the plugin release check, so a version bump is required once per stack rather than once per layer. Pushes and pull requests that target the default branch keep the provider's default base. - Patch InitCliConfigWithContext in the scheduler adapter tests; query and all now call it, and patching only the InitCliConfig wrapper no longer intercepts them. - Raise go-jose/v4 to v4.1.6 in the plugin and bridge modules. - Name configuration artifacts with a non-cryptographic FNV-1a digest of the stack and component instead of SHA-256. The name is a stable file identity, not a credential hash. - Compare get_terragrunt_dir() results as native paths in the environment test. - Report the affected rows and command stderr when the nested-stacks scenario fails, and cover mixed-separator paths in the discovery path helpers. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/plugin-packages.yaml | 17 ++++++++++++- .github/workflows/pre-commit.yml | 5 +++- pkg/component/terraform/configuration.go | 17 ++++++++++--- pkg/component/terraform/configuration_test.go | 12 +++++++++ pkg/component/terraform/utils_test.go | 17 ++++++++++--- plugins/terragrunt/bridge/go.mod | 2 +- plugins/terragrunt/bridge/go.sum | 4 +-- plugins/terragrunt/go.mod | 2 +- plugins/terragrunt/go.sum | 4 +-- .../internal/engine/discovery_paths_test.go | 25 +++++++++++++++++++ .../internal/engine/environment_test.go | 5 +++- .../internal/provider/boundaries_test.go | 24 ++++++++++++++++++ plugins/terragrunt/scripts/affected.star | 22 +++++++++++----- 13 files changed, 135 insertions(+), 21 deletions(-) diff --git a/.github/workflows/plugin-packages.yaml b/.github/workflows/plugin-packages.yaml index fd5317a3ea1..28bc4fc8a5b 100644 --- a/.github/workflows/plugin-packages.yaml +++ b/.github/workflows/plugin-packages.yaml @@ -24,12 +24,25 @@ jobs: add-to-path: 'true' - uses: ./.github/actions/setup-go-cache with: + # Official plugins build in their own modules. plugins/terragrunt requires the newest Go in the repository. + go-version-file: plugins/terragrunt/go.mod cache: 'false' + # A stacked pull request targets its parent branch, so the default comparison base would demand a + # version bump in every layer that touches a package input. Compare such pull requests with the merge + # base of the default branch instead, the same range the whole stack is released against. Pushes and + # pull requests that target the default branch keep the provider's default base. + - name: Resolve the release comparison base + id: base + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref != github.event.repository.default_branch + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + run: echo "ref=$(git merge-base HEAD "origin/${DEFAULT_BRANCH}")" >> "$GITHUB_OUTPUT" - name: Check plugin releases env: GOCACHE: ${{ runner.temp }}/plugin-go-build GOMODCACHE: ${{ runner.temp }}/plugin-go-mod - run: atmos plugin release --inventory plugins/releases.yaml --check + RELEASE_BASE: ${{ steps.base.outputs.ref }} + run: atmos plugin release --inventory plugins/releases.yaml --check ${RELEASE_BASE:+--base "$RELEASE_BASE"} release: needs: check @@ -56,6 +69,8 @@ jobs: add-to-path: 'true' - uses: ./.github/actions/setup-go-cache with: + # Official plugins build in their own modules. plugins/terragrunt requires the newest Go in the repository. + go-version-file: plugins/terragrunt/go.mod cache: 'false' - name: Publish plugin releases and reconcile the catalog env: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d8d63730a8e..ad273d4ba22 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -47,7 +47,10 @@ jobs: - name: Set up Go uses: ./.github/actions/setup-go-cache with: - go-version-file: go.mod + # Use the newest Go any module in the repository requires. plugins/terragrunt requires a newer Go + # than the root module, and go mod tidy runs with GOTOOLCHAIN=local, so a Go taken from the root + # go.mod cannot tidy that module. The newer toolchain still builds the root module. + go-version-file: plugins/terragrunt/go.mod - name: Install Go tools env: diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index 149d4462ad9..a98f7ef4082 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -2,8 +2,9 @@ package terraform import ( "context" - "crypto/sha256" + "encoding/hex" "fmt" + "hash/fnv" "maps" "os/exec" "path/filepath" @@ -62,8 +63,18 @@ func configurationArtifactName(info *schema.ConfigAndStacksInfo, suffix string) if _, owned := info.ComponentSettingsSection["configuration"]; !owned { return "", false } - identity := sha256.Sum256([]byte(info.Stack + "\x00" + info.ComponentFromArg)) - return fmt.Sprintf("atmos-%x%s", identity, suffix), true + return "atmos-" + configurationIdentity(info.Stack, info.ComponentFromArg) + suffix, true +} + +// configurationIdentity names a stack and component pair for artifact files. The name must be the same in +// every process (a plan in one run is applied by another), so it is a plain content digest with no secret. +// It identifies a component for file naming only: it is not a credential hash and gives no security +// guarantee, which is why a non-cryptographic 128-bit FNV-1a digest is used instead of SHA-256. +func configurationIdentity(stack, component string) string { + digest := fnv.New128a() + // Writing to a hash never fails. + _, _ = digest.Write([]byte(stack + "\x00" + component)) + return hex.EncodeToString(digest.Sum(nil)) } // prepareConfigurationEnvironment applies the same authentication, RC, cache, diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index e0531d271a5..0f9621bf038 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -75,3 +75,15 @@ func TestConfigurationArtifactNames(t *testing.T) { _, owned := configurationArtifactName(info, ".plan") require.False(t, owned) } + +// A plan written by one process is applied by another, so the artifact name must never depend on +// process state. The digest is pinned so a change to the naming scheme is deliberate. +func TestConfigurationIdentityIsStableAndSeparatesFields(t *testing.T) { + const pinned = "060d8d2f24f80685c67572911d8f2cd5" + first := configurationIdentity("live/dev", "region/app") + require.Equal(t, pinned, first) + require.Equal(t, first, configurationIdentity("live/dev", "region/app")) + require.NotEqual(t, first, configurationIdentity("live/dev", "region/app2")) + // The separator keeps adjacent fields from sliding into each other. + require.NotEqual(t, configurationIdentity("ab", "c"), configurationIdentity("a", "bc")) +} diff --git a/pkg/component/terraform/utils_test.go b/pkg/component/terraform/utils_test.go index 7a7a3606d3e..507cc02bbbb 100644 --- a/pkg/component/terraform/utils_test.go +++ b/pkg/component/terraform/utils_test.go @@ -204,7 +204,9 @@ func TestExecuteTerraformQueryRoutesThroughSchedulerAdapter(t *testing.T) { patches := gomonkey.NewPatches() defer patches.Reset() - patches.ApplyFunc(cfg.InitCliConfig, func(info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + // The query path loads configuration through InitCliConfigWithContext. InitCliConfig is only a + // wrapper around it, so patching the wrapper would not intercept this call. + patches.ApplyFunc(cfg.InitCliConfigWithContext, func(_ context.Context, info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { require.Equal(t, "dev", info.Stack) require.True(t, processStacks) return schema.AtmosConfiguration{}, nil @@ -298,9 +300,18 @@ func TestExecuteTerraformAffectedRoutesThroughSchedulerAdapter(t *testing.T) { patches := gomonkey.NewPatches() defer patches.Reset() - patches.ApplyFunc(cfg.InitCliConfig, func(info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + // Affected selection loads configuration through InitCliConfig; the query it schedules uses + // the context variant. Patch both entry points. + checkInit := func(info schema.ConfigAndStacksInfo, processStacks bool) { require.Equal(t, "plan", info.SubCommand) require.True(t, processStacks) + } + patches.ApplyFunc(cfg.InitCliConfig, func(info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + checkInit(info, processStacks) + return schema.AtmosConfiguration{}, nil + }) + patches.ApplyFunc(cfg.InitCliConfigWithContext, func(_ context.Context, info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + checkInit(info, processStacks) return schema.AtmosConfiguration{}, nil }) patches.ApplyFuncVar(&testExecutor(t).services.GetAffectedComponents, func(args *DescribeAffectedCmdArgs) ([]schema.Affected, error) { @@ -397,7 +408,7 @@ func TestExecuteTerraformQueryPropagatesSetupErrors(t *testing.T) { var schedulerErr error describePatches := gomonkey.NewPatches() defer describePatches.Reset() - describePatches.ApplyFunc(cfg.InitCliConfig, func(schema.ConfigAndStacksInfo, bool) (schema.AtmosConfiguration, error) { + describePatches.ApplyFunc(cfg.InitCliConfigWithContext, func(context.Context, schema.ConfigAndStacksInfo, bool) (schema.AtmosConfiguration, error) { return schema.AtmosConfiguration{}, initErr }) describePatches.ApplyFuncVar(&executor.services.ExecuteDescribeStacksWithMocks, func( diff --git a/plugins/terragrunt/bridge/go.mod b/plugins/terragrunt/bridge/go.mod index 6a5271b8e95..8ffaf34646a 100644 --- a/plugins/terragrunt/bridge/go.mod +++ b/plugins/terragrunt/bridge/go.mod @@ -95,7 +95,7 @@ require ( github.com/felixge/httpsnoop v1.1.0 // indirect github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e // indirect github.com/getsops/sops/v3 v3.13.3 // indirect - github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-jose/go-jose/v4 v4.1.6 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect diff --git a/plugins/terragrunt/bridge/go.sum b/plugins/terragrunt/bridge/go.sum index 27ac1b34140..1120e5f0636 100644 --- a/plugins/terragrunt/bridge/go.sum +++ b/plugins/terragrunt/bridge/go.sum @@ -275,8 +275,8 @@ github.com/gitsight/go-vcsurl v1.0.1 h1:wkijKsbVg9R2IBP97U7wOANeIW9WJJKkBwS9Xqll github.com/gitsight/go-vcsurl v1.0.1/go.mod h1:qRFdKDa/0Lh9MT0xE+qQBYZ/01+mY1H40rZUHR24X9U= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= -github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= -github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= +github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= diff --git a/plugins/terragrunt/go.mod b/plugins/terragrunt/go.mod index f811afa524a..66df99a36e2 100644 --- a/plugins/terragrunt/go.mod +++ b/plugins/terragrunt/go.mod @@ -102,7 +102,7 @@ require ( github.com/felixge/httpsnoop v1.1.0 // indirect github.com/getsops/gopgagent v0.0.0-20241224165529-7044f28e491e // indirect github.com/getsops/sops/v3 v3.13.3 // indirect - github.com/go-jose/go-jose/v4 v4.1.4 // indirect + github.com/go-jose/go-jose/v4 v4.1.6 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect diff --git a/plugins/terragrunt/go.sum b/plugins/terragrunt/go.sum index 890b0287e6b..afc79b62e54 100644 --- a/plugins/terragrunt/go.sum +++ b/plugins/terragrunt/go.sum @@ -275,8 +275,8 @@ github.com/gitsight/go-vcsurl v1.0.1 h1:wkijKsbVg9R2IBP97U7wOANeIW9WJJKkBwS9Xqll github.com/gitsight/go-vcsurl v1.0.1/go.mod h1:qRFdKDa/0Lh9MT0xE+qQBYZ/01+mY1H40rZUHR24X9U= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= -github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= -github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= +github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= diff --git a/plugins/terragrunt/internal/engine/discovery_paths_test.go b/plugins/terragrunt/internal/engine/discovery_paths_test.go index 3a6e188b094..daad05bff78 100644 --- a/plugins/terragrunt/internal/engine/discovery_paths_test.go +++ b/plugins/terragrunt/internal/engine/discovery_paths_test.go @@ -87,3 +87,28 @@ func TestDiscoveryReportsBrokenStacksAndMissingDependencies(t *testing.T) { }) } } + +// Terragrunt builds stack template sources by concatenating a native directory with a slash-separated +// suffix, for example "${values.project_root}/catalog/units/app". On Windows that yields mixed separators, +// and the discovery helpers must treat those paths as equal to their native spelling. +func TestPathHelpersAcceptMixedSeparators(t *testing.T) { + root, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + nativeUnit := filepath.Join(root, "catalog", "units", "app") + for name, spelling := range map[string]string{ + "native": nativeUnit, + "slash suffix": root + "/catalog/units/app", + "slash relative": root + string(filepath.Separator) + filepath.FromSlash("catalog/units/app"), + "redundant": root + "/catalog/./units/app", + } { + t.Run(name, func(t *testing.T) { + require.True(t, plainLocalSource(spelling)) + require.True(t, within(spelling, root)) + require.False(t, within(root, spelling)) + require.Equal(t, nativeUnit, localPath("ignored", spelling)) + }) + } + // A relative source resolves against the stack directory in native form. + require.Equal(t, nativeUnit, localPath(root, "catalog/units/app")) + require.Equal(t, nativeUnit, localPath(filepath.Join(root, "live"), "../catalog/units/app")) +} diff --git a/plugins/terragrunt/internal/engine/environment_test.go b/plugins/terragrunt/internal/engine/environment_test.go index 87bccab478d..cd939c8c704 100644 --- a/plugins/terragrunt/internal/engine/environment_test.go +++ b/plugins/terragrunt/internal/engine/environment_test.go @@ -79,7 +79,10 @@ inputs = { for outcome := range outcomes { require.NoError(t, outcome.err) result, profile := outcome.result, outcome.profile - require.Equal(t, filepath.ToSlash(physical), result.Inputs["directory"]) + // get_terragrunt_dir() returns native separators, which are backslashes on Windows. + directory, isString := result.Inputs["directory"].(string) + require.True(t, isString) + require.Equal(t, filepath.Clean(physical), filepath.Clean(filepath.FromSlash(directory))) require.Equal(t, profile, result.Inputs["direct"]) child := result.Inputs["child"].(map[string]any) require.Equal(t, filepath.Clean(physical), filepath.Clean(child["cwd"].(string))) diff --git a/plugins/terragrunt/internal/provider/boundaries_test.go b/plugins/terragrunt/internal/provider/boundaries_test.go index 87f31b5cbfb..18826595680 100644 --- a/plugins/terragrunt/internal/provider/boundaries_test.go +++ b/plugins/terragrunt/internal/provider/boundaries_test.go @@ -127,3 +127,27 @@ func TestStateAndPreparationRejectEscapedProvenance(t *testing.T) { _, err = p.Prepare(t.Context(), req) require.Equal(t, codes.Unimplemented, status.Code(err)) } + +// Watched paths reach the host as slash-separated, project-relative strings. Terragrunt reports paths with +// mixed separators on Windows (a native directory plus a slash-separated suffix), so every spelling of the +// same file must normalize to one slash-separated relative path. +func TestRelativeNormalizesMixedSeparators(t *testing.T) { + // Terragrunt reports physical paths, so compare from the physical root. + root, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + for name, spelling := range map[string]string{ + "native": filepath.Join(root, "live", "terragrunt.stack.hcl"), + "slash suffix": root + "/live/terragrunt.stack.hcl", + "redundant": root + "/live/./sub/../terragrunt.stack.hcl", + } { + t.Run(name, func(t *testing.T) { + got, err := relative(root, spelling) + require.NoError(t, err) + require.Equal(t, "live/terragrunt.stack.hcl", got) + }) + } + for _, outside := range []string{filepath.Dir(root), root + "/../elsewhere/terragrunt.hcl"} { + _, err := relative(root, outside) + require.ErrorIs(t, err, ErrUnsupported) + } +} diff --git a/plugins/terragrunt/scripts/affected.star b/plugins/terragrunt/scripts/affected.star index b6353716040..d5f87ad8c9b 100644 --- a/plugins/terragrunt/scripts/affected.star +++ b/plugins/terragrunt/scripts/affected.star @@ -16,17 +16,26 @@ def seed_units(root): return fixtures.commit(root, "initial units") -def affected(root, ref, *flags): +def affected_result(root, ref, *flags): + # Returns the decoded rows together with the command's stderr, so a failing expectation can explain itself. result = fixtures.run(root, [ "describe", "affected", "--base", ref, "--format=json", ] + list(flags)) fixtures.check("treating BASE as empty" not in result.stderr, result.stderr) - return json.decode(result.stdout) + return struct(rows=json.decode(result.stdout), stderr=result.stderr) + + +def affected(root, ref, *flags): + return affected_result(root, ref, *flags).rows -def expect_components(rows, expected): +def expect_components(rows, expected, stderr=""): actual = sorted([row["component"] for row in rows]) - fixtures.check(actual == sorted(expected), "Unexpected affected components: " + str(actual)) + message = "Unexpected affected components: " + str(actual) + "\nExpected: " + str(sorted(expected)) + message += "\nAffected rows: " + json.encode(rows) + if stderr: + message += "\nCommand stderr:\n" + stderr + fixtures.check(actual == sorted(expected), message) def dry_plan(root, base, *flags): @@ -103,9 +112,10 @@ def test_nested_stacks(root, package): path = "live/terragrunt.stack.hcl" fixtures.write(root, path, fs.read_file(root + "/" + path) + "\n# changed definition\n") fixtures.commit(root, "change explicit root") - expect_components(affected(root, base), [ + changed = affected_result(root, base, "--logs-level=Debug") + expect_components(changed.rows, [ "dev/app", "dev/network", "prod/app", "prod/network", - ]) + ], changed.stderr) fixtures.check(not fs.exists(root + "/live/.terragrunt-stack"), "Discovery wrote generated stacks") fixtures.check(not fs.glob(root + "/**/*.tfstate"), "Discovery created state") From 2fc4697a0893e087018dc60ac7d5b3a553eeebee Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 13:07:20 -0600 Subject: [PATCH 08/52] chore(deps): tidy go.sum after rebasing onto main The rebase onto main kept go-ordered-map checksums that main's gomplate v5 migration removed; nothing in this layer requires them. Co-Authored-By: Claude Opus 5.5 --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 55e29ebe176..a80193115f5 100644 --- a/go.sum +++ b/go.sum @@ -1533,8 +1533,6 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= -github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= github.com/wlynxg/chardet v1.0.5 h1:BNEolSEujJUtKwkaqNb0D6Ue+d7VTKTh5rXDyEdiipU= github.com/wlynxg/chardet v1.0.5/go.mod h1:q4N3YNbywQtX0u12Eh0+0LZB53Ayc7nOfHHaio+RcVA= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= From 4238aad7cb735b23c7f024455204056ae19389d8 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 16:32:03 -0600 Subject: [PATCH 09/52] fix(validate): validate discovered inventories without a YAML stack directory Run native discovery when stacks.base_path does not exist, and schema-validate exactly the manifests stacks.included_paths selects in a discovery-only project instead of skipping them. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks_test.go | 35 +++++++++++ internal/exec/validate_stacks.go | 70 +++++++++++++--------- 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index 31f4bc03590..1c861ef10f6 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -82,3 +82,38 @@ func TestConfigurationStacksRejectCollisionsAndErrors(t *testing.T) { require.Nil(t, raw) require.Nil(t, deferred) } + +func TestValidateStacksDiscoveryOnlyChecksSelectedManifests(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}}} + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + provider.EXPECT().Discover(gomock.Any()).Return(map[string]map[string]any{}, nil).AnyTimes() + config.ComponentConfigurations = provider + // The project root still holds a non-stack file that must never be scanned. + require.NoError(t, os.WriteFile(filepath.Join(root, "atmos.yaml"), []byte("not: [a stack manifest"), 0o600)) + selected := filepath.Join(root, "live.yaml") + require.NoError(t, os.WriteFile(selected, []byte("components:\n terraform:\n app:\n metadata:\n type: bogus\n"), 0o600)) + config.StackConfigFilesAbsolutePaths = []string{selected} + + err := ValidateStacks(config) + require.Error(t, err, "a manifest selected by stacks.included_paths must be schema-validated") + require.Contains(t, err.Error(), "live.yaml") + require.NotContains(t, err.Error(), "atmos.yaml") +} + +func TestValidateStacksMissingStacksDirStillRunsDiscovery(t *testing.T) { + root := t.TempDir() + missing := filepath.Join(root, "stacks") + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: missing, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Stacks.BasePath = "stacks" + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}}} + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + provider.EXPECT().Discover(gomock.Any()).Return(nil, errUtils.ErrPluginInvalidConfig) + config.ComponentConfigurations = provider + require.ErrorIs(t, ValidateStacks(config), errUtils.ErrPluginInvalidConfig) + + // Without discovery, a missing stacks directory remains a validation no-op. + plain := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: missing} + require.NoError(t, ValidateStacks(plain)) +} diff --git a/internal/exec/validate_stacks.go b/internal/exec/validate_stacks.go index bf931622fbb..7b1298b44d9 100644 --- a/internal/exec/validate_stacks.go +++ b/internal/exec/validate_stacks.go @@ -78,9 +78,14 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { // workflows and legitimately have no stacks directory. Validation is a // no-op in that case; a missing imported manifest is still reported later // once a stack base directory exists and manifests are discovered. + // Discovered components are still validated without a stacks directory. + stacksDirMissing := false if atmosConfig.StacksBaseAbsolutePath != "" { if _, err := os.Stat(atmosConfig.StacksBaseAbsolutePath); os.IsNotExist(err) { - return nil + if !atmosConfig.HasComponentDiscovery() { + return nil + } + stacksDirMissing = true } else if err != nil { return err } @@ -116,15 +121,6 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { } validationErrorMessages = append(validationErrorMessages, errorList...) - // A discovery-only project has no YAML stack directory. Do not treat the - // project root (and atmos.yaml itself) as a directory of stack manifests. - if atmosConfig.HasComponentDiscovery() && atmosConfig.Stacks.BasePath == "" { - if len(validationErrorMessages) > 0 { - return fmt.Errorf("%w: %s", errUtils.ErrStackManifestSchemaValidation, strings.Join(dedupeStrings(validationErrorMessages), "\n\n")) - } - return nil - } - // 2. Check all YAML stack manifests defined in the infrastructure // It will check YAML syntax and all the Atmos sections defined in the manifests @@ -162,25 +158,7 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { manifestSchema.Manifest) } - // Include (process and validate) all YAML files in the `stacks` folder in all subfolders - includedPaths := []string{"**/*"} - // Don't exclude any YAML files for validation except template files and user-configured exclusions - excludedPaths := []string{ - // Exclude template files from validation since they may contain invalid YAML before being rendered - "**/*.tmpl", - "**/*.yaml.tmpl", - "**/*.yml.tmpl", - } - // Also exclude paths specified in the atmos.yaml stacks.excluded_paths config - // This prevents non-Atmos YAML files (e.g., Helm Chart.yaml) from being validated as stack manifests - excludedPaths = append(excludedPaths, atmosConfig.Stacks.ExcludedPaths...) - - includeStackAbsPaths, err := u.JoinPaths(atmosConfig.StacksBaseAbsolutePath, includedPaths) - if err != nil { - return err - } - - stackConfigFilesAbsolutePaths, _, err := cfg.FindAllStackConfigsInPaths(atmosConfig, includeStackAbsPaths, excludedPaths) + stackConfigFilesAbsolutePaths, err := stackManifestsToValidate(atmosConfig, stacksDirMissing) if err != nil { return err } @@ -275,6 +253,40 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { return nil } +// stackManifestsToValidate returns the YAML manifests whose schema is validated. +// A discovery-only project has no YAML stack directory, so it validates exactly +// the manifests that stacks.included_paths selected instead of treating the +// project root (and atmos.yaml itself) as a directory of stack manifests. +func stackManifestsToValidate(atmosConfig *schema.AtmosConfiguration, stacksDirMissing bool) ([]string, error) { + if stacksDirMissing { + return nil, nil + } + if atmosConfig.HasComponentDiscovery() && atmosConfig.Stacks.BasePath == "" { + return atmosConfig.StackConfigFilesAbsolutePaths, nil + } + + // Include (process and validate) all YAML files in the `stacks` folder in all subfolders + includedPaths := []string{"**/*"} + // Don't exclude any YAML files for validation except template files and user-configured exclusions + excludedPaths := []string{ + // Exclude template files from validation since they may contain invalid YAML before being rendered + "**/*.tmpl", + "**/*.yaml.tmpl", + "**/*.yml.tmpl", + } + // Also exclude paths specified in the atmos.yaml stacks.excluded_paths config + // This prevents non-Atmos YAML files (e.g., Helm Chart.yaml) from being validated as stack manifests + excludedPaths = append(excludedPaths, atmosConfig.Stacks.ExcludedPaths...) + + includeStackAbsPaths, err := u.JoinPaths(atmosConfig.StacksBaseAbsolutePath, includedPaths) + if err != nil { + return nil, err + } + + stackConfigFilesAbsolutePaths, _, err := cfg.FindAllStackConfigsInPaths(atmosConfig, includeStackAbsPaths, excludedPaths) + return stackConfigFilesAbsolutePaths, err +} + func warnDeprecatedStackFields(atmosConfig *schema.AtmosConfiguration, schemaPath string, files []string) { deprecatedSchema, err := validator.LoadDeprecatedYAMLSchema(atmosConfig, schemaPath) if err != nil { From 673fd60c0bc9a7d9842bebe843df927b026d1b6c Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 16:35:07 -0600 Subject: [PATCH 10/52] ci(plugins): fail when the stacked release base cannot be resolved Co-Authored-By: Claude Opus 5.5 --- .github/workflows/plugin-packages.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/plugin-packages.yaml b/.github/workflows/plugin-packages.yaml index 28bc4fc8a5b..5ad0a8395e3 100644 --- a/.github/workflows/plugin-packages.yaml +++ b/.github/workflows/plugin-packages.yaml @@ -36,7 +36,10 @@ jobs: if: github.event_name == 'pull_request' && github.event.pull_request.base.ref != github.event.repository.default_branch env: DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - run: echo "ref=$(git merge-base HEAD "origin/${DEFAULT_BRANCH}")" >> "$GITHUB_OUTPUT" + # Fail rather than fall back to the PR target when the branches share no history. + run: | + base="$(git merge-base HEAD "origin/${DEFAULT_BRANCH}")" + echo "ref=${base}" >> "$GITHUB_OUTPUT" - name: Check plugin releases env: GOCACHE: ${{ runner.temp }}/plugin-go-build From 4dcd0f0d8eb700db32bc94366480e4be502b365b Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 16:36:48 -0600 Subject: [PATCH 11/52] fix(plugin): keep declared dependency settings on discovered components Discovery replaced the whole dependencies section, dropping tool pins and provider-declared watches. Merge the discovered sources and component dependencies into the declared section instead. Co-Authored-By: Claude Opus 5.5 --- pkg/plugin/adapter/configuration/discovery.go | 23 ++++++++++++++++++- .../adapter/configuration/environment_test.go | 22 ++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/pkg/plugin/adapter/configuration/discovery.go b/pkg/plugin/adapter/configuration/discovery.go index 7a84bfea731..53ade788235 100644 --- a/pkg/plugin/adapter/configuration/discovery.go +++ b/pkg/plugin/adapter/configuration/discovery.go @@ -69,7 +69,7 @@ func addInstance(definitions map[string]map[string]any, instance *pluginv1.Disco } settings["configuration"] = map[string]any{"provider": instance.Provider, "engine": instance.Engine, "source": instance.Source} config["settings"] = settings - config["dependencies"] = instanceDependencies(instance) + config["dependencies"] = mergeDependencies(config["dependencies"], instanceDependencies(instance)) definition := definitions[address.Stack] if definition == nil { definition = map[string]any{"name": address.Stack, componentsKey: map[string]any{terraformType: map[string]any{}}} @@ -105,6 +105,27 @@ func instanceDependencies(instance *pluginv1.DiscoveredComponent) map[string]any return deps } +// mergeDependencies keeps provider-declared dependency settings, such as tool +// pins, and appends the discovered watches and component dependencies to them. +func mergeDependencies(declared any, discovered map[string]any) map[string]any { + existing, ok := declared.(map[string]any) + if !ok { + return discovered + } + merged := make(map[string]any, len(existing)+len(discovered)) + for key, value := range existing { + merged[key] = value + } + for key, value := range discovered { + if prior, isList := merged[key].([]any); isList { + merged[key] = append(append([]any{}, prior...), value.([]any)...) + continue + } + merged[key] = value + } + return merged +} + func addDiscovered(definitions map[string]map[string]any, instances map[[3]string]*pluginv1.DiscoveredComponent, discovered *pluginv1.DiscoverComponentsResponse) error { for _, instance := range discovered.Components { key := addressKey(instance.Address) diff --git a/pkg/plugin/adapter/configuration/environment_test.go b/pkg/plugin/adapter/configuration/environment_test.go index 26fd2fe1dbc..39fc57d5fb7 100644 --- a/pkg/plugin/adapter/configuration/environment_test.go +++ b/pkg/plugin/adapter/configuration/environment_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" + adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" "github.com/cloudposse/atmos/pkg/schema" ) @@ -45,3 +46,24 @@ func TestPreparationEnvironmentPrecedenceAndSanitization(t *testing.T) { }) } } + +func TestDiscoveredDependenciesKeepProviderSettings(t *testing.T) { + app := unit(t, "app") + declared := map[string]any{"source": "./modules/unit", "dependencies": map[string]any{"tools": map[string]any{"opentofu": "1.10.0"}, "files": []any{"extra.hcl"}}} + value, err := adapter.EncodeObject(declared) + require.NoError(t, err) + app.Configuration = value + definitions := map[string]map[string]any{} + require.NoError(t, addInstance(definitions, app)) + deps := definitions["live"]["components"].(map[string]any)["terraform"].(map[string]any)["app"].(map[string]any)["dependencies"].(map[string]any) + require.Equal(t, map[string]any{"opentofu": "1.10.0"}, deps["tools"], "tool pins must survive discovery") + require.Equal(t, []any{"extra.hcl", "root.hcl"}, deps["files"]) + require.Equal(t, []any{"modules"}, deps["folders"]) + + // Without declared dependencies, the discovered set is used as-is. + plain := map[string]map[string]any{} + require.NoError(t, addInstance(plain, unit(t, "network"))) + network := plain["live"]["components"].(map[string]any)["terraform"].(map[string]any)["network"].(map[string]any)["dependencies"].(map[string]any) + require.Equal(t, []any{"root.hcl"}, network["files"]) + require.NotContains(t, network, "tools") +} From df30cc49d438dbc83642c4c9ed820f85b71938dd Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 16:41:18 -0600 Subject: [PATCH 12/52] fix(schema): reserve empty built-in configuration keys omitempty dropped empty built-in fields such as mode before the collision check, so a provider option with the same name was serialized and sent to the plugin. Reserve every declared JSON field name. Co-Authored-By: Claude Opus 5.5 --- pkg/schema/component_configuration.go | 33 +++++++++++++++++++++- pkg/schema/component_configuration_test.go | 8 ++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go index 7ae1c4fcd16..aeb0ca76ab8 100644 --- a/pkg/schema/component_configuration.go +++ b/pkg/schema/component_configuration.go @@ -5,6 +5,8 @@ import ( "encoding/json" "errors" "fmt" + "reflect" + "strings" ) // ErrComponentConfigurationCollision prevents dynamic settings from overriding built-in fields. @@ -94,8 +96,10 @@ func marshalConfiguration[T any](base any, extras map[string]T) ([]byte, error) if err := json.Unmarshal(raw, &result); err != nil { return nil, err } + reserved := jsonFieldNames(reflect.TypeOf(base)) for name, value := range extras { - if _, exists := result[name]; exists { + // Check declared names too: omitempty drops an empty built-in field from result. + if _, exists := result[name]; exists || reserved[name] { return nil, fmt.Errorf("%w: configuration key %s", ErrComponentConfigurationCollision, name) } data, err := json.Marshal(value) @@ -106,3 +110,30 @@ func marshalConfiguration[T any](base any, extras map[string]T) ([]byte, error) } return json.Marshal(result) } + +// jsonFieldNames returns the JSON names a struct type declares, including names +// that omitempty would leave out of an encoded value. +func jsonFieldNames(t reflect.Type) map[string]bool { + names := map[string]bool{} + if t.Kind() != reflect.Struct { + return names + } + for i := range t.NumField() { + field := t.Field(i) + tag := field.Tag.Get("json") + name, _, _ := strings.Cut(tag, ",") + switch { + case name == "-": + continue + case name == "" && field.Anonymous: + for embedded := range jsonFieldNames(field.Type) { + names[embedded] = true + } + case name == "" && field.IsExported(): + names[field.Name] = true + case name != "": + names[name] = true + } + } + return names +} diff --git a/pkg/schema/component_configuration_test.go b/pkg/schema/component_configuration_test.go index 6c2809f3bbf..bbf46fa2096 100644 --- a/pkg/schema/component_configuration_test.go +++ b/pkg/schema/component_configuration_test.go @@ -26,6 +26,14 @@ func TestComponentConfigurationSerialization(t *testing.T) { require.ErrorIs(t, err, ErrComponentConfigurationCollision) _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"enabled": false}}) require.ErrorIs(t, err, ErrComponentConfigurationCollision) + // An empty omitempty field is still reserved and must not be replaced by an option. + _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"mode": "native"}}) + require.ErrorIs(t, err, ErrComponentConfigurationCollision) + _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"provider": "other"}}) + require.ErrorIs(t, err, ErrComponentConfigurationCollision) + raw, err = json.Marshal(ComponentConfiguration{Enabled: true, Options: map[string]any{"version": "1"}}) + require.NoError(t, err) + require.Contains(t, string(raw), `"version":"1"`) _, err = json.Marshal(ComponentConfiguration{Options: map[string]any{"bad": make(chan int)}}) require.Error(t, err) } From 100554e52f3a0b20a66464b9136ce3baac01fc3f Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sun, 8 Nov 2026 16:44:27 -0600 Subject: [PATCH 13/52] test(terragrunt): name each affected scenario and keep its debug stderr The Windows job reports only 'Unexpected affected components: []' without saying whether the mixed-graph or project-root scenario failed. Report each scenario and include debug-level command stderr in the failure. Co-Authored-By: Claude Opus 5.5 --- plugins/terragrunt/scripts/affected.star | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/terragrunt/scripts/affected.star b/plugins/terragrunt/scripts/affected.star index d5f87ad8c9b..f19d8c6f0f8 100644 --- a/plugins/terragrunt/scripts/affected.star +++ b/plugins/terragrunt/scripts/affected.star @@ -139,7 +139,8 @@ def test_mixed_graph(root, configuration): fixtures.write(root, "live/prod/network/terragrunt.hcl", unit() + "# changed upstream\n") fixtures.commit(root, "change upstream in mixed graph") - expect_components(affected(root, base), ["network"]) + changed = affected_result(root, base, "--logs-level=Debug") + expect_components(changed.rows, ["network"], "mixed graph\n" + changed.stderr) expanded = affected(root, base, "--include-dependents", "--flatten") expect_components(expanded, ["api", "app", "native", "network"]) filtered = affected(root, base, "--stack=live/prod", "--include-dependents", "--flatten") @@ -157,7 +158,8 @@ def test_project_root(root): fixtures.check(not affected(root, base), "Unchanged subdirectory inventory selected") fixtures.write(root, "project/modules/unit/main.tf", 'output "vpc_id" { value = "changed" }\n') fixtures.commit(root, "change module under base_path") - expect_components(affected(root, base), ["network"]) + changed = affected_result(root, base, "--logs-level=Debug") + expect_components(changed.rows, ["network"], "project root\n" + changed.stderr) def main(): @@ -175,8 +177,10 @@ def main(): fixtures.project(work + "/nested", package) test_nested_stacks(work + "/nested", package) + ui.success("nested-stacks") config = fixtures.project(work + "/mixed", package) test_mixed_graph(work + "/mixed", config) + ui.success("mixed-graph") fixtures.project(work + "/subdirectory", package, base_path="project") test_project_root(work + "/subdirectory") - ui.success("Nested stacks, mixed graphs, and project-relative watches") + ui.success("project-relative-watches") From 51acb9640874e8627c368fc091db17460020556a Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Mon, 9 Nov 2026 06:58:24 -0600 Subject: [PATCH 14/52] fix(affected): match provider watches across root spellings Provider watch paths are joined to BasePathAbsolute, while changed files are joined to the repository root opened from the working directory. A bare base_path such as "project" resolves through the git root and can spell the same directory differently: the long form of TEMP on Windows runners (runneradmin vs RUNNER~1), or the resolved form of a symlinked working directory on macOS (/private/tmp vs /tmp). The two spellings never match, so a module change under base_path selected nothing. Compare provider watches with symlinks and short names resolved on both sides, keeping the configured spelling in the report. The change set is resolved once per index rather than per component. YAML dependency matching is unchanged. Co-Authored-By: Claude Opus 5.5 --- internal/exec/describe_affected_components.go | 8 ++- .../exec/describe_affected_configuration.go | 63 ++++++++++++++++++- .../describe_affected_configuration_test.go | 49 +++++++++++++++ 3 files changed, 114 insertions(+), 6 deletions(-) diff --git a/internal/exec/describe_affected_components.go b/internal/exec/describe_affected_components.go index 4e5d00b7c0c..f9b5184631d 100644 --- a/internal/exec/describe_affected_components.go +++ b/internal/exec/describe_affected_components.go @@ -1173,16 +1173,18 @@ func checkDependencyChangesIndexed( ) error { // Get file/folder dependencies from dependencies.components or settings.depends_on. deps := getFileFolderDependencies(*componentSection, settingsSection) - configurationWatchPaths(atmosConfig, settingsSection, deps) + provider := configurationWatchPaths(atmosConfig, settingsSection, deps) if len(deps) > 0 { + index, matched := configurationMatchInputs(filesIndex, deps, provider) isFolderOrFileChanged, changedType, changedFileOrFolder, err := isComponentDependentFolderOrFileChangedIndexed( - filesIndex, - deps, + index, + matched, ) if err != nil { return err } if isFolderOrFileChanged { + changedFileOrFolder = configuredDependencyPath(deps, matched, changedFileOrFolder) return addDependencyAffectedItem( affected, atmosConfig, componentName, stackName, componentType, componentSection, changedType, changedFileOrFolder, diff --git a/internal/exec/describe_affected_configuration.go b/internal/exec/describe_affected_configuration.go index 8e48eb9c743..600fda2082d 100644 --- a/internal/exec/describe_affected_configuration.go +++ b/internal/exec/describe_affected_configuration.go @@ -3,6 +3,8 @@ package exec import ( "fmt" "path/filepath" + "slices" + "sync/atomic" errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/schema" @@ -28,14 +30,69 @@ func rebaseConfigurationDiscovery(config *schema.AtmosConfiguration) error { // configurationWatchPaths resolves provider-owned watches against the project // root without putting checkout-specific absolute paths into stack comparisons. -// Existing YAML dependency path semantics remain unchanged. -func configurationWatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) { +// Existing YAML dependency path semantics remain unchanged. It reports whether +// the dependencies belong to a provider-discovered component. +func configurationWatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) bool { if _, provider := settings["configuration"]; !provider { - return + return false } for i := range deps { if !filepath.IsAbs(deps[i].Path) { deps[i].Path = filepath.Join(config.BasePathAbsolute, deps[i].Path) } } + return true +} + +// configurationMatchInputs returns the change set and dependencies to match. +// Provider watches are rooted at BasePathAbsolute, and base-path resolution +// can spell that root differently from the repository root the changed files +// are joined to: through a symlinked temp dir on macOS (/var vs /private/var) +// or as an 8.3 short name on Windows (RUNNER~1 vs runneradmin). Two spellings +// of one directory never match, so provider watches compare both sides with +// symlinks and short names resolved. YAML dependencies keep exact matching. +func configurationMatchInputs(filesIndex *changedFilesIndex, deps []schema.ComponentDependency, provider bool) (*changedFilesIndex, []schema.ComponentDependency) { + if !provider { + return filesIndex, deps + } + resolved := slices.Clone(deps) + for i := range resolved { + resolved[i].Path = evalSymlinksBestEffort(resolved[i].Path) + } + return resolvedChangedFiles(filesIndex), resolved +} + +// configuredDependencyPath reports a matched dependency in its configured spelling. +func configuredDependencyPath(deps, matched []schema.ComponentDependency, path string) string { + for i := range matched { + if matched[i].Path == path { + return deps[i].Path + } + } + return path +} + +// resolvedChangedFilesView pairs a change-set index with its resolved copy. +type resolvedChangedFilesView struct { + source, resolved *changedFilesIndex +} + +// lastResolvedChangedFiles holds the view for the most recent index, so a run +// resolves its change set once rather than once per provider component. The +// index is immutable after construction, so pointer identity is a safe key. +var lastResolvedChangedFiles atomic.Pointer[resolvedChangedFilesView] + +// resolvedChangedFiles returns the change set with symlinks and short names resolved. +func resolvedChangedFiles(index *changedFilesIndex) *changedFilesIndex { + if view := lastResolvedChangedFiles.Load(); view != nil && view.source == index { + return view.resolved + } + files := index.getAllFiles() + resolved := make([]string, len(files)) + for i, file := range files { + resolved[i] = evalSymlinksBestEffort(file) + } + view := &resolvedChangedFilesView{source: index, resolved: &changedFilesIndex{allFiles: resolved}} + lastResolvedChangedFiles.Store(view) + return view.resolved } diff --git a/internal/exec/describe_affected_configuration_test.go b/internal/exec/describe_affected_configuration_test.go index d3257971836..9ac35d39308 100644 --- a/internal/exec/describe_affected_configuration_test.go +++ b/internal/exec/describe_affected_configuration_test.go @@ -2,6 +2,7 @@ package exec import ( "context" + "os" "path/filepath" "testing" @@ -101,6 +102,54 @@ func TestAffectedConfigurationForkErrors(t *testing.T) { } } +// TestAffectedConfigurationWatchRootSpelling reproduces the Windows runner, where +// base_path resolves to the long form of TEMP (runneradmin) while changed files +// are joined to the 8.3 form the CLI's working directory uses (RUNNER~1). A +// symlinked repository root gives the same two spellings of one directory. +func TestAffectedConfigurationWatchRootSpelling(t *testing.T) { + temp, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + repo := filepath.Join(temp, "repo") + require.NoError(t, os.MkdirAll(filepath.Join(repo, "project", "modules", "unit"), 0o755)) + link := filepath.Join(temp, "link") + if err := os.Symlink(repo, link); err != nil { + t.Skipf("symlinks unavailable: %v", err) + } + config := &schema.AtmosConfiguration{BasePathAbsolute: filepath.Join(repo, "project")} + settings := map[string]any{"configuration": map[string]any{"provider": "terragrunt"}} + watches := func() []schema.ComponentDependency { + deps := []schema.ComponentDependency{{Kind: "folder", Path: "modules/unit"}} + require.True(t, configurationWatchPaths(config, settings, deps)) + return deps + } + + match := func(index *changedFilesIndex, deps []schema.ComponentDependency, provider bool) (bool, string, string) { + resolvedIndex, matched := configurationMatchInputs(index, deps, provider) + changed, kind, path, err := isComponentDependentFolderOrFileChangedIndexed(resolvedIndex, matched) + require.NoError(t, err) + return changed, kind, configuredDependencyPath(deps, matched, path) + } + + deps := watches() + index := newChangedFilesIndex(config, []string{"project/modules/unit/main.tf"}, link) + changed, _, _, err := isComponentDependentFolderOrFileChangedIndexed(index, deps) + require.NoError(t, err) + require.False(t, changed, "precondition: the two spellings differ") + + changed, kind, path := match(index, deps, true) + require.True(t, changed) + require.Equal(t, "folder", kind) + require.Equal(t, filepath.Join(repo, "project", "modules", "unit"), path, "report the configured spelling") + + other := newChangedFilesIndex(config, []string{"project/modules/other/main.tf"}, link) + changed, _, _ = match(other, watches(), true) + require.False(t, changed, "a change outside the watch must not select the unit") + + // YAML dependencies keep exact matching. + changed, _, _ = match(index, watches(), false) + require.False(t, changed) +} + func TestAffectedConfigurationWatchRoot(t *testing.T) { root := t.TempDir() config := &schema.AtmosConfiguration{BasePathAbsolute: root} From 6aa32fd6b8778841e407116eef17a64020b6b158 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:46:25 -0600 Subject: [PATCH 15/52] fix(plugin): keep discovered numbers numeric in describe output Decoded plugin values held numbers as json.Number, which YAML renders as a quoted string. Convert numbers to int64 or float64 when that is exact and keep json.Number only when neither type holds the value without loss. Co-Authored-By: Claude Opus 5.5 --- pkg/plugin/adapter/component/objects.go | 29 ++++++++++++++++++- pkg/plugin/adapter/component/objects_test.go | 8 +++-- .../adapter/configuration/session_test.go | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/pkg/plugin/adapter/component/objects.go b/pkg/plugin/adapter/component/objects.go index 7f9e4d3794a..954fecf94f3 100644 --- a/pkg/plugin/adapter/component/objects.go +++ b/pkg/plugin/adapter/component/objects.go @@ -3,6 +3,7 @@ package component import ( "bytes" "encoding/json" + "strconv" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" @@ -67,13 +68,39 @@ func DecodeObject(input *pluginv1.ComponentValue) (map[string]any, error) { if err != nil { return nil, err } - object, ok := result.(map[string]any) + object, ok := nativeNumbers(result).(map[string]any) if !ok { return nil, errUtils.ErrPluginProtocol } return object, nil } +// Float64Bits is the bit size strconv uses for float64 formatting. +const float64Bits = 64 + +// nativeNumbers converts JSON numbers to int64 or float64 when that is exact, so YAML +// output keeps them numeric. A number neither type can hold exactly stays a json.Number. +func nativeNumbers(value any) any { + switch value := value.(type) { + case map[string]any: + for key, child := range value { + value[key] = nativeNumbers(child) + } + case []any: + for i, child := range value { + value[i] = nativeNumbers(child) + } + case json.Number: + if integer, err := value.Int64(); err == nil { + return integer + } + if float, err := value.Float64(); err == nil && strconv.FormatFloat(float, 'g', -1, float64Bits) == value.String() { + return float + } + } + return value +} + func decodePlain(input *pluginv1.ComponentValue) (cty.Value, error) { if input == nil { return cty.NilVal, errUtils.ErrPluginProtocol diff --git a/pkg/plugin/adapter/component/objects_test.go b/pkg/plugin/adapter/component/objects_test.go index fdb2f96f095..c973cec486a 100644 --- a/pkg/plugin/adapter/component/objects_test.go +++ b/pkg/plugin/adapter/component/objects_test.go @@ -23,12 +23,14 @@ func objectWireValue(t *testing.T, value cty.Value) *pluginv1.ComponentValue { } func TestObjectRoundTrip(t *testing.T) { - value := map[string]any{"large": json.Number("9007199254740993"), "nested": []any{nil, true, "literal"}} + value := map[string]any{"large": json.Number("9007199254740993"), "ratio": json.Number("0.5"), "precise": json.Number("0.1000000000000000000001"), "nested": []any{nil, true, "literal", json.Number("3")}} encoded, err := EncodeObject(value) require.NoError(t, err) decoded, err := DecodeObject(encoded) require.NoError(t, err) - require.Equal(t, value, decoded) + // Exact numbers become native so YAML renders them unquoted; others keep full precision. + want := map[string]any{"large": int64(9007199254740993), "ratio": 0.5, "precise": json.Number("0.1000000000000000000001"), "nested": []any{nil, true, "literal", int64(3)}} + require.Equal(t, want, decoded) decoded, err = DecodeObject(nil) require.NoError(t, err) require.Empty(t, decoded) @@ -54,7 +56,7 @@ func TestObjectSensitivePaths(t *testing.T) { encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} decoded, err := DecodeObject(encoded) require.NoError(t, err) - require.Equal(t, []any{"masked-value", json.Number("12345")}, decoded["items"]) + require.Equal(t, []any{"masked-value", int64(12345)}, decoded["items"]) } for _, path := range []*pluginv1.ComponentValuePath{nil, {Steps: []*pluginv1.ComponentValueStep{nil}}, {Steps: []*pluginv1.ComponentValueStep{index}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.True)}}}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{}}}}} { encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index bf9649591db..84772ce67e8 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -75,7 +75,7 @@ func TestSessionDiscoveryAndPreparation(t *testing.T) { }) prepared, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{Stack: "live", ComponentFromArg: "app", Command: "tofu", SubCommand: "apply", TerraformWorkspace: "stage", ComponentSettingsSection: map[string]any{"configuration": true}, ComponentEnvList: []string{"FROM_COMPONENT=original", "FROM_COMPONENT=override"}, ComponentEnvSection: map[string]any{"FROM_COMPONENT": "override"}}) require.NoError(t, err) - require.Equal(t, json.Number("9007199254740993"), prepared.Inputs["large"]) + require.Equal(t, int64(9007199254740993), prepared.Inputs["large"]) require.Equal(t, filepath.Join(config.BasePathAbsolute, "state.tfstate"), prepared.Backend["path"]) require.Equal(t, "{{ literal }}", string(prepared.Files[0].Content)) } From 9cc202d5d28abc777bb6d4dcac44289ce719bdb9 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:47:23 -0600 Subject: [PATCH 16/52] fix(plugin): keep one caller's cancellation from failing shared discovery Discovery ran on a context canceled when the first caller's context ended, so that caller's cancellation was cached for every later waiter. Run shared discovery on the session's own context; each caller still stops waiting when its own context ends. Co-Authored-By: Claude Opus 5.5 --- pkg/plugin/adapter/configuration/session.go | 8 ++--- .../adapter/configuration/session_test.go | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/pkg/plugin/adapter/configuration/session.go b/pkg/plugin/adapter/configuration/session.go index 80ada4de149..158f151aeb8 100644 --- a/pkg/plugin/adapter/configuration/session.go +++ b/pkg/plugin/adapter/configuration/session.go @@ -107,11 +107,9 @@ func (s *Session) ensure(ctx context.Context) error { s.once.Do(func() { go func() { defer close(s.done) - call, cancel := context.WithCancel(s.ctx) - stop := context.AfterFunc(ctx, cancel) - defer stop() - defer cancel() - s.err = s.discover(call) + // Shared discovery is owned by the session: one caller giving up must not + // cancel it or cache that cancellation for the other waiters. + s.err = s.discover(s.ctx) }() }) select { diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index 84772ce67e8..3f04b8d0dc9 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -150,6 +150,35 @@ func TestSessionCancellationAndFailure(t *testing.T) { require.True(t, errors.Is(err, errUtils.ErrPluginUnsupportedExtension)) } +func TestSessionCallerCancellationDoesNotStopSharedDiscovery(t *testing.T) { + release := make(chan struct{}) + started := make(chan struct{}) + session, err := New(t.Context(), enabledConfig(t), "list", func(ctx context.Context, _ []string) (map[string]Provider, error) { + close(started) + select { + case <-release: + return nil, errUtils.ErrPluginInvalidConfig + case <-ctx.Done(): + return nil, ctx.Err() + } + }) + require.NoError(t, err) + caller, cancel := context.WithCancel(t.Context()) + first := make(chan error, 1) + go func() { + _, err := session.Discover(caller) + first <- err + }() + <-started + cancel() + require.ErrorIs(t, <-first, context.Canceled) + close(release) + // The other waiter sees discovery's own result, not the first caller's cancellation. + _, err = session.Discover(t.Context()) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + require.NotErrorIs(t, err, context.Canceled) +} + func TestSessionRejectsConflictingDiscovery(t *testing.T) { for _, test := range []struct { name string From 2907ae0d308cdc3851f726cd930aff2ec48eec86 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:48:17 -0600 Subject: [PATCH 17/52] fix(terragrunt): keep validation status codes from Prepare and Resolve Prepare and Resolve converted the status error returned by Validate a second time, which turned Canceled and Unimplemented into InvalidArgument. Validate once internally and map the raw cause to a status code a single time. Co-Authored-By: Claude Opus 5.5 --- .../terragrunt/internal/provider/preparation.go | 2 +- .../terragrunt/internal/provider/provider.go | 17 +++++++++++------ .../internal/provider/provider_test.go | 7 +++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go index 5bdef4b4e92..fd7e4afb9b2 100644 --- a/plugins/terragrunt/internal/provider/preparation.go +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -11,7 +11,7 @@ import ( ) func (p *Provider) componentRequest(ctx context.Context, request *pluginv1.ComponentRequest) (model.Request, error) { - if _, err := p.Validate(ctx, request); err != nil { + if err := validate(ctx, request); err != nil { return model.Request{}, err } req, err := operation(request.RootDirectory, request.Provider, request.Operation, request.Invocation) diff --git a/plugins/terragrunt/internal/provider/provider.go b/plugins/terragrunt/internal/provider/provider.go index 4debfa3bbaf..258b10b0ce9 100644 --- a/plugins/terragrunt/internal/provider/provider.go +++ b/plugins/terragrunt/internal/provider/provider.go @@ -166,14 +166,19 @@ func rpcError(err error) error { // Validate rejects unsupported operation and provider settings without evaluating HCL. func (p *Provider) Validate(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ValidateResponse, error) { - if err := ctx.Err(); err != nil { + if err := validate(ctx, request); err != nil { return nil, rpcError(err) } - if _, err := operation(request.GetRootDirectory(), request.GetProvider(), request.GetOperation(), request.GetInvocation()); err != nil { - return nil, rpcError(err) + return &pluginv1.ValidateResponse{}, nil +} + +// validate returns the unconverted cause so callers map it to a status code exactly once. +func validate(ctx context.Context, request *pluginv1.ComponentRequest) error { + if err := ctx.Err(); err != nil { + return err } - if err := settings(request.GetProviderConfiguration()); err != nil { - return nil, rpcError(err) + if _, err := operation(request.GetRootDirectory(), request.GetProvider(), request.GetOperation(), request.GetInvocation()); err != nil { + return err } - return &pluginv1.ValidateResponse{}, nil + return settings(request.GetProviderConfiguration()) } diff --git a/plugins/terragrunt/internal/provider/provider_test.go b/plugins/terragrunt/internal/provider/provider_test.go index a2d8f16f7f1..b52a79a429a 100644 --- a/plugins/terragrunt/internal/provider/provider_test.go +++ b/plugins/terragrunt/internal/provider/provider_test.go @@ -90,6 +90,13 @@ func TestRequestsRejectUnsupportedBeforeEvaluation(t *testing.T) { cancel() _, err := p.Validate(ctx, componentRequest(t)) require.Equal(t, codes.Canceled, status.Code(err)) + // Prepare and Resolve keep the validation status instead of re-mapping it to InvalidArgument. + _, err = p.Prepare(ctx, componentRequest(t)) + require.Equal(t, codes.Canceled, status.Code(err)) + unsupported := componentRequest(t) + unsupported.Operation.Mode = "cli" + _, err = p.Resolve(t.Context(), unsupported) + require.Equal(t, codes.Unimplemented, status.Code(err)) } func TestEvaluatorErrorsDoNotExposePayloads(t *testing.T) { From 73ddc3a199712cd842d657c0960f263e185ad4ac Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:49:19 -0600 Subject: [PATCH 18/52] fix(terraform): keep provider artifact names distinct without a CLI component Provider-owned planfile and varfile names hashed only ComponentFromArg, so callers that resolve a component without CLI arguments gave every component in a stack the same file names. Fall back to the component identity. Co-Authored-By: Claude Opus 5.5 --- pkg/component/terraform/configuration.go | 7 ++++++- pkg/component/terraform/configuration_test.go | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index a98f7ef4082..eb6c574a34c 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -63,7 +63,12 @@ func configurationArtifactName(info *schema.ConfigAndStacksInfo, suffix string) if _, owned := info.ComponentSettingsSection["configuration"]; !owned { return "", false } - return "atmos-" + configurationIdentity(info.Stack, info.ComponentFromArg) + suffix, true + component := info.ComponentFromArg + if component == "" { + // Callers that resolve a component without CLI arguments still name distinct files. + component = info.Component + } + return "atmos-" + configurationIdentity(info.Stack, component) + suffix, true } // configurationIdentity names a stack and component pair for artifact files. The name must be the same in diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index 0f9621bf038..a122b0cc856 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -71,6 +71,13 @@ func TestConfigurationArtifactNames(t *testing.T) { info.Stack = "live/dev" info.ComponentFromArg = "other/app" require.NotEqual(t, first, ConstructTerraformComponentVarfileName(info)) + // Without ComponentFromArg the component identity still keeps names distinct. + info.ComponentFromArg, info.Component = "", "region/app" + app := ConstructTerraformComponentPlanfileName(info) + info.Component = "region/other" + require.NotEqual(t, app, ConstructTerraformComponentPlanfileName(info)) + info.ComponentFromArg, info.Component = "region/app", "ignored" + require.Equal(t, app, ConstructTerraformComponentPlanfileName(info), "ComponentFromArg keeps precedence") info.ComponentSettingsSection = nil _, owned := configurationArtifactName(info, ".plan") require.False(t, owned) From 4f6b3b7277af2d777bba66d35126a6ced235f516 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:49:54 -0600 Subject: [PATCH 19/52] test(plugin): assert an explicit empty environment override stays set Co-Authored-By: Claude Opus 5.5 --- pkg/plugin/adapter/configuration/environment_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/plugin/adapter/configuration/environment_test.go b/pkg/plugin/adapter/configuration/environment_test.go index 39fc57d5fb7..88c7e4015cd 100644 --- a/pkg/plugin/adapter/configuration/environment_test.go +++ b/pkg/plugin/adapter/configuration/environment_test.go @@ -31,6 +31,9 @@ func TestPreparationEnvironmentPrecedenceAndSanitization(t *testing.T) { info := &schema.ConfigAndStacksInfo{SanitizedEnv: test.sanitized, ComponentEnvList: test.overrides, ComponentEnvSection: map[string]any{"AWS_WEB_IDENTITY_TOKEN_FILE": "stale-section"}} got := preparationEnvironment(info) require.Equal(t, test.want, got["ATMOS_ENV_AMBIENT_PROBE"]) + if test.name == "explicit empty override" { + require.Contains(t, got, "ATMOS_ENV_AMBIENT_PROBE", "an explicit empty override must stay set") + } _, present := got["AWS_WEB_IDENTITY_TOKEN_FILE"] require.Equal(t, test.present, present) if test.name == "last path wins" { From 35ff9699c67038580ad41497b9a1a47f0d2b2490 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 15:53:47 -0600 Subject: [PATCH 20/52] fix(affected): pass the command context to configuration initialization describe affected initialized configuration with a background context, so canceling the command never reached native component discovery. Use the command's context. Co-Authored-By: Claude Opus 5.5 --- internal/exec/describe_affected.go | 8 ++++- .../describe_affected_configuration_test.go | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/internal/exec/describe_affected.go b/internal/exec/describe_affected.go index e4af04b59b2..b2f7d799ead 100644 --- a/internal/exec/describe_affected.go +++ b/internal/exec/describe_affected.go @@ -1,6 +1,7 @@ package exec import ( + "context" "errors" "fmt" "strings" @@ -147,10 +148,15 @@ func NewDescribeAffectedExec( func ParseDescribeAffectedCliArgs(cmd *cobra.Command, args []string) (DescribeAffectedCmdArgs, error) { defer perf.Track(nil, "exec.ParseDescribeAffectedCliArgs")() + // Native discovery runs during configuration initialization, so it must see the command's cancellation. + ctx := cmd.Context() + if ctx == nil { + ctx = context.Background() + } var atmosConfig schema.AtmosConfiguration if info, err := ProcessCommandLineArgs("", cmd, args, nil); err != nil { return DescribeAffectedCmdArgs{}, err - } else if atmosConfig, err = cfg.InitCliConfig(info, true); err != nil { + } else if atmosConfig, err = cfg.InitCliConfigWithContext(ctx, info, true); err != nil { return DescribeAffectedCmdArgs{}, err } if err := ValidateStacks(&atmosConfig); err != nil { diff --git a/internal/exec/describe_affected_configuration_test.go b/internal/exec/describe_affected_configuration_test.go index 9ac35d39308..ba3a82f2de6 100644 --- a/internal/exec/describe_affected_configuration_test.go +++ b/internal/exec/describe_affected_configuration_test.go @@ -6,6 +6,7 @@ import ( "path/filepath" "testing" + "github.com/spf13/cobra" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" @@ -173,3 +174,36 @@ func TestAffectedConfigurationWatchRoot(t *testing.T) { } } } + +// Native discovery starts during configuration initialization, so the command's cancellation must reach it. +func TestParseDescribeAffectedCliArgsPassesCommandContext(t *testing.T) { + root := t.TempDir() + config := `base_path: "." +components: + terraform: + base_path: components/terraform + terragrunt: + enabled: true + discovery: + enabled: true + included_paths: ["live/**"] +stacks: + base_path: stacks + included_paths: ["**/*"] + name_template: "{{ .vars.stage }}" +` + require.NoError(t, os.WriteFile(filepath.Join(root, "atmos.yaml"), []byte(config), 0o600)) + t.Setenv("ATMOS_CLI_CONFIG_PATH", root) + t.Setenv("ATMOS_BASE_PATH", root) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + cmd := &cobra.Command{Use: "affected"} + cmd.Flags().AddFlagSet(newDescribeAffectedFlagSet()) + cmd.Flags().StringSlice("profile", nil, "") + cmd.Flags().StringSlice("config-path", nil, "") + cmd.Flags().StringSlice("config", nil, "") + cmd.Flags().String("base-path", "", "") + cmd.SetContext(ctx) + _, err := ParseDescribeAffectedCliArgs(cmd, nil) + require.ErrorIs(t, err, context.Canceled) +} From c4b070e6022291fe6a402e5aa6e72b74b466adb4 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:42:51 -0600 Subject: [PATCH 21/52] fix(plugin): treat settings.configuration false as an ordinary component Ownership checks keyed on the presence of settings.configuration, so a component that set it to false (or null) was rejected as an unsupported extension when discovery was off. Share one ownership predicate across the preparation, artifact, auth, and affected branches. Co-Authored-By: Claude Opus 5.5 --- .../exec/describe_affected_configuration.go | 2 +- pkg/component/terraform/configuration.go | 6 +++--- pkg/component/terraform/configuration_test.go | 2 ++ pkg/component/terraform/execute_pipeline.go | 4 ++-- .../adapter/configuration/preparation.go | 2 +- pkg/schema/component_configuration.go | 13 +++++++++++++ pkg/schema/component_configuration_test.go | 19 +++++++++++++++++++ 7 files changed, 41 insertions(+), 7 deletions(-) diff --git a/internal/exec/describe_affected_configuration.go b/internal/exec/describe_affected_configuration.go index 600fda2082d..e22490694b4 100644 --- a/internal/exec/describe_affected_configuration.go +++ b/internal/exec/describe_affected_configuration.go @@ -33,7 +33,7 @@ func rebaseConfigurationDiscovery(config *schema.AtmosConfiguration) error { // Existing YAML dependency path semantics remain unchanged. It reports whether // the dependencies belong to a provider-discovered component. func configurationWatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) bool { - if _, provider := settings["configuration"]; !provider { + if !schema.ConfigurationOwned(settings) { return false } for i := range deps { diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index eb6c574a34c..fe3adecda95 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -15,7 +15,7 @@ import ( ) func prepareConfiguration(ctx context.Context, config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { - if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + if !schema.ConfigurationOwned(info.ComponentSettingsSection) { return nil, nil } if config.ComponentConfigurations == nil { @@ -60,7 +60,7 @@ func prepareConfiguration(ctx context.Context, config *schema.AtmosConfiguration } func configurationArtifactName(info *schema.ConfigAndStacksInfo, suffix string) (string, bool) { - if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + if !schema.ConfigurationOwned(info.ComponentSettingsSection) { return "", false } component := info.ComponentFromArg @@ -85,7 +85,7 @@ func configurationIdentity(stack, component string) string { // prepareConfigurationEnvironment applies the same authentication, RC, cache, // and toolchain environment as Terraform before the evaluator can spawn children. func (e *Executor) prepareConfigurationEnvironment(ctx context.Context, config *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, shouldProcess bool) (*dependencies.ToolchainEnvironment, error) { - if _, owned := info.ComponentSettingsSection["configuration"]; !owned || info.DryRun { + if !schema.ConfigurationOwned(info.ComponentSettingsSection) || info.DryRun { return nil, nil } if err := checkComponentRestrictions(info); err != nil { diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index a122b0cc856..0e89745608c 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -41,6 +41,8 @@ func TestPrepareConfigurationGuards(t *testing.T) { want error }{ {name: "ordinary"}, + {name: "explicitly disabled", info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": false}}}, + {name: "null", info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": nil}}}, {name: "unavailable", info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}}, want: errUtils.ErrPluginUnsupportedExtension}, {name: "abstract", runtime: true, info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}, SubCommand: "apply", ComponentIsAbstract: true}, want: errUtils.ErrAbstractComponentCantBeProvisioned}, {name: "dry run", runtime: true, info: schema.ConfigAndStacksInfo{ComponentSettingsSection: map[string]any{"configuration": true}, DryRun: true}}, diff --git a/pkg/component/terraform/execute_pipeline.go b/pkg/component/terraform/execute_pipeline.go index b643d0f8d15..91608a71088 100644 --- a/pkg/component/terraform/execute_pipeline.go +++ b/pkg/component/terraform/execute_pipeline.go @@ -132,7 +132,7 @@ func (e *Executor) runPreExecutionSteps( return err } - if _, owned := info.ComponentSettingsSection["configuration"]; !owned || info.DryRun { + if !schema.ConfigurationOwned(info.ComponentSettingsSection) || info.DryRun { if err := auth.TerraformPreHook(atmosConfig, info); err != nil { // The error is returned and rendered once by the command boundary, so it is only logged // at debug level here to avoid printing the same failure twice. @@ -155,7 +155,7 @@ func (e *Executor) runPreExecutionSteps( warnOnConflictingEnvVars() - if _, owned := info.ComponentSettingsSection["configuration"]; owned && !info.DryRun { + if schema.ConfigurationOwned(info.ComponentSettingsSection) && !info.DryRun { // Inputs have now been evaluated; append their secret variables after masking. return appendTerraformSecretEnv(info) } diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go index 84288a68b6f..675ea11fe46 100644 --- a/pkg/plugin/adapter/configuration/preparation.go +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -18,7 +18,7 @@ import ( func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) (*schema.PreparedComponentConfiguration, error) { defer perf.Track(nil, "configurationadapter.Prepare")() - if _, owned := info.ComponentSettingsSection["configuration"]; !owned { + if !schema.ConfigurationOwned(info.ComponentSettingsSection) { return nil, nil } if info.UseTerraformPlan || info.PlanFile != "" || info.StoredPlanFile != "" { diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go index aeb0ca76ab8..a5c993a8c85 100644 --- a/pkg/schema/component_configuration.go +++ b/pkg/schema/component_configuration.go @@ -61,6 +61,19 @@ type ComponentConfigurationFile struct { Sensitive bool } +// ConfigurationOwned reports whether a configuration provider owns a component's settings. +// Discovery records ownership as a map; an explicit false or null leaves an ordinary component. +func ConfigurationOwned(settings map[string]any) bool { + switch value := settings["configuration"].(type) { + case nil: + return false + case bool: + return value + default: + return true + } +} + // HasComponentDiscovery reports an explicit opt-in without consulting plugins or the filesystem. func (c *AtmosConfiguration) HasComponentDiscovery() bool { for _, provider := range c.Components.Terraform.ConfigurationProviders { diff --git a/pkg/schema/component_configuration_test.go b/pkg/schema/component_configuration_test.go index bbf46fa2096..0881ae039e6 100644 --- a/pkg/schema/component_configuration_test.go +++ b/pkg/schema/component_configuration_test.go @@ -49,3 +49,22 @@ func TestComponentDiscoveryRequiresBothOptIns(t *testing.T) { } require.False(t, (&AtmosConfiguration{}).HasComponentDiscovery()) } + +func TestConfigurationOwned(t *testing.T) { + for _, test := range []struct { + name string + settings map[string]any + want bool + }{ + {name: "absent", settings: map[string]any{}}, + {name: "nil settings"}, + {name: "explicit false", settings: map[string]any{"configuration": false}}, + {name: "explicit null", settings: map[string]any{"configuration": nil}}, + {name: "explicit true", settings: map[string]any{"configuration": true}, want: true}, + {name: "discovered", settings: map[string]any{"configuration": map[string]any{"provider": "terragrunt"}}, want: true}, + } { + t.Run(test.name, func(t *testing.T) { + require.Equal(t, test.want, ConfigurationOwned(test.settings)) + }) + } +} From d9fffd6339651df90232794f1a80fdf34a63d7b2 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:44:20 -0600 Subject: [PATCH 22/52] fix(terraform): reject a TF_WORKSPACE that conflicts with the prepared workspace A configuration provider prepares one workspace, but a TF_WORKSPACE in the base or component environment makes Terraform use another and skips workspace selection. Fail before initialization when the two differ. Co-Authored-By: Claude Opus 5.5 --- pkg/component/terraform/configuration.go | 24 +++++++++++++++++++ pkg/component/terraform/configuration_test.go | 22 +++++++++++++++++ pkg/component/terraform/execute_pipeline.go | 3 +++ 3 files changed, 49 insertions(+) diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index fe3adecda95..21fe9d92473 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -6,8 +6,10 @@ import ( "fmt" "hash/fnv" "maps" + "os" "os/exec" "path/filepath" + "strings" errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/dependencies" @@ -115,3 +117,25 @@ func (e *Executor) prepareConfigurationEnvironment(ctx context.Context, config * } return tenv, nil } + +// checkConfigurationWorkspace rejects a TF_WORKSPACE that would make Terraform use a different +// workspace than the one the configuration provider prepared, before any initialization runs. +// The component environment overrides the base environment, as it does for the Terraform process. +func checkConfigurationWorkspace(info *schema.ConfigAndStacksInfo) error { + base := info.SanitizedEnv + if base == nil { + base = os.Environ() + } + workspace := "" + for _, entries := range [][]string{base, info.ComponentEnvList} { + for _, entry := range entries { + if key, value, ok := strings.Cut(entry, "="); ok && key == "TF_WORKSPACE" { + workspace = value + } + } + } + if workspace != "" && workspace != info.TerraformWorkspace { + return fmt.Errorf("%w: TF_WORKSPACE %q differs from the prepared workspace %q", errUtils.ErrPluginInvalidConfig, workspace, info.TerraformWorkspace) + } + return nil +} diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index 0e89745608c..a769ee60d9d 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -96,3 +96,25 @@ func TestConfigurationIdentityIsStableAndSeparatesFields(t *testing.T) { // The separator keeps adjacent fields from sliding into each other. require.NotEqual(t, configurationIdentity("ab", "c"), configurationIdentity("a", "bc")) } + +func TestCheckConfigurationWorkspace(t *testing.T) { + for _, test := range []struct { + name string + base []string + component []string + want error + }{ + {name: "unset", base: []string{}}, + {name: "empty", base: []string{"TF_WORKSPACE="}}, + {name: "matching base", base: []string{"TF_WORKSPACE=stage"}}, + {name: "matching component", base: []string{}, component: []string{"TF_WORKSPACE=stage"}}, + {name: "conflicting base", base: []string{"TF_WORKSPACE=prod"}, want: errUtils.ErrPluginInvalidConfig}, + {name: "conflicting component", base: []string{"TF_WORKSPACE=stage"}, component: []string{"TF_WORKSPACE=prod"}, want: errUtils.ErrPluginInvalidConfig}, + {name: "component overrides conflicting base", base: []string{"TF_WORKSPACE=prod"}, component: []string{"TF_WORKSPACE=stage"}}, + } { + t.Run(test.name, func(t *testing.T) { + info := &schema.ConfigAndStacksInfo{TerraformWorkspace: "stage", SanitizedEnv: test.base, ComponentEnvList: test.component} + require.ErrorIs(t, checkConfigurationWorkspace(info), test.want) + }) + } +} diff --git a/pkg/component/terraform/execute_pipeline.go b/pkg/component/terraform/execute_pipeline.go index 91608a71088..00334ce998a 100644 --- a/pkg/component/terraform/execute_pipeline.go +++ b/pkg/component/terraform/execute_pipeline.go @@ -156,6 +156,9 @@ func (e *Executor) runPreExecutionSteps( warnOnConflictingEnvVars() if schema.ConfigurationOwned(info.ComponentSettingsSection) && !info.DryRun { + if err := checkConfigurationWorkspace(info); err != nil { + return err + } // Inputs have now been evaluated; append their secret variables after masking. return appendTerraformSecretEnv(info) } From f767975bd6b975655b1c5330e4188798f9d03ec8 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:46:05 -0600 Subject: [PATCH 23/52] fix(auth): include discovered units in scoped auth validation Static describe, used by atmos auth validate --stack, loaded only YAML manifests and skipped discovered definitions, so a stack defined only by a configuration provider matched no components. Merge the discovered inventory into the static stack map as the evaluated path already does. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks_test.go | 13 +++++++++++++ internal/exec/describe_stacks_static.go | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index 1c861ef10f6..1fc8f1d7e6c 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -117,3 +117,16 @@ func TestValidateStacksMissingStacksDirStillRunsDiscovery(t *testing.T) { plain := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: missing} require.NoError(t, ValidateStacks(plain)) } + +func TestStaticDescribeStacksIncludesDiscoveredStacks(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: filepath.Join(root, "stacks"), TerraformDirAbsolutePath: filepath.Join(root, "components")} + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + definitions := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module"}}}}} + provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil) + stacks, raw, _, err := findDescribeStacksMap(config, "live", false, true) + require.NoError(t, err) + require.Contains(t, stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"], "app") + require.Equal(t, "live", raw["live"]["name"]) +} diff --git a/internal/exec/describe_stacks_static.go b/internal/exec/describe_stacks_static.go index fda3ddbfa2d..0d73b15ed66 100644 --- a/internal/exec/describe_stacks_static.go +++ b/internal/exec/describe_stacks_static.go @@ -22,7 +22,15 @@ func findDescribeStacksMap(config *schema.AtmosConfiguration, stack string, igno _, stacks, raw, deferred, err := processYAMLConfigFilesWithOptions(config, config.StacksBaseAbsolutePath, config.TerraformDirAbsolutePath, config.HelmfileDirAbsolutePath, config.PackerDirAbsolutePath, config.AnsibleDirAbsolutePath, files, false, true, ignoreMissing, &StackLoadOptions{SkipTemplates: true, StaticOnly: true}) - return stacks, raw, deferred, err + if err != nil { + return nil, nil, nil, err + } + // Discovered definitions are literal data from the provider inventory, so static + // inspection includes them without authenticating or evaluating templates. + if err := mergeConfigurationStacks(config, stacks, raw, deferred); err != nil { + return nil, nil, nil, err + } + return stacks, raw, deferred, nil } func (p *describeStacksProcessor) resolveStackName(file, manifest string, info schema.ConfigAndStacksInfo, vars map[string]any) (string, schema.Context, error) { //nolint:gocritic // Mirrors the existing read-only name resolver. From 8d95fc8b4a03c52423a4b30987af8897485873df Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:49:32 -0600 Subject: [PATCH 24/52] fix(terraform): keep generated files away from state and workdir runtime files A configuration provider could generate a file over terraform.tfstate, a provider lock, or workdir metadata, including with the overwrite policy. Check the whole artifact set against the paths the workdir sync preserves before any file is written. Co-Authored-By: Claude Opus 5.5 --- pkg/component/terraform/configuration.go | 35 +++++++++++++++++++ pkg/component/terraform/configuration_test.go | 11 ++++++ pkg/component/terraform/execute_pipeline.go | 3 ++ 3 files changed, 49 insertions(+) diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index 21fe9d92473..fd4eb9dae59 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -13,6 +13,8 @@ import ( errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/dependencies" + "github.com/cloudposse/atmos/pkg/provisioner" + "github.com/cloudposse/atmos/pkg/provisioner/workdir" "github.com/cloudposse/atmos/pkg/schema" ) @@ -139,3 +141,36 @@ func checkConfigurationWorkspace(info *schema.ConfigAndStacksInfo) error { } return nil } + +// Workdir runtime paths generated artifacts must never write. They mirror the paths the +// workdir sync preserves: Terraform data and workspace-state directories, Atmos metadata, +// provider lock files at any depth, and the default local-backend state files at the root. +var ( + runtimeArtifactDirs = map[string]bool{".terraform": true, "terraform.tfstate.d": true, workdir.AtmosDir: true} + runtimeArtifactFiles = map[string]bool{"terraform.tfstate": true, "terraform.tfstate.backup": true, ".terraform.tfstate.lock.info": true} +) + +// rejectRuntimeArtifacts checks the whole artifact set before any file is written, so a +// generated file can never replace Terraform state, provider locks, or workdir metadata, +// even with an overwrite policy. +func rejectRuntimeArtifacts(files []schema.ComponentConfigurationFile) error { + for _, file := range files { + if isRuntimeArtifact(file.Path) { + return fmt.Errorf("%w: generated file %s overlaps Terraform state or workdir runtime files", errUtils.ErrPluginInvalidConfig, file.Path) + } + } + return nil +} + +func isRuntimeArtifact(path string) bool { + path = filepath.ToSlash(filepath.Clean(filepath.FromSlash(path))) + if runtimeArtifactFiles[path] || strings.HasSuffix(path, provisioner.CanonicalLockFilename) { + return true + } + for _, segment := range strings.Split(path, "/") { + if runtimeArtifactDirs[segment] { + return true + } + } + return false +} diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index a769ee60d9d..fe957df793a 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -118,3 +118,14 @@ func TestCheckConfigurationWorkspace(t *testing.T) { }) } } + +func TestRejectRuntimeArtifacts(t *testing.T) { + require.NoError(t, rejectRuntimeArtifacts([]schema.ComponentConfigurationFile{{Path: "backend.tf", IfExists: "overwrite"}})) + for _, path := range []string{"examples/terraform.tfstate", "nested/provider.tf"} { + require.NoError(t, rejectRuntimeArtifacts([]schema.ComponentConfigurationFile{{Path: path}}), path) + } + for _, path := range []string{"terraform.tfstate", "terraform.tfstate.backup", ".terraform.tfstate.lock.info", ".terraform/environment", "nested/.terraform/modules/modules.json", "terraform.tfstate.d/stage/terraform.tfstate", ".terraform.lock.hcl", "nested/.dev-app.terraform.lock.hcl", ".atmos/metadata.json"} { + files := []schema.ComponentConfigurationFile{{Path: "backend.tf", IfExists: "overwrite"}, {Path: path, IfExists: "overwrite"}} + require.ErrorIs(t, rejectRuntimeArtifacts(files), errUtils.ErrPluginInvalidConfig, path) + } +} diff --git a/pkg/component/terraform/execute_pipeline.go b/pkg/component/terraform/execute_pipeline.go index 00334ce998a..95291894850 100644 --- a/pkg/component/terraform/execute_pipeline.go +++ b/pkg/component/terraform/execute_pipeline.go @@ -65,6 +65,9 @@ func (e *Executor) prepareComponentExecution( } if prepared != nil && !info.DryRun { + if err := rejectRuntimeArtifacts(prepared.Files); err != nil { + return nil, err + } if err := configuration.WriteFiles(componentPath, prepared.Files); err != nil { return nil, err } From 66e627a98b611e06cfcbe5a450468ff32de337fc Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:52:29 -0600 Subject: [PATCH 25/52] fix(validate): check discovered definitions against the manifest schema atmos validate stacks schema-checked only YAML manifests, so a discovered definition with an invalid field such as metadata.type reported success. Validate each discovered stack against the selected manifest schema. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks.go | 60 ++++++++++++++++++++++ internal/exec/configuration_stacks_test.go | 44 +++++++++++++++- internal/exec/validate_stacks.go | 6 +++ 3 files changed, 109 insertions(+), 1 deletion(-) diff --git a/internal/exec/configuration_stacks.go b/internal/exec/configuration_stacks.go index 14f877ec807..bcb4aaf73c2 100644 --- a/internal/exec/configuration_stacks.go +++ b/internal/exec/configuration_stacks.go @@ -3,10 +3,16 @@ package exec import ( "context" "fmt" + "maps" + "os" "path/filepath" + "slices" + + "github.com/santhosh-tekuri/jsonschema/v5" errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/schema" + u "github.com/cloudposse/atmos/pkg/utils" ) // mergeConfigurationStacks feeds provider definitions through the ordinary stack compiler. @@ -34,3 +40,57 @@ func mergeConfigurationStacks(config *schema.AtmosConfiguration, stacks map[stri } return nil } + +// validateDiscoveredManifests checks provider definitions against the same manifest schema +// as YAML stack manifests, so an invalid discovered field fails `atmos validate stacks`. +func validateDiscoveredManifests(config *schema.AtmosConfiguration, schemaPath string) ([]string, error) { + if config.ComponentConfigurations == nil { + return nil, nil + } + discovered, err := config.ComponentConfigurations.Discover(context.Background()) + if err != nil { + return nil, err + } + compiled, err := compiledManifestSchema(schemaPath) + if err != nil { + return nil, err + } + var messages []string + for _, name := range slices.Sorted(maps.Keys(discovered)) { + data, err := u.ConvertToJSONFast(discovered[name]) + if err != nil { + return nil, err + } + instance, err := u.ConvertFromJSON(data) + if err != nil { + return nil, err + } + if err := compiled.Validate(instance); err != nil { + messages = append(messages, fmt.Sprintf("Atmos manifest JSON Schema validation error in the discovered stack '%s':\n%v", name, err)) + } + } + return messages, nil +} + +// compiledManifestSchema shares the stack processor's compiled-schema cache. +func compiledManifestSchema(path string) (*jsonschema.Schema, error) { + if compiled, found := getCachedCompiledSchema(path); found { + return compiled, nil + } + reader, err := os.Open(path) + if err != nil { + return nil, err + } + defer reader.Close() + compiler := jsonschema.NewCompiler() + compiler.Draft = jsonschema.Draft2020 + if err := compiler.AddResource(path, reader); err != nil { + return nil, err + } + compiled, err := compiler.Compile(path) + if err != nil { + return nil, err + } + cacheCompiledSchema(path, compiled) + return compiled, nil +} diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index 1fc8f1d7e6c..b2447cdd893 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -43,7 +43,8 @@ func TestConfigurationStacksDoNotReuseAnotherInvocationsCache(t *testing.T) { provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) config.ComponentConfigurations = provider definitions := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module", "vars": map[string]any{"revision": revision}}}}}} - provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil).Times(2) + // FindStacksMap, then ValidateStacks for its stack map and its schema check. + provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil).Times(3) stacks, _, _, err := FindStacksMap(config, false) require.NoError(t, err) app := stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"].(map[string]any)["app"].(map[string]any) @@ -130,3 +131,44 @@ func TestStaticDescribeStacksIncludesDiscoveredStacks(t *testing.T) { require.Contains(t, stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"], "app") require.Equal(t, "live", raw["live"]["name"]) } + +func TestValidateStacksChecksDiscoveredDefinitionsAgainstManifestSchema(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} + config.Components.Terraform.ConfigurationProviders = map[string]schema.ComponentConfiguration{"terragrunt": {Enabled: true, Discovery: schema.ComponentDiscoveryConfig{Enabled: true}}} + // The shape the Terragrunt provider and discovery adapter produce for a unit. + unit := map[string]any{ + "source": "./modules/app", "vars": map[string]any{}, + "provision": map[string]any{"workdir": map[string]any{"enabled": true}}, + "backend_type": "local", "backend": map[string]any{"local": map[string]any{}}, + "metadata": map[string]any{"terraform_workspace": "default", "type": "real"}, + "settings": map[string]any{ + "terragrunt": map[string]any{"generation_root": ""}, + "configuration": map[string]any{"provider": "terragrunt", "engine": "terraform", "source": "live/app/terragrunt.hcl"}, + }, + "dependencies": map[string]any{"files": []any{"live/app/terragrunt.hcl"}, "folders": []any{"modules/app"}, "components": []any{map[string]any{"name": "vpc", "stack": "live", "kind": "terraform"}}}, + } + vpc := map[string]any{"source": "./modules/vpc", "vars": map[string]any{}} + valid := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": unit, "vpc": vpc}}}} + invalid := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module", "metadata": map[string]any{"type": "bogus"}}}}}} + for _, test := range []struct { + name string + definitions map[string]map[string]any + wantErr bool + }{{name: "valid", definitions: valid}, {name: "invalid metadata type", definitions: invalid, wantErr: true}} { + t.Run(test.name, func(t *testing.T) { + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + provider.EXPECT().Discover(gomock.Any()).DoAndReturn(func(context.Context) (map[string]map[string]any, error) { + return test.definitions, nil + }).AnyTimes() + config.ComponentConfigurations = provider + err := ValidateStacks(config) + if !test.wantErr { + require.NoError(t, err) + return + } + require.Error(t, err) + require.Contains(t, err.Error(), "discovered stack 'live'") + }) + } +} diff --git a/internal/exec/validate_stacks.go b/internal/exec/validate_stacks.go index 7b1298b44d9..a2700ec206a 100644 --- a/internal/exec/validate_stacks.go +++ b/internal/exec/validate_stacks.go @@ -246,6 +246,12 @@ func ValidateStacks(atmosConfig *schema.AtmosConfiguration) error { } } + discoveredErrors, err := validateDiscoveredManifests(atmosConfig, atmosManifestJsonSchemaFilePath) + if err != nil { + return err + } + validationErrorMessages = append(validationErrorMessages, discoveredErrors...) + if len(validationErrorMessages) > 0 { return errors.New(strings.Join(dedupeStrings(validationErrorMessages), "\n\n")) } From 16b9f22cc723a31a23d1e260aef8b967f300eb7e Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 19:55:43 -0600 Subject: [PATCH 26/52] Revert "fix(auth): include discovered units in scoped auth validation" This reverts commit f767975bd6b975655b1c5330e4188798f9d03ec8. The fix touches internal/exec/describe_stacks_static.go, which is outside this pull request's diff and takes it past CodeRabbit's 149-file review limit. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks_test.go | 13 ------------- internal/exec/describe_stacks_static.go | 10 +--------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index b2447cdd893..b47b82c7e67 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -119,19 +119,6 @@ func TestValidateStacksMissingStacksDirStillRunsDiscovery(t *testing.T) { require.NoError(t, ValidateStacks(plain)) } -func TestStaticDescribeStacksIncludesDiscoveredStacks(t *testing.T) { - root := t.TempDir() - config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: filepath.Join(root, "stacks"), TerraformDirAbsolutePath: filepath.Join(root, "components")} - provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) - config.ComponentConfigurations = provider - definitions := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module"}}}}} - provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil) - stacks, raw, _, err := findDescribeStacksMap(config, "live", false, true) - require.NoError(t, err) - require.Contains(t, stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"], "app") - require.Equal(t, "live", raw["live"]["name"]) -} - func TestValidateStacksChecksDiscoveredDefinitionsAgainstManifestSchema(t *testing.T) { root := t.TempDir() config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: root, TerraformDirAbsolutePath: filepath.Join(root, "components")} diff --git a/internal/exec/describe_stacks_static.go b/internal/exec/describe_stacks_static.go index 0d73b15ed66..fda3ddbfa2d 100644 --- a/internal/exec/describe_stacks_static.go +++ b/internal/exec/describe_stacks_static.go @@ -22,15 +22,7 @@ func findDescribeStacksMap(config *schema.AtmosConfiguration, stack string, igno _, stacks, raw, deferred, err := processYAMLConfigFilesWithOptions(config, config.StacksBaseAbsolutePath, config.TerraformDirAbsolutePath, config.HelmfileDirAbsolutePath, config.PackerDirAbsolutePath, config.AnsibleDirAbsolutePath, files, false, true, ignoreMissing, &StackLoadOptions{SkipTemplates: true, StaticOnly: true}) - if err != nil { - return nil, nil, nil, err - } - // Discovered definitions are literal data from the provider inventory, so static - // inspection includes them without authenticating or evaluating templates. - if err := mergeConfigurationStacks(config, stacks, raw, deferred); err != nil { - return nil, nil, nil, err - } - return stacks, raw, deferred, nil + return stacks, raw, deferred, err } func (p *describeStacksProcessor) resolveStackName(file, manifest string, info schema.ConfigAndStacksInfo, vars map[string]any) (string, schema.Context, error) { //nolint:gocritic // Mirrors the existing read-only name resolver. From b23e0e2a15849b3d57b796694ce5a5868bb6520f Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 10 Nov 2026 21:03:00 -0600 Subject: [PATCH 27/52] fix(auth): include discovered units in scoped auth validation Static describe, used by atmos auth validate --stack, loaded only YAML manifests, so a stack defined only by a configuration provider matched no components. Register discovery with the static describe merge point. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks.go | 6 ++++++ internal/exec/configuration_stacks_test.go | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/internal/exec/configuration_stacks.go b/internal/exec/configuration_stacks.go index bcb4aaf73c2..4bdea6ab8d7 100644 --- a/internal/exec/configuration_stacks.go +++ b/internal/exec/configuration_stacks.go @@ -15,6 +15,12 @@ import ( u "github.com/cloudposse/atmos/pkg/utils" ) +// Discovered definitions are literal provider inventory data, so static inspection +// (for example scoped `atmos auth validate`) includes them as well. +func init() { + mergeStaticStacks = mergeConfigurationStacks +} + // mergeConfigurationStacks feeds provider definitions through the ordinary stack compiler. // The invocation-owned provider retains the caller's cancellation scope. func mergeConfigurationStacks(config *schema.AtmosConfiguration, stacks map[string]any, raw map[string]map[string]any, contexts AllStacksDeferredContexts) error { diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index b47b82c7e67..887c79db8b8 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -159,3 +159,16 @@ func TestValidateStacksChecksDiscoveredDefinitionsAgainstManifestSchema(t *testi }) } } + +func TestStaticDescribeStacksIncludesDiscoveredStacks(t *testing.T) { + root := t.TempDir() + config := &schema.AtmosConfiguration{BasePath: root, BasePathAbsolute: root, StacksBaseAbsolutePath: filepath.Join(root, "stacks"), TerraformDirAbsolutePath: filepath.Join(root, "components")} + provider := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config.ComponentConfigurations = provider + definitions := map[string]map[string]any{"live": {"name": "live", "components": map[string]any{"terraform": map[string]any{"app": map[string]any{"source": "./module"}}}}} + provider.EXPECT().Discover(gomock.Any()).Return(definitions, nil) + stacks, raw, _, err := findDescribeStacksMap(config, "live", false, true) + require.NoError(t, err) + require.Contains(t, stacks["live"].(map[string]any)["components"].(map[string]any)["terraform"], "app") + require.Equal(t, "live", raw["live"]["name"]) +} From 851ed78c8699e91e0a5980af3468e9ae0edd8407 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 14:49:03 -0600 Subject: [PATCH 28/52] test(terraform): verify query initializer cancellation --- pkg/component/terraform/utils_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/component/terraform/utils_test.go b/pkg/component/terraform/utils_test.go index 507cc02bbbb..7514247694e 100644 --- a/pkg/component/terraform/utils_test.go +++ b/pkg/component/terraform/utils_test.go @@ -201,12 +201,16 @@ func TestExecuteTerraformQueryRoutesThroughSchedulerAdapter(t *testing.T) { stacks := map[string]any{"dev": map[string]any{}} var described bool var scheduled bool + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + var initializerContext context.Context patches := gomonkey.NewPatches() defer patches.Reset() // The query path loads configuration through InitCliConfigWithContext. InitCliConfig is only a // wrapper around it, so patching the wrapper would not intercept this call. - patches.ApplyFunc(cfg.InitCliConfigWithContext, func(_ context.Context, info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + patches.ApplyFunc(cfg.InitCliConfigWithContext, func(got context.Context, info schema.ConfigAndStacksInfo, processStacks bool) (schema.AtmosConfiguration, error) { + initializerContext = got require.Equal(t, "dev", info.Stack) require.True(t, processStacks) return schema.AtmosConfiguration{}, nil @@ -266,9 +270,12 @@ func TestExecuteTerraformQueryRoutesThroughSchedulerAdapter(t *testing.T) { ProcessFunctions: true, Skip: []string{"skip-me"}, } - require.NoError(t, testExecutor(t).ExecuteTerraformQuery(info)) + require.NoError(t, testExecutor(t).ExecuteTerraformQueryWithContext(ctx, info)) require.True(t, described) require.True(t, scheduled) + require.NotNil(t, initializerContext) + cancel() + require.ErrorIs(t, initializerContext.Err(), context.Canceled) } func TestExecuteTerraformAffectedRoutesThroughSchedulerAdapter(t *testing.T) { From 596408fe129710fe6cbe01ec896497a5d017e7e2 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 14:49:38 -0600 Subject: [PATCH 29/52] fix(terragrunt): keep backend resolution read-only --- plugins/terragrunt/internal/engine/resolve.go | 7 ++++--- plugins/terragrunt/internal/engine/resolve_test.go | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index 265d4b5cfad..b096a7b184d 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -66,8 +66,9 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* return nil, err } discover := request.Phase == "discover" || request.Command == "discover" - if discover || request.Phase == "backend" || request.Command == "generate" { - environment = atmosbridge.Discovery(environment, request.Command == "generate") + generate := request.Command == "generate" && request.Phase != "backend" + if discover || request.Phase == "backend" || generate { + environment = atmosbridge.Discovery(environment, generate) } command := request.Command if command == "" || command == "discover" || command == "generate" { @@ -83,7 +84,7 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* pctx.AutoInit = true pctx.MaxFoldersToCheck = options.DefaultMaxFoldersToCheck if filepath.Base(path) == "terragrunt.stack.hcl" { - if request.Command == "generate" { + if generate { if err := atmosbridge.Generate(ctx, logger, environment, path, request.Tofu); err != nil { return nil, err } diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 48af1d022cc..8d18aabc840 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -89,6 +89,16 @@ remote_state { require.ErrorContains(t, err, "cannot inspect selected executable") } +func TestBackendGenerateDoesNotWriteStack(t *testing.T) { + root := t.TempDir() + fixture := filepath.Join("..", "..", "fixtures", "explicit-stack") + require.NoError(t, os.CopyFS(root, os.DirFS(fixture))) + request := model.Request{Path: filepath.Join(root, "live", "terragrunt.stack.hcl"), BasePath: root, Phase: "backend", Command: "generate", Tofu: "must-not-execute", Environment: map[string]string{}} + _, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.NoDirExists(t, filepath.Join(root, "live", ".terragrunt-stack")) +} + func TestDiscoveryDeniesCommands(t *testing.T) { request := nativeUnit(t, `locals { value = run_cmd("must-not-execute") } inputs = { value = local.value } From 52023efbdebea6762d0ef9f0b3b71136b59f0b64 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 14:54:40 -0600 Subject: [PATCH 30/52] test(plugin): cover preparation deadline --- pkg/plugin/adapter/component/calls_test.go | 7 +++++++ pkg/plugin/adapter/component/main_test.go | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/plugin/adapter/component/calls_test.go b/pkg/plugin/adapter/component/calls_test.go index 1329c56d25b..613390953a4 100644 --- a/pkg/plugin/adapter/component/calls_test.go +++ b/pkg/plugin/adapter/component/calls_test.go @@ -114,6 +114,13 @@ func TestRPCFailuresAndDeadlineAreSafe(t *testing.T) { _, err = p.Prepare(t.Context(), request) require.ErrorIs(t, err, errUtils.ErrPluginTimeout) require.ErrorIs(t, err, context.DeadlineExceeded) + + request.Operation.Command = "wait-prepare" + p.timeout = 2 * time.Second + _, err = p.Prepare(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginTimeout) + require.ErrorIs(t, err, context.DeadlineExceeded) + require.FileExists(t, filepath.Join(request.RootDirectory, "preparation.pb"), "preparation must have started") } func TestProviderWithoutValidatorStillHasIndependentStateCapability(t *testing.T) { diff --git a/pkg/plugin/adapter/component/main_test.go b/pkg/plugin/adapter/component/main_test.go index 1a198dbc9a5..7fa6f709d7f 100644 --- a/pkg/plugin/adapter/component/main_test.go +++ b/pkg/plugin/adapter/component/main_test.go @@ -95,10 +95,14 @@ func (*componentFixture) Discover(_ context.Context, request *pluginv1.DiscoverC return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{{Address: fixtureAddress(), Provider: request.Provider, Engine: "terraform", Source: "live/app/terragrunt.hcl"}}}, nil } -func (*componentFixture) Prepare(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { +func (*componentFixture) Prepare(ctx context.Context, request *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) { if err := recordCall(request.RootDirectory, "preparation", request); err != nil { return nil, err } + if request.GetOperation().GetCommand() == "wait-prepare" { + <-ctx.Done() + return nil, status.FromContextError(ctx.Err()).Err() + } return &pluginv1.PrepareComponentResponse{Engine: "terraform", WorkingDirectory: request.RootDirectory, ModuleSource: "./module", Inputs: request.Configuration, State: fixtureState(request.RootDirectory), Files: []*pluginv1.ComponentGeneratedFile{{Path: "backend.tf", Content: []byte("$${literal}\n%{ literal }\n"), IfExists: "error"}}}, nil } From f630689f25046cb853a65be0ce60c059bb03c81e Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 14:55:51 -0600 Subject: [PATCH 31/52] test(terragrunt): assert discovered fixture dependencies --- .../internal/provider/fixtures_test.go | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins/terragrunt/internal/provider/fixtures_test.go b/plugins/terragrunt/internal/provider/fixtures_test.go index d13c5fa781c..e76cdaa2e64 100644 --- a/plugins/terragrunt/internal/provider/fixtures_test.go +++ b/plugins/terragrunt/internal/provider/fixtures_test.go @@ -43,11 +43,37 @@ func TestDiscoveryFixtures(t *testing.T) { request := &pluginv1.DiscoverComponentsRequest{RootDirectory: root, Provider: "terragrunt", ProviderConfiguration: opts, IncludePaths: []string{test.scope}, Operation: &pluginv1.ComponentOperation{Mode: "native", Command: "list"}, Invocation: &pluginv1.Invocation{Environment: map[string]string{"ATMOS_TERRAFORM_BINARY": "must-not-execute"}}} response, err := p.Discover(t.Context(), request) require.NoError(t, err) + expected := map[string]map[string]pluginv1.ComponentDependency_Kind{} + if test.name == "advanced" { + expected = map[string]map[string]pluginv1.ComponentDependency_Kind{ + "app": {"network": pluginv1.ComponentDependency_ORDER, "database": pluginv1.ComponentDependency_OUTPUT, "cache": pluginv1.ComponentDependency_OUTPUT}, + "cache": {"network": pluginv1.ComponentDependency_OUTPUT}, + "database": {"network": pluginv1.ComponentDependency_OUTPUT}, + } + } else { + expected = map[string]map[string]pluginv1.ComponentDependency_Kind{ + "dev/app": {"dev/network": pluginv1.ComponentDependency_OUTPUT}, + "prod/app": {"prod/network": pluginv1.ComponentDependency_OUTPUT}, + } + } names := []string{} for _, instance := range response.Components { names = append(names, instance.Address.Component) require.Equal(t, "terraform", instance.Address.ComponentType) require.NotEmpty(t, instance.Sources) + dependencies := make(map[string]pluginv1.ComponentDependency_Kind) + for _, dependency := range instance.Dependencies { + require.NotNil(t, dependency.Target) + require.Equal(t, instance.Address.Stack, dependency.Target.Stack) + require.Equal(t, "terraform", dependency.Target.ComponentType) + require.NotContains(t, dependencies, dependency.Target.Component) + dependencies[dependency.Target.Component] = dependency.Kind + } + require.Len(t, dependencies, len(expected[instance.Address.Component])) + for target, kind := range expected[instance.Address.Component] { + require.Contains(t, dependencies, target) + require.Equal(t, kind, dependencies[target]) + } } require.Equal(t, test.names, names) require.NoError(t, filepath.WalkDir(root, func(path string, entry fs.DirEntry, err error) error { From 7fd032b51b540dd54b1c3e1633b72d99cae9414f Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 14:59:14 -0600 Subject: [PATCH 32/52] fix(affected): scope resolved paths to changed file index --- .../describe_affected_changed_files_index.go | 3 ++ internal/exec/describe_affected_components.go | 3 +- .../exec/describe_affected_configuration.go | 48 ++++--------------- .../describe_affected_configuration_test.go | 44 ++++++++--------- pkg/component/configuration/files.go | 17 +++++++ pkg/component/configuration/files_test.go | 19 ++++++++ 6 files changed, 69 insertions(+), 65 deletions(-) diff --git a/internal/exec/describe_affected_changed_files_index.go b/internal/exec/describe_affected_changed_files_index.go index 04358e2a82e..2e9ee9ba056 100644 --- a/internal/exec/describe_affected_changed_files_index.go +++ b/internal/exec/describe_affected_changed_files_index.go @@ -24,6 +24,9 @@ type changedFilesIndex struct { // outside a component base path, such as native Helm values_files. allFilesSet map[string]struct{} + resolvedOnce sync.Once + resolved *changedFilesIndex + mu sync.RWMutex } diff --git a/internal/exec/describe_affected_components.go b/internal/exec/describe_affected_components.go index f9b5184631d..e93f3f16b6e 100644 --- a/internal/exec/describe_affected_components.go +++ b/internal/exec/describe_affected_components.go @@ -8,6 +8,7 @@ import ( "github.com/go-viper/mapstructure/v2" + "github.com/cloudposse/atmos/pkg/component/configuration" cfg "github.com/cloudposse/atmos/pkg/config" log "github.com/cloudposse/atmos/pkg/logger" "github.com/cloudposse/atmos/pkg/schema" @@ -1173,7 +1174,7 @@ func checkDependencyChangesIndexed( ) error { // Get file/folder dependencies from dependencies.components or settings.depends_on. deps := getFileFolderDependencies(*componentSection, settingsSection) - provider := configurationWatchPaths(atmosConfig, settingsSection, deps) + provider := configuration.WatchPaths(atmosConfig, settingsSection, deps) if len(deps) > 0 { index, matched := configurationMatchInputs(filesIndex, deps, provider) isFolderOrFileChanged, changedType, changedFileOrFolder, err := isComponentDependentFolderOrFileChangedIndexed( diff --git a/internal/exec/describe_affected_configuration.go b/internal/exec/describe_affected_configuration.go index e22490694b4..6ac57234c24 100644 --- a/internal/exec/describe_affected_configuration.go +++ b/internal/exec/describe_affected_configuration.go @@ -2,9 +2,7 @@ package exec import ( "fmt" - "path/filepath" "slices" - "sync/atomic" errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/schema" @@ -28,22 +26,6 @@ func rebaseConfigurationDiscovery(config *schema.AtmosConfiguration) error { return nil } -// configurationWatchPaths resolves provider-owned watches against the project -// root without putting checkout-specific absolute paths into stack comparisons. -// Existing YAML dependency path semantics remain unchanged. It reports whether -// the dependencies belong to a provider-discovered component. -func configurationWatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) bool { - if !schema.ConfigurationOwned(settings) { - return false - } - for i := range deps { - if !filepath.IsAbs(deps[i].Path) { - deps[i].Path = filepath.Join(config.BasePathAbsolute, deps[i].Path) - } - } - return true -} - // configurationMatchInputs returns the change set and dependencies to match. // Provider watches are rooted at BasePathAbsolute, and base-path resolution // can spell that root differently from the repository root the changed files @@ -72,27 +54,15 @@ func configuredDependencyPath(deps, matched []schema.ComponentDependency, path s return path } -// resolvedChangedFilesView pairs a change-set index with its resolved copy. -type resolvedChangedFilesView struct { - source, resolved *changedFilesIndex -} - -// lastResolvedChangedFiles holds the view for the most recent index, so a run -// resolves its change set once rather than once per provider component. The -// index is immutable after construction, so pointer identity is a safe key. -var lastResolvedChangedFiles atomic.Pointer[resolvedChangedFilesView] - // resolvedChangedFiles returns the change set with symlinks and short names resolved. func resolvedChangedFiles(index *changedFilesIndex) *changedFilesIndex { - if view := lastResolvedChangedFiles.Load(); view != nil && view.source == index { - return view.resolved - } - files := index.getAllFiles() - resolved := make([]string, len(files)) - for i, file := range files { - resolved[i] = evalSymlinksBestEffort(file) - } - view := &resolvedChangedFilesView{source: index, resolved: &changedFilesIndex{allFiles: resolved}} - lastResolvedChangedFiles.Store(view) - return view.resolved + index.resolvedOnce.Do(func() { + files := index.getAllFiles() + resolved := make([]string, len(files)) + for i, file := range files { + resolved[i] = evalSymlinksBestEffort(file) + } + index.resolved = &changedFilesIndex{allFiles: resolved} + }) + return index.resolved } diff --git a/internal/exec/describe_affected_configuration_test.go b/internal/exec/describe_affected_configuration_test.go index ba3a82f2de6..379d961c68e 100644 --- a/internal/exec/describe_affected_configuration_test.go +++ b/internal/exec/describe_affected_configuration_test.go @@ -6,6 +6,8 @@ import ( "path/filepath" "testing" + "github.com/cloudposse/atmos/pkg/component/configuration" + "github.com/spf13/cobra" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" @@ -120,7 +122,7 @@ func TestAffectedConfigurationWatchRootSpelling(t *testing.T) { settings := map[string]any{"configuration": map[string]any{"provider": "terragrunt"}} watches := func() []schema.ComponentDependency { deps := []schema.ComponentDependency{{Kind: "folder", Path: "modules/unit"}} - require.True(t, configurationWatchPaths(config, settings, deps)) + require.True(t, configuration.WatchPaths(config, settings, deps)) return deps } @@ -151,30 +153,6 @@ func TestAffectedConfigurationWatchRootSpelling(t *testing.T) { require.False(t, changed) } -func TestAffectedConfigurationWatchRoot(t *testing.T) { - root := t.TempDir() - config := &schema.AtmosConfiguration{BasePathAbsolute: root} - for _, provider := range []bool{true, false} { - settings := map[string]any{} - if provider { - settings["configuration"] = map[string]any{"provider": "terragrunt"} - } - absolute := filepath.Join(root, "module") - deps := []schema.ComponentDependency{{Kind: "file", Path: "root.hcl"}, {Kind: "folder", Path: absolute}} - configurationWatchPaths(config, settings, deps) - require.Equal(t, absolute, deps[1].Path) - if provider { - require.Equal(t, filepath.Join(root, "root.hcl"), deps[0].Path) - changed, kind, _, err := isComponentDependentFolderOrFileChangedIndexed(newChangedFilesIndex(config, []string{"root.hcl"}, root), deps) - require.NoError(t, err) - require.True(t, changed) - require.Equal(t, "file", kind) - } else { - require.Equal(t, "root.hcl", deps[0].Path) - } - } -} - // Native discovery starts during configuration initialization, so the command's cancellation must reach it. func TestParseDescribeAffectedCliArgsPassesCommandContext(t *testing.T) { root := t.TempDir() @@ -207,3 +185,19 @@ stacks: _, err := ParseDescribeAffectedCliArgs(cmd, nil) require.ErrorIs(t, err, context.Canceled) } + +func TestResolvedChangedFilesPerIndex(t *testing.T) { + first := &changedFilesIndex{allFiles: []string{filepath.Join(t.TempDir(), "first")}} + second := &changedFilesIndex{allFiles: []string{filepath.Join(t.TempDir(), "second")}} + const n = 20 + results := make(chan *changedFilesIndex, n) + for range n { + go func() { results <- resolvedChangedFiles(first) }() + } + initial := <-results + for i := 1; i < n; i++ { + require.Same(t, initial, <-results) + } + require.NotSame(t, initial, resolvedChangedFiles(second)) + require.Same(t, initial, resolvedChangedFiles(first)) +} diff --git a/pkg/component/configuration/files.go b/pkg/component/configuration/files.go index d3bd4fd7235..7c01f7b97f1 100644 --- a/pkg/component/configuration/files.go +++ b/pkg/component/configuration/files.go @@ -75,3 +75,20 @@ func writeFile(root *os.Root, file schema.ComponentConfigurationFile) error { _, writeErr := output.Write(file.Content) return errors.Join(writeErr, output.Close()) } + +// WatchPaths resolves provider-owned watches against the project +// root without putting checkout-specific absolute paths into stack comparisons. +// Existing YAML dependency path semantics remain unchanged. It reports whether +// the dependencies belong to a provider-discovered component. +func WatchPaths(config *schema.AtmosConfiguration, settings map[string]any, deps []schema.ComponentDependency) bool { + defer perf.Track(nil, "configuration.WatchPaths")() + if !schema.ConfigurationOwned(settings) { + return false + } + for i := range deps { + if !filepath.IsAbs(deps[i].Path) { + deps[i].Path = filepath.Join(config.BasePathAbsolute, deps[i].Path) + } + } + return true +} diff --git a/pkg/component/configuration/files_test.go b/pkg/component/configuration/files_test.go index fe72930a580..559584c8bff 100644 --- a/pkg/component/configuration/files_test.go +++ b/pkg/component/configuration/files_test.go @@ -58,3 +58,22 @@ func TestWriteFilesPreflightAndContainment(t *testing.T) { _, err := os.Stat(filepath.Join(outside, "escape.tf")) require.True(t, os.IsNotExist(err)) } + +func TestWatchPaths(t *testing.T) { + root := t.TempDir() + for _, provider := range []bool{true, false} { + settings := map[string]any{} + if provider { + settings["configuration"] = map[string]any{"provider": "terragrunt"} + } + absolute := filepath.Join(root, "module") + deps := []schema.ComponentDependency{{Path: "root.hcl"}, {Path: absolute}} + require.Equal(t, provider, WatchPaths(&schema.AtmosConfiguration{BasePathAbsolute: root}, settings, deps)) + require.Equal(t, absolute, deps[1].Path) + if provider { + require.Equal(t, filepath.Join(root, "root.hcl"), deps[0].Path) + } else { + require.Equal(t, "root.hcl", deps[0].Path) + } + } +} From c0923d360c6f335149ad720f03df7c155b8573e4 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 15:00:27 -0600 Subject: [PATCH 33/52] test(plugin): assert masking for sensitive paths --- pkg/plugin/adapter/component/objects_test.go | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/adapter/component/objects_test.go b/pkg/plugin/adapter/component/objects_test.go index c973cec486a..bc992bdd420 100644 --- a/pkg/plugin/adapter/component/objects_test.go +++ b/pkg/plugin/adapter/component/objects_test.go @@ -2,6 +2,7 @@ package component import ( "encoding/json" + "fmt" "testing" "github.com/stretchr/testify/require" @@ -10,6 +11,7 @@ import ( "github.com/zclconf/go-cty/cty/msgpack" errUtils "github.com/cloudposse/atmos/errors" + atmosio "github.com/cloudposse/atmos/pkg/io" pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" ) @@ -48,16 +50,33 @@ func TestObjectRejectsMalformedAndUnknown(t *testing.T) { } func TestObjectSensitivePaths(t *testing.T) { - value := cty.ObjectVal(map[string]cty.Value{"items": cty.TupleVal([]cty.Value{cty.StringVal("masked-value"), cty.NumberIntVal(12345)})}) - encoded := objectWireValue(t, value) + atmosio.Reset() + t.Cleanup(atmosio.Reset) + require.NoError(t, atmosio.Initialize()) attr := &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: "items"}} index := &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.NumberIntVal(0))}} - for _, path := range []*pluginv1.ComponentValuePath{{}, {Steps: []*pluginv1.ComponentValueStep{attr}}, {Steps: []*pluginv1.ComponentValueStep{attr, index}}} { + paths := []*pluginv1.ComponentValuePath{{}, {Steps: []*pluginv1.ComponentValueStep{attr}}, {Steps: []*pluginv1.ComponentValueStep{attr, index}}} + for i, path := range paths { + secret := fmt.Sprintf("unique-masked-value-%d", i) + value := cty.ObjectVal(map[string]cty.Value{"items": cty.TupleVal([]cty.Value{cty.StringVal(secret), cty.NumberIntVal(int64(12345 + i))})}) + encoded := objectWireValue(t, value) encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} + require.Equal(t, secret, atmosio.MaskString(secret)) decoded, err := DecodeObject(encoded) require.NoError(t, err) - require.Equal(t, []any{"masked-value", int64(12345)}, decoded["items"]) + require.Equal(t, []any{secret, int64(12345 + i)}, decoded["items"]) + require.Equal(t, "", atmosio.MaskString(secret)) } + numeric := "987654321" + require.Equal(t, numeric, atmosio.MaskString(numeric)) + numericValue := objectWireValue(t, cty.ObjectVal(map[string]cty.Value{"items": cty.TupleVal([]cty.Value{cty.StringVal("other"), cty.NumberIntVal(987654321)})})) + numericIndex := &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.NumberIntVal(1))}} + numericValue.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{attr, numericIndex}}} + _, err := DecodeObject(numericValue) + require.NoError(t, err) + require.Equal(t, "", atmosio.MaskString(numeric)) + encoded := objectWireValue(t, cty.ObjectVal(map[string]cty.Value{"items": cty.TupleVal([]cty.Value{cty.StringVal("x"), cty.NumberIntVal(1)})})) + for _, path := range []*pluginv1.ComponentValuePath{nil, {Steps: []*pluginv1.ComponentValueStep{nil}}, {Steps: []*pluginv1.ComponentValueStep{index}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.True)}}}}, {Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{}}}}} { encoded.SensitivePaths = []*pluginv1.ComponentValuePath{path} _, err := DecodeObject(encoded) From 7d65e4643d6c2475f0b445175bb77831b233c2ef Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 15:04:11 -0600 Subject: [PATCH 34/52] fix(terragrunt): serialize stack generation and preparation --- plugins/terragrunt/go.mod | 2 +- .../internal/provider/preparation.go | 30 ++++++++++++++ .../internal/provider/provider_test.go | 39 +++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/plugins/terragrunt/go.mod b/plugins/terragrunt/go.mod index 66df99a36e2..d7d5f224603 100644 --- a/plugins/terragrunt/go.mod +++ b/plugins/terragrunt/go.mod @@ -5,6 +5,7 @@ go 1.27.3 require ( github.com/bmatcuk/doublestar/v4 v4.10.2 github.com/cloudposse/atmos/sdk v0.0.0 + github.com/gofrs/flock v0.13.1 github.com/gruntwork-io/terragrunt v1.2.1 github.com/gruntwork-io/terragrunt/pkg/atmosbridge v0.0.0-00010101000000-000000000000 github.com/hashicorp/go-version v1.9.0 @@ -109,7 +110,6 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.6 // indirect github.com/goccy/go-yaml v1.19.2 // indirect - github.com/gofrs/flock v0.13.1 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/flatbuffers v25.12.19+incompatible // indirect diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go index fd7e4afb9b2..7fbbcfbee76 100644 --- a/plugins/terragrunt/internal/provider/preparation.go +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -2,9 +2,15 @@ package provider import ( "context" + "crypto/sha256" + "fmt" "maps" + "os" "path/filepath" "slices" + "time" + + "github.com/gofrs/flock" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" @@ -53,6 +59,30 @@ func (p *Provider) Prepare(ctx context.Context, request *pluginv1.ComponentReque return nil, rpcError(ErrUnsupported) } if req.GenerationRoot != "" { + // All provider processes generating the same stack must retain the lock + // until the subsequent unit parse has finished. + root, err := filepath.EvalSymlinks(req.BasePath) + if err != nil { + return nil, rpcError(err) + } + rel, err := filepath.Rel(req.BasePath, req.GenerationRoot) + if err != nil { + return nil, rpcError(err) + } + generationPath := filepath.Join(root, rel) + if resolved, resolveErr := filepath.EvalSymlinks(generationPath); resolveErr == nil { + generationPath = resolved + } + key := sha256.Sum256([]byte(generationPath)) + lock := flock.New(filepath.Join(os.TempDir(), fmt.Sprintf("atmos-terragrunt-%x.lock", key))) + locked, err := lock.TryLockContext(ctx, 50*time.Millisecond) + if err != nil { + return nil, rpcError(err) + } + if !locked { + return nil, rpcError(ctx.Err()) + } + defer lock.Unlock() generation := req generation.Path, generation.Phase, generation.Command = req.GenerationRoot, "discover", "generate" if _, err := p.evaluate(ctx, generation); err != nil { diff --git a/plugins/terragrunt/internal/provider/provider_test.go b/plugins/terragrunt/internal/provider/provider_test.go index b52a79a429a..8edc16a04dc 100644 --- a/plugins/terragrunt/internal/provider/provider_test.go +++ b/plugins/terragrunt/internal/provider/provider_test.go @@ -4,7 +4,9 @@ import ( "context" "errors" "path/filepath" + "sync/atomic" "testing" + "time" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -110,3 +112,40 @@ func TestEvaluatorErrorsDoNotExposePayloads(t *testing.T) { require.NotContains(t, err.Error(), "secret-evaluated-value") } } + +func TestPreparationsSerializeGenerationAndParsing(t *testing.T) { + request := componentRequest(t) + parsing := make(chan struct{}) + release := make(chan struct{}) + secondGeneration := make(chan struct{}, 1) + var calls atomic.Int32 + p := New(func(ctx context.Context, req model.Request) (*model.Resolution, error) { + if req.Phase == "discover" { + if calls.Add(1) == 2 { + secondGeneration <- struct{}{} + } + } else if calls.Load() == 1 { + close(parsing) + <-release + } + return &model.Resolution{Source: request.RootDirectory, WorkingDir: request.RootDirectory}, nil + }) + first := make(chan error, 1) + go func() { _, err := p.Prepare(t.Context(), request); first <- err }() + <-parsing + second := make(chan error, 1) + go func() { _, err := p.Prepare(t.Context(), request); second <- err }() + select { + case <-secondGeneration: + t.Fatal("second generation started before the first parse finished") + case <-time.After(150 * time.Millisecond): + } + close(release) + require.NoError(t, <-first) + require.NoError(t, <-second) + select { + case <-secondGeneration: + default: + t.Fatal("second generation did not run") + } +} From 5dc5f8cbe6f20ab3b827b46cb1a6ca1db6276bd6 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Wed, 11 Nov 2026 21:00:50 -0600 Subject: [PATCH 35/52] fix(terraform): retain structured input sensitivity --- pkg/component/terraform/configuration.go | 1 + pkg/component/terraform/configuration_test.go | 28 +++++++++++ pkg/component/terraform/execute_prepare.go | 8 ++++ pkg/plugin/adapter/component/objects.go | 36 +++++++++++++- pkg/plugin/adapter/component/objects_test.go | 48 +++++++++++++++++++ .../adapter/configuration/preparation.go | 4 +- .../adapter/configuration/session_test.go | 14 ++++++ pkg/schema/component_configuration.go | 2 + pkg/schema/schema.go | 2 + 9 files changed, 140 insertions(+), 3 deletions(-) diff --git a/pkg/component/terraform/configuration.go b/pkg/component/terraform/configuration.go index fd4eb9dae59..c6b085842d4 100644 --- a/pkg/component/terraform/configuration.go +++ b/pkg/component/terraform/configuration.go @@ -47,6 +47,7 @@ func prepareConfiguration(ctx context.Context, config *schema.AtmosConfiguration return prepared, err } info.ComponentVarsSection = prepared.Inputs + info.ConfigurationSensitiveInputKeys = maps.Clone(prepared.SensitiveInputKeys) info.ComponentBackendType, info.ComponentBackendSection = prepared.BackendType, prepared.Backend info.TerraformWorkspace = prepared.Workspace info.ComponentSection["vars"] = prepared.Inputs diff --git a/pkg/component/terraform/configuration_test.go b/pkg/component/terraform/configuration_test.go index fe957df793a..0257843c6a8 100644 --- a/pkg/component/terraform/configuration_test.go +++ b/pkg/component/terraform/configuration_test.go @@ -9,6 +9,7 @@ import ( "go.uber.org/mock/gomock" errUtils "github.com/cloudposse/atmos/errors" + atmosio "github.com/cloudposse/atmos/pkg/io" "github.com/cloudposse/atmos/pkg/schema" ) @@ -129,3 +130,30 @@ func TestRejectRuntimeArtifacts(t *testing.T) { require.ErrorIs(t, rejectRuntimeArtifacts(files), errUtils.ErrPluginInvalidConfig, path) } } + +func TestPreparedConfigurationSensitiveInputsNeverHitDisk(t *testing.T) { + atmosio.Reset() + t.Cleanup(atmosio.Reset) + require.NoError(t, atmosio.Initialize()) + for _, disabled := range []bool{false, true} { + atmosio.ApplyMaskingConfig(&atmosio.Config{DisableMasking: disabled}) + runtime := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + config := &schema.AtmosConfiguration{ComponentConfigurations: runtime} + binary, err := os.Executable() + require.NoError(t, err) + info := &schema.ConfigAndStacksInfo{Command: binary, SubCommand: "apply", ComponentSection: map[string]any{}, ComponentSettingsSection: map[string]any{"configuration": true}} + inputs := map[string]any{"credentials": map[string]any{"secret-input-key": ""}, "empty": map[string]any{}, "null": nil, "public": "visible"} + prepared := &schema.PreparedComponentConfiguration{Inputs: inputs, SensitiveInputKeys: map[string]bool{"credentials": true, "empty": true, "null": true, "absent": true}} + runtime.EXPECT().Prepare(gomock.Any(), info).Return(prepared, nil) + _, err = prepareConfiguration(t.Context(), config, info) + require.NoError(t, err) + // Partition repeatedly without relying on registered secret strings. + ComputeTerraformSecretVarKeys(info) + ComputeTerraformSecretVarKeys(info) + require.Equal(t, map[string]bool{"credentials": true, "empty": true, "null": true}, info.TerraformSecretVarKeys) + require.Equal(t, map[string]any{"public": "visible"}, DiskSafeVars(info)) + env, err := SecretVarEnv(info) + require.NoError(t, err) + require.ElementsMatch(t, []string{`TF_VAR_credentials={"secret-input-key":""}`, `TF_VAR_empty={}`, `TF_VAR_null=null`}, env) + } +} diff --git a/pkg/component/terraform/execute_prepare.go b/pkg/component/terraform/execute_prepare.go index e957d7c2e63..92e877569fa 100644 --- a/pkg/component/terraform/execute_prepare.go +++ b/pkg/component/terraform/execute_prepare.go @@ -277,6 +277,14 @@ func ComputeTerraformSecretVarKeys(info *schema.ConfigAndStacksInfo) { keys[k] = true } + // Provider sensitivity is authoritative even for empty containers and when + // output masking is disabled; it must never depend on registered leaf values. + for key, sensitive := range info.ConfigurationSensitiveInputKeys { + if _, supplied := info.ComponentVarsSection[key]; supplied && sensitive { + keys[key] = true + } + } + // Terraform's `sensitive = true` is an explicit declaration that an input must // not be persisted in a generated tfvars file. When masking is disabled, retain // the established compatibility behavior that keeps typed sensitive values in diff --git a/pkg/plugin/adapter/component/objects.go b/pkg/plugin/adapter/component/objects.go index 954fecf94f3..971f4737491 100644 --- a/pkg/plugin/adapter/component/objects.go +++ b/pkg/plugin/adapter/component/objects.go @@ -75,6 +75,39 @@ func DecodeObject(input *pluginv1.ComponentValue) (map[string]any, error) { return object, nil } +// DecodeObjectWithSensitiveKeys retains validated sensitivity paths as top-level +// input keys. Terraform partitions whole variables, so a sensitive descendant +// makes its containing input sensitive even when it has no non-empty leaves. +func DecodeObjectWithSensitiveKeys(input *pluginv1.ComponentValue) (map[string]any, map[string]bool, error) { + defer perf.Track(nil, "componentadapter.DecodeObjectWithSensitiveKeys")() + + object, err := DecodeObject(input) + if err != nil { + return nil, nil, err + } + keys := make(map[string]bool) + for _, path := range input.GetSensitivePaths() { + if len(path.Steps) == 0 { + for key := range object { + keys[key] = true + } + continue + } + switch selector := path.Steps[0].GetSelector().(type) { + case *pluginv1.ComponentValueStep_Attribute: + keys[selector.Attribute] = true + case *pluginv1.ComponentValueStep_Index: + // DecodeObject already validated this path against an object or map. + index, err := sensitiveIndex(selector.Index) + if err != nil || index.Type() != cty.String { + return nil, nil, errUtils.ErrPluginProtocol + } + keys[index.AsString()] = true + } + } + return object, keys, nil +} + // Float64Bits is the bit size strconv uses for float64 formatting. const float64Bits = 64 @@ -159,7 +192,8 @@ func objectJSON(value cty.Value) (any, error) { func registerSensitive(value any) { switch value := value.(type) { case map[string]any: - for _, child := range value { + for key, child := range value { + atmosio.RegisterSecretValue(key) registerSensitive(child) } case []any: diff --git a/pkg/plugin/adapter/component/objects_test.go b/pkg/plugin/adapter/component/objects_test.go index bc992bdd420..cfc84c683ff 100644 --- a/pkg/plugin/adapter/component/objects_test.go +++ b/pkg/plugin/adapter/component/objects_test.go @@ -83,3 +83,51 @@ func TestObjectSensitivePaths(t *testing.T) { require.ErrorIs(t, err, errUtils.ErrPluginProtocol) } } + +func TestObjectStructuredSensitivity(t *testing.T) { + atmosio.Reset() + t.Cleanup(atmosio.Reset) + require.NoError(t, atmosio.Initialize()) + value := cty.ObjectVal(map[string]cty.Value{ + "credentials": cty.ObjectVal(map[string]cty.Value{"private-map-key": cty.StringVal("")}), + "empty": cty.EmptyObjectVal, + "public": cty.StringVal("visible"), + }) + attr := func(name string) *pluginv1.ComponentValueStep { + return &pluginv1.ComponentValueStep{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: name}} + } + for _, test := range []struct { + name string + paths []*pluginv1.ComponentValuePath + keys map[string]bool + }{ + {name: "map with empty value", paths: []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{attr("credentials")}}}, keys: map[string]bool{"credentials": true}}, + {name: "empty descendant", paths: []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{attr("credentials"), attr("private-map-key")}}}, keys: map[string]bool{"credentials": true}}, + {name: "empty object", paths: []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{attr("empty")}}}, keys: map[string]bool{"empty": true}}, + {name: "root", paths: []*pluginv1.ComponentValuePath{{}}, keys: map[string]bool{"credentials": true, "empty": true, "public": true}}, + } { + t.Run(test.name, func(t *testing.T) { + encoded := objectWireValue(t, value) + encoded.SensitivePaths = test.paths + decoded, keys, err := DecodeObjectWithSensitiveKeys(encoded) + require.NoError(t, err) + require.Equal(t, test.keys, keys) + require.Equal(t, map[string]any{"private-map-key": ""}, decoded["credentials"]) + }) + } + require.Equal(t, "", atmosio.MaskString("private-map-key")) + rendered, err := json.Marshal(map[string]any{"credentials": map[string]any{"private-map-key": ""}}) + require.NoError(t, err) + require.NotContains(t, atmosio.MaskString(string(rendered)), "private-map-key") + encoded := objectWireValue(t, cty.MapVal(map[string]cty.Value{"empty": cty.EmptyObjectVal})) + encoded.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Index{Index: objectWireValue(t, cty.StringVal("empty"))}}}}} + _, keys, err := DecodeObjectWithSensitiveKeys(encoded) + require.NoError(t, err) + require.Equal(t, map[string]bool{"empty": true}, keys) + _, keys, err = DecodeObjectWithSensitiveKeys(nil) + require.NoError(t, err) + require.Empty(t, keys) + encoded.SensitivePaths = []*pluginv1.ComponentValuePath{nil} + _, _, err = DecodeObjectWithSensitiveKeys(encoded) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) +} diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go index 675ea11fe46..f1a777f22f9 100644 --- a/pkg/plugin/adapter/configuration/preparation.go +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -56,7 +56,7 @@ func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) } func preparedConfiguration(result *pluginv1.PrepareComponentResponse) (*schema.PreparedComponentConfiguration, error) { - inputs, err := adapter.DecodeObject(result.Inputs) + inputs, sensitiveKeys, err := adapter.DecodeObjectWithSensitiveKeys(result.Inputs) if err != nil { return nil, err } @@ -67,7 +67,7 @@ func preparedConfiguration(result *pluginv1.PrepareComponentResponse) (*schema.P if result.State.BackendType == "local" { resolveLocalBackend(backend, result.State.WorkingDirectory) } - prepared := &schema.PreparedComponentConfiguration{Engine: result.Engine, Source: result.ModuleSource, Inputs: inputs, BackendType: result.State.BackendType, Backend: backend, Workspace: result.State.Workspace} + prepared := &schema.PreparedComponentConfiguration{Engine: result.Engine, Source: result.ModuleSource, Inputs: inputs, SensitiveInputKeys: sensitiveKeys, BackendType: result.State.BackendType, Backend: backend, Workspace: result.State.Workspace} for _, file := range result.Files { if file.IfExists == "overwrite_terragrunt" { return nil, errUtils.ErrPluginUnsupportedExtension diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index 3f04b8d0dc9..cb89702c467 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -12,6 +12,7 @@ import ( "go.uber.org/mock/gomock" errUtils "github.com/cloudposse/atmos/errors" + atmosio "github.com/cloudposse/atmos/pkg/io" adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" "github.com/cloudposse/atmos/pkg/schema" @@ -240,3 +241,16 @@ func TestPreparedConfigurationRejectsUnsupportedValues(t *testing.T) { _, err = preparedConfiguration(response) require.ErrorIs(t, err, errUtils.ErrPluginProtocol) } + +func TestPreparedConfigurationRetainsSensitiveInputs(t *testing.T) { + atmosio.Reset() + t.Cleanup(atmosio.Reset) + require.NoError(t, atmosio.Initialize()) + inputs, err := adapter.EncodeObject(map[string]any{"credentials": map[string]any{"private-input-key": ""}, "public": "visible"}) + require.NoError(t, err) + inputs.SensitivePaths = []*pluginv1.ComponentValuePath{{Steps: []*pluginv1.ComponentValueStep{{Selector: &pluginv1.ComponentValueStep_Attribute{Attribute: "credentials"}}}}} + prepared, err := preparedConfiguration(&pluginv1.PrepareComponentResponse{Inputs: inputs, State: &pluginv1.ComponentStateIdentity{}}) + require.NoError(t, err) + require.Equal(t, map[string]bool{"credentials": true}, prepared.SensitiveInputKeys) + require.Equal(t, map[string]any{"private-input-key": ""}, prepared.Inputs["credentials"]) +} diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go index a5c993a8c85..b09320417bb 100644 --- a/pkg/schema/component_configuration.go +++ b/pkg/schema/component_configuration.go @@ -51,6 +51,8 @@ type PreparedComponentConfiguration struct { Backend map[string]any Workspace string Files []ComponentConfigurationFile + // SensitiveInputKeys projects provider sensitivity paths onto whole input variables. + SensitiveInputKeys map[string]bool } // ComponentConfigurationFile must bypass template rendering. diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index 26d798c3a75..97be30c022b 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -2142,6 +2142,8 @@ type ConfigAndStacksInfo struct { // before auth credentials are registered) to keep the varfile-write and env-assembly // steps consistent. TerraformSecretVarKeys map[string]bool + // ConfigurationSensitiveInputKeys retains provider-declared sensitivity independently of masking. + ConfigurationSensitiveInputKeys map[string]bool // SanitizedEnv holds the sanitized process environment from auth. // When set, subprocess execution uses this instead of re-reading os.Environ(), // which would reintroduce problematic vars (e.g., IRSA credentials on EKS pods). From e5a39f19392c32b5fdec53f64b33780e19fde0ba Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 12 Nov 2026 06:47:42 -0600 Subject: [PATCH 36/52] fix(terragrunt): preserve secret-safe discovery diagnostics --- go.mod | 2 +- pkg/plugin/adapter/component/calls_test.go | 35 ++++++++++++++++ pkg/plugin/adapter/component/invoke.go | 41 +++++++++++++++++++ plugins/terragrunt/README.md | 13 ++++++ plugins/terragrunt/go.mod | 2 +- .../terragrunt/internal/engine/discovery.go | 34 +++++++++++++-- .../terragrunt/internal/provider/provider.go | 15 ++++++- .../internal/provider/provider_test.go | 28 +++++++++++++ 8 files changed, 164 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e46583516a7..0da590a90e5 100644 --- a/go.mod +++ b/go.mod @@ -139,6 +139,7 @@ require ( golang.org/x/text v0.43.0 google.golang.org/api v0.290.0 google.golang.org/genai v1.58.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260720171339-e059f2f05d78 google.golang.org/grpc v1.83.2 gopkg.in/ini.v1 v1.67.3 gopkg.in/yaml.v2 v2.4.0 @@ -435,7 +436,6 @@ require ( golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260727163830-6c54dddc4772 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260720171339-e059f2f05d78 // indirect google.golang.org/protobuf v1.36.12 gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/pkg/plugin/adapter/component/calls_test.go b/pkg/plugin/adapter/component/calls_test.go index 613390953a4..913c851bb55 100644 --- a/pkg/plugin/adapter/component/calls_test.go +++ b/pkg/plugin/adapter/component/calls_test.go @@ -11,6 +11,7 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" "github.com/zclconf/go-cty/cty/msgpack" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" @@ -172,3 +173,37 @@ func TestTransportCancellationAndErrorClassification(t *testing.T) { require.ErrorIs(t, invocationError(status.Error(codes.DeadlineExceeded, "secret")), context.DeadlineExceeded) require.ErrorIs(t, invocationError(context.Canceled), context.Canceled) } + +func TestDiscoveryDiagnosticContract(t *testing.T) { + for _, test := range []struct { + name, domain, reason, file string + safe bool + }{ + {"inline", "atmos.terragrunt.discovery.v1", "MISSING_TERRAFORM_SOURCE", "live/app/terragrunt.hcl", true}, + {"evaluation", "atmos.terragrunt.discovery.v1", "EVALUATION_FAILED", "live/terragrunt.stack.hcl", true}, + {"source", "atmos.terragrunt.discovery.v1", "NONLOCAL_SOURCE", "live/app/terragrunt.hcl", true}, + {"unknown domain", "secret", "EVALUATION_FAILED", "live/app/terragrunt.hcl", false}, + {"unknown reason", "atmos.terragrunt.discovery.v1", "secret", "live/app/terragrunt.hcl", false}, + {"absolute", "atmos.terragrunt.discovery.v1", "EVALUATION_FAILED", "/secret/terragrunt.hcl", false}, + {"traversal", "atmos.terragrunt.discovery.v1", "EVALUATION_FAILED", "../secret/terragrunt.hcl", false}, + {"control", "atmos.terragrunt.discovery.v1", "EVALUATION_FAILED", "secret\nterragrunt.hcl", false}, + } { + t.Run(test.name, func(t *testing.T) { + wire, err := status.New(codes.InvalidArgument, "secret RPC payload").WithDetails(&errdetails.ErrorInfo{Domain: test.domain, Reason: test.reason, Metadata: map[string]string{"file": test.file}}) + require.NoError(t, err) + // Round-trip the status protobuf as the RPC transport does. + data, err := proto.Marshal(wire.Proto()) + require.NoError(t, err) + decoded := wire.Proto() + require.NoError(t, proto.Unmarshal(data, decoded)) + result := invocationError(status.FromProto(decoded).Err()) + require.ErrorIs(t, result, errUtils.ErrPluginAPI) + require.NotContains(t, result.Error(), "secret") + if test.safe { + require.Contains(t, result.Error(), test.file) + } else { + require.Equal(t, errUtils.ErrPluginAPI, result) + } + }) + } +} diff --git a/pkg/plugin/adapter/component/invoke.go b/pkg/plugin/adapter/component/invoke.go index bd45902430e..cba19908f9e 100644 --- a/pkg/plugin/adapter/component/invoke.go +++ b/pkg/plugin/adapter/component/invoke.go @@ -3,8 +3,11 @@ package component import ( "context" "errors" + "fmt" "path/filepath" + "strings" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" @@ -51,6 +54,8 @@ func invocationError(err error) error { return errors.Join(errUtils.ErrPluginAPI, context.Canceled) case codes.DeadlineExceeded: return errors.Join(errUtils.ErrPluginAPI, context.DeadlineExceeded) + case codes.InvalidArgument: + return discoveryDiagnostic(err) case codes.Unimplemented: return errUtils.ErrPluginUnsupportedExtension default: @@ -104,3 +109,39 @@ func (p *Provider) validateOperation(ctx context.Context, handle *native.Handle, } return nil } + +// discoveryDiagnostic accepts only the versioned discovery contract. Messages, +// unknown categories, and extra metadata never become host diagnostics. File is +// a root-relative configuration identity (including virtual generated files), +// not a path or source snippet extracted from an HCL error message. +func discoveryDiagnostic(err error) error { + for _, detail := range status.Convert(err).Details() { + info, ok := detail.(*errdetails.ErrorInfo) + if !ok || info.Domain != "atmos.terragrunt.discovery.v1" || len(info.Metadata) != 1 { + continue + } + file := info.Metadata["file"] + if !validDiscoveryFile(file) { + continue + } + var message string + switch info.Reason { + case "MISSING_TERRAFORM_SOURCE": + message = "inline Terraform modules require terraform.source" + case "NONLOCAL_SOURCE": + message = "discovery requires a local source" + case "EVALUATION_FAILED": + message = "configuration evaluation failed" + default: + continue + } + return fmt.Errorf("%w: Terragrunt discovery in %q: %s", errUtils.ErrPluginAPI, file, message) + } + return errUtils.ErrPluginAPI +} + +func validDiscoveryFile(file string) bool { + const maxDiagnosticPathBytes = 4096 + return len(file) <= maxDiagnosticPathBytes && filepath.IsLocal(file) && + !strings.ContainsAny(file, "\\\r\n\x00") && filepath.ToSlash(filepath.Clean(file)) == file +} diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md index f2bb0dd0ec2..f0c77685df0 100644 --- a/plugins/terragrunt/README.md +++ b/plugins/terragrunt/README.md @@ -70,3 +70,16 @@ go -C plugins/terragrunt/bridge test ./... ``` See [the Terragrunt PRD](../../docs/prd/terragrunt-support.md) and [the shared component contract](../../docs/prd/plugins/extensions/component-engines.md) for the release requirements. + +## Discovery diagnostics + +Discovery failures use `google.rpc.ErrorInfo` with domain +`atmos.terragrunt.discovery.v1`, a fixed reason (`MISSING_TERRAFORM_SOURCE`, +`NONLOCAL_SOURCE`, or `EVALUATION_FAILED`), and a single `file` metadata entry. +The file is a filesystem-derived path relative to the discovery root, including +virtual generated configuration files. Paths are diagnostic identities and are +not read by the host. This contract permits configuration filenames, never HCL +source, evaluated values, or evaluator error text. The host validates paths and +categories and renders its own messages; unknown details retain the generic +error. Cancellation, deadlines, and unsupported operations retain their existing +status mappings. The contract assumes the enabled native plugin is trusted code. diff --git a/plugins/terragrunt/go.mod b/plugins/terragrunt/go.mod index d7d5f224603..6ae44b7312a 100644 --- a/plugins/terragrunt/go.mod +++ b/plugins/terragrunt/go.mod @@ -12,6 +12,7 @@ require ( github.com/spf13/afero v1.15.0 github.com/stretchr/testify v1.12.1 github.com/zclconf/go-cty v1.19.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b google.golang.org/grpc v1.84.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -230,7 +231,6 @@ require ( google.golang.org/api v0.308.0 // indirect google.golang.org/genproto v0.0.0-20260720171339-e059f2f05d78 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect google.golang.org/protobuf v1.36.12 // indirect gopkg.in/ini.v1 v1.67.3 // indirect oras.land/oras-go/v2 v2.7.0 // indirect diff --git a/plugins/terragrunt/internal/engine/discovery.go b/plugins/terragrunt/internal/engine/discovery.go index 2dcde3c262f..6ff3b5d68e8 100644 --- a/plugins/terragrunt/internal/engine/discovery.go +++ b/plugins/terragrunt/internal/engine/discovery.go @@ -2,6 +2,7 @@ package engine import ( "context" + "errors" "fmt" "os" "path/filepath" @@ -13,6 +14,29 @@ import ( "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" ) +// DiscoveryError carries only a filesystem identity and a fixed category across +// the RPC boundary. Cause remains local for debugging and cancellation checks. +type DiscoveryError struct { + File string + Category string + Cause error +} + +func (e *DiscoveryError) Error() string { return e.Cause.Error() } +func (e *DiscoveryError) Unwrap() error { return e.Cause } + +func discoveryError(root, path, category string, cause error) error { + var existing *DiscoveryError + if errors.As(cause, &existing) { + return cause + } + relative, err := filepath.Rel(root, path) + if err != nil || !filepath.IsLocal(relative) { + return cause + } + return &DiscoveryError{File: filepath.ToSlash(relative), Category: category, Cause: cause} +} + // canonicalPath preserves physical ancestor identity for files generated only in // the discovery overlay. Actual existence is checked through the active FS. func canonicalPath(path string) (string, error) { @@ -74,7 +98,11 @@ func discoverProject(ctx context.Context, request model.Request) (*model.Resolut if generate { req.Command = "generate" } - return resolve(ctx, req, overlay) + resolved, err := resolve(ctx, req, overlay) + if err != nil { + return nil, discoveryError(root, path, "EVALUATION_FAILED", err) + } + return resolved, nil } var visit func(string, string, string, string, []string, []string, int) error visit = func(path, stack, name, generationRoot string, files, folders []string, depth int) error { @@ -110,13 +138,13 @@ func discoverProject(ctx context.Context, request model.Request) (*model.Resolut } for _, entry := range entries { if !entry.IsDir() && (strings.HasSuffix(entry.Name(), ".tf") || strings.HasSuffix(entry.Name(), ".tf.json")) { - return fmt.Errorf("discovery of inline Terraform modules without terraform.source is not implemented: %s", path) + return discoveryError(root, path, "MISSING_TERRAFORM_SOURCE", fmt.Errorf("inline Terraform modules require terraform.source")) } } return nil } // Shared include, not a runnable local-source unit. if !plainLocalSource(resolved.Folders[0]) { - return fmt.Errorf("discovery only supports local sources: %s", path) + return discoveryError(root, path, "NONLOCAL_SOURCE", fmt.Errorf("discovery requires local sources")) } resolved.Files = append(resolved.Files, files...) resolved.Folders = append(resolved.Folders, folders...) diff --git a/plugins/terragrunt/internal/provider/provider.go b/plugins/terragrunt/internal/provider/provider.go index 258b10b0ce9..9509101c40e 100644 --- a/plugins/terragrunt/internal/provider/provider.go +++ b/plugins/terragrunt/internal/provider/provider.go @@ -10,6 +10,7 @@ import ( "strings" ctyjson "github.com/zclconf/go-cty/cty/json" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -161,7 +162,19 @@ func rpcError(err error) error { if errors.Is(err, ErrUnsupported) { return status.Error(codes.Unimplemented, ErrUnsupported.Error()) } - return status.Error(codes.InvalidArgument, "Terragrunt evaluation failed") + result := status.New(codes.InvalidArgument, "Terragrunt evaluation failed") + var diagnostic *engine.DiscoveryError + if errors.As(err, &diagnostic) { + // Never serialize the wrapped evaluator error or any evaluated HCL values. + detailed, detailErr := result.WithDetails(&errdetails.ErrorInfo{ + Domain: "atmos.terragrunt.discovery.v1", Reason: diagnostic.Category, + Metadata: map[string]string{"file": diagnostic.File}, + }) + if detailErr == nil { + return detailed.Err() + } + } + return result.Err() } // Validate rejects unsupported operation and provider settings without evaluating HCL. diff --git a/plugins/terragrunt/internal/provider/provider_test.go b/plugins/terragrunt/internal/provider/provider_test.go index 8edc16a04dc..5d81e927e85 100644 --- a/plugins/terragrunt/internal/provider/provider_test.go +++ b/plugins/terragrunt/internal/provider/provider_test.go @@ -3,12 +3,14 @@ package provider import ( "context" "errors" + "os" "path/filepath" "sync/atomic" "testing" "time" "github.com/stretchr/testify/require" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -149,3 +151,29 @@ func TestPreparationsSerializeGenerationAndParsing(t *testing.T) { t.Fatal("second generation did not run") } } + +func TestDiscoveryDiagnosticsRedactPayloads(t *testing.T) { + for _, test := range []struct{ name, content, reason string }{ + {"inline", "locals { password = \"secret-evaluated-value\" }", "MISSING_TERRAFORM_SOURCE"}, + {"parse", "locals { password = \"secret-evaluated-value\"", "EVALUATION_FAILED"}, + } { + t.Run(test.name, func(t *testing.T) { + request := componentRequest(t) + require.NoError(t, os.WriteFile(filepath.Join(request.RootDirectory, "terragrunt.hcl"), []byte(test.content), 0o600)) + require.NoError(t, os.WriteFile(filepath.Join(request.RootDirectory, "main.tf"), []byte("terraform {}"), 0o600)) + _, err := New(nil).Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{ + RootDirectory: request.RootDirectory, Provider: request.Provider, + ProviderConfiguration: request.ProviderConfiguration, Operation: request.Operation, IncludePaths: []string{"**"}, + }) + require.Equal(t, codes.InvalidArgument, status.Code(err)) + details := status.Convert(err).Details() + require.Len(t, details, 1) + info := details[0].(*errdetails.ErrorInfo) + require.Equal(t, "atmos.terragrunt.discovery.v1", info.Domain) + require.Equal(t, test.reason, info.Reason) + require.Equal(t, map[string]string{"file": "terragrunt.hcl"}, info.Metadata) + require.NotContains(t, status.Convert(err).Proto().String(), "secret-evaluated-value") + require.NotContains(t, status.Convert(err).Proto().String(), request.RootDirectory) + }) + } +} From 7830d96b2d8f2e5957b318ec8d95195834258615 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 12 Nov 2026 07:10:13 -0600 Subject: [PATCH 37/52] fix: check published plugin versions before merge --- .github/workflows/plugin-packages.yaml | 2 + cmd/plugin/release.go | 13 ++- cmd/plugin/release_check_test.go | 76 +++++++++++++++++ pkg/plugin/adapter/component/calls_test.go | 70 ++++++++++++++++ pkg/plugin/adapter/component/registry.go | 41 ++++++++++ .../adapter/component/responses_test.go | 82 ------------------- pkg/plugin/adapter/component/settings.go | 49 ----------- pkg/plugin/bootstrap/components.go | 28 +++++++ pkg/plugin/bootstrap/configuration.go | 36 -------- pkg/plugin/oci/publish.go | 50 +++++++++-- 10 files changed, 270 insertions(+), 177 deletions(-) create mode 100644 cmd/plugin/release_check_test.go delete mode 100644 pkg/plugin/adapter/component/responses_test.go delete mode 100644 pkg/plugin/adapter/component/settings.go delete mode 100644 pkg/plugin/bootstrap/configuration.go diff --git a/.github/workflows/plugin-packages.yaml b/.github/workflows/plugin-packages.yaml index 5ad0a8395e3..13c5a1dffa2 100644 --- a/.github/workflows/plugin-packages.yaml +++ b/.github/workflows/plugin-packages.yaml @@ -31,6 +31,8 @@ jobs: # version bump in every layer that touches a package input. Compare such pull requests with the merge # base of the default branch instead, the same range the whole stack is released against. Pushes and # pull requests that target the default branch keep the provider's default base. + # The inventory --check also compares packed bytes with any published version in the registry, + # so a child cannot reuse its parent's published version for different package bytes. - name: Resolve the release comparison base id: base if: github.event_name == 'pull_request' && github.event.pull_request.base.ref != github.event.repository.default_branch diff --git a/cmd/plugin/release.go b/cmd/plugin/release.go index 9502322014d..fb89a94a35e 100644 --- a/cmd/plugin/release.go +++ b/cmd/plugin/release.go @@ -121,8 +121,17 @@ func (backend *releaseBackend) Test(ctx context.Context, directory string) error return conformance.Present(report, err, conformance.FormatText) } -func (backend *releaseBackend) Pack(_ context.Context, directory, layout string) error { - return pluginoci.Pack(directory, layout, backend.manager.Installer.Descriptors, pluginoci.WithExecutableFormatCheck()) +func (backend *releaseBackend) Pack(ctx context.Context, directory, layout string) error { + if err := pluginoci.Pack(directory, layout, backend.manager.Installer.Descriptors, pluginoci.WithExecutableFormatCheck()); err != nil { + return err + } + // Inventory entries always supply a destination. Directory-only checks can + // remain offline unless the caller supplies --to. + destination := backend.values.GetString(publishDestinationFlag) + if backend.values.GetBool(releaseCheckFlag) && destination != "" { + return pluginoci.CheckPublication(ctx, backend.manager.Installer.Registry, layout, destination) + } + return nil } func (backend *releaseBackend) Publish(ctx context.Context, layout string) (*pluginoci.Release, error) { diff --git a/cmd/plugin/release_check_test.go b/cmd/plugin/release_check_test.go new file mode 100644 index 00000000000..cca13940f22 --- /dev/null +++ b/cmd/plugin/release_check_test.go @@ -0,0 +1,76 @@ +package plugin + +import ( + "net/http" + "os" + "path/filepath" + "testing" + + "github.com/google/go-containerregistry/pkg/name" + v1 "github.com/google/go-containerregistry/pkg/v1" + "github.com/google/go-containerregistry/pkg/v1/remote/transport" + "github.com/spf13/viper" + "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" + + errUtils "github.com/cloudposse/atmos/errors" + atmosoci "github.com/cloudposse/atmos/pkg/oci" + "github.com/cloudposse/atmos/pkg/plugin/extension" + "github.com/cloudposse/atmos/pkg/plugin/install" + "github.com/cloudposse/atmos/pkg/plugin/manage" + pluginoci "github.com/cloudposse/atmos/pkg/plugin/oci" +) + +func TestReleaseCheckPublishedVersion(t *testing.T) { + descriptors := extension.New() + require.NoError(t, descriptors.Register(extension.Descriptor{Capability: "fixture", Path: []string{"fixtures"}, Version: 1, Validate: func(extension.Binding) error { return nil }})) + parentLayout := publicReleaseLayout(t, descriptors) + index, err := atmosoci.LoadIndex(parentLayout, "") + require.NoError(t, err) + parent, err := pluginoci.Inspect(index, "") + require.NoError(t, err) + reference, err := name.NewTag("registry.example.com/example/fixture:1.0.0") + require.NoError(t, err) + missing := &transport.Error{StatusCode: http.StatusNotFound} + for _, test := range []struct { + name string + changed bool + check bool + destination string + registryErr error + wantErr error + }{ + {name: "unpublished version", changed: true, check: true, destination: "oci://registry.example.com/example/fixture", registryErr: missing}, + {name: "identical published parent", check: true, destination: "oci://registry.example.com/example/fixture"}, + {name: "child reuses published parent version", changed: true, check: true, destination: "oci://registry.example.com/example/fixture", wantErr: errUtils.ErrPluginImmutableRelease}, + {name: "registry access denied", check: true, destination: "oci://registry.example.com/example/fixture", registryErr: os.ErrPermission, wantErr: os.ErrPermission}, + {name: "registry timeout", check: true, destination: "oci://registry.example.com/example/fixture", registryErr: os.ErrDeadlineExceeded, wantErr: os.ErrDeadlineExceeded}, + {name: "offline directory", check: true}, + {name: "publication checks later", destination: "oci://registry.example.com/example/fixture"}, + } { + t.Run(test.name, func(t *testing.T) { + directory := t.TempDir() + require.NoError(t, parent.Extract("linux/amd64", directory)) + if test.changed { + binary := filepath.Join(directory, "bin", "plugin") + raw, err := os.ReadFile(binary) + require.NoError(t, err) + require.NoError(t, os.WriteFile(binary, append(raw, []byte("child change")...), 0o755)) + } + client := NewMockRegistry(gomock.NewController(t)) + if test.check && test.destination != "" { + client.EXPECT().Head(gomock.Any(), reference).Return(&v1.Descriptor{Digest: hashOf(t, parent.Digest)}, test.registryErr) + } + values := viper.New() + values.Set(releaseCheckFlag, test.check) + values.Set(publishDestinationFlag, test.destination) + backend := &releaseBackend{values: values, manager: &manage.Manager{Installer: &install.Service{Registry: client, Descriptors: descriptors}}} + err := backend.Pack(t.Context(), directory, filepath.Join(t.TempDir(), "layout")) + if test.wantErr != nil { + require.ErrorIs(t, err, test.wantErr) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/pkg/plugin/adapter/component/calls_test.go b/pkg/plugin/adapter/component/calls_test.go index 913c851bb55..ac8601b394d 100644 --- a/pkg/plugin/adapter/component/calls_test.go +++ b/pkg/plugin/adapter/component/calls_test.go @@ -207,3 +207,73 @@ func TestDiscoveryDiagnosticContract(t *testing.T) { }) } } + +func TestDiscoveryRejectsInvalidOwnershipIdentityAndProvenance(t *testing.T) { + t.Parallel() + p := fixtureProvider(t) + unit := &pluginv1.DiscoveredComponent{ + Address: fixtureAddress(), Provider: p.name, Engine: "terraform", Source: "live/app.hcl", + Sources: []*pluginv1.ComponentSource{{Path: "root.hcl", Kind: pluginv1.ComponentSource_FILE}}, + Dependencies: []*pluginv1.ComponentDependency{{Target: fixtureAddress(), Kind: pluginv1.ComponentDependency_ORDER}}, + } + require.NoError(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit}})) + for name, change := range map[string]func(*pluginv1.DiscoveredComponent){ + "no address": func(v *pluginv1.DiscoveredComponent) { v.Address = nil }, + "empty identity": func(v *pluginv1.DiscoveredComponent) { v.Address.Component = "" }, + "different type": func(v *pluginv1.DiscoveredComponent) { v.Address.ComponentType = "different" }, + "different provider": func(v *pluginv1.DiscoveredComponent) { v.Provider = "different" }, + "no engine": func(v *pluginv1.DiscoveredComponent) { v.Engine = "" }, + "escaping source": func(v *pluginv1.DiscoveredComponent) { v.Source = "../outside.hcl" }, + "escaping watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Path = "../outside.hcl" }, + "unknown watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Kind = pluginv1.ComponentSource_KIND_UNSPECIFIED }, + "nil watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0] = nil }, + "unknown dependency": func(v *pluginv1.DiscoveredComponent) { + v.Dependencies[0].Kind = pluginv1.ComponentDependency_KIND_UNSPECIFIED + }, + "nil dependency": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0] = nil }, + "no target": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0].Target = nil }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + item := proto.Clone(unit).(*pluginv1.DiscoveredComponent) + change(item) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{item}}), errUtils.ErrPluginProtocol) + }) + } + require.ErrorIs(t, p.checkDiscovery(nil), errUtils.ErrPluginProtocol) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{nil}}), errUtils.ErrPluginProtocol) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit, unit}}), errUtils.ErrDuplicatePluginExtension) + require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) +} + +func TestPreparationRejectsUnsafeArtifactsAndMissingStateIdentity(t *testing.T) { + t.Parallel() + root := t.TempDir() + valid := &pluginv1.PrepareComponentResponse{Engine: "terraform", WorkingDirectory: root, ModuleSource: "./module", State: fixtureState(root), Files: []*pluginv1.ComponentGeneratedFile{{Path: "backend.tf", IfExists: "error"}}} + require.NoError(t, checkPreparation(valid)) + for name, change := range map[string]func(*pluginv1.PrepareComponentResponse){ + "no engine": func(v *pluginv1.PrepareComponentResponse) { v.Engine = "" }, + "no module": func(v *pluginv1.PrepareComponentResponse) { v.ModuleSource = "" }, + "no workdir": func(v *pluginv1.PrepareComponentResponse) { v.WorkingDirectory = "relative" }, + "no state": func(v *pluginv1.PrepareComponentResponse) { v.State = nil }, + "empty backend": func(v *pluginv1.PrepareComponentResponse) { v.State.BackendType = "" }, + "empty workspace": func(v *pluginv1.PrepareComponentResponse) { v.State.Workspace = "" }, + "relative backend": func(v *pluginv1.PrepareComponentResponse) { v.State.WorkingDirectory = "relative" }, + "escaping artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = "../outside.tf" }, + "absolute artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = filepath.Join(root, "absolute.tf") }, + "unknown ownership": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].IfExists = "unknown" }, + "nil artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0] = nil }, + "duplicate destination": func(v *pluginv1.PrepareComponentResponse) { + v.Files = append(v.Files, &pluginv1.ComponentGeneratedFile{Path: filepath.Join("sub", "..", "backend.tf"), IfExists: "error"}) + }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + value := proto.Clone(valid).(*pluginv1.PrepareComponentResponse) + change(value) + require.ErrorIs(t, checkPreparation(value), errUtils.ErrPluginProtocol) + }) + } + require.ErrorIs(t, checkPreparation(nil), errUtils.ErrPluginProtocol) + require.ErrorIs(t, checkPreparation(&pluginv1.PrepareComponentResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) +} diff --git a/pkg/plugin/adapter/component/registry.go b/pkg/plugin/adapter/component/registry.go index 158d3d7505d..a2a411c57c5 100644 --- a/pkg/plugin/adapter/component/registry.go +++ b/pkg/plugin/adapter/component/registry.go @@ -2,12 +2,16 @@ package component import ( + "bytes" + "encoding/json" "fmt" "maps" "slices" "time" "github.com/santhosh-tekuri/jsonschema/v5" + ctyjson "github.com/zclconf/go-cty/cty/json" + "github.com/zclconf/go-cty/cty/msgpack" "google.golang.org/protobuf/proto" errUtils "github.com/cloudposse/atmos/errors" @@ -145,3 +149,40 @@ func (p *Provider) ValidateSettings(settings map[string]any) error { } return nil } + +func (p *Provider) validateConfiguration(value *pluginv1.ComponentValue) error { + settings := map[string]any{} + if value != nil { + var err error + settings, err = settingsObject(value) + if err != nil { + return err + } + } + return p.ValidateSettings(settings) +} + +// settingsObject decodes a known provider-settings object only for local schema +// validation. The original typed envelope and sensitivity paths travel unchanged +// to the plugin; resolved component inputs are not converted to JSON here. +func settingsObject(encoded *pluginv1.ComponentValue) (map[string]any, error) { + valueType, err := ctyjson.UnmarshalType(encoded.TypeJson) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + value, err := msgpack.Unmarshal(encoded.Msgpack, valueType) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + data, err := ctyjson.Marshal(value, valueType) + if err != nil { + return nil, errUtils.ErrPluginInvalidConfig + } + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.UseNumber() + var settings map[string]any + if err := decoder.Decode(&settings); err != nil || settings == nil { + return nil, errUtils.ErrPluginInvalidConfig + } + return settings, nil +} diff --git a/pkg/plugin/adapter/component/responses_test.go b/pkg/plugin/adapter/component/responses_test.go deleted file mode 100644 index 1a8178cf704..00000000000 --- a/pkg/plugin/adapter/component/responses_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package component - -import ( - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - - errUtils "github.com/cloudposse/atmos/errors" - pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" -) - -func TestDiscoveryRejectsInvalidOwnershipIdentityAndProvenance(t *testing.T) { - t.Parallel() - p := fixtureProvider(t) - unit := &pluginv1.DiscoveredComponent{ - Address: fixtureAddress(), Provider: p.name, Engine: "terraform", Source: "live/app.hcl", - Sources: []*pluginv1.ComponentSource{{Path: "root.hcl", Kind: pluginv1.ComponentSource_FILE}}, - Dependencies: []*pluginv1.ComponentDependency{{Target: fixtureAddress(), Kind: pluginv1.ComponentDependency_ORDER}}, - } - require.NoError(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit}})) - for name, change := range map[string]func(*pluginv1.DiscoveredComponent){ - "no address": func(v *pluginv1.DiscoveredComponent) { v.Address = nil }, - "empty identity": func(v *pluginv1.DiscoveredComponent) { v.Address.Component = "" }, - "different type": func(v *pluginv1.DiscoveredComponent) { v.Address.ComponentType = "different" }, - "different provider": func(v *pluginv1.DiscoveredComponent) { v.Provider = "different" }, - "no engine": func(v *pluginv1.DiscoveredComponent) { v.Engine = "" }, - "escaping source": func(v *pluginv1.DiscoveredComponent) { v.Source = "../outside.hcl" }, - "escaping watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Path = "../outside.hcl" }, - "unknown watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0].Kind = pluginv1.ComponentSource_KIND_UNSPECIFIED }, - "nil watch": func(v *pluginv1.DiscoveredComponent) { v.Sources[0] = nil }, - "unknown dependency": func(v *pluginv1.DiscoveredComponent) { - v.Dependencies[0].Kind = pluginv1.ComponentDependency_KIND_UNSPECIFIED - }, - "nil dependency": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0] = nil }, - "no target": func(v *pluginv1.DiscoveredComponent) { v.Dependencies[0].Target = nil }, - } { - t.Run(name, func(t *testing.T) { - t.Parallel() - item := proto.Clone(unit).(*pluginv1.DiscoveredComponent) - change(item) - require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{item}}), errUtils.ErrPluginProtocol) - }) - } - require.ErrorIs(t, p.checkDiscovery(nil), errUtils.ErrPluginProtocol) - require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{nil}}), errUtils.ErrPluginProtocol) - require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit, unit}}), errUtils.ErrDuplicatePluginExtension) - require.ErrorIs(t, p.checkDiscovery(&pluginv1.DiscoverComponentsResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) -} - -func TestPreparationRejectsUnsafeArtifactsAndMissingStateIdentity(t *testing.T) { - t.Parallel() - root := t.TempDir() - valid := &pluginv1.PrepareComponentResponse{Engine: "terraform", WorkingDirectory: root, ModuleSource: "./module", State: fixtureState(root), Files: []*pluginv1.ComponentGeneratedFile{{Path: "backend.tf", IfExists: "error"}}} - require.NoError(t, checkPreparation(valid)) - for name, change := range map[string]func(*pluginv1.PrepareComponentResponse){ - "no engine": func(v *pluginv1.PrepareComponentResponse) { v.Engine = "" }, - "no module": func(v *pluginv1.PrepareComponentResponse) { v.ModuleSource = "" }, - "no workdir": func(v *pluginv1.PrepareComponentResponse) { v.WorkingDirectory = "relative" }, - "no state": func(v *pluginv1.PrepareComponentResponse) { v.State = nil }, - "empty backend": func(v *pluginv1.PrepareComponentResponse) { v.State.BackendType = "" }, - "empty workspace": func(v *pluginv1.PrepareComponentResponse) { v.State.Workspace = "" }, - "relative backend": func(v *pluginv1.PrepareComponentResponse) { v.State.WorkingDirectory = "relative" }, - "escaping artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = "../outside.tf" }, - "absolute artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].Path = filepath.Join(root, "absolute.tf") }, - "unknown ownership": func(v *pluginv1.PrepareComponentResponse) { v.Files[0].IfExists = "unknown" }, - "nil artifact": func(v *pluginv1.PrepareComponentResponse) { v.Files[0] = nil }, - "duplicate destination": func(v *pluginv1.PrepareComponentResponse) { - v.Files = append(v.Files, &pluginv1.ComponentGeneratedFile{Path: filepath.Join("sub", "..", "backend.tf"), IfExists: "error"}) - }, - } { - t.Run(name, func(t *testing.T) { - t.Parallel() - value := proto.Clone(valid).(*pluginv1.PrepareComponentResponse) - change(value) - require.ErrorIs(t, checkPreparation(value), errUtils.ErrPluginProtocol) - }) - } - require.ErrorIs(t, checkPreparation(nil), errUtils.ErrPluginProtocol) - require.ErrorIs(t, checkPreparation(&pluginv1.PrepareComponentResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) -} diff --git a/pkg/plugin/adapter/component/settings.go b/pkg/plugin/adapter/component/settings.go deleted file mode 100644 index 74f898ca469..00000000000 --- a/pkg/plugin/adapter/component/settings.go +++ /dev/null @@ -1,49 +0,0 @@ -package component - -import ( - "bytes" - "encoding/json" - - ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/zclconf/go-cty/cty/msgpack" - - errUtils "github.com/cloudposse/atmos/errors" - pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" -) - -func (p *Provider) validateConfiguration(value *pluginv1.ComponentValue) error { - settings := map[string]any{} - if value != nil { - var err error - settings, err = settingsObject(value) - if err != nil { - return err - } - } - return p.ValidateSettings(settings) -} - -// settingsObject decodes a known provider-settings object only for local schema -// validation. The original typed envelope and sensitivity paths travel unchanged -// to the plugin; resolved component inputs are not converted to JSON here. -func settingsObject(encoded *pluginv1.ComponentValue) (map[string]any, error) { - valueType, err := ctyjson.UnmarshalType(encoded.TypeJson) - if err != nil { - return nil, errUtils.ErrPluginInvalidConfig - } - value, err := msgpack.Unmarshal(encoded.Msgpack, valueType) - if err != nil { - return nil, errUtils.ErrPluginInvalidConfig - } - data, err := ctyjson.Marshal(value, valueType) - if err != nil { - return nil, errUtils.ErrPluginInvalidConfig - } - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.UseNumber() - var settings map[string]any - if err := decoder.Decode(&settings); err != nil || settings == nil { - return nil, errUtils.ErrPluginInvalidConfig - } - return settings, nil -} diff --git a/pkg/plugin/bootstrap/components.go b/pkg/plugin/bootstrap/components.go index 4bffbae8c7e..2ae00ca2d09 100644 --- a/pkg/plugin/bootstrap/components.go +++ b/pkg/plugin/bootstrap/components.go @@ -7,9 +7,11 @@ import ( "slices" errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/component/configuration" "github.com/cloudposse/atmos/pkg/perf" authadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/auth" componentadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" + configurationadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/configuration" "github.com/cloudposse/atmos/pkg/plugin/config" "github.com/cloudposse/atmos/pkg/plugin/extension" pluginlock "github.com/cloudposse/atmos/pkg/plugin/lock" @@ -191,3 +193,29 @@ func componentPackageExports(alias string, state *config.Selections, file *plugi } return result, exists, nil } + +func init() { + // Register the constructor, never an invocation's provider or discovered stack map. + if err := configuration.Register("plugin", newConfigurationSession); err != nil { + panic(err) + } +} + +func newConfigurationSession(ctx context.Context, config *schema.AtmosConfiguration, operation string) (schema.ComponentConfigurationRuntime, error) { + snapshot := *config + return configurationadapter.New(ctx, config, operation, func(call context.Context, names []string) (map[string]configurationadapter.Provider, error) { + references := make([]ComponentReference, 0, len(names)) + for _, name := range names { + references = append(references, ComponentReference{Provider: name, Capability: extension.ComponentDiscovery}) + } + registry, err := LoadComponents(call, &snapshot, references) + if err != nil { + return nil, err + } + providers := make(map[string]configurationadapter.Provider) + for _, name := range registry.Names() { + providers[name], _ = registry.Get(name) + } + return providers, nil + }) +} diff --git a/pkg/plugin/bootstrap/configuration.go b/pkg/plugin/bootstrap/configuration.go deleted file mode 100644 index 10a65f16c6f..00000000000 --- a/pkg/plugin/bootstrap/configuration.go +++ /dev/null @@ -1,36 +0,0 @@ -package bootstrap - -import ( - "context" - - "github.com/cloudposse/atmos/pkg/component/configuration" - configurationadapter "github.com/cloudposse/atmos/pkg/plugin/adapter/configuration" - "github.com/cloudposse/atmos/pkg/plugin/extension" - "github.com/cloudposse/atmos/pkg/schema" -) - -func init() { - // Register the constructor, never an invocation's provider or discovered stack map. - if err := configuration.Register("plugin", newConfigurationSession); err != nil { - panic(err) - } -} - -func newConfigurationSession(ctx context.Context, config *schema.AtmosConfiguration, operation string) (schema.ComponentConfigurationRuntime, error) { - snapshot := *config - return configurationadapter.New(ctx, config, operation, func(call context.Context, names []string) (map[string]configurationadapter.Provider, error) { - references := make([]ComponentReference, 0, len(names)) - for _, name := range names { - references = append(references, ComponentReference{Provider: name, Capability: extension.ComponentDiscovery}) - } - registry, err := LoadComponents(call, &snapshot, references) - if err != nil { - return nil, err - } - providers := make(map[string]configurationadapter.Provider) - for _, name := range registry.Names() { - providers[name], _ = registry.Get(name) - } - return providers, nil - }) -} diff --git a/pkg/plugin/oci/publish.go b/pkg/plugin/oci/publish.go index 5b4082021ea..468673d1146 100644 --- a/pkg/plugin/oci/publish.go +++ b/pkg/plugin/oci/publish.go @@ -52,14 +52,8 @@ func Publish(ctx context.Context, client atmosoci.Registry, directory, destinati } func publishIndex(ctx context.Context, client atmosoci.Registry, reference name.Reference, release *Release, index v1.ImageIndex) error { - existing, err := client.Head(ctx, reference) - if err == nil { - if existing.Digest.String() != release.Digest { - return errUtils.ErrPluginImmutableRelease - } - return nil - } - if !atmosoci.IsNotFound(err) { + exists, err := checkAvailableVersion(ctx, client, reference, release.Digest) + if err != nil || exists { return err } if err := client.WriteIndex(ctx, reference, index); err != nil { @@ -68,6 +62,46 @@ func publishIndex(ctx context.Context, client atmosoci.Registry, reference name. return checkPublished(ctx, client, reference, release.Digest) } +// CheckPublication checks a packed layout against its immutable registry version +// without uploading it. Missing versions and identical bytes are acceptable; +// registry failures are not treated as evidence that a version is available. +// Publishers must still check again under their publication lock. +func CheckPublication(ctx context.Context, client atmosoci.Registry, directory, destination string) error { + defer perf.Track(nil, "pluginoci.CheckPublication")() + + if err := pluginpolicy.Source(ctx, "publish", destination); err != nil { + return err + } + repository, err := ParseDestination(destination) + if err != nil { + return err + } + index, err := atmosoci.LoadIndex(directory, "") + if err != nil { + return err + } + release, err := Inspect(index, "") + if err != nil { + return err + } + _, err = checkAvailableVersion(ctx, client, repository.Tag(release.Version), release.Digest) + return err +} + +func checkAvailableVersion(ctx context.Context, client atmosoci.Registry, reference name.Reference, digest string) (bool, error) { + existing, err := client.Head(ctx, reference) + if err == nil { + if existing.Digest.String() != digest { + return true, errUtils.ErrPluginImmutableRelease + } + return true, nil + } + if !atmosoci.IsNotFound(err) { + return false, err + } + return false, nil +} + func validatePayloads(release *Release, descriptors *extension.Registry, configured *options) error { if err := checkDeclaredPaths(declaredExecutables(release.Definition)...); err != nil { return err From 614a50e552aa1a786caf9a77ce70756500e1f790 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 12 Nov 2026 07:29:06 -0600 Subject: [PATCH 38/52] fix: revalidate preparation dependencies and restore link checks --- .github/workflows/link-check.yml | 33 ++++- .../adapter/configuration/preparation.go | 63 +++++++++ .../adapter/configuration/revision_test.go | 60 --------- .../adapter/configuration/session_test.go | 125 +++++++++++++++++- 4 files changed, 219 insertions(+), 62 deletions(-) delete mode 100644 pkg/plugin/adapter/configuration/revision_test.go diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 571af35757a..6eeadbf4a5a 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -6,12 +6,14 @@ on: - '**.md' - '!website/**' - 'lychee.toml' + - '.github/workflows/link-check.yml' push: branches: [main] paths: - '**.md' - '!website/**' - 'lychee.toml' + - '.github/workflows/link-check.yml' workflow_dispatch: permissions: @@ -37,10 +39,39 @@ jobs: with: persist-credentials: false + # Cursor's marketplace intermittently sends HTTP/2 responses Lychee cannot parse on + # GitHub runners. Check this exact URL over HTTP/1.1 and fail on any non-2xx response; + # all other URLs continue through the normal Lychee configuration. + - name: Check Cursor marketplace over HTTP/1.1 + shell: bash + run: | + status=$(curl --http1.1 --fail --location --silent --show-error --max-time 60 --retry 3 \ + --proto '=https' --proto-redir '=https' --output /dev/null --write-out '%{http_code}' \ + 'https://cursor.com/marketplace') + case "$status" in + 2??) ;; + *) echo "Cursor marketplace returned HTTP $status" >&2; exit 1 ;; + esac + + - name: Prepare Lychee CI configuration + shell: bash + run: | + python3 - <<'PYTHON' + import os + from pathlib import Path + + config = Path("lychee.toml").read_text() + marker = "exclude = [" + if config.count(marker) != 1: + raise SystemExit("expected exactly one Lychee URL exclusion list") + pattern = r" '^https://cursor\.com/marketplace/?$'," + "\n" + Path(os.environ["RUNNER_TEMP"], "lychee-ci.toml").write_text(config.replace(marker, marker + "\n" + pattern, 1)) + PYTHON + - name: Check links with lychee uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2 with: - args: --config lychee.toml --root-dir ${{ github.workspace }} '**/*.md' + args: --config ${{ runner.temp }}/lychee-ci.toml --root-dir ${{ github.workspace }} '**/*.md' fail: true jobSummary: true token: ${{ secrets.GITHUB_TOKEN }} diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go index f1a777f22f9..86cd39e9112 100644 --- a/pkg/plugin/adapter/configuration/preparation.go +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -7,6 +7,8 @@ import ( "path/filepath" "strings" + "google.golang.org/protobuf/proto" + errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/perf" adapter "github.com/cloudposse/atmos/pkg/plugin/adapter/component" @@ -39,6 +41,9 @@ func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) env := preparationEnvironment(info) env["ATMOS_TERRAFORM_BINARY"] = info.Command env["TF_WORKSPACE"] = info.TerraformWorkspace + if err := s.checkPreparationDependencies(ctx, instance, env, info.SubCommand); err != nil { + return nil, err + } result, err := provider.Prepare(ctx, &pluginv1.ComponentRequest{ Provider: instance.Provider, Address: instance.Address, Source: instance.Source, RootDirectory: s.root, Configuration: instance.Configuration, ProviderConfiguration: settings, @@ -55,6 +60,64 @@ func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) return preparedConfiguration(result) } +// Reevaluate the inventory without preparation effects before any dependency +// outputs are read. Identity and component environment overrides must not change +// the units that the scheduler ordered using the original discovery result. +func (s *Session) checkPreparationDependencies(ctx context.Context, instance *pluginv1.DiscoveredComponent, env map[string]string, command string) error { + for _, original := range s.requests { + if original.Provider != instance.Provider { + continue + } + request := proto.Clone(original).(*pluginv1.DiscoverComponentsRequest) + request.Invocation = &pluginv1.Invocation{Environment: env} + request.Operation = &pluginv1.ComponentOperation{Command: command, Mode: "native"} + response, err := s.registry[instance.Provider].Discover(ctx, request) + if err != nil { + return err + } + current := make(map[[3]string]*pluginv1.DiscoveredComponent) + if err := addDiscovered(make(map[string]map[string]any), current, response); err != nil { + return err + } + selected := current[addressKey(instance.Address)] + if !sameDependencyUnit(instance, selected) || !sameDependencies(instance.Dependencies, selected.Dependencies) { + return fmt.Errorf("%w: preparation changed discovered dependency paths", errUtils.ErrPluginInvalidConfig) + } + for _, dependency := range selected.Dependencies { + key := addressKey(dependency.Target) + if !sameDependencyUnit(s.instances[key], current[key]) { + return fmt.Errorf("%w: preparation changed discovered dependency paths", errUtils.ErrPluginInvalidConfig) + } + } + return nil + } + return errUtils.ErrPluginInvalidConfig +} + +func sameDependencyUnit(before, after *pluginv1.DiscoveredComponent) bool { + return before != nil && after != nil && before.Source == after.Source && before.Provider == after.Provider && before.Engine == after.Engine +} + +func sameDependencies(before, after []*pluginv1.ComponentDependency) bool { + type edge struct { + target [3]string + kind pluginv1.ComponentDependency_Kind + } + counts := make(map[edge]int) + for _, dependency := range before { + counts[edge{addressKey(dependency.Target), dependency.Kind}]++ + } + for _, dependency := range after { + counts[edge{addressKey(dependency.Target), dependency.Kind}]-- + } + for _, count := range counts { + if count != 0 { + return false + } + } + return true +} + func preparedConfiguration(result *pluginv1.PrepareComponentResponse) (*schema.PreparedComponentConfiguration, error) { inputs, sensitiveKeys, err := adapter.DecodeObjectWithSensitiveKeys(result.Inputs) if err != nil { diff --git a/pkg/plugin/adapter/configuration/revision_test.go b/pkg/plugin/adapter/configuration/revision_test.go deleted file mode 100644 index 079ab176b72..00000000000 --- a/pkg/plugin/adapter/configuration/revision_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package configuration - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - "go.uber.org/mock/gomock" - - errUtils "github.com/cloudposse/atmos/errors" - pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" -) - -func TestRevisionDiscoveryIsolated(t *testing.T) { - config := enabledConfig(t) - baseRoot := t.TempDir() - provider := NewMockProvider(gomock.NewController(t)) - provider.EXPECT().ComponentType().Return("terraform").Times(2) - provider.EXPECT().Discover(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { - require.Nil(t, request.Effects, "revision discovery cannot read state or run commands") - require.Equal(t, "plan", request.Operation.Command) - name := "head" - if request.RootDirectory == baseRoot { - name = "base" - } else { - require.Equal(t, config.BasePathAbsolute, request.RootDirectory) - } - return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit(t, name)}}, nil - }).Times(2) - ctx, cancel := context.WithCancel(t.Context()) - defer cancel() - head, err := New(ctx, config, "plan", func(context.Context, []string) (map[string]Provider, error) { - return map[string]Provider{"terragrunt": provider}, nil - }) - require.NoError(t, err) - headDefinitions, err := head.Discover(t.Context()) - require.NoError(t, err) - revision, err := head.ForRevision(baseRoot) - require.NoError(t, err) - baseDefinitions, err := revision.Discover(t.Context()) - require.NoError(t, err) - require.Contains(t, baseDefinitions["live"]["components"].(map[string]any)["terraform"], "base") - again, err := head.Discover(t.Context()) - require.NoError(t, err) - require.Equal(t, headDefinitions, again) - require.Contains(t, again["live"]["components"].(map[string]any)["terraform"], "head") - // A revision's request data must not alias the HEAD request in either direction. - base := revision.(*Session) - base.requests[0].IncludePaths[0] = "base/**" - require.Equal(t, "live/**", head.requests[0].IncludePaths[0]) - head.requests[0].Invocation.Environment["REVISION"] = "head" - require.NotContains(t, base.requests[0].Invocation.Environment, "REVISION") - _, err = head.ForRevision("relative") - require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) - cancel() - _, err = head.ForRevision(baseRoot) - require.ErrorIs(t, err, context.Canceled) - _, err = revision.Discover(t.Context()) - require.ErrorIs(t, err, context.Canceled) -} diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index cb89702c467..cb3e5e131db 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" + "google.golang.org/protobuf/proto" errUtils "github.com/cloudposse/atmos/errors" atmosio "github.com/cloudposse/atmos/pkg/io" @@ -41,7 +42,7 @@ func TestSessionDiscoveryAndPreparation(t *testing.T) { require.Nil(t, request.Effects) require.Equal(t, "tofu", request.Invocation.Environment["ATMOS_TERRAFORM_BINARY"]) return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{network, app}}, nil - }) + }).Times(2) calls := 0 session, err := New(t.Context(), config, "apply", func(_ context.Context, names []string) (map[string]Provider, error) { calls++ @@ -254,3 +255,125 @@ func TestPreparedConfigurationRetainsSensitiveInputs(t *testing.T) { require.Equal(t, map[string]bool{"credentials": true}, prepared.SensitiveInputKeys) require.Equal(t, map[string]any{"private-input-key": ""}, prepared.Inputs["credentials"]) } + +func TestPreparationRevalidatesDependencyPaths(t *testing.T) { + for _, change := range []string{"target", "removed", "added", "kind", "source", "selected source", "missing selected", "discovery error", "unchanged", "reordered"} { + t.Run(change, func(t *testing.T) { + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform") + network, other, app := unit(t, "network"), unit(t, "other"), unit(t, "app") + app.Dependencies = []*pluginv1.ComponentDependency{ + {Target: network.Address, Kind: pluginv1.ComponentDependency_OUTPUT}, + {Target: other.Address, Kind: pluginv1.ComponentDependency_ORDER}, + } + initial := &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{network, other, app}} + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).Return(initial, nil) + session, err := New(t.Context(), enabledConfig(t), "apply", func(context.Context, []string) (map[string]Provider, error) { + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + _, err = session.Discover(t.Context()) + require.NoError(t, err) + originalRequest := proto.Clone(session.requests[0]) + current := proto.Clone(initial).(*pluginv1.DiscoverComponentsResponse) + selected := current.Components[2] + switch change { + case "target": + selected.Dependencies[0].Target = other.Address + case "removed": + selected.Dependencies = selected.Dependencies[1:] + case "added": + selected.Dependencies = append(selected.Dependencies, &pluginv1.ComponentDependency{Target: app.Address}) + case "kind": + selected.Dependencies[0].Kind = pluginv1.ComponentDependency_ORDER + case "source": + current.Components[0].Source = "changed/terragrunt.hcl" + case "selected source": + selected.Source = "changed/app/terragrunt.hcl" + case "missing selected": + current.Components = current.Components[:2] + case "reordered": + selected.Dependencies[0], selected.Dependencies[1] = selected.Dependencies[1], selected.Dependencies[0] + } + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + require.Equal(t, map[string]string{"DEPENDENCY": "component", "IDENTITY": "selected", "TF_WORKSPACE": "stage", "ATMOS_TERRAFORM_BINARY": "tofu"}, request.Invocation.Environment) + require.Equal(t, "apply", request.Operation.Command) + require.Nil(t, request.Effects) + require.Equal(t, []string{"live/**"}, request.IncludePaths) + if change == "discovery error" { + return nil, context.Canceled + } + return current, nil + }) + if change == "unchanged" || change == "reordered" { + provider.EXPECT().Prepare(gomock.Any(), gomock.Any()).Return(&pluginv1.PrepareComponentResponse{Engine: "opentofu", State: &pluginv1.ComponentStateIdentity{}}, nil) + } + result, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{ + Stack: "live", ComponentFromArg: "app", Command: "tofu", SubCommand: "apply", TerraformWorkspace: "stage", + ComponentSettingsSection: map[string]any{"configuration": true}, SanitizedEnv: []string{"IDENTITY=selected", "DEPENDENCY=identity"}, ComponentEnvList: []string{"DEPENDENCY=component"}, + }) + switch change { + case "unchanged", "reordered": + require.NoError(t, err) + require.NotNil(t, result) + case "discovery error": + require.ErrorIs(t, err, context.Canceled) + default: + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + require.Nil(t, result) + } + // Revalidation must leave the scheduled inventory and request untouched. + require.True(t, proto.Equal(originalRequest, session.requests[0])) + require.Equal(t, "network", app.Dependencies[0].Target.Component) + require.Equal(t, "live/network/terragrunt.hcl", network.Source) + }) + } +} + +func TestRevisionDiscoveryIsolated(t *testing.T) { + config := enabledConfig(t) + baseRoot := t.TempDir() + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform").Times(2) + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) { + require.Nil(t, request.Effects, "revision discovery cannot read state or run commands") + require.Equal(t, "plan", request.Operation.Command) + name := "head" + if request.RootDirectory == baseRoot { + name = "base" + } else { + require.Equal(t, config.BasePathAbsolute, request.RootDirectory) + } + return &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{unit(t, name)}}, nil + }).Times(2) + ctx, cancel := context.WithCancel(t.Context()) + defer cancel() + head, err := New(ctx, config, "plan", func(context.Context, []string) (map[string]Provider, error) { + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + headDefinitions, err := head.Discover(t.Context()) + require.NoError(t, err) + revision, err := head.ForRevision(baseRoot) + require.NoError(t, err) + baseDefinitions, err := revision.Discover(t.Context()) + require.NoError(t, err) + require.Contains(t, baseDefinitions["live"]["components"].(map[string]any)["terraform"], "base") + again, err := head.Discover(t.Context()) + require.NoError(t, err) + require.Equal(t, headDefinitions, again) + require.Contains(t, again["live"]["components"].(map[string]any)["terraform"], "head") + // A revision's request data must not alias the HEAD request in either direction. + base := revision.(*Session) + base.requests[0].IncludePaths[0] = "base/**" + require.Equal(t, "live/**", head.requests[0].IncludePaths[0]) + head.requests[0].Invocation.Environment["REVISION"] = "head" + require.NotContains(t, base.requests[0].Invocation.Environment, "REVISION") + _, err = head.ForRevision("relative") + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + cancel() + _, err = head.ForRevision(baseRoot) + require.ErrorIs(t, err, context.Canceled) + _, err = revision.Discover(t.Context()) + require.ErrorIs(t, err, context.Canceled) +} From fa5dd7d2e8dd81659db4de526b4148a5fa1a2901 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Thu, 12 Nov 2026 16:54:15 -0600 Subject: [PATCH 39/52] fix(terraform): reject state lookup for configuration-owned components Discovery gives a configuration-owned component a placeholder local backend instead of its real state location. !terraform.state then reported missing state or could read another component's file. Fail the lookup explicitly with ErrPluginUnsupportedExtension until a provider can resolve the state. To stay within the 150-file review limit, put the regression test in configuration_environment_test.go and fold the 21-line FuzzDecodeValue into value_test.go. Both files belong only to this layer. Co-Authored-By: Claude Opus 5.5 --- .../configuration_environment_test.go | 17 +++++++++++++++ pkg/component/terraform/state_utils.go | 7 +++++++ sdk/component/value_fuzz_test.go | 21 ------------------- sdk/component/value_test.go | 13 ++++++++++++ 4 files changed, 37 insertions(+), 21 deletions(-) delete mode 100644 sdk/component/value_fuzz_test.go diff --git a/pkg/component/terraform/configuration_environment_test.go b/pkg/component/terraform/configuration_environment_test.go index 18265f81895..fcaac886e3b 100644 --- a/pkg/component/terraform/configuration_environment_test.go +++ b/pkg/component/terraform/configuration_environment_test.go @@ -12,6 +12,7 @@ import ( "go.uber.org/mock/gomock" errUtils "github.com/cloudposse/atmos/errors" + componentpkg "github.com/cloudposse/atmos/pkg/component" "github.com/cloudposse/atmos/pkg/dependencies" "github.com/cloudposse/atmos/pkg/schema" "github.com/cloudposse/atmos/pkg/toolchain" @@ -186,3 +187,19 @@ func TestConfigurationPreparationUsesSelectedInstalledToolVersion(t *testing.T) require.NoError(t, err) } } + +// Discovery supplies a placeholder backend, so state lookup must fail instead of reading it. +func TestGetTerraformStateRejectsConfigurationOwnedBackend(t *testing.T) { + executor := testExecutor(t) + executor.services.ExecuteDescribeComponent = func(*componentpkg.ExecuteDescribeComponentParams) (map[string]any, error) { + return map[string]any{ + "settings": map[string]any{"configuration": map[string]any{"provider": "terragrunt"}}, + "backend_type": "local", + "backend": map[string]any{"local": map[string]any{}}, + }, nil + } + value, err := executor.GetTerraformState(&schema.AtmosConfiguration{}, "!terraform.state", "dev", "native", "id", true, nil, nil) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + require.ErrorContains(t, err, "does not support state lookup") + require.Nil(t, value) +} diff --git a/pkg/component/terraform/state_utils.go b/pkg/component/terraform/state_utils.go index a0121c7c1e1..f55b8b25dd1 100644 --- a/pkg/component/terraform/state_utils.go +++ b/pkg/component/terraform/state_utils.go @@ -216,6 +216,13 @@ func (e *Executor) GetTerraformState( return staticTerraformStateOutput(atmosConfig, lookup, remoteStateBackendStaticTypeOutputs) } + // Discovery does not provide the native unit's state identity. Reading the + // placeholder backend could return a different component's local state. + settings, _ := componentSections["settings"].(map[string]any) + if schema.ConfigurationOwned(settings) { + return nil, fmt.Errorf("%w: %s does not support state lookup for configuration-owned component `%s` in stack `%s`", errUtils.ErrPluginUnsupportedExtension, yamlFunc, component, stack) + } + // Read Terraform backend using resolved auth context. backend, err := tb.GetTerraformBackend(atmosConfig, &componentSections, resolvedAuthContext) if err != nil { diff --git a/sdk/component/value_fuzz_test.go b/sdk/component/value_fuzz_test.go deleted file mode 100644 index 409c9d2ddb7..00000000000 --- a/sdk/component/value_fuzz_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package component - -import ( - "errors" - "testing" - - pluginv1 "github.com/cloudposse/atmos/sdk/proto/atmos/plugin/v1" -) - -func FuzzDecodeValue(f *testing.F) { - f.Add([]byte(`"string"`), []byte{0xa2, 'o', 'k'}) - f.Add([]byte(`"number"`), []byte{42}) - f.Add([]byte(`"bool"`), []byte{0xc0}) - f.Add([]byte(`[]`), []byte{}) - f.Fuzz(func(t *testing.T, typeJSON, payload []byte) { - _, err := Decode(&pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload}) - if err != nil && (!errors.Is(err, ErrInvalidValue) || err.Error() != ErrInvalidValue.Error()) { - t.Fatal("decoder exposed payload details") - } - }) -} diff --git a/sdk/component/value_test.go b/sdk/component/value_test.go index 16974ac163f..08deb73bb27 100644 --- a/sdk/component/value_test.go +++ b/sdk/component/value_test.go @@ -143,3 +143,16 @@ func TestDecodeCannotDropSensitivityBelowAnUnknownObject(t *testing.T) { t.Fatalf("unapplied sensitivity mark accepted: %v", err) } } + +func FuzzDecodeValue(f *testing.F) { + f.Add([]byte(`"string"`), []byte{0xa2, 'o', 'k'}) + f.Add([]byte(`"number"`), []byte{42}) + f.Add([]byte(`"bool"`), []byte{0xc0}) + f.Add([]byte(`[]`), []byte{}) + f.Fuzz(func(t *testing.T, typeJSON, payload []byte) { + _, err := Decode(&pluginv1.ComponentValue{TypeJson: typeJSON, Msgpack: payload}) + if err != nil && (!errors.Is(err, ErrInvalidValue) || err.Error() != ErrInvalidValue.Error()) { + t.Fatal("decoder exposed payload details") + } + }) +} From 2957a9e1f7a73edb8d1b196ab353846bd1b904f4 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Fri, 13 Nov 2026 07:31:04 -0600 Subject: [PATCH 40/52] fix(configuration): own discovery validation and check dependency state Move provider dependency path normalization and discovered-manifest schema validation into pkg/component/configuration, leaving exec with thin cache and orchestration adapters. Schema open, registration, and compile failures now wrap ErrOpenFile or ErrStackManifestSchemaValidation. Preparation now refuses output reads when a dependency's state identity under the dependent's environment differs from the identity it was prepared with (or, failing that, its discovery-environment identity). Replace the hand-written ForRevision test double with a generated mock. Co-Authored-By: Claude Opus 5.5 --- internal/exec/configuration_stacks.go | 43 ++------- internal/exec/configuration_stacks_test.go | 2 +- internal/exec/describe_affected_components.go | 2 +- .../exec/describe_affected_configuration.go | 26 +----- .../describe_affected_configuration_test.go | 24 ++--- internal/exec/mock_configuration_test.go | 43 ++++++++- pkg/component/configuration/registry.go | 93 +++++++++++++++++++ pkg/component/configuration/registry_test.go | 79 ++++++++++++++++ .../configuration/mock_provider_test.go | 15 +++ .../adapter/configuration/preparation.go | 55 ++++++++++- pkg/plugin/adapter/configuration/session.go | 6 +- .../adapter/configuration/session_test.go | 73 +++++++++++++++ 12 files changed, 386 insertions(+), 75 deletions(-) diff --git a/internal/exec/configuration_stacks.go b/internal/exec/configuration_stacks.go index 4bdea6ab8d7..1dec831dd72 100644 --- a/internal/exec/configuration_stacks.go +++ b/internal/exec/configuration_stacks.go @@ -3,16 +3,13 @@ package exec import ( "context" "fmt" - "maps" - "os" "path/filepath" - "slices" "github.com/santhosh-tekuri/jsonschema/v5" errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/component/configuration" "github.com/cloudposse/atmos/pkg/schema" - u "github.com/cloudposse/atmos/pkg/utils" ) // Discovered definitions are literal provider inventory data, so static inspection @@ -47,8 +44,8 @@ func mergeConfigurationStacks(config *schema.AtmosConfiguration, stacks map[stri return nil } -// validateDiscoveredManifests checks provider definitions against the same manifest schema -// as YAML stack manifests, so an invalid discovered field fails `atmos validate stacks`. +// validateDiscoveredManifests adapts the configuration package's manifest validation +// to the stack processor's compiled-schema cache. func validateDiscoveredManifests(config *schema.AtmosConfiguration, schemaPath string) ([]string, error) { if config.ComponentConfigurations == nil { return nil, nil @@ -57,25 +54,9 @@ func validateDiscoveredManifests(config *schema.AtmosConfiguration, schemaPath s if err != nil { return nil, err } - compiled, err := compiledManifestSchema(schemaPath) - if err != nil { - return nil, err - } - var messages []string - for _, name := range slices.Sorted(maps.Keys(discovered)) { - data, err := u.ConvertToJSONFast(discovered[name]) - if err != nil { - return nil, err - } - instance, err := u.ConvertFromJSON(data) - if err != nil { - return nil, err - } - if err := compiled.Validate(instance); err != nil { - messages = append(messages, fmt.Sprintf("Atmos manifest JSON Schema validation error in the discovered stack '%s':\n%v", name, err)) - } - } - return messages, nil + return configuration.ValidateDiscoveredManifests(discovered, func() (*jsonschema.Schema, error) { + return compiledManifestSchema(schemaPath) + }) } // compiledManifestSchema shares the stack processor's compiled-schema cache. @@ -83,17 +64,7 @@ func compiledManifestSchema(path string) (*jsonschema.Schema, error) { if compiled, found := getCachedCompiledSchema(path); found { return compiled, nil } - reader, err := os.Open(path) - if err != nil { - return nil, err - } - defer reader.Close() - compiler := jsonschema.NewCompiler() - compiler.Draft = jsonschema.Draft2020 - if err := compiler.AddResource(path, reader); err != nil { - return nil, err - } - compiled, err := compiler.Compile(path) + compiled, err := configuration.CompileManifestSchema(path) if err != nil { return nil, err } diff --git a/internal/exec/configuration_stacks_test.go b/internal/exec/configuration_stacks_test.go index 887c79db8b8..2ca6c96a1c2 100644 --- a/internal/exec/configuration_stacks_test.go +++ b/internal/exec/configuration_stacks_test.go @@ -13,7 +13,7 @@ import ( "github.com/cloudposse/atmos/pkg/schema" ) -//go:generate go run go.uber.org/mock/mockgen -destination=mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime +//go:generate go run go.uber.org/mock/mockgen -destination=mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime,ComponentConfigurationRevisionRuntime func TestConfigurationStacksUseStackCompiler(t *testing.T) { root := t.TempDir() diff --git a/internal/exec/describe_affected_components.go b/internal/exec/describe_affected_components.go index e93f3f16b6e..a78c751ec69 100644 --- a/internal/exec/describe_affected_components.go +++ b/internal/exec/describe_affected_components.go @@ -1185,7 +1185,7 @@ func checkDependencyChangesIndexed( return err } if isFolderOrFileChanged { - changedFileOrFolder = configuredDependencyPath(deps, matched, changedFileOrFolder) + changedFileOrFolder = configuration.ConfiguredDependencyPath(deps, matched, changedFileOrFolder) return addDependencyAffectedItem( affected, atmosConfig, componentName, stackName, componentType, componentSection, changedType, changedFileOrFolder, diff --git a/internal/exec/describe_affected_configuration.go b/internal/exec/describe_affected_configuration.go index 6ac57234c24..376a99cb887 100644 --- a/internal/exec/describe_affected_configuration.go +++ b/internal/exec/describe_affected_configuration.go @@ -2,9 +2,9 @@ package exec import ( "fmt" - "slices" errUtils "github.com/cloudposse/atmos/errors" + "github.com/cloudposse/atmos/pkg/component/configuration" "github.com/cloudposse/atmos/pkg/schema" ) @@ -27,31 +27,13 @@ func rebaseConfigurationDiscovery(config *schema.AtmosConfiguration) error { } // configurationMatchInputs returns the change set and dependencies to match. -// Provider watches are rooted at BasePathAbsolute, and base-path resolution -// can spell that root differently from the repository root the changed files -// are joined to: through a symlinked temp dir on macOS (/var vs /private/var) -// or as an 8.3 short name on Windows (RUNNER~1 vs runneradmin). Two spellings -// of one directory never match, so provider watches compare both sides with -// symlinks and short names resolved. YAML dependencies keep exact matching. +// The configuration package owns provider dependency normalization; exec only +// supplies the shared resolver and the cached resolved change set. func configurationMatchInputs(filesIndex *changedFilesIndex, deps []schema.ComponentDependency, provider bool) (*changedFilesIndex, []schema.ComponentDependency) { if !provider { return filesIndex, deps } - resolved := slices.Clone(deps) - for i := range resolved { - resolved[i].Path = evalSymlinksBestEffort(resolved[i].Path) - } - return resolvedChangedFiles(filesIndex), resolved -} - -// configuredDependencyPath reports a matched dependency in its configured spelling. -func configuredDependencyPath(deps, matched []schema.ComponentDependency, path string) string { - for i := range matched { - if matched[i].Path == path { - return deps[i].Path - } - } - return path + return resolvedChangedFiles(filesIndex), configuration.MatchDependencies(deps, provider, evalSymlinksBestEffort) } // resolvedChangedFiles returns the change set with symlinks and short names resolved. diff --git a/internal/exec/describe_affected_configuration_test.go b/internal/exec/describe_affected_configuration_test.go index 379d961c68e..db6af48b53a 100644 --- a/internal/exec/describe_affected_configuration_test.go +++ b/internal/exec/describe_affected_configuration_test.go @@ -16,13 +16,11 @@ import ( "github.com/cloudposse/atmos/pkg/schema" ) +// revisionConfigurationRuntime composes the generated runtime and revision mocks, +// because a revision-capable provider implements both schema interfaces. type revisionConfigurationRuntime struct { *MockComponentConfigurationRuntime - revision func(string) (schema.ComponentConfigurationRuntime, error) -} - -func (r *revisionConfigurationRuntime) ForRevision(root string) (schema.ComponentConfigurationRuntime, error) { - return r.revision(root) + *MockComponentConfigurationRevisionRuntime } func affectedConfigurationDefinitions(names ...string) map[string]map[string]any { @@ -61,11 +59,12 @@ func TestAffectedConfigurationRevisions(t *testing.T) { previous := NewMockComponentConfigurationRuntime(ctrl) previous.EXPECT().Discover(gomock.Any()).Return(affectedConfigurationDefinitions(tc.before...), tc.discoverErr).AnyTimes() forked := false - runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: current, revision: func(root string) (schema.ComponentConfigurationRuntime, error) { - require.Equal(t, baseRoot, root) + revisions := NewMockComponentConfigurationRevisionRuntime(ctrl) + revisions.EXPECT().ForRevision(baseRoot).DoAndReturn(func(string) (schema.ComponentConfigurationRuntime, error) { forked = true return previous, tc.forkErr - }} + }).Times(1) + runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: current, MockComponentConfigurationRevisionRuntime: revisions} config.ComponentConfigurations = runtime affected, _, _, err := executeDescribeAffected(config, headRoot, baseRoot, head, base, false, false, "", false, false, nil, AffectedFilter{}, nil, true, DescribeStacksErrorOptions{}) require.True(t, forked, "BASE must discover independently") @@ -93,12 +92,15 @@ func TestAffectedConfigurationRevisions(t *testing.T) { func TestAffectedConfigurationForkErrors(t *testing.T) { require.NoError(t, rebaseConfigurationDiscovery(&schema.AtmosConfiguration{})) - original := NewMockComponentConfigurationRuntime(gomock.NewController(t)) + ctrl := gomock.NewController(t) + original := NewMockComponentConfigurationRuntime(ctrl) config := &schema.AtmosConfiguration{ComponentConfigurations: original} require.ErrorIs(t, rebaseConfigurationDiscovery(config), errUtils.ErrPluginUnsupportedExtension) require.Same(t, original, config.ComponentConfigurations) for _, failure := range []error{context.Canceled, errUtils.ErrPluginInvalidConfig} { - runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: original, revision: func(string) (schema.ComponentConfigurationRuntime, error) { return nil, failure }} + revisions := NewMockComponentConfigurationRevisionRuntime(ctrl) + revisions.EXPECT().ForRevision(gomock.Any()).Return(nil, failure).Times(1) + runtime := &revisionConfigurationRuntime{MockComponentConfigurationRuntime: original, MockComponentConfigurationRevisionRuntime: revisions} config.ComponentConfigurations = runtime require.ErrorIs(t, rebaseConfigurationDiscovery(config), failure) require.Same(t, runtime, config.ComponentConfigurations) @@ -130,7 +132,7 @@ func TestAffectedConfigurationWatchRootSpelling(t *testing.T) { resolvedIndex, matched := configurationMatchInputs(index, deps, provider) changed, kind, path, err := isComponentDependentFolderOrFileChangedIndexed(resolvedIndex, matched) require.NoError(t, err) - return changed, kind, configuredDependencyPath(deps, matched, path) + return changed, kind, configuration.ConfiguredDependencyPath(deps, matched, path) } deps := watches() diff --git a/internal/exec/mock_configuration_test.go b/internal/exec/mock_configuration_test.go index 873ac8bd408..c8dd5532c67 100644 --- a/internal/exec/mock_configuration_test.go +++ b/internal/exec/mock_configuration_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/cloudposse/atmos/pkg/schema (interfaces: ComponentConfigurationRuntime) +// Source: github.com/cloudposse/atmos/pkg/schema (interfaces: ComponentConfigurationRuntime,ComponentConfigurationRevisionRuntime) // // Generated by this command: // -// mockgen -destination=internal/exec/mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime +// mockgen -destination=mock_configuration_test.go -package=exec github.com/cloudposse/atmos/pkg/schema ComponentConfigurationRuntime,ComponentConfigurationRevisionRuntime // // Package exec is a generated GoMock package. @@ -70,3 +70,42 @@ func (mr *MockComponentConfigurationRuntimeMockRecorder) Prepare(arg0, arg1 any) mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockComponentConfigurationRuntime)(nil).Prepare), arg0, arg1) } + +// MockComponentConfigurationRevisionRuntime is a mock of ComponentConfigurationRevisionRuntime interface. +type MockComponentConfigurationRevisionRuntime struct { + ctrl *gomock.Controller + recorder *MockComponentConfigurationRevisionRuntimeMockRecorder + isgomock struct{} +} + +// MockComponentConfigurationRevisionRuntimeMockRecorder is the mock recorder for MockComponentConfigurationRevisionRuntime. +type MockComponentConfigurationRevisionRuntimeMockRecorder struct { + mock *MockComponentConfigurationRevisionRuntime +} + +// NewMockComponentConfigurationRevisionRuntime creates a new mock instance. +func NewMockComponentConfigurationRevisionRuntime(ctrl *gomock.Controller) *MockComponentConfigurationRevisionRuntime { + mock := &MockComponentConfigurationRevisionRuntime{ctrl: ctrl} + mock.recorder = &MockComponentConfigurationRevisionRuntimeMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockComponentConfigurationRevisionRuntime) EXPECT() *MockComponentConfigurationRevisionRuntimeMockRecorder { + return m.recorder +} + +// ForRevision mocks base method. +func (m *MockComponentConfigurationRevisionRuntime) ForRevision(root string) (schema.ComponentConfigurationRuntime, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ForRevision", root) + ret0, _ := ret[0].(schema.ComponentConfigurationRuntime) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ForRevision indicates an expected call of ForRevision. +func (mr *MockComponentConfigurationRevisionRuntimeMockRecorder) ForRevision(root any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForRevision", reflect.TypeOf((*MockComponentConfigurationRevisionRuntime)(nil).ForRevision), root) +} diff --git a/pkg/component/configuration/registry.go b/pkg/component/configuration/registry.go index ec27287cac6..0da99c40184 100644 --- a/pkg/component/configuration/registry.go +++ b/pkg/component/configuration/registry.go @@ -3,11 +3,18 @@ package configuration import ( "context" + "fmt" + "maps" + "os" + "slices" "sync" + "github.com/santhosh-tekuri/jsonschema/v5" + errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/perf" "github.com/cloudposse/atmos/pkg/schema" + u "github.com/cloudposse/atmos/pkg/utils" ) // Factory constructs an invocation-local session. Registration stores no invocation state. @@ -57,3 +64,89 @@ func Attach(ctx context.Context, config *schema.AtmosConfiguration, operation st config.ComponentConfigurations = session return nil } + +// MatchDependencies returns the dependencies to compare against a change set. +// Provider watches are rooted at BasePathAbsolute, and base-path resolution +// can spell that root differently from the repository root the changed files +// are joined to: through a symlinked temp dir on macOS (/var vs /private/var) +// or as an 8.3 short name on Windows (RUNNER~1 vs runneradmin). Two spellings +// of one directory never match, so provider watches are canonicalized with +// resolve, which the caller also applies to the change set. YAML dependencies +// keep exact matching and are returned unchanged. +func MatchDependencies(deps []schema.ComponentDependency, provider bool, resolve func(string) string) []schema.ComponentDependency { + defer perf.Track(nil, "configuration.MatchDependencies")() + + if !provider || resolve == nil { + return deps + } + resolved := slices.Clone(deps) + for i := range resolved { + resolved[i].Path = resolve(resolved[i].Path) + } + return resolved +} + +// ConfiguredDependencyPath reports a matched dependency in its configured spelling. +// The matched slice must come from MatchDependencies for the same deps. +// +//nolint:lintroller // Pure lookup or validation; exempt from performance tracking. +func ConfiguredDependencyPath(deps, matched []schema.ComponentDependency, path string) string { + for i := range matched { + if matched[i].Path == path && i < len(deps) { + return deps[i].Path + } + } + return path +} + +// ValidateDiscoveredManifests checks provider definitions against the same manifest +// schema as YAML stack manifests, so an invalid discovered field fails validation. +// The schema is compiled lazily through compile, which lets the caller share its +// compiled-schema cache; nothing is compiled when no stack was discovered. +func ValidateDiscoveredManifests(discovered map[string]map[string]any, compile func() (*jsonschema.Schema, error)) ([]string, error) { + defer perf.Track(nil, "configuration.ValidateDiscoveredManifests")() + + if len(discovered) == 0 { + return nil, nil + } + compiled, err := compile() + if err != nil { + return nil, err + } + var messages []string + for _, name := range slices.Sorted(maps.Keys(discovered)) { + data, err := u.ConvertToJSONFast(discovered[name]) + if err != nil { + return nil, err + } + instance, err := u.ConvertFromJSON(data) + if err != nil { + return nil, err + } + if err := compiled.Validate(instance); err != nil { + messages = append(messages, fmt.Sprintf("Atmos manifest JSON Schema validation error in the discovered stack '%s':\n%v", name, err)) + } + } + return messages, nil +} + +// CompileManifestSchema compiles the Atmos manifest JSON schema at path. +func CompileManifestSchema(path string) (*jsonschema.Schema, error) { + defer perf.Track(nil, "configuration.CompileManifestSchema")() + + reader, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("%w: manifest schema %s: %w", errUtils.ErrOpenFile, path, err) + } + defer reader.Close() + compiler := jsonschema.NewCompiler() + compiler.Draft = jsonschema.Draft2020 + if err := compiler.AddResource(path, reader); err != nil { + return nil, fmt.Errorf("%w: register manifest schema %s: %w", errUtils.ErrStackManifestSchemaValidation, path, err) + } + compiled, err := compiler.Compile(path) + if err != nil { + return nil, fmt.Errorf("%w: compile manifest schema %s: %w", errUtils.ErrStackManifestSchemaValidation, path, err) + } + return compiled, nil +} diff --git a/pkg/component/configuration/registry_test.go b/pkg/component/configuration/registry_test.go index ba0a5fb8678..352d033950a 100644 --- a/pkg/component/configuration/registry_test.go +++ b/pkg/component/configuration/registry_test.go @@ -2,8 +2,11 @@ package configuration import ( "context" + "os" + "path/filepath" "testing" + "github.com/santhosh-tekuri/jsonschema/v5" "github.com/stretchr/testify/require" errUtils "github.com/cloudposse/atmos/errors" @@ -48,3 +51,79 @@ func TestFactoryRegistrationAndOptIn(t *testing.T) { factories.Unlock() require.NoError(t, Attach(t.Context(), config, "list")) } + +func TestMatchDependencies(t *testing.T) { + deps := []schema.ComponentDependency{{Kind: "folder", Path: "short/unit"}, {Kind: "file", Path: "short/a.tf"}} + resolve := func(path string) string { return "long/" + path } + + t.Run("YAML dependencies keep exact matching", func(t *testing.T) { + require.Equal(t, deps, MatchDependencies(deps, false, resolve)) + }) + t.Run("provider watches are canonicalized without mutating input", func(t *testing.T) { + matched := MatchDependencies(deps, true, resolve) + require.Equal(t, "long/short/unit", matched[0].Path) + require.Equal(t, "long/short/a.tf", matched[1].Path) + require.Equal(t, "file", matched[1].Kind) + require.Equal(t, "short/unit", deps[0].Path, "configured spelling must be preserved") + require.Equal(t, "short/unit", ConfiguredDependencyPath(deps, matched, "long/short/unit")) + require.Equal(t, "short/a.tf", ConfiguredDependencyPath(deps, matched, "long/short/a.tf")) + require.Equal(t, "other", ConfiguredDependencyPath(deps, matched, "other")) + }) + t.Run("nil resolver leaves dependencies unchanged", func(t *testing.T) { + require.Equal(t, deps, MatchDependencies(deps, true, nil)) + }) +} + +func writeManifestSchema(t *testing.T, content string) string { + t.Helper() + path := filepath.Join(t.TempDir(), "manifest.json") + require.NoError(t, os.WriteFile(path, []byte(content), 0o600)) + return path +} + +const testManifestSchema = `{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string"}}}` + +func TestValidateDiscoveredManifests(t *testing.T) { + path := writeManifestSchema(t, testManifestSchema) + compiles := 0 + compile := func() (*jsonschema.Schema, error) { + compiles++ + return CompileManifestSchema(path) + } + + messages, err := ValidateDiscoveredManifests(nil, compile) + require.NoError(t, err) + require.Empty(t, messages) + require.Zero(t, compiles, "no discovered stacks must not compile the schema") + + discovered := map[string]map[string]any{ + "zeta": {"name": 7}, + "alpha": {"name": false}, + "ok": {"name": "ok"}, + } + messages, err = ValidateDiscoveredManifests(discovered, compile) + require.NoError(t, err) + require.Equal(t, 1, compiles) + require.Len(t, messages, 2) + require.Contains(t, messages[0], "discovered stack 'alpha'", "messages are ordered by stack name") + require.Contains(t, messages[1], "discovered stack 'zeta'") + + _, err = ValidateDiscoveredManifests(discovered, func() (*jsonschema.Schema, error) { return nil, errUtils.ErrOpenFile }) + require.ErrorIs(t, err, errUtils.ErrOpenFile) +} + +func TestCompileManifestSchemaWrapsFailures(t *testing.T) { + _, err := CompileManifestSchema(filepath.Join(t.TempDir(), "missing.json")) + require.ErrorIs(t, err, errUtils.ErrOpenFile) + require.ErrorIs(t, err, os.ErrNotExist, "the underlying chain must remain inspectable") + + _, err = CompileManifestSchema(writeManifestSchema(t, "{not json")) + require.ErrorIs(t, err, errUtils.ErrStackManifestSchemaValidation) + + _, err = CompileManifestSchema(writeManifestSchema(t, `{"type": 12}`)) + require.ErrorIs(t, err, errUtils.ErrStackManifestSchemaValidation) + + compiled, err := CompileManifestSchema(writeManifestSchema(t, testManifestSchema)) + require.NoError(t, err) + require.NotNil(t, compiled) +} diff --git a/pkg/plugin/adapter/configuration/mock_provider_test.go b/pkg/plugin/adapter/configuration/mock_provider_test.go index 8bf10fa5aec..49372017d79 100644 --- a/pkg/plugin/adapter/configuration/mock_provider_test.go +++ b/pkg/plugin/adapter/configuration/mock_provider_test.go @@ -84,3 +84,18 @@ func (mr *MockProviderMockRecorder) Prepare(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Prepare", reflect.TypeOf((*MockProvider)(nil).Prepare), arg0, arg1) } + +// ResolveState mocks base method. +func (m *MockProvider) ResolveState(arg0 context.Context, arg1 *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResolveState", arg0, arg1) + ret0, _ := ret[0].(*pluginv1.ResolveComponentStateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResolveState indicates an expected call of ResolveState. +func (mr *MockProviderMockRecorder) ResolveState(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResolveState", reflect.TypeOf((*MockProvider)(nil).ResolveState), arg0, arg1) +} diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go index 86cd39e9112..da3997c09d1 100644 --- a/pkg/plugin/adapter/configuration/preparation.go +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -57,6 +57,9 @@ func (s *Session) Prepare(ctx context.Context, info *schema.ConfigAndStacksInfo) if result.Engine != instance.Engine { return nil, errUtils.ErrPluginProtocol } + if result.State != nil { + s.prepared.Store(addressKey(instance.Address), proto.Clone(result.State)) + } return preparedConfiguration(result) } @@ -89,11 +92,61 @@ func (s *Session) checkPreparationDependencies(ctx context.Context, instance *pl return fmt.Errorf("%w: preparation changed discovered dependency paths", errUtils.ErrPluginInvalidConfig) } } - return nil + return s.checkDependencyStates(ctx, original, selected.Dependencies, env, command) } return errUtils.ErrPluginInvalidConfig } +// checkDependencyStates keeps output reads on the dependency's own state. The +// provider evaluates a dependency's remote_state under the dependent's +// environment, so an identity or component override can select different state. +// The reference is the identity the dependency was prepared with in this +// invocation, or else its identity under the discovery environment. +func (s *Session) checkDependencyStates(ctx context.Context, discovery *pluginv1.DiscoverComponentsRequest, dependencies []*pluginv1.ComponentDependency, env map[string]string, command string) error { + for _, dependency := range dependencies { + if dependency.Kind != pluginv1.ComponentDependency_OUTPUT { + continue + } + key := addressKey(dependency.Target) + target := s.instances[key] + current, err := s.dependencyState(ctx, discovery, target, env, command) + if err != nil { + return err + } + expected, err := s.referenceState(ctx, discovery, target, key, command) + if err != nil { + return err + } + if !proto.Equal(expected, current) { + return fmt.Errorf("%w: dependency %s/%s state differs under the dependent's environment", errUtils.ErrPluginInvalidConfig, key[0], key[2]) + } + } + return nil +} + +func (s *Session) referenceState(ctx context.Context, discovery *pluginv1.DiscoverComponentsRequest, target *pluginv1.DiscoveredComponent, key [3]string, command string) (*pluginv1.ComponentStateIdentity, error) { + if prepared, ok := s.prepared.Load(key); ok { + return prepared.(*pluginv1.ComponentStateIdentity), nil + } + return s.dependencyState(ctx, discovery, target, discovery.GetInvocation().GetEnvironment(), command) +} + +func (s *Session) dependencyState(ctx context.Context, discovery *pluginv1.DiscoverComponentsRequest, target *pluginv1.DiscoveredComponent, env map[string]string, command string) (*pluginv1.ComponentStateIdentity, error) { + result, err := s.registry[target.Provider].ResolveState(ctx, &pluginv1.ComponentRequest{ + Provider: target.Provider, Address: target.Address, Source: target.Source, RootDirectory: s.root, + Configuration: target.Configuration, ProviderConfiguration: discovery.ProviderConfiguration, + Invocation: &pluginv1.Invocation{Environment: env}, + Operation: &pluginv1.ComponentOperation{Command: command, Mode: "native"}, + }) + if err != nil { + return nil, err + } + if result == nil || result.State == nil { + return nil, errUtils.ErrPluginProtocol + } + return result.State, nil +} + func sameDependencyUnit(before, after *pluginv1.DiscoveredComponent) bool { return before != nil && after != nil && before.Source == after.Source && before.Provider == after.Provider && before.Engine == after.Engine } diff --git a/pkg/plugin/adapter/configuration/session.go b/pkg/plugin/adapter/configuration/session.go index 158f151aeb8..45094bbdadb 100644 --- a/pkg/plugin/adapter/configuration/session.go +++ b/pkg/plugin/adapter/configuration/session.go @@ -25,6 +25,7 @@ type Provider interface { ComponentType() string Discover(context.Context, *pluginv1.DiscoverComponentsRequest) (*pluginv1.DiscoverComponentsResponse, error) Prepare(context.Context, *pluginv1.ComponentRequest) (*pluginv1.PrepareComponentResponse, error) + ResolveState(context.Context, *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) } // Loader resolves the requested configuration providers through package policy and locks. @@ -41,7 +42,10 @@ type Session struct { registry map[string]Provider definitions map[string]map[string]any instances map[[3]string]*pluginv1.DiscoveredComponent - err error + // prepared records the state identity each instance was prepared with, so a + // dependent's output reads can be checked against it within this invocation. + prepared sync.Map + err error } // New snapshots the explicitly enabled scope without starting plugins or scanning directories. diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index cb3e5e131db..5ff8fd55a4f 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -75,6 +75,12 @@ func TestSessionDiscoveryAndPreparation(t *testing.T) { require.Equal(t, "override", request.Invocation.Environment["FROM_COMPONENT"]) return &pluginv1.PrepareComponentResponse{Engine: "opentofu", ModuleSource: "/module", Inputs: inputs, State: &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, Workspace: "stage", WorkingDirectory: config.BasePathAbsolute}, Files: []*pluginv1.ComponentGeneratedFile{{Path: "context.tf", Content: []byte("{{ literal }}"), IfExists: "overwrite"}}}, nil }) + networkState := &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, Workspace: "default", WorkingDirectory: config.BasePathAbsolute} + provider.EXPECT().ResolveState(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + require.Equal(t, "network", request.Address.Component) + require.Equal(t, "live/network/terragrunt.hcl", request.Source) + return &pluginv1.ResolveComponentStateResponse{State: networkState}, nil + }).Times(2) prepared, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{Stack: "live", ComponentFromArg: "app", Command: "tofu", SubCommand: "apply", TerraformWorkspace: "stage", ComponentSettingsSection: map[string]any{"configuration": true}, ComponentEnvList: []string{"FROM_COMPONENT=original", "FROM_COMPONENT=override"}, ComponentEnvSection: map[string]any{"FROM_COMPONENT": "override"}}) require.NoError(t, err) require.Equal(t, int64(9007199254740993), prepared.Inputs["large"]) @@ -306,6 +312,7 @@ func TestPreparationRevalidatesDependencyPaths(t *testing.T) { return current, nil }) if change == "unchanged" || change == "reordered" { + provider.EXPECT().ResolveState(gomock.Any(), gomock.Any()).Return(&pluginv1.ResolveComponentStateResponse{State: &pluginv1.ComponentStateIdentity{BackendType: "local"}}, nil).Times(2) provider.EXPECT().Prepare(gomock.Any(), gomock.Any()).Return(&pluginv1.PrepareComponentResponse{Engine: "opentofu", State: &pluginv1.ComponentStateIdentity{}}, nil) } result, err := session.Prepare(t.Context(), &schema.ConfigAndStacksInfo{ @@ -377,3 +384,69 @@ func TestRevisionDiscoveryIsolated(t *testing.T) { _, err = revision.Discover(t.Context()) require.ErrorIs(t, err, context.Canceled) } + +// Output reads must use the state the dependency was prepared with, not the +// state its remote_state selects under the dependent's environment. +func TestPreparationRejectsDependencyStateDrift(t *testing.T) { + stateAt := func(path string) *pluginv1.ComponentStateIdentity { + backend, err := adapter.EncodeObject(map[string]any{"path": path}) + require.NoError(t, err) + return &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, Workspace: "default", WorkingDirectory: "/work"} + } + for _, test := range []struct { + name string + prepareNetworkFirst bool + dependent, reference *pluginv1.ComponentStateIdentity + resolveErr error + want error + }{ + {name: "same state", dependent: stateAt("network.tfstate"), reference: stateAt("network.tfstate")}, + {name: "state differs from discovery environment", dependent: stateAt("other.tfstate"), reference: stateAt("network.tfstate"), want: errUtils.ErrPluginInvalidConfig}, + {name: "state differs from prepared dependency", prepareNetworkFirst: true, dependent: stateAt("other.tfstate"), want: errUtils.ErrPluginInvalidConfig}, + {name: "matches prepared dependency", prepareNetworkFirst: true, dependent: stateAt("network.tfstate")}, + {name: "resolve failure", resolveErr: errUtils.ErrPluginProtocol, want: errUtils.ErrPluginProtocol}, + } { + t.Run(test.name, func(t *testing.T) { + provider := NewMockProvider(gomock.NewController(t)) + provider.EXPECT().ComponentType().Return("terraform") + network, app := unit(t, "network"), unit(t, "app") + app.Dependencies = []*pluginv1.ComponentDependency{{Target: network.Address, Kind: pluginv1.ComponentDependency_OUTPUT}} + inventory := &pluginv1.DiscoverComponentsResponse{Components: []*pluginv1.DiscoveredComponent{network, app}} + provider.EXPECT().Discover(gomock.Any(), gomock.Any()).Return(inventory, nil).AnyTimes() + session, err := New(t.Context(), enabledConfig(t), "apply", func(context.Context, []string) (map[string]Provider, error) { + return map[string]Provider{"terragrunt": provider}, nil + }) + require.NoError(t, err) + info := func(component string) *schema.ConfigAndStacksInfo { + return &schema.ConfigAndStacksInfo{Stack: "live", ComponentFromArg: component, Command: "tofu", SubCommand: "apply", TerraformWorkspace: "default", ComponentSettingsSection: map[string]any{"configuration": true}, SanitizedEnv: []string{"IDENTITY=" + component}} + } + if test.prepareNetworkFirst { + provider.EXPECT().Prepare(gomock.Any(), gomock.Any()).Return(&pluginv1.PrepareComponentResponse{Engine: "opentofu", State: stateAt("network.tfstate")}, nil) + _, err := session.Prepare(t.Context(), info("network")) + require.NoError(t, err) + } + provider.EXPECT().ResolveState(gomock.Any(), gomock.Any()).DoAndReturn(func(_ context.Context, request *pluginv1.ComponentRequest) (*pluginv1.ResolveComponentStateResponse, error) { + require.Equal(t, "network", request.Address.Component) + if test.resolveErr != nil { + return nil, test.resolveErr + } + if request.Invocation.Environment["IDENTITY"] == "app" { + return &pluginv1.ResolveComponentStateResponse{State: test.dependent}, nil + } + require.False(t, test.prepareNetworkFirst, "a prepared dependency must not be re-resolved") + return &pluginv1.ResolveComponentStateResponse{State: test.reference}, nil + }).MinTimes(1) + if test.want == nil { + provider.EXPECT().Prepare(gomock.Any(), gomock.Any()).Return(&pluginv1.PrepareComponentResponse{Engine: "opentofu", State: stateAt("app.tfstate")}, nil) + } + result, err := session.Prepare(t.Context(), info("app")) + if test.want != nil { + require.ErrorIs(t, err, test.want) + require.Nil(t, result) + return + } + require.NoError(t, err) + require.NotNil(t, result) + }) + } +} From 2a4a7872790975789de8e7fe81f104ef34b5f349 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Fri, 13 Nov 2026 07:31:56 -0600 Subject: [PATCH 41/52] fix(terragrunt): scope stack generation and preserve unit identities Generate only the selected stack file and the nested stacks it declares, through a scoped bridge entry point, instead of directory-wide generation that also materialized undeclared or excluded stack files. Key expanded units and stacks by name/key instance identity so for_each and count elements no longer overwrite one another; reject keys that cannot form a path segment. Skip units already generated by a stack in the standalone pass so they are not discovered twice. Split resolve, project discovery, and Provider.Prepare into bounded phase helpers, keeping the overlay and generation-lock lifetimes. Co-Authored-By: Claude Opus 5.5 --- plugins/terragrunt/bridge/bridge.go | 29 +- .../terragrunt/internal/engine/discovery.go | 435 ++++++++++++++---- .../internal/engine/discovery_paths_test.go | 131 ++++++ .../terragrunt/internal/engine/policies.go | 28 ++ plugins/terragrunt/internal/engine/resolve.go | 293 ++++++------ .../internal/provider/preparation.go | 103 +++-- 6 files changed, 730 insertions(+), 289 deletions(-) diff --git a/plugins/terragrunt/bridge/bridge.go b/plugins/terragrunt/bridge/bridge.go index 03a78dd4f78..13a16d38718 100644 --- a/plugins/terragrunt/bridge/bridge.go +++ b/plugins/terragrunt/bridge/bridge.go @@ -5,21 +5,28 @@ package atmosbridge import ( "context" + "errors" "fmt" "io" "path/filepath" - "github.com/gruntwork-io/terragrunt/internal/stacks/generate" + "github.com/gruntwork-io/terragrunt/internal/configbridge" "github.com/gruntwork-io/terragrunt/internal/tf" "github.com/gruntwork-io/terragrunt/internal/venv" "github.com/gruntwork-io/terragrunt/internal/vexec" "github.com/gruntwork-io/terragrunt/internal/vhttp" "github.com/gruntwork-io/terragrunt/internal/vsops" + "github.com/gruntwork-io/terragrunt/internal/worker" + "github.com/gruntwork-io/terragrunt/pkg/config" "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/gruntwork-io/terragrunt/pkg/options" "github.com/spf13/afero" ) +// Venv is the pinned upstream virtual environment. The alias lets evaluator +// phases pass it between helpers without importing upstream internals. +type Venv = venv.Venv + // Environment isolates invocation environments and output writers. func Environment(env map[string]string, stdout, stderr io.Writer) *venv.Venv { // Invocation environments must not replace the plugin's process-wide environment. @@ -49,13 +56,25 @@ func WorkingDir(logger log.Logger, env *venv.Venv, source, download, directory s return resolved.WorkingDir, nil } -// Generate expands nested stacks through Terragrunt's real Go implementation. -// It does not execute the Terragrunt CLI or apply infrastructure. -func Generate(ctx context.Context, logger log.Logger, env *venv.Venv, path, tofu string) error { +// GenerateStack materializes the units and nested stack files declared by one +// stack file through Terragrunt's real Go implementation. Unlike directory-wide +// generation, it never lists or generates other stack files under the same +// directory; callers recurse into the nested stacks the file declares. It does +// not execute the Terragrunt CLI or apply infrastructure. +func GenerateStack(ctx context.Context, logger log.Logger, env *venv.Venv, path, tofu string) error { opts := options.NewTerragruntOptions(env.Exec) opts.WorkingDir = filepath.Dir(path) opts.RootWorkingDir = opts.WorkingDir opts.TerragruntStackConfigPath = path opts.TFPath = tofu - return generate.NewGenerator().GenerateStacks(ctx, logger, env, opts, nil) + scoped, pctx, err := configbridge.NewParsingContext(opts).WithConfigPath(logger, path) + if err != nil { + return err + } + pool := worker.NewWorkerPool(opts.Parallelism) + defer pool.Stop() + if err := config.GenerateStackFile(ctx, scoped, env, pctx, pool, path); err != nil { + return errors.Join(err, pool.Wait()) + } + return pool.Wait() } diff --git a/plugins/terragrunt/internal/engine/discovery.go b/plugins/terragrunt/internal/engine/discovery.go index 6ff3b5d68e8..219a49229a4 100644 --- a/plugins/terragrunt/internal/engine/discovery.go +++ b/plugins/terragrunt/internal/engine/discovery.go @@ -4,11 +4,15 @@ import ( "context" "errors" "fmt" + "maps" "os" "path/filepath" "slices" "strings" + "github.com/gruntwork-io/terragrunt/pkg/atmosbridge" + "github.com/gruntwork-io/terragrunt/pkg/config" + "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/spf13/afero" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" @@ -63,137 +67,386 @@ func within(path, directory string) bool { return err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) } -// discoverProject uses an invocation-local copy-on-write overlay. Generated HCL -// retains its original virtual path; no source files or state are moved/written. +// projectDiscovery holds one inventory pass. Its overlay is invocation-local: +// generated HCL retains its original virtual path and no source files or state +// are moved or written. +type projectDiscovery struct { + ctx context.Context + request model.Request + root string + overlay afero.Fs + result *model.Resolution + templates map[string]bool + // generated records units reached through stack traversal so the standalone + // pass does not discover the same generated unit again. + generated map[string]bool +} + +// discoverProject discovers live stacks first, then standalone units that no +// stack owns, and rejects colliding Atmos identities. func discoverProject(ctx context.Context, request model.Request) (*model.Resolution, error) { root, err := canonicalPath(request.BasePath) if err != nil { return nil, err } - overlay := afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) stacks, units, err := discoveryPaths(root, request.IncludedPaths, request.ExcludedPaths) if err != nil { return nil, err } - result := &model.Resolution{} - templates := map[string]bool{} - skipped := func(path string) bool { - for dir := range templates { - if within(path, dir) { - return true - } - } - return false + d := &projectDiscovery{ + ctx: ctx, request: request, root: root, + overlay: afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()), + result: &model.Resolution{}, + templates: map[string]bool{}, + generated: map[string]bool{}, } - nameFor := func(dir string) string { - rel, _ := filepath.Rel(root, dir) - if rel == "." { - return "default" - } - return filepath.ToSlash(rel) + if err := d.discoverStacks(stacks); err != nil { + return nil, err } - parse := func(path string, generate bool) (*model.Resolution, error) { - req := request - req.Path, req.Phase = path, "discover" - if generate { - req.Command = "generate" - } - resolved, err := resolve(ctx, req, overlay) - if err != nil { - return nil, discoveryError(root, path, "EVALUATION_FAILED", err) - } - return resolved, nil + if err := d.discoverStandaloneUnits(units); err != nil { + return nil, err } - var visit func(string, string, string, string, []string, []string, int) error - visit = func(path, stack, name, generationRoot string, files, folders []string, depth int) error { - if depth > 32 { - return fmt.Errorf("nested-stack discovery depth exceeded at %s", path) - } - resolved, err := parse(path, false) - if err != nil { - return err + slices.SortFunc(d.result.Inventory, func(a, b model.DiscoveredUnit) int { return strings.Compare(a.Stack+"/"+a.Name, b.Stack+"/"+b.Name) }) + if err := checkIdentityCollisions(d.result.Inventory); err != nil { + return nil, err + } + return d.result, nil +} + +// skipped reports whether path lies inside a catalog template directory. +func (d *projectDiscovery) skipped(path string) bool { + for dir := range d.templates { + if within(path, dir) { + return true } - if filepath.Base(path) == "terragrunt.stack.hcl" { - files = append(append([]string{}, files...), resolved.Files...) - for child, childPath := range resolved.StackConfigs { - source := resolved.StackSources[child] - templates[source] = true - if err := visit(childPath, stack, filepath.Join(name, resolved.Stacks[child]), generationRoot, files, append(append([]string{}, folders...), source), depth+1); err != nil { - return err - } - } - for child, childPath := range resolved.UnitConfigs { - source := resolved.UnitSources[child] - templates[source] = true - if err := visit(childPath, stack, filepath.Join(name, child), generationRoot, files, append(append([]string{}, folders...), source), depth+1); err != nil { - return err - } - } - return nil - } - if len(resolved.Folders) == 0 { - entries, err := afero.ReadDir(overlay, filepath.Dir(path)) - if err != nil { - return err - } - for _, entry := range entries { - if !entry.IsDir() && (strings.HasSuffix(entry.Name(), ".tf") || strings.HasSuffix(entry.Name(), ".tf.json")) { - return discoveryError(root, path, "MISSING_TERRAFORM_SOURCE", fmt.Errorf("inline Terraform modules require terraform.source")) - } - } - return nil - } // Shared include, not a runnable local-source unit. - if !plainLocalSource(resolved.Folders[0]) { - return discoveryError(root, path, "NONLOCAL_SOURCE", fmt.Errorf("discovery requires local sources")) - } - resolved.Files = append(resolved.Files, files...) - resolved.Folders = append(resolved.Folders, folders...) - result.Inventory = append(result.Inventory, model.DiscoveredUnit{Stack: stack, Name: filepath.ToSlash(name), GenerationRoot: generationRoot, Config: *resolved}) - return nil - } - // Catalog stack templates may require values supplied by a live stack. Delay - // their errors until successful roots have identified the referenced templates. + } + return false +} + +func (d *projectDiscovery) nameFor(dir string) string { + rel, _ := filepath.Rel(d.root, dir) + if rel == "." { + return "default" + } + return filepath.ToSlash(rel) +} + +func (d *projectDiscovery) parse(path string, generate bool) (*model.Resolution, error) { + req := d.request + req.Path, req.Phase = path, "discover" + if generate { + req.Command = "generate" + } + resolved, err := resolve(d.ctx, req, d.overlay) + if err != nil { + return nil, discoveryError(d.root, path, "EVALUATION_FAILED", err) + } + return resolved, nil +} + +// discoverStacks visits live stacks. Catalog stack templates may require values +// supplied by a live stack, so their errors wait until successful roots have +// identified the referenced templates. +func (d *projectDiscovery) discoverStacks(stacks []string) error { failures := map[string]error{} for _, path := range stacks { - if skipped(path) { + if d.skipped(path) { continue } - if _, err := parse(path, true); err != nil { + if _, err := d.parse(path, true); err != nil { failures[path] = err continue } - if err := visit(path, nameFor(filepath.Dir(path)), "", path, nil, nil, 0); err != nil { + if err := d.visit(path, unitPlacement{stack: d.nameFor(filepath.Dir(path)), generationRoot: path}, 0); err != nil { failures[path] = err } } for _, path := range stacks { - if err := failures[path]; err != nil && !skipped(path) { - return nil, fmt.Errorf("discover %s: %w", path, err) + if err := failures[path]; err != nil && !d.skipped(path) { + return fmt.Errorf("discover %s: %w", path, err) } } // A template that parsed independently is still a template, not another live stack. - result.Inventory = slices.DeleteFunc(result.Inventory, func(unit model.DiscoveredUnit) bool { return skipped(unit.GenerationRoot) }) + d.result.Inventory = slices.DeleteFunc(d.result.Inventory, func(unit model.DiscoveredUnit) bool { return d.skipped(unit.GenerationRoot) }) + return nil +} + +// discoverStandaloneUnits visits units that no stack owns. A unit already +// materialized by a stack (for example with no_dot_terragrunt_stack, or left on +// disk by an earlier generate) belongs to that stack and is not added twice. +func (d *projectDiscovery) discoverStandaloneUnits(units []string) error { for _, path := range units { - if skipped(path) { + if d.skipped(path) || d.generated[path] { continue } dir := filepath.Dir(path) - stack, name := nameFor(filepath.Dir(dir)), filepath.Base(dir) - if dir == root { + stack, name := d.nameFor(filepath.Dir(dir)), filepath.Base(dir) + if dir == d.root { stack, name = "default", "root" } - if err := visit(path, stack, name, "", nil, nil, 0); err != nil { - return nil, fmt.Errorf("discover %s: %w", path, err) + if err := d.visit(path, unitPlacement{stack: stack, name: name}, 0); err != nil { + return fmt.Errorf("discover %s: %w", path, err) } } - slices.SortFunc(result.Inventory, func(a, b model.DiscoveredUnit) int { return strings.Compare(a.Stack+"/"+a.Name, b.Stack+"/"+b.Name) }) + return nil +} + +// unitPlacement is the Atmos identity and provenance inherited through nested stacks. +type unitPlacement struct { + stack, name, generationRoot string + files, folders []string +} + +func (p unitPlacement) child(name, source string, files []string) unitPlacement { + return unitPlacement{ + stack: p.stack, name: filepath.Join(p.name, name), generationRoot: p.generationRoot, + files: files, folders: append(slices.Clone(p.folders), source), + } +} + +func (d *projectDiscovery) visit(path string, placement unitPlacement, depth int) error { + if depth > maxStackDepth { + return fmt.Errorf("nested-stack discovery depth exceeded at %s", path) + } + resolved, err := d.parse(path, false) + if err != nil { + return err + } + if filepath.Base(path) == stackFile { + return d.visitStack(resolved, placement, depth) + } + return d.visitUnit(path, resolved, placement) +} + +func (d *projectDiscovery) visitStack(resolved *model.Resolution, placement unitPlacement, depth int) error { + files := append(slices.Clone(placement.files), resolved.Files...) + for _, child := range slices.Sorted(maps.Keys(resolved.StackConfigs)) { + source := resolved.StackSources[child] + d.templates[source] = true + if err := d.visit(resolved.StackConfigs[child], placement.child(resolved.Stacks[child], source, files), depth+1); err != nil { + return err + } + } + for _, child := range slices.Sorted(maps.Keys(resolved.UnitConfigs)) { + source := resolved.UnitSources[child] + d.templates[source] = true + if physical, err := canonicalPath(resolved.UnitConfigs[child]); err == nil { + d.generated[physical] = true + } + if err := d.visit(resolved.UnitConfigs[child], placement.child(child, source, files), depth+1); err != nil { + return err + } + } + return nil +} + +func (d *projectDiscovery) visitUnit(path string, resolved *model.Resolution, placement unitPlacement) error { + if len(resolved.Folders) == 0 { + // Shared include, not a runnable local-source unit. + return d.checkInlineModule(path) + } + if !plainLocalSource(resolved.Folders[0]) { + return discoveryError(d.root, path, "NONLOCAL_SOURCE", fmt.Errorf("discovery requires local sources")) + } + resolved.Files = append(resolved.Files, placement.files...) + resolved.Folders = append(resolved.Folders, placement.folders...) + d.result.Inventory = append(d.result.Inventory, model.DiscoveredUnit{Stack: placement.stack, Name: filepath.ToSlash(placement.name), GenerationRoot: placement.generationRoot, Config: *resolved}) + return nil +} + +func (d *projectDiscovery) checkInlineModule(path string) error { + entries, err := afero.ReadDir(d.overlay, filepath.Dir(path)) + if err != nil { + return err + } + for _, entry := range entries { + if !entry.IsDir() && (strings.HasSuffix(entry.Name(), ".tf") || strings.HasSuffix(entry.Name(), ".tf.json")) { + return discoveryError(d.root, path, "MISSING_TERRAFORM_SOURCE", fmt.Errorf("inline Terraform modules require terraform.source")) + } + } + return nil +} + +func checkIdentityCollisions(inventory []model.DiscoveredUnit) error { identities := map[string]string{} - for _, unit := range result.Inventory { + for _, unit := range inventory { key := unit.Stack + "\x00" + unit.Name if previous, exists := identities[key]; exists { - return nil, fmt.Errorf("discovered instance collision %s/%s: %s and %s", unit.Stack, unit.Name, previous, unit.Config.Path) + return fmt.Errorf("discovered instance collision %s/%s: %s and %s", unit.Stack, unit.Name, previous, unit.Config.Path) } identities[key] = unit.Config.Path } + return nil +} + +// resolveStack reads the units and nested stacks one stack file declares. With +// generation, only this file and the nested stacks it declares are generated; +// other stack files under the same directory are never listed or generated. +func resolveStack(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, path string) (*model.Resolution, error) { + if generating(request) { + if err := generateStack(ctx, logger, environment, request, path, 0); err != nil { + return nil, err + } + } + stack, err := readStack(ctx, logger, environment, pctx, path) + if err != nil { + return nil, err + } + return stackResolution(pctx, stack, path) +} + +func readStack(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, path string) (*config.StackConfig, error) { + values, err := config.ReadValues(ctx, logger, environment, pctx, filepath.Dir(path)) + if err != nil { + return nil, err + } + return config.ReadStackConfigFile(ctx, logger, environment, pctx, path, values) +} + +// generateStack generates path and then, recursively, each enabled nested stack +// it declares. Units are generated by their declaring stack file. +func generateStack(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, request model.Request, path string, depth int) error { + if depth > maxStackDepth { + return fmt.Errorf("nested-stack generation depth exceeded at %s", path) + } + if err := atmosbridge.GenerateStack(ctx, logger, environment, path, request.Tofu); err != nil { + return err + } + stack, err := readStack(ctx, logger, environment, parsingContext(request, path), path) + if err != nil { + return err + } + for _, child := range stack.Stacks { + if !child.IsEnabled() { + continue + } + if err := generateStack(ctx, logger, environment, request, filepath.Join(child.GeneratedPath(filepath.Dir(path)), stackFile), depth+1); err != nil { + return err + } + } + return nil +} + +// instanceIdentity keeps expansion elements that share a block label distinct. +// An unexpanded block keeps its label, so ordinary discovery is unchanged. +func instanceIdentity(kind, name, key string, expanded bool) (string, error) { + if !expanded { + return name, nil + } + if key == "" || key == "." || key == ".." || strings.ContainsAny(key, `/\`) { + return "", fmt.Errorf("unsupported %s expansion key %q in %s", kind, key, name) + } + return name + "/" + key, nil +} + +func stackResolution(pctx *config.ParsingContext, stack *config.StackConfig, path string) (*model.Resolution, error) { + dir := filepath.Dir(path) + result := &model.Resolution{ + Path: path, Files: append(pctx.FilesRead.Paths(), path), + Units: map[string]string{}, UnitSources: map[string]string{}, UnitConfigs: map[string]string{}, + Stacks: map[string]string{}, StackSources: map[string]string{}, StackConfigs: map[string]string{}, + } + for _, unit := range stack.Units { + if !unit.IsEnabled() { + continue + } + key, expanded := unit.InstanceKey() + id, err := instanceIdentity("unit", unit.Name, key, expanded) + if err != nil { + return nil, err + } + if _, exists := result.Units[id]; exists { + return nil, fmt.Errorf("duplicate unit instance %s in %s", id, path) + } + result.Units[id] = unit.Path + result.UnitSources[id] = localPath(dir, unit.Source) + result.UnitConfigs[id] = filepath.Join(unit.GeneratedPath(dir), unitFile) + } + for _, child := range stack.Stacks { + if !child.IsEnabled() { + continue + } + key, expanded := child.InstanceKey() + id, err := instanceIdentity("stack", child.Name, key, expanded) + if err != nil { + return nil, err + } + if _, exists := result.Stacks[id]; exists { + return nil, fmt.Errorf("duplicate stack instance %s in %s", id, path) + } + result.Stacks[id] = child.Path + result.StackSources[id] = localPath(dir, child.Source) + result.StackConfigs[id] = filepath.Join(child.GeneratedPath(dir), stackFile) + } + return result, nil +} + +// resolveUnitInventory reads only the source and dependency blocks of a unit. +func resolveUnitInventory(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, path string) (*model.Resolution, error) { + cfg, err := config.PartialParseConfigFile(ctx, logger, environment, + pctx.WithDecodeList(config.DependenciesBlock, config.DependencyBlock, config.TerraformSource), path, nil) + if err != nil { + return nil, err + } + result := &model.Resolution{Path: path, Files: append(pctx.FilesRead.Paths(), path)} + if workspace := request.Environment["TF_WORKSPACE"]; workspace != "" && workspace != "default" && len(cfg.TerragruntDependencies) > 0 && cfg.Dependencies != nil && len(cfg.Dependencies.Paths) > 0 { + return nil, fmt.Errorf("native output dependencies with non-default workspaces require a dependency backend adapter: %s", path) + } + if cfg.Terraform != nil && cfg.Terraform.Source != nil { + result.Folders = []string{localPath(filepath.Dir(path), *cfg.Terraform.Source)} + } + if result.OutputDependencies, err = outputDependencies(cfg, path); err != nil { + return nil, err + } + if result.Dependencies, err = orderDependencies(environment, cfg, path); err != nil { + return nil, err + } + return result, nil +} + +func outputDependencies(cfg *config.TerragruntConfig, path string) ([]string, error) { + var result []string + for _, dep := range cfg.TerragruntDependencies { + if (dep.Enabled != nil && !*dep.Enabled) || (dep.SkipOutputs != nil && *dep.SkipOutputs) { + continue + } + if !dep.ConfigPath.IsKnown() || dep.ConfigPath.IsNull() { + continue + } + dependency := localPath(filepath.Dir(path), dep.ConfigPath.AsString()) + if filepath.Ext(dependency) != ".hcl" { + dependency = filepath.Join(dependency, unitFile) + } + physical, err := canonicalPath(dependency) + if err != nil { + return nil, err + } + result = append(result, physical) + } + return result, nil +} + +func orderDependencies(environment *atmosbridge.Venv, cfg *config.TerragruntConfig, path string) ([]string, error) { + if cfg.Dependencies == nil { + return nil, nil + } + var result []string + for _, dependency := range cfg.Dependencies.Paths { + if !filepath.IsAbs(dependency) { + dependency = filepath.Join(filepath.Dir(path), dependency) + } + info, err := environment.FS.Stat(dependency) + if err != nil { + return nil, err + } + if info.IsDir() { + dependency = filepath.Join(dependency, unitFile) + } + physical, err := canonicalPath(dependency) + if err != nil { + return nil, fmt.Errorf("native adapter dependency must target a unit: %w", err) + } + result = append(result, physical) + } return result, nil } diff --git a/plugins/terragrunt/internal/engine/discovery_paths_test.go b/plugins/terragrunt/internal/engine/discovery_paths_test.go index daad05bff78..b3ebeb59825 100644 --- a/plugins/terragrunt/internal/engine/discovery_paths_test.go +++ b/plugins/terragrunt/internal/engine/discovery_paths_test.go @@ -1,6 +1,7 @@ package engine import ( + "encoding/json" "os" "path/filepath" "testing" @@ -112,3 +113,133 @@ func TestPathHelpersAcceptMixedSeparators(t *testing.T) { require.Equal(t, nativeUnit, localPath(root, "catalog/units/app")) require.Equal(t, nativeUnit, localPath(filepath.Join(root, "live"), "../catalog/units/app")) } + +// stackProject writes a module, a catalog unit pointing at it, and the given files. +func stackProject(t *testing.T, files map[string]string) string { + t.Helper() + root, err := filepath.EvalSymlinks(t.TempDir()) + require.NoError(t, err) + module := filepath.Join(root, "modules", "unit") + source, err := json.Marshal(filepath.ToSlash(module)) + require.NoError(t, err) + files["modules/unit/main.tf"] = "terraform {}\n" + files["catalog/units/app/terragrunt.hcl"] = "terraform { source = " + string(source) + " }\n" + for name, content := range files { + path := filepath.Join(root, filepath.FromSlash(name)) + require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755)) + require.NoError(t, os.WriteFile(path, []byte(content), 0o644)) + } + return root +} + +func inventoryNames(t *testing.T, result *model.Resolution) []string { + t.Helper() + names := make([]string, 0, len(result.Inventory)) + for _, unit := range result.Inventory { + names = append(names, unit.Stack+"/"+unit.Name) + } + return names +} + +func TestDiscoveryPreservesExpandedInstanceIdentities(t *testing.T) { + root := stackProject(t, map[string]string{"live/terragrunt.stack.hcl": ` +unit "aurora" { + expansion { + for_each = toset(["web", "api"]) + } + source = "../catalog/units/app" + path = "aurora/${each.key}" +} + +unit "shard" { + expansion { + count = 2 + } + source = "../catalog/units/app" + path = "shard/${count.index}" +} + +unit "vpc" { + source = "../catalog/units/app" + path = "vpc" +} +`}) + result, err := Resolve(t.Context(), model.Request{Phase: "inventory", BasePath: root, IncludedPaths: []string{"live/**"}, Environment: map[string]string{}}) + require.NoError(t, err) + require.Equal(t, []string{"live/aurora/api", "live/aurora/web", "live/shard/0", "live/shard/1", "live/vpc"}, inventoryNames(t, result)) + paths := map[string]bool{} + for _, unit := range result.Inventory { + paths[unit.Config.Path] = true + } + require.Len(t, paths, 5, "each expansion element keeps its own generated unit") +} + +func TestInstanceIdentityRejectsUnrepresentableKeys(t *testing.T) { + id, err := instanceIdentity("unit", "app", "", false) + require.NoError(t, err) + require.Equal(t, "app", id, "unexpanded blocks keep their label") + id, err = instanceIdentity("unit", "app", "web", true) + require.NoError(t, err) + require.Equal(t, "app/web", id) + for _, key := range []string{"", ".", "..", "a/b", `a\b`} { + _, err := instanceIdentity("stack", "app", key, true) + require.ErrorContains(t, err, "unsupported stack expansion key", key) + } +} + +// Generation must not materialize stack files that the selected stack does not +// declare, including excluded stack files nested under its directory. +func TestStackGenerationIsScopedToDeclaredStacks(t *testing.T) { + root := stackProject(t, map[string]string{ + "live/terragrunt.stack.hcl": ` +unit "app" { + source = "../catalog/units/app" + path = "app" +} +`, + // Undeclared and excluded: generating it would fail on the missing value. + "live/other/terragrunt.stack.hcl": ` +unit "app" { + source = values.missing + path = "app" +} +`, + }) + request := model.Request{Phase: "inventory", BasePath: root, IncludedPaths: []string{"live/**"}, ExcludedPaths: []string{"live/other/**"}, Environment: map[string]string{}} + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, []string{"live/app"}, inventoryNames(t, result)) + require.NoDirExists(t, filepath.Join(root, "live", ".terragrunt-stack"), "discovery generates only into its overlay") + + request.ExcludedPaths = nil + _, err = Resolve(t.Context(), request) + require.Error(t, err, "an included broken stack is still reported") +} + +// A unit that a stack generates beside its stack file belongs to that stack; a +// copy already on disk must not be discovered again as a standalone unit. +func TestDiscoverySkipsStackOwnedGeneratedUnits(t *testing.T) { + root := stackProject(t, map[string]string{ + "live/terragrunt.stack.hcl": ` +unit "app" { + source = "../catalog/units/app" + path = "app" + no_dot_terragrunt_stack = true +} +`, + "live/standalone/terragrunt.hcl": "", + }) + module, err := json.Marshal(filepath.ToSlash(filepath.Join(root, "modules", "unit"))) + require.NoError(t, err) + unit := "terraform { source = " + string(module) + " }\n" + require.NoError(t, os.WriteFile(filepath.Join(root, "live", "standalone", "terragrunt.hcl"), []byte(unit), 0o644)) + // Materialized by an earlier `terragrunt stack generate`. + require.NoError(t, os.MkdirAll(filepath.Join(root, "live", "app"), 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(root, "live", "app", "terragrunt.hcl"), []byte(unit), 0o644)) + + result, err := Resolve(t.Context(), model.Request{Phase: "inventory", BasePath: root, IncludedPaths: []string{"live/**"}, Environment: map[string]string{}}) + require.NoError(t, err) + require.Equal(t, []string{"live/app", "live/standalone"}, inventoryNames(t, result)) + require.Equal(t, filepath.Join(root, "live", "terragrunt.stack.hcl"), result.Inventory[0].GenerationRoot, "the stack owns the generated unit") + require.Empty(t, result.Inventory[1].GenerationRoot) +} diff --git a/plugins/terragrunt/internal/engine/policies.go b/plugins/terragrunt/internal/engine/policies.go index bc8478443de..ed72fd9c1e7 100644 --- a/plugins/terragrunt/internal/engine/policies.go +++ b/plugins/terragrunt/internal/engine/policies.go @@ -8,6 +8,7 @@ import ( "path/filepath" "strings" + "github.com/gruntwork-io/terragrunt/pkg/config" "github.com/hashicorp/go-version" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" @@ -68,3 +69,30 @@ func checkVersions(ctx context.Context, request model.Request, terraform, terrag } return check("terraform_version_constraint", terraform, result.Version) } + +// checkUnitPolicies rejects Terragrunt semantics that the native adapter cannot +// represent faithfully. Backend reads skip the version probe, which may execute +// the selected binary. +func checkUnitPolicies(ctx context.Context, request model.Request, cfg *config.TerragruntConfig) error { + if cfg.Terraform == nil || cfg.Terraform.Source == nil { + return fmt.Errorf("native adapter requires terraform.source") + } + if request.Phase != "backend" { + if err := checkVersions(ctx, request, cfg.TerraformVersionConstraint, cfg.TerragruntVersionConstraint); err != nil { + return err + } + } + if cfg.TerraformBinary != "" { + return fmt.Errorf("native adaptation of terraform_binary is not implemented") + } + if len(cfg.Terraform.BeforeHooks)+len(cfg.Terraform.AfterHooks)+len(cfg.Terraform.ErrorHooks)+len(cfg.Terraform.ExtraArgs) > 0 { + return fmt.Errorf("native adaptation of hooks/extra_arguments is not implemented") + } + if cfg.PreventDestroy != nil && *cfg.PreventDestroy { + return fmt.Errorf("native adaptation of prevent_destroy is not implemented") + } + if cfg.Errors != nil || cfg.Exclude != nil || len(cfg.FeatureFlags) > 0 || cfg.IamRole != "" || cfg.IamWebIdentityToken != "" { + return fmt.Errorf("native adaptation of errors, exclude, feature flags, or IAM settings is not implemented") + } + return nil +} diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index b096a7b184d..064bcf801e0 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -28,36 +28,107 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* if request.Phase == "inventory" { return discoverProject(ctx, request) } - if request.Phase == "backend" && request.GenerationRoot != "" { - filesystem = afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) - generation := request - generation.Path, generation.Phase, generation.Command = request.GenerationRoot, "discover", "generate" - if _, err := resolve(ctx, generation, filesystem); err != nil { - return nil, err - } - } - path, err := filepath.Abs(strings.TrimPrefix(request.Path, "terragrunt://")) + filesystem, err := backendGenerationOverlay(ctx, request, filesystem) if err != nil { return nil, err } - // Use one physical path identity for parsing and CLI execution. On macOS, - // mixing /var and /private/var breaks upstream diamond dependency reads. - path, err = canonicalPath(path) + path, err := requestPath(request.Path) if err != nil { return nil, err } ctx = config.WithCaches(ctx) + logger, err := evaluationLogger(request.LogLevel) + if err != nil { + return nil, err + } + environment, err := evaluationEnvironment(request, filesystem, path) + if err != nil { + return nil, err + } + pctx := parsingContext(request, path) + if filepath.Base(path) == stackFile { + return resolveStack(ctx, logger, environment, pctx, request, path) + } + if discovering(request) { + return resolveUnitInventory(ctx, logger, environment, pctx, request, path) + } + cfg, err := parseUnit(ctx, logger, environment, pctx, request, path) + if err != nil { + return nil, err + } + if err := checkUnitPolicies(ctx, request, cfg); err != nil { + return nil, err + } + result, err := unitResolution(logger, environment, pctx, request, cfg, path) + if err != nil { + return nil, err + } + if err := resolveBackend(result, cfg); err != nil { + return nil, err + } + if err := convertGeneration(result, cfg); err != nil { + return nil, err + } + return result, nil +} + +const ( + stackFile = "terragrunt.stack.hcl" + unitFile = "terragrunt.hcl" + // Nested-stack recursion for generation and discovery stops at maxStackDepth. + maxStackDepth = 32 +) + +// backendGenerationOverlay generates the owning stack into an invocation-local +// copy-on-write overlay before a backend read of a stack-generated unit. The +// returned filesystem is the one the unit is then parsed from. +func backendGenerationOverlay(ctx context.Context, request model.Request, filesystem afero.Fs) (afero.Fs, error) { + if request.Phase != "backend" || request.GenerationRoot == "" { + return filesystem, nil + } + filesystem = afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) + generation := request + generation.Path, generation.Phase, generation.Command = request.GenerationRoot, "discover", "generate" + if _, err := resolve(ctx, generation, filesystem); err != nil { + return nil, err + } + return filesystem, nil +} + +// requestPath uses one physical path identity for parsing and CLI execution. On +// macOS, mixing /var and /private/var breaks upstream diamond dependency reads. +func requestPath(path string) (string, error) { + path, err := filepath.Abs(strings.TrimPrefix(path, "terragrunt://")) + if err != nil { + return "", err + } + return canonicalPath(path) +} + +func evaluationLogger(level string) (log.Logger, error) { formatter := format.NewFormatter(format.NewKeyValueFormatPlaceholders()) formatter.SetDisabledColors(true) logger := log.New(log.WithOutput(io.Discard), log.WithFormatter(formatter)) - if request.LogLevel != "" { - if err := logger.SetLevel(request.LogLevel); err != nil { + if level != "" { + if err := logger.SetLevel(level); err != nil { return nil, err } } + return logger, nil +} + +func discovering(request model.Request) bool { + return request.Phase == "discover" || request.Command == "discover" +} + +func generating(request model.Request) bool { + return request.Command == "generate" && request.Phase != "backend" +} - // The local maintained facade exposes the pinned upstream virtual environment - // and recursive stack generation without modifying upstream source. +// evaluationEnvironment uses the local maintained facade, which exposes the +// pinned upstream virtual environment and scoped stack generation without +// modifying upstream source. +func evaluationEnvironment(request model.Request, filesystem afero.Fs, path string) (*atmosbridge.Venv, error) { environment := atmosbridge.Environment(request.Environment, io.Discard, io.Discard) if filesystem != nil { environment = environment.WithFS(filesystem) @@ -65,11 +136,13 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* if _, err := environment.FS.Stat(path); err != nil { return nil, err } - discover := request.Phase == "discover" || request.Command == "discover" - generate := request.Command == "generate" && request.Phase != "backend" - if discover || request.Phase == "backend" || generate { - environment = atmosbridge.Discovery(environment, generate) + if discovering(request) || request.Phase == "backend" || generating(request) { + environment = atmosbridge.Discovery(environment, generating(request)) } + return environment, nil +} + +func parsingContext(request model.Request, path string) *config.ParsingContext { command := request.Command if command == "" || command == "discover" || command == "generate" { command = "plan" @@ -83,126 +156,18 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* pctx.DownloadDir = filepath.Join(filepath.Dir(path), ".terragrunt-cache") pctx.AutoInit = true pctx.MaxFoldersToCheck = options.DefaultMaxFoldersToCheck - if filepath.Base(path) == "terragrunt.stack.hcl" { - if generate { - if err := atmosbridge.Generate(ctx, logger, environment, path, request.Tofu); err != nil { - return nil, err - } - } - values, err := config.ReadValues(ctx, logger, environment, pctx, filepath.Dir(path)) - if err != nil { - return nil, err - } - stack, err := config.ReadStackConfigFile(ctx, logger, environment, pctx, path, values) - if err != nil { - return nil, err - } - units := map[string]string{} - unitSources := map[string]string{} - unitConfigs := map[string]string{} - for _, unit := range stack.Units { - if !unit.IsEnabled() { - continue - } - units[unit.Name] = unit.Path - unitSources[unit.Name] = localPath(filepath.Dir(path), unit.Source) - unitConfigs[unit.Name] = filepath.Join(unit.GeneratedPath(filepath.Dir(path)), "terragrunt.hcl") - } - stacks := map[string]string{} - stackSources := map[string]string{} - stackConfigs := map[string]string{} - for _, child := range stack.Stacks { - if !child.IsEnabled() { - continue - } - stacks[child.Name] = child.Path - stackSources[child.Name] = localPath(filepath.Dir(path), child.Source) - stackConfigs[child.Name] = filepath.Join(child.GeneratedPath(filepath.Dir(path)), "terragrunt.stack.hcl") - } - return &model.Resolution{Path: path, Files: append(pctx.FilesRead.Paths(), path), Units: units, Stacks: stacks, UnitConfigs: unitConfigs, StackConfigs: stackConfigs, UnitSources: unitSources, StackSources: stackSources}, nil - } - if discover { - cfg, err := config.PartialParseConfigFile(ctx, logger, environment, - pctx.WithDecodeList(config.DependenciesBlock, config.DependencyBlock, config.TerraformSource), path, nil) - if err != nil { - return nil, err - } - result := &model.Resolution{Path: path, Files: append(pctx.FilesRead.Paths(), path)} - if workspace := request.Environment["TF_WORKSPACE"]; workspace != "" && workspace != "default" && len(cfg.TerragruntDependencies) > 0 && cfg.Dependencies != nil && len(cfg.Dependencies.Paths) > 0 { - return nil, fmt.Errorf("native output dependencies with non-default workspaces require a dependency backend adapter: %s", path) - } - if cfg.Terraform != nil && cfg.Terraform.Source != nil { - result.Folders = []string{localPath(filepath.Dir(path), *cfg.Terraform.Source)} - } - for _, dep := range cfg.TerragruntDependencies { - if dep.Enabled != nil && !*dep.Enabled { - continue - } - if dep.SkipOutputs != nil && *dep.SkipOutputs { - continue - } - if dep.ConfigPath.IsKnown() && !dep.ConfigPath.IsNull() { - dependency := localPath(filepath.Dir(path), dep.ConfigPath.AsString()) - if filepath.Ext(dependency) != ".hcl" { - dependency = filepath.Join(dependency, "terragrunt.hcl") - } - physical, err := canonicalPath(dependency) - if err != nil { - return nil, err - } - result.OutputDependencies = append(result.OutputDependencies, physical) - } - } - if cfg.Dependencies != nil { - for _, dependency := range cfg.Dependencies.Paths { - if !filepath.IsAbs(dependency) { - dependency = filepath.Join(filepath.Dir(path), dependency) - } - info, err := environment.FS.Stat(dependency) - if err != nil { - return nil, err - } - if info.IsDir() { - dependency = filepath.Join(dependency, "terragrunt.hcl") - } - physical, err := canonicalPath(dependency) - if err != nil { - return nil, fmt.Errorf("native adapter dependency must target a unit: %w", err) - } - result.Dependencies = append(result.Dependencies, physical) - } - } - return result, nil - } - var cfg *config.TerragruntConfig + return pctx +} + +func parseUnit(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, path string) (*config.TerragruntConfig, error) { if request.Phase == "backend" { - cfg, err = config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) - } else { - cfg, err = config.ParseConfigFile(ctx, logger, environment, pctx, path, nil) - } - if err != nil { - return nil, err - } - if cfg.Terraform == nil || cfg.Terraform.Source == nil { - return nil, fmt.Errorf("native adapter requires terraform.source") - } - if request.Phase != "backend" { - if err := checkVersions(ctx, request, cfg.TerraformVersionConstraint, cfg.TerragruntVersionConstraint); err != nil { - return nil, err - } - } - if cfg.TerraformBinary != "" { - return nil, fmt.Errorf("native adaptation of terraform_binary is not implemented") - } - if len(cfg.Terraform.BeforeHooks)+len(cfg.Terraform.AfterHooks)+len(cfg.Terraform.ErrorHooks)+len(cfg.Terraform.ExtraArgs) > 0 { - return nil, fmt.Errorf("native adaptation of hooks/extra_arguments is not implemented") - } - if cfg.PreventDestroy != nil && *cfg.PreventDestroy { - return nil, fmt.Errorf("native adaptation of prevent_destroy is not implemented") - } - if cfg.Errors != nil || cfg.Exclude != nil || len(cfg.FeatureFlags) > 0 || cfg.IamRole != "" || cfg.IamWebIdentityToken != "" { - return nil, fmt.Errorf("native adaptation of errors, exclude, feature flags, or IAM settings is not implemented") + return config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) } + return config.ParseConfigFile(ctx, logger, environment, pctx, path, nil) +} + +// unitResolution converts the parsed unit into its local module identity. +func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*model.Resolution, error) { result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)} if !plainLocalSource(result.Source) { return nil, fmt.Errorf("native adapter only adapts plain local directory sources") @@ -220,40 +185,52 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { download = localPath(filepath.Dir(path), configured) } - result.WorkingDir, err = atmosbridge.WorkingDir(logger, environment, result.Source, download, filepath.Dir(path)) + workingDir, err := atmosbridge.WorkingDir(logger, environment, result.Source, download, filepath.Dir(path)) if err != nil { return nil, err } + result.WorkingDir = workingDir result.Folders = []string{result.Source} result.Files = append(result.Files, request.OriginFiles...) result.Folders = append(result.Folders, request.OriginFolders...) - if cfg.RemoteState != nil { - result.BackendType = cfg.RemoteState.BackendName - result.Backend = cfg.RemoteState.BackendConfig - if result.BackendType != "local" { - return nil, fmt.Errorf("native adapter only adapts the local backend") - } - // Local backend paths are relative to Terragrunt's working directory, - // including the separate non-default-workspace state directory. - for key, fallback := range map[string]string{"path": "terraform.tfstate", "workspace_dir": "terraform.tfstate.d"} { - value, _ := result.Backend[key].(string) - if value == "" { - value = fallback - } - result.Backend[key] = localPath(result.WorkingDir, value) - } - } + return result, nil +} + +// resolveBackend adapts only the local backend. Local backend paths are relative +// to Terragrunt's working directory, including the separate non-default-workspace +// state directory. +func resolveBackend(result *model.Resolution, cfg *config.TerragruntConfig) error { + if cfg.RemoteState == nil { + return nil + } + result.BackendType = cfg.RemoteState.BackendName + result.Backend = cfg.RemoteState.BackendConfig + if result.BackendType != "local" { + return fmt.Errorf("native adapter only adapts the local backend") + } + for key, fallback := range map[string]string{"path": "terraform.tfstate", "workspace_dir": "terraform.tfstate.d"} { + value, _ := result.Backend[key].(string) + if value == "" { + value = fallback + } + result.Backend[key] = localPath(result.WorkingDir, value) + } + return nil +} + +// convertGeneration returns literal generated files that Atmos writes itself. +func convertGeneration(result *model.Resolution, cfg *config.TerragruntConfig) error { for _, generated := range cfg.GenerateConfigs { if generated.Disable { continue } if filepath.Base(generated.Path) != generated.Path || !strings.HasSuffix(generated.Path, ".tf") { - return nil, fmt.Errorf("unsupported generated path: %s", generated.Path) + return fmt.Errorf("unsupported generated path: %s", generated.Path) } if generated.IfExistsStr != "overwrite" || !generated.DisableSignature { - return nil, fmt.Errorf("native adapter generation requires overwrite and disable_signature") + return fmt.Errorf("native adapter generation requires overwrite and disable_signature") } result.Generated[generated.Path] = generated.Contents } - return result, nil + return nil } diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go index 7fbbcfbee76..32b146d0964 100644 --- a/plugins/terragrunt/internal/provider/preparation.go +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -54,60 +54,93 @@ func (p *Provider) Prepare(ctx context.Context, request *pluginv1.ComponentReque if err != nil { return nil, rpcError(err) } - effects := request.GetEffects() - if !effects.GetCommands() || !effects.GetWrites() || !effects.GetStateReads() || !effects.GetNetwork() || !effects.GetSecrets() { + if !preparationEffects(request.GetEffects()) { return nil, rpcError(ErrUnsupported) } - if req.GenerationRoot != "" { - // All provider processes generating the same stack must retain the lock - // until the subsequent unit parse has finished. - root, err := filepath.EvalSymlinks(req.BasePath) - if err != nil { - return nil, rpcError(err) - } - rel, err := filepath.Rel(req.BasePath, req.GenerationRoot) - if err != nil { - return nil, rpcError(err) - } - generationPath := filepath.Join(root, rel) - if resolved, resolveErr := filepath.EvalSymlinks(generationPath); resolveErr == nil { - generationPath = resolved - } - key := sha256.Sum256([]byte(generationPath)) - lock := flock.New(filepath.Join(os.TempDir(), fmt.Sprintf("atmos-terragrunt-%x.lock", key))) - locked, err := lock.TryLockContext(ctx, 50*time.Millisecond) - if err != nil { - return nil, rpcError(err) - } - if !locked { - return nil, rpcError(ctx.Err()) - } - defer lock.Unlock() - generation := req - generation.Path, generation.Phase, generation.Command = req.GenerationRoot, "discover", "generate" - if _, err := p.evaluate(ctx, generation); err != nil { - return nil, rpcError(err) - } + // All provider processes generating the same stack must retain the lock + // until the subsequent unit parse has finished. + unlock, err := p.generateLocked(ctx, req) + if err != nil { + return nil, rpcError(err) } + defer unlock() result, err := p.evaluate(ctx, req) if err != nil { return nil, rpcError(err) } + response, err := preparedResponse(req, result) + if err != nil { + return nil, rpcError(err) + } + return response, nil +} + +func preparationEffects(effects *pluginv1.ComponentEffects) bool { + return effects.GetCommands() && effects.GetWrites() && effects.GetStateReads() && effects.GetNetwork() && effects.GetSecrets() +} + +// generateLocked generates the owning stack under a cross-process lock and +// returns the function that releases it. Units outside a stack need no lock. +func (p *Provider) generateLocked(ctx context.Context, req model.Request) (func(), error) { + if req.GenerationRoot == "" { + return func() {}, nil + } + lock, err := generationLock(ctx, req) + if err != nil { + return nil, err + } + generation := req + generation.Path, generation.Phase, generation.Command = req.GenerationRoot, "discover", "generate" + if _, err := p.evaluate(ctx, generation); err != nil { + _ = lock.Unlock() + return nil, err + } + return func() { _ = lock.Unlock() }, nil +} + +// generationLock keys the lock by the physical generation root, so processes +// that spell the project root differently still serialize. +func generationLock(ctx context.Context, req model.Request) (*flock.Flock, error) { + root, err := filepath.EvalSymlinks(req.BasePath) + if err != nil { + return nil, err + } + rel, err := filepath.Rel(req.BasePath, req.GenerationRoot) + if err != nil { + return nil, err + } + generationPath := filepath.Join(root, rel) + if resolved, resolveErr := filepath.EvalSymlinks(generationPath); resolveErr == nil { + generationPath = resolved + } + key := sha256.Sum256([]byte(generationPath)) + lock := flock.New(filepath.Join(os.TempDir(), fmt.Sprintf("atmos-terragrunt-%x.lock", key))) + locked, err := lock.TryLockContext(ctx, 50*time.Millisecond) + if err != nil { + return nil, err + } + if !locked { + return nil, ctx.Err() + } + return lock, nil +} + +func preparedResponse(req model.Request, result *model.Resolution) (*pluginv1.PrepareComponentResponse, error) { values := result.Inputs if values == nil { values = map[string]any{} } inputs, err := encode(values) if err != nil { - return nil, rpcError(err) + return nil, err } state, err := stateIdentity(req, result) if err != nil { - return nil, rpcError(err) + return nil, err } watched, err := sources(req.BasePath, result) if err != nil { - return nil, rpcError(err) + return nil, err } response := &pluginv1.PrepareComponentResponse{Engine: engineName(req.Tofu), ModuleSource: result.Source, WorkingDirectory: result.WorkingDir, Inputs: inputs, State: state, Sources: watched} for _, name := range slices.Sorted(maps.Keys(result.Generated)) { From ca3c8ba52c90aa2bec3eccdd04cdd5bd3800118f Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Fri, 13 Nov 2026 08:14:05 -0600 Subject: [PATCH 42/52] test(plugin): fold component registry tests into calls tests Move the registry tests and their shared activation fixture from registry_test.go into calls_test.go, which already depends on that fixture. Test bodies are unchanged. This brings PR #3571 back under the 149-file review limit. Co-Authored-By: Claude Opus 5.5 --- pkg/plugin/adapter/component/calls_test.go | 94 +++++++++++++++ pkg/plugin/adapter/component/registry_test.go | 110 ------------------ 2 files changed, 94 insertions(+), 110 deletions(-) delete mode 100644 pkg/plugin/adapter/component/registry_test.go diff --git a/pkg/plugin/adapter/component/calls_test.go b/pkg/plugin/adapter/component/calls_test.go index ac8601b394d..dc0db2f681d 100644 --- a/pkg/plugin/adapter/component/calls_test.go +++ b/pkg/plugin/adapter/component/calls_test.go @@ -21,6 +21,25 @@ import ( pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" ) +func fixtureActivations(t *testing.T) []*extension.Activation { + t.Helper() + directory := t.TempDir() + require.NoError(t, os.WriteFile(filepath.Join(directory, "schema.json"), []byte(`{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"number"}}}`), 0o600)) + executable, err := os.Executable() + require.NoError(t, err) + expected := &pluginv1.DescribeResponse{PluginName: "fixture/components", PluginVersion: "0.1.0", ManifestDigest: "sha256:fixture"} + var result []*extension.Activation + for _, capability := range []string{extension.ComponentDiscovery, extension.ComponentValidation, extension.ComponentPreparation, extension.ComponentState} { + expected.Services = append(expected.Services, &pluginv1.ServiceVersionRange{Service: capability, Min: 1, Max: 1}) + expected.Exports = append(expected.Exports, &pluginv1.Export{Service: capability, Kind: "fixture/hcl"}) + result = append(result, &extension.Activation{Binding: extension.Binding{Capability: capability, Name: "fixture/hcl", Directory: directory, Metadata: map[string]any{"component_type": "terraform", "schema": "schema.json"}}, Package: expected.PluginName, Executable: executable, Description: expected}) + } + raw, err := proto.Marshal(expected) + require.NoError(t, err) + require.NoError(t, os.WriteFile(filepath.Join(directory, "description.pb"), raw, 0o600)) + return result +} + func fixtureProvider(t *testing.T) *Provider { t.Helper() registry, err := NewRegistry(fixtureActivations(t)) @@ -277,3 +296,78 @@ func TestPreparationRejectsUnsafeArtifactsAndMissingStateIdentity(t *testing.T) require.ErrorIs(t, checkPreparation(nil), errUtils.ErrPluginProtocol) require.ErrorIs(t, checkPreparation(&pluginv1.PrepareComponentResponse{Diagnostics: []*pluginv1.Diagnostic{{Message: "failure"}}}), errUtils.ErrPluginInvalidConfig) } + +func TestRegistryGroupsCapabilitiesWithoutReplacingEngines(t *testing.T) { + t.Parallel() + activations := fixtureActivations(t) + registry, err := NewRegistry(activations) + require.NoError(t, err) + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + provider, ok := registry.Get("fixture/hcl") + require.True(t, ok) + require.Equal(t, "terraform", provider.ComponentType()) + require.True(t, provider.Supports(extension.ComponentState)) + require.False(t, provider.Supports("component.execution")) + _, ok = registry.Get("terraform") + require.False(t, ok, "provider names do not occupy the engine namespace") + activations[0].Description.PluginName = "changed" + activations[0].Metadata["component_type"] = "changed" + require.Equal(t, "fixture/components", provider.expected.PluginName) + require.Equal(t, "terraform", provider.ComponentType()) + names := registry.Names() + names[0] = "changed" + require.Equal(t, []string{"fixture/hcl"}, registry.Names()) + _, ok = (*Registry)(nil).Get("anything") + require.False(t, ok) + require.Nil(t, (*Registry)(nil).Names()) +} + +func TestRegistryRejectsPartialAndConflictingBatches(t *testing.T) { + t.Parallel() + for name, modify := range map[string]func(*extension.Activation){ + "owner": func(a *extension.Activation) { a.Package = "other/package" }, + "family": func(a *extension.Activation) { a.Metadata["component_type"] = "other" }, + "executable": func(a *extension.Activation) { a.Executable = "other" }, + "timeout": func(a *extension.Activation) { a.Timeout = time.Second }, + "duplicate": func(a *extension.Activation) { a.Capability = extension.ComponentDiscovery }, + "bad schema": func(a *extension.Activation) { a.Metadata["schema"] = "missing.json" }, + "bad type": func(a *extension.Activation) { a.Metadata["component_type"] = "" }, + "unknown key": func(a *extension.Activation) { a.Metadata["typo"] = true }, + "unknown capability": func(a *extension.Activation) { a.Capability = "unknown" }, + "missing handshake": func(a *extension.Activation) { a.Description = nil }, + } { + t.Run(name, func(t *testing.T) { + t.Parallel() + items := fixtureActivations(t) + modify(items[1]) + registry, err := NewRegistry(items) + require.Error(t, err) + require.Nil(t, registry, "no partial batch may become visible") + }) + } + _, err := NewRegistry([]*extension.Activation{nil}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + empty, err := NewRegistry(nil) + require.NoError(t, err) + require.Empty(t, empty.Names()) +} + +func TestUnsupportedAndInvalidCallsDoNotStartExecutable(t *testing.T) { + t.Parallel() + items := fixtureActivations(t)[:1] + items[0].Executable = filepath.Join(t.TempDir(), "does-not-exist") + registry, err := NewRegistry(items) + require.NoError(t, err) + p, _ := registry.Get("fixture/hcl") + request := &pluginv1.ComponentRequest{RootDirectory: t.TempDir(), Address: fixtureAddress()} + _, err = p.ResolveState(t.Context(), request) + require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) + _, err = p.Validate(t.Context(), nil) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + _, err = p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: "relative"}) + require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) + ctx, cancel := context.WithCancel(t.Context()) + cancel() + _, err = p.Discover(ctx, &pluginv1.DiscoverComponentsRequest{RootDirectory: request.RootDirectory}) + require.ErrorIs(t, err, context.Canceled) +} diff --git a/pkg/plugin/adapter/component/registry_test.go b/pkg/plugin/adapter/component/registry_test.go deleted file mode 100644 index 50d3ba41bab..00000000000 --- a/pkg/plugin/adapter/component/registry_test.go +++ /dev/null @@ -1,110 +0,0 @@ -package component - -import ( - "context" - "os" - "path/filepath" - "testing" - "time" - - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - - errUtils "github.com/cloudposse/atmos/errors" - "github.com/cloudposse/atmos/pkg/plugin/extension" - pluginv1 "github.com/cloudposse/atmos/pkg/plugin/proto/atmos/plugin/v1" -) - -func fixtureActivations(t *testing.T) []*extension.Activation { - t.Helper() - directory := t.TempDir() - require.NoError(t, os.WriteFile(filepath.Join(directory, "schema.json"), []byte(`{"type":"object","additionalProperties":false,"properties":{"limit":{"type":"number"}}}`), 0o600)) - executable, err := os.Executable() - require.NoError(t, err) - expected := &pluginv1.DescribeResponse{PluginName: "fixture/components", PluginVersion: "0.1.0", ManifestDigest: "sha256:fixture"} - var result []*extension.Activation - for _, capability := range []string{extension.ComponentDiscovery, extension.ComponentValidation, extension.ComponentPreparation, extension.ComponentState} { - expected.Services = append(expected.Services, &pluginv1.ServiceVersionRange{Service: capability, Min: 1, Max: 1}) - expected.Exports = append(expected.Exports, &pluginv1.Export{Service: capability, Kind: "fixture/hcl"}) - result = append(result, &extension.Activation{Binding: extension.Binding{Capability: capability, Name: "fixture/hcl", Directory: directory, Metadata: map[string]any{"component_type": "terraform", "schema": "schema.json"}}, Package: expected.PluginName, Executable: executable, Description: expected}) - } - raw, err := proto.Marshal(expected) - require.NoError(t, err) - require.NoError(t, os.WriteFile(filepath.Join(directory, "description.pb"), raw, 0o600)) - return result -} - -func TestRegistryGroupsCapabilitiesWithoutReplacingEngines(t *testing.T) { - t.Parallel() - activations := fixtureActivations(t) - registry, err := NewRegistry(activations) - require.NoError(t, err) - require.Equal(t, []string{"fixture/hcl"}, registry.Names()) - provider, ok := registry.Get("fixture/hcl") - require.True(t, ok) - require.Equal(t, "terraform", provider.ComponentType()) - require.True(t, provider.Supports(extension.ComponentState)) - require.False(t, provider.Supports("component.execution")) - _, ok = registry.Get("terraform") - require.False(t, ok, "provider names do not occupy the engine namespace") - activations[0].Description.PluginName = "changed" - activations[0].Metadata["component_type"] = "changed" - require.Equal(t, "fixture/components", provider.expected.PluginName) - require.Equal(t, "terraform", provider.ComponentType()) - names := registry.Names() - names[0] = "changed" - require.Equal(t, []string{"fixture/hcl"}, registry.Names()) - _, ok = (*Registry)(nil).Get("anything") - require.False(t, ok) - require.Nil(t, (*Registry)(nil).Names()) -} - -func TestRegistryRejectsPartialAndConflictingBatches(t *testing.T) { - t.Parallel() - for name, modify := range map[string]func(*extension.Activation){ - "owner": func(a *extension.Activation) { a.Package = "other/package" }, - "family": func(a *extension.Activation) { a.Metadata["component_type"] = "other" }, - "executable": func(a *extension.Activation) { a.Executable = "other" }, - "timeout": func(a *extension.Activation) { a.Timeout = time.Second }, - "duplicate": func(a *extension.Activation) { a.Capability = extension.ComponentDiscovery }, - "bad schema": func(a *extension.Activation) { a.Metadata["schema"] = "missing.json" }, - "bad type": func(a *extension.Activation) { a.Metadata["component_type"] = "" }, - "unknown key": func(a *extension.Activation) { a.Metadata["typo"] = true }, - "unknown capability": func(a *extension.Activation) { a.Capability = "unknown" }, - "missing handshake": func(a *extension.Activation) { a.Description = nil }, - } { - t.Run(name, func(t *testing.T) { - t.Parallel() - items := fixtureActivations(t) - modify(items[1]) - registry, err := NewRegistry(items) - require.Error(t, err) - require.Nil(t, registry, "no partial batch may become visible") - }) - } - _, err := NewRegistry([]*extension.Activation{nil}) - require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) - empty, err := NewRegistry(nil) - require.NoError(t, err) - require.Empty(t, empty.Names()) -} - -func TestUnsupportedAndInvalidCallsDoNotStartExecutable(t *testing.T) { - t.Parallel() - items := fixtureActivations(t)[:1] - items[0].Executable = filepath.Join(t.TempDir(), "does-not-exist") - registry, err := NewRegistry(items) - require.NoError(t, err) - p, _ := registry.Get("fixture/hcl") - request := &pluginv1.ComponentRequest{RootDirectory: t.TempDir(), Address: fixtureAddress()} - _, err = p.ResolveState(t.Context(), request) - require.ErrorIs(t, err, errUtils.ErrPluginUnsupportedExtension) - _, err = p.Validate(t.Context(), nil) - require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) - _, err = p.Discover(t.Context(), &pluginv1.DiscoverComponentsRequest{RootDirectory: "relative"}) - require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig) - ctx, cancel := context.WithCancel(t.Context()) - cancel() - _, err = p.Discover(ctx, &pluginv1.DiscoverComponentsRequest{RootDirectory: request.RootDirectory}) - require.ErrorIs(t, err, context.Canceled) -} From 8853787dcff9b9f5fd853b09af5df0dd5ec593db Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Fri, 13 Nov 2026 22:00:42 -0600 Subject: [PATCH 43/52] fix(terragrunt): preserve native unit overlays and download settings --- pkg/plugin/adapter/configuration/session.go | 3 ++ .../adapter/configuration/session_test.go | 13 +++++ plugins/terragrunt/bridge/overlay.go | 53 +++++++++++++++++++ .../terragrunt/internal/engine/policies.go | 3 ++ plugins/terragrunt/internal/engine/resolve.go | 11 +++- .../internal/engine/resolve_test.go | 36 ++++++++++++- plugins/terragrunt/internal/model/model.go | 1 + .../internal/provider/fixtures_test.go | 4 +- .../internal/provider/preparation.go | 11 +++- 9 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 plugins/terragrunt/bridge/overlay.go diff --git a/pkg/plugin/adapter/configuration/session.go b/pkg/plugin/adapter/configuration/session.go index 45094bbdadb..001c9f1c9e9 100644 --- a/pkg/plugin/adapter/configuration/session.go +++ b/pkg/plugin/adapter/configuration/session.go @@ -154,6 +154,9 @@ func discoveryRequest(config *schema.AtmosConfiguration, settings *schema.Compon return nil, err } env := environment() + for key, value := range config.Env { + env[key] = value + } env["ATMOS_TERRAFORM_BINARY"] = config.Components.Terraform.Command return &pluginv1.DiscoverComponentsRequest{Provider: name, RootDirectory: root, IncludePaths: slices.Clone(settings.Discovery.IncludedPaths), ExcludePaths: slices.Clone(settings.Discovery.ExcludedPaths), ProviderConfiguration: value, Operation: &pluginv1.ComponentOperation{Command: command, Mode: "native"}, Invocation: &pluginv1.Invocation{Environment: env}}, nil } diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index 5ff8fd55a4f..0347265dc9e 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -450,3 +450,16 @@ func TestPreparationRejectsDependencyStateDrift(t *testing.T) { }) } } + +func TestDiscoveryConfiguredEnvironment(t *testing.T) { + config := enabledConfig(t) + config.Env = map[string]string{"DISCOVERY_SETTING": "configured"} + t.Setenv("DISCOVERY_SETTING", "ambient-value") + t.Setenv("DISCOVERY_AMBIENT", "ambient") + settings := config.Components.Terraform.ConfigurationProviders["terragrunt"] + request, err := discoveryRequest(config, &settings, "terragrunt", config.BasePathAbsolute, "plan") + require.NoError(t, err) + require.Equal(t, "configured", request.Invocation.Environment["DISCOVERY_SETTING"]) + require.Equal(t, "ambient", request.Invocation.Environment["DISCOVERY_AMBIENT"]) + require.Equal(t, "tofu", request.Invocation.Environment["ATMOS_TERRAFORM_BINARY"]) +} diff --git a/plugins/terragrunt/bridge/overlay.go b/plugins/terragrunt/bridge/overlay.go new file mode 100644 index 00000000000..070a0bf9187 --- /dev/null +++ b/plugins/terragrunt/bridge/overlay.go @@ -0,0 +1,53 @@ +package atmosbridge + +import ( + "os" + "path/filepath" + + "github.com/gruntwork-io/terragrunt/internal/util" + "github.com/gruntwork-io/terragrunt/pkg/config" + "github.com/gruntwork-io/terragrunt/pkg/log" + "github.com/spf13/afero" +) + +// UnitOverlay applies upstream default copy rules without writing to the unit or module. +func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.TerraformConfig) (map[string][]byte, error) { + memory := afero.NewMemMapFs() + fsys := afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(env.FS), memory) + destination := filepath.Join(filepath.Dir(unit), ".atmos-unit-overlay") + include := []string{".tflint.hcl"} + var exclude []string + if terraform.IncludeInCopy != nil { + include = append(include, (*terraform.IncludeInCopy)...) + } + if terraform.ExcludeFromCopy != nil { + exclude = append(exclude, (*terraform.ExcludeFromCopy)...) + } + if err := util.CopyFolderContents(logger, fsys, unit, destination, ".terragrunt-module-manifest", + util.WithIncludeInCopy(include...), util.WithExcludeFromCopy(exclude...)); err != nil { + return nil, err + } + files := map[string][]byte{} + err := afero.Walk(memory, destination, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + name, err := filepath.Rel(destination, path) + if err != nil { + return err + } + if name == ".terragrunt-module-manifest" { + return nil + } + content, err := afero.ReadFile(memory, path) + if err != nil { + return err + } + files[filepath.ToSlash(name)] = content + return nil + }) + return files, err +} diff --git a/plugins/terragrunt/internal/engine/policies.go b/plugins/terragrunt/internal/engine/policies.go index ed72fd9c1e7..7a791a77b9c 100644 --- a/plugins/terragrunt/internal/engine/policies.go +++ b/plugins/terragrunt/internal/engine/policies.go @@ -82,6 +82,9 @@ func checkUnitPolicies(ctx context.Context, request model.Request, cfg *config.T return err } } + if cfg.RemoteState != nil && len(cfg.RemoteState.Encryption) > 0 { + return fmt.Errorf("native adaptation of remote_state.encryption is not implemented") + } if cfg.TerraformBinary != "" { return fmt.Errorf("native adaptation of terraform_binary is not implemented") } diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index 064bcf801e0..c3a11dd6851 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -66,6 +66,12 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* if err := resolveBackend(result, cfg); err != nil { return nil, err } + if request.Phase != "backend" { + result.Overlay, err = atmosbridge.UnitOverlay(logger, environment, filepath.Dir(path), cfg.Terraform) + if err != nil { + return nil, err + } + } if err := convertGeneration(result, cfg); err != nil { return nil, err } @@ -154,6 +160,9 @@ func parsingContext(request model.Request, path string) *config.ParsingContext { pctx.OriginalTerraformCommand = command pctx.TerraformCliArgs.SetCommand(command).AppendArgument(request.Arguments...) pctx.DownloadDir = filepath.Join(filepath.Dir(path), ".terragrunt-cache") + if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { + pctx.DownloadDir = localPath(filepath.Dir(path), configured) + } pctx.AutoInit = true pctx.MaxFoldersToCheck = options.DefaultMaxFoldersToCheck return pctx @@ -179,7 +188,7 @@ func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *conf return nil, fmt.Errorf("native adapter source must be an existing local directory: %s", result.Source) } download := pctx.DownloadDir - if cfg.DownloadDir != "" { + if cfg.DownloadDir != "" && request.Environment["TG_DOWNLOAD_DIR"] == "" { download = localPath(filepath.Dir(path), cfg.DownloadDir) } if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 8d18aabc840..c5e95c43f22 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "os" "path/filepath" + "strings" "testing" "github.com/stretchr/testify/require" @@ -135,7 +136,7 @@ func TestVersionConstraintsUseSelectedExecutable(t *testing.T) { func TestResolveGuardsAndDownloadDirectory(t *testing.T) { request := nativeUnit(t, `download_dir = "custom-cache" -inputs = { value = "constant" } +inputs = { value = "constant", working = get_working_dir() } generate "disabled" { path = "not-valid" disable = true @@ -151,6 +152,7 @@ generate "disabled" { result, err = Resolve(t.Context(), request) require.NoError(t, err) require.Contains(t, result.WorkingDir, "environment-cache") + require.Equal(t, result.WorkingDir, result.Inputs["working"]) request.LogLevel = "not-a-level" _, err = Resolve(t.Context(), request) require.Error(t, err) @@ -169,3 +171,35 @@ generate "disabled" { require.Error(t, err) } } + +func TestResolvePreservesUnitOverlay(t *testing.T) { + request := nativeUnit(t, "") + directory := filepath.Dir(request.Path) + require.NoError(t, os.WriteFile(filepath.Join(directory, "override.tf"), []byte("# overlay"), 0o644)) + require.NoError(t, os.WriteFile(filepath.Join(directory, ".hidden"), []byte("ignored"), 0o644)) + require.NoError(t, os.WriteFile(filepath.Join(directory, ".tflint.hcl"), []byte("# lint"), 0o644)) + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, []byte("# overlay"), result.Overlay["override.tf"]) + require.Equal(t, []byte("# lint"), result.Overlay[".tflint.hcl"]) + require.NotContains(t, result.Overlay, ".hidden") + data, err := os.ReadFile(request.Path) + require.NoError(t, err) + configuration := strings.Replace(string(data), "terraform { source =", "terraform {\n include_in_copy = [\".hidden\"]\n exclude_from_copy = [\"override.tf\"]\n source =", 1) + configuration = strings.Replace(configuration, " }", "\n}", 1) + require.NoError(t, os.WriteFile(request.Path, []byte(configuration), 0o644)) + result, err = Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, []byte("ignored"), result.Overlay[".hidden"]) + require.NotContains(t, result.Overlay, "override.tf") +} + +func TestRejectRemoteStateEncryption(t *testing.T) { + request := nativeUnit(t, `remote_state { + backend = "local" + config = { path = "state.tfstate" } + encryption = { key_provider = "pbkdf2" } +}`) + _, err := Resolve(t.Context(), request) + require.ErrorContains(t, err, "remote_state.encryption") +} diff --git a/plugins/terragrunt/internal/model/model.go b/plugins/terragrunt/internal/model/model.go index adae75d9a9d..9f4115c4e1c 100644 --- a/plugins/terragrunt/internal/model/model.go +++ b/plugins/terragrunt/internal/model/model.go @@ -19,6 +19,7 @@ type Request struct { } type Resolution struct { + Overlay map[string][]byte `json:"overlay,omitempty"` Inventory []DiscoveredUnit `json:"inventory,omitempty"` Path string `json:"path,omitempty"` OutputDependencies []string `json:"output_dependencies,omitempty"` diff --git a/plugins/terragrunt/internal/provider/fixtures_test.go b/plugins/terragrunt/internal/provider/fixtures_test.go index e76cdaa2e64..3ee00597dde 100644 --- a/plugins/terragrunt/internal/provider/fixtures_test.go +++ b/plugins/terragrunt/internal/provider/fixtures_test.go @@ -109,6 +109,8 @@ func TestExplicitStackStateAndPreparation(t *testing.T) { require.NoError(t, decode(prepared.State.Backend, &after)) require.Equal(t, before, after) require.Equal(t, filepath.Join(root, "state/dev/network.tfstate"), after["path"]) - require.Empty(t, prepared.Files) + require.Len(t, prepared.Files, 2) + require.Equal(t, "terragrunt.hcl", prepared.Files[0].Path) + require.Equal(t, "terragrunt.values.hcl", prepared.Files[1].Path) require.NotNil(t, prepared.Inputs) } diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go index 32b146d0964..9db30b35494 100644 --- a/plugins/terragrunt/internal/provider/preparation.go +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -143,8 +143,15 @@ func preparedResponse(req model.Request, result *model.Resolution) (*pluginv1.Pr return nil, err } response := &pluginv1.PrepareComponentResponse{Engine: engineName(req.Tofu), ModuleSource: result.Source, WorkingDirectory: result.WorkingDir, Inputs: inputs, State: state, Sources: watched} - for _, name := range slices.Sorted(maps.Keys(result.Generated)) { - response.Files = append(response.Files, &pluginv1.ComponentGeneratedFile{Path: name, Content: []byte(result.Generated[name]), IfExists: "overwrite"}) + files := maps.Clone(result.Overlay) + if files == nil { + files = map[string][]byte{} + } + for name, content := range result.Generated { + files[name] = []byte(content) + } + for _, name := range slices.Sorted(maps.Keys(files)) { + response.Files = append(response.Files, &pluginv1.ComponentGeneratedFile{Path: name, Content: files[name], IfExists: "overwrite"}) } return response, nil } From f31f1d37fe49a42bf2364e79a276dde4ad09d804 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 14 Nov 2026 07:49:54 -0600 Subject: [PATCH 44/52] fix(terragrunt): keep download_dir for backend reads and reject overlay files the contract cannot carry - Backend resolution now resolves download_dir (with dependency outputs replaced by an unknown placeholder) so relative local state paths match full preparation. - Version rejections wrap the engine.ErrVersionRejected sentinel. - Extract checkUnsupportedSettings to keep checkUnitPolicies under the complexity limit. - Reject committed .terraform.lock.hcl and executable unit files in the overlay with atmosbridge.ErrUnsupportedOverlay instead of failing at the host or dropping the execute bit. Co-Authored-By: Claude Sonnet 5.5 --- plugins/terragrunt/README.md | 2 +- plugins/terragrunt/bridge/overlay.go | 25 ++++++ .../internal/engine/environment_test.go | 6 +- .../terragrunt/internal/engine/policies.go | 13 ++- plugins/terragrunt/internal/engine/resolve.go | 27 ++++++- .../internal/engine/resolve_test.go | 80 +++++++++++++++++++ 6 files changed, 149 insertions(+), 4 deletions(-) diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md index f0c77685df0..c6106b2af65 100644 --- a/plugins/terragrunt/README.md +++ b/plugins/terragrunt/README.md @@ -38,7 +38,7 @@ plugins: path: /absolute/path/to/this/plugins/terragrunt ``` -Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. +Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. Unit files travel as content only, so a unit directory that contains a committed `.terraform.lock.hcl` or an executable file is rejected until the file is listed in `exclude_from_copy`. Preparation receives Atmos's sanitized environment after authentication, the selected executable, toolchain PATH, and managed Terraform RC configuration. Child commands use the invocation PATH. Neither identity changes nor HCL evaluation replace the plugin process environment. diff --git a/plugins/terragrunt/bridge/overlay.go b/plugins/terragrunt/bridge/overlay.go index 070a0bf9187..0e48a57657a 100644 --- a/plugins/terragrunt/bridge/overlay.go +++ b/plugins/terragrunt/bridge/overlay.go @@ -1,6 +1,8 @@ package atmosbridge import ( + "errors" + "fmt" "os" "path/filepath" @@ -10,6 +12,10 @@ import ( "github.com/spf13/afero" ) +// ErrUnsupportedOverlay reports a unit file that the Atmos preparation contract +// cannot carry faithfully. +var ErrUnsupportedOverlay = errors.New("unit file cannot be exported through the overlay") + // UnitOverlay applies upstream default copy rules without writing to the unit or module. func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.TerraformConfig) (map[string][]byte, error) { memory := afero.NewMemMapFs() @@ -42,6 +48,9 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te if name == ".terragrunt-module-manifest" { return nil } + if err := checkOverlayFile(name, info); err != nil { + return err + } content, err := afero.ReadFile(memory, path) if err != nil { return err @@ -51,3 +60,19 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te }) return files, err } + +// checkOverlayFile rejects files whose meaning is lost by the contract. The +// contract carries content only: a committed provider lock file belongs to +// Atmos' per-instance lock management and the host refuses it as a runtime +// artifact, and file modes are not carried, so an executable would be written +// without its execute permission. Failing here reports the unit file by name +// instead of failing later or changing behavior silently. +func checkOverlayFile(name string, info os.FileInfo) error { + if filepath.Base(name) == util.TerraformLockFile { + return fmt.Errorf("%w: %s is a dependency lock file, which Atmos manages per component instance; list it in exclude_from_copy to proceed without the committed pins", ErrUnsupportedOverlay, filepath.ToSlash(name)) + } + if info.Mode()&0o111 != 0 { + return fmt.Errorf("%w: %s is executable, and file modes are not preserved; list it in exclude_from_copy if only parse-time functions use it", ErrUnsupportedOverlay, filepath.ToSlash(name)) + } + return nil +} diff --git a/plugins/terragrunt/internal/engine/environment_test.go b/plugins/terragrunt/internal/engine/environment_test.go index cd939c8c704..9e6456ce545 100644 --- a/plugins/terragrunt/internal/engine/environment_test.go +++ b/plugins/terragrunt/internal/engine/environment_test.go @@ -44,7 +44,11 @@ func TestEvaluatorUsesScopedEnvironmentForFunctionsAndCommands(t *testing.T) { require.NoError(t, os.WriteFile(filepath.Join(root, name), content, 0o755)) sourceJSON, err := json.Marshal(filepath.ToSlash(module)) require.NoError(t, err) - config := `terraform { source = ` + string(sourceJSON) + ` } + // Executables are parse-time helpers here; the overlay contract cannot carry their mode. + config := `terraform { + source = ` + string(sourceJSON) + ` + exclude_from_copy = ["bin", "` + name + `"] +} inputs = { direct = get_env("CUSTOM_VALUE") child = jsondecode(run_cmd("` + name + `")) diff --git a/plugins/terragrunt/internal/engine/policies.go b/plugins/terragrunt/internal/engine/policies.go index 7a791a77b9c..539ca06be22 100644 --- a/plugins/terragrunt/internal/engine/policies.go +++ b/plugins/terragrunt/internal/engine/policies.go @@ -3,6 +3,7 @@ package engine import ( "context" "encoding/json" + "errors" "fmt" "os/exec" "path/filepath" @@ -14,6 +15,10 @@ import ( "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" ) +// ErrVersionRejected reports a terraform or terragrunt version that violates a +// declared version constraint. +var ErrVersionRejected = errors.New("version constraint rejected") + func localPath(base, path string) string { if filepath.IsAbs(path) { return filepath.Clean(path) @@ -42,7 +47,7 @@ func checkVersions(ctx context.Context, request model.Request, terraform, terrag return err } if !rules.Check(v) { - return fmt.Errorf("%s %q rejects version %s", name, constraint, actual) + return fmt.Errorf("%w: %s %q rejects version %s", ErrVersionRejected, name, constraint, actual) } return nil } @@ -94,6 +99,12 @@ func checkUnitPolicies(ctx context.Context, request model.Request, cfg *config.T if cfg.PreventDestroy != nil && *cfg.PreventDestroy { return fmt.Errorf("native adaptation of prevent_destroy is not implemented") } + return checkUnsupportedSettings(cfg) +} + +// checkUnsupportedSettings rejects error handling, exclusion, feature flag and +// IAM settings, which have no native equivalent. +func checkUnsupportedSettings(cfg *config.TerragruntConfig) error { if cfg.Errors != nil || cfg.Exclude != nil || len(cfg.FeatureFlags) > 0 || cfg.IamRole != "" || cfg.IamWebIdentityToken != "" { return fmt.Errorf("native adaptation of errors, exclude, feature flags, or IAM settings is not implemented") } diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index c3a11dd6851..3316e2e4db1 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -15,6 +15,7 @@ import ( "github.com/gruntwork-io/terragrunt/pkg/log/format" "github.com/gruntwork-io/terragrunt/pkg/options" "github.com/spf13/afero" + "github.com/zclconf/go-cty/cty" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" ) @@ -170,11 +171,35 @@ func parsingContext(request model.Request, path string) *config.ParsingContext { func parseUnit(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, path string) (*config.TerragruntConfig, error) { if request.Phase == "backend" { - return config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) + cfg, err := config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) + if err != nil { + return nil, err + } + return withDownloadDir(ctx, logger, environment, pctx, request, cfg, path) } return config.ParseConfigFile(ctx, logger, environment, pctx, path, nil) } +// withDownloadDir restores download_dir on a partially parsed unit. Partial +// decoding has no section for that attribute, but the working directory (and so +// every relative local-state path) depends on it. The extra parse skips +// dependency output resolution (an unknown placeholder replaces every +// dependency), so backend reads still never read outputs. +func withDownloadDir(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*config.TerragruntConfig, error) { + if request.Environment["TG_DOWNLOAD_DIR"] != "" { + return cfg, nil + } + placeholder := cty.DynamicVal + probe := pctx.WithSkipOutputsResolution() + probe.DecodedDependencies = &placeholder + full, err := config.ParseConfigFile(ctx, logger, environment, probe, path, nil) + if err != nil { + return nil, err + } + cfg.DownloadDir = full.DownloadDir + return cfg, nil +} + // unitResolution converts the parsed unit into its local module identity. func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*model.Resolution, error) { result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)} diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index c5e95c43f22..9947051b001 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -4,9 +4,11 @@ import ( "encoding/json" "os" "path/filepath" + "runtime" "strings" "testing" + "github.com/gruntwork-io/terragrunt/pkg/atmosbridge" "github.com/stretchr/testify/require" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" @@ -130,6 +132,9 @@ func TestVersionConstraintsUseSelectedExecutable(t *testing.T) { } else { require.ErrorContains(t, err, test.want) } + if test.want == "rejects version" { + require.ErrorIs(t, err, ErrVersionRejected) + } }) } } @@ -203,3 +208,78 @@ func TestRejectRemoteStateEncryption(t *testing.T) { _, err := Resolve(t.Context(), request) require.ErrorContains(t, err, "remote_state.encryption") } + +func TestBackendResolutionHonorsConfiguredDownloadDirectory(t *testing.T) { + request := nativeUnit(t, `download_dir = "custom-cache" +remote_state { + backend = "local" + config = { path = "state.tfstate" } +} +`) + full, err := Resolve(t.Context(), request) + require.NoError(t, err) + request.Phase = "backend" + backend, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, backend.WorkingDir, "custom-cache") + require.Equal(t, full.WorkingDir, backend.WorkingDir) + require.Equal(t, full.Backend["path"], backend.Backend["path"]) +} + +func TestBackendDownloadDirectoryNeverReadsDependencyOutputs(t *testing.T) { + request := nativeUnit(t, `download_dir = "custom-cache" +dependency "other" { + config_path = "other" +} +inputs = { value = dependency.other.outputs.value } +remote_state { + backend = "local" + config = { path = "state.tfstate" } +} +`) + other := filepath.Join(filepath.Dir(request.Path), "other") + require.NoError(t, os.MkdirAll(other, 0o755)) + require.NoError(t, os.WriteFile(filepath.Join(other, "terragrunt.hcl"), []byte("inputs = {}\n"), 0o644)) + request.Phase = "backend" + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, result.WorkingDir, "custom-cache") +} + +func TestOverlayRejectsFilesTheHostContractCannotCarry(t *testing.T) { + t.Run("committed dependency lock file", func(t *testing.T) { + request := nativeUnit(t, "") + require.NoError(t, os.WriteFile(filepath.Join(filepath.Dir(request.Path), ".terraform.lock.hcl"), []byte("# lock"), 0o644)) + _, err := Resolve(t.Context(), request) + require.ErrorIs(t, err, atmosbridge.ErrUnsupportedOverlay) + require.ErrorContains(t, err, ".terraform.lock.hcl") + request.Phase = "backend" + _, err = Resolve(t.Context(), request) + require.NoError(t, err, "backend reads never export the overlay") + request.Phase = "" + data, err := os.ReadFile(request.Path) + require.NoError(t, err) + excluded := strings.Replace(string(data), "terraform { source =", "terraform {\n exclude_from_copy = [\".terraform.lock.hcl\"]\n source =", 1) + excluded = strings.Replace(excluded, " }", "\n}", 1) + require.NoError(t, os.WriteFile(request.Path, []byte(excluded), 0o644)) + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.NotContains(t, result.Overlay, ".terraform.lock.hcl") + }) + t.Run("executable file", func(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Windows has no executable permission bit.") + } + request := nativeUnit(t, "") + script := filepath.Join(filepath.Dir(request.Path), "probe.sh") + require.NoError(t, os.WriteFile(script, []byte("#!/bin/sh\n"), 0o755)) + require.NoError(t, os.Chmod(script, 0o755)) + _, err := Resolve(t.Context(), request) + require.ErrorIs(t, err, atmosbridge.ErrUnsupportedOverlay) + require.ErrorContains(t, err, "probe.sh") + require.NoError(t, os.Chmod(script, 0o644)) + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, result.Overlay, "probe.sh") + }) +} From 1db0b51f4b94540eb461f5250f70352baa242e3d Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 14 Nov 2026 08:37:19 -0600 Subject: [PATCH 45/52] feat(plugin): carry file modes through the component contract Add an optional mode field to ComponentGeneratedFile (additive; zero keeps the 0644 default) and thread it through schema and the adapter. The host clamps requested modes: setuid, setgid, sticky, and group/other write bits are stripped, sensitive files stay private, and Windows ignores modes. The Terragrunt plugin exports unit overlay file modes, so executable helpers keep their execute bit instead of being rejected. Co-Authored-By: Claude Sonnet 5.5 --- pkg/component/configuration/files.go | 58 +++++++++++++++---- pkg/component/configuration/files_test.go | 48 +++++++++++++++ .../adapter/configuration/preparation.go | 2 +- .../adapter/configuration/session_test.go | 18 ++++++ pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go | 20 +++++-- pkg/schema/component_configuration.go | 3 + plugins/terragrunt/README.md | 2 +- plugins/terragrunt/bridge/overlay.go | 28 ++++----- .../internal/engine/environment_test.go | 6 +- plugins/terragrunt/internal/engine/resolve.go | 2 +- .../internal/engine/resolve_test.go | 15 ++--- plugins/terragrunt/internal/model/model.go | 1 + .../internal/provider/preparation.go | 7 ++- .../internal/provider/provider_test.go | 21 +++++++ proto/atmos/plugin/v1/plugin.proto | 4 ++ sdk/proto/atmos/plugin/v1/plugin.pb.go | 20 +++++-- 16 files changed, 205 insertions(+), 50 deletions(-) diff --git a/pkg/component/configuration/files.go b/pkg/component/configuration/files.go index 7c01f7b97f1..3bcdd1a53c5 100644 --- a/pkg/component/configuration/files.go +++ b/pkg/component/configuration/files.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" errUtils "github.com/cloudposse/atmos/errors" atmosio "github.com/cloudposse/atmos/pkg/io" @@ -16,6 +17,11 @@ const ( fileMode = 0o644 secretMode = 0o600 directoryMode = 0o755 + // Requests carry at most the permission, setuid, setgid, and sticky bits. + maxRequestedMode = 0o7777 + // Granted modes keep owner rwx and group/other read-execute bits only. + grantedModeMask = 0o755 + ownerReadWrite = 0o600 ) // WriteFiles materializes evaluated bytes under the provisioned module, without templating. @@ -31,11 +37,8 @@ func WriteFiles(directory string, files []schema.ComponentConfigurationFile) err } defer root.Close() for _, file := range files { - if !filepath.IsLocal(file.Path) { - return errUtils.ErrPluginProtocol - } - if file.IfExists != "error" && file.IfExists != "skip" && file.IfExists != "overwrite" { - return errUtils.ErrPluginUnsupportedExtension + if err := validateFile(file); err != nil { + return err } } for _, file := range files { @@ -46,10 +49,19 @@ func WriteFiles(directory string, files []schema.ComponentConfigurationFile) err return nil } +func validateFile(file schema.ComponentConfigurationFile) error { + if !filepath.IsLocal(file.Path) || file.Mode > maxRequestedMode { + return errUtils.ErrPluginProtocol + } + if file.IfExists != "error" && file.IfExists != "skip" && file.IfExists != "overwrite" { + return errUtils.ErrPluginUnsupportedExtension + } + return nil +} + func writeFile(root *os.Root, file schema.ComponentConfigurationFile) error { - mode := os.FileMode(fileMode) + mode := writtenMode(file) if file.Sensitive { - mode = secretMode atmosio.RegisterSecretValue(string(file.Content)) } if err := root.MkdirAll(filepath.Dir(file.Path), directoryMode); err != nil { @@ -66,16 +78,38 @@ func writeFile(root *os.Root, file schema.ComponentConfigurationFile) error { if err != nil { return fmt.Errorf("%w: generated file %s: %w", errUtils.ErrPluginInvalidConfig, file.Path, err) } - if file.Sensitive { - if err := output.Chmod(mode); err != nil { - _ = output.Close() - return err - } + // Open applies the process umask and ignores the mode of an existing file, so set it explicitly. + chmodErr := applyMode(output, file, mode) + if chmodErr != nil { + return errors.Join(chmodErr, output.Close()) } _, writeErr := output.Write(file.Content) return errors.Join(writeErr, output.Close()) } +// applyMode sets the permission bits explicitly because open applies the umask +// and leaves an existing file's mode alone. Windows keeps its ACLs. +func applyMode(output *os.File, file schema.ComponentConfigurationFile, mode os.FileMode) error { + if (!file.Sensitive && file.Mode == 0) || runtime.GOOS == "windows" { + return nil + } + return output.Chmod(mode) +} + +// writtenMode returns the clamped permission bits for a generated file. An absent +// mode keeps the historical defaults. A requested mode keeps owner access (rw) +// and the read and execute bits, and drops everything that widens privilege. +// Sensitive files never grant group or other access. +func writtenMode(file schema.ComponentConfigurationFile) os.FileMode { + if file.Sensitive { + return os.FileMode(secretMode | file.Mode&0o100) + } + if file.Mode == 0 { + return fileMode + } + return os.FileMode(file.Mode&grantedModeMask | ownerReadWrite) +} + // WatchPaths resolves provider-owned watches against the project // root without putting checkout-specific absolute paths into stack comparisons. // Existing YAML dependency path semantics remain unchanged. It reports whether diff --git a/pkg/component/configuration/files_test.go b/pkg/component/configuration/files_test.go index 559584c8bff..7652d5c072e 100644 --- a/pkg/component/configuration/files_test.go +++ b/pkg/component/configuration/files_test.go @@ -77,3 +77,51 @@ func TestWatchPaths(t *testing.T) { } } } + +func TestWriteFilesAppliesClampedMode(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Windows ignores POSIX permission bits.") + } + tests := []struct { + name string + mode uint32 + sensitive bool + want os.FileMode + }{ + {name: "absent mode keeps the default", mode: 0, want: 0o644}, + {name: "executable keeps the execute bit", mode: 0o755, want: 0o755}, + {name: "owner-only executable", mode: 0o700, want: 0o700}, + {name: "group and other write are stripped", mode: 0o777, want: 0o755}, + {name: "setuid setgid sticky are stripped", mode: 0o7755, want: 0o755}, + {name: "owner read-write is guaranteed", mode: 0o111, want: 0o711}, + {name: "sensitive stays private", mode: 0o755, sensitive: true, want: 0o700}, + {name: "sensitive without mode", mode: 0, sensitive: true, want: 0o600}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + root := t.TempDir() + file := schema.ComponentConfigurationFile{Path: filepath.Join("bin", "helper.sh"), Content: []byte("#!/bin/sh\n"), IfExists: "overwrite", Mode: tt.mode, Sensitive: tt.sensitive} + require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{file})) + stat, err := os.Stat(filepath.Join(root, file.Path)) + require.NoError(t, err) + require.Equal(t, tt.want, stat.Mode()) + }) + } + t.Run("overwrite updates the mode of an existing file", func(t *testing.T) { + root := t.TempDir() + path := filepath.Join(root, "run.sh") + require.NoError(t, os.WriteFile(path, []byte("old"), 0o644)) + require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{{Path: "run.sh", Content: []byte("new"), IfExists: "overwrite", Mode: 0o755}})) + stat, err := os.Stat(path) + require.NoError(t, err) + require.Equal(t, os.FileMode(0o755), stat.Mode()) + }) +} + +func TestWriteFilesRejectsModesBeyondPermissionBits(t *testing.T) { + root := t.TempDir() + err := WriteFiles(root, []schema.ComponentConfigurationFile{{Path: "a.sh", IfExists: "error", Mode: 1 << 31}}) + require.ErrorIs(t, err, errUtils.ErrPluginProtocol) + _, statErr := os.Stat(filepath.Join(root, "a.sh")) + require.True(t, os.IsNotExist(statErr)) +} diff --git a/pkg/plugin/adapter/configuration/preparation.go b/pkg/plugin/adapter/configuration/preparation.go index b74f38fe3a4..293b0eb8883 100644 --- a/pkg/plugin/adapter/configuration/preparation.go +++ b/pkg/plugin/adapter/configuration/preparation.go @@ -198,7 +198,7 @@ func preparedConfiguration(result *pluginv1.PrepareComponentResponse) (*schema.P if file.IfExists == "overwrite_terragrunt" { return nil, errUtils.ErrPluginUnsupportedExtension } - prepared.Files = append(prepared.Files, schema.ComponentConfigurationFile{Path: file.Path, Content: file.Content, IfExists: file.IfExists, Sensitive: file.Sensitive}) + prepared.Files = append(prepared.Files, schema.ComponentConfigurationFile{Path: file.Path, Content: file.Content, IfExists: file.IfExists, Sensitive: file.Sensitive, Mode: file.Mode}) } return prepared, nil } diff --git a/pkg/plugin/adapter/configuration/session_test.go b/pkg/plugin/adapter/configuration/session_test.go index 0347265dc9e..b79d1455222 100644 --- a/pkg/plugin/adapter/configuration/session_test.go +++ b/pkg/plugin/adapter/configuration/session_test.go @@ -249,6 +249,24 @@ func TestPreparedConfigurationRejectsUnsupportedValues(t *testing.T) { require.ErrorIs(t, err, errUtils.ErrPluginProtocol) } +func TestPreparedConfigurationCarriesFileMode(t *testing.T) { + backend, err := adapter.EncodeObject(map[string]any{}) + require.NoError(t, err) + response := &pluginv1.PrepareComponentResponse{Engine: "terraform", State: &pluginv1.ComponentStateIdentity{BackendType: "local", Backend: backend, WorkingDirectory: t.TempDir(), Workspace: "default"}, Files: []*pluginv1.ComponentGeneratedFile{{Path: "bin/run.sh", Content: []byte("#!/bin/sh\n"), IfExists: "overwrite", Mode: 0o755}, {Path: "main.tf", IfExists: "overwrite"}}} + // The mode must survive wire encoding, and an older plugin that omits it decodes as zero. + data, err := proto.Marshal(response) + require.NoError(t, err) + decoded := &pluginv1.PrepareComponentResponse{} + require.NoError(t, proto.Unmarshal(data, decoded)) + prepared, err := preparedConfiguration(decoded) + require.NoError(t, err) + require.Len(t, prepared.Files, 2) + require.Equal(t, "bin/run.sh", prepared.Files[0].Path) + require.Equal(t, uint32(0o755), prepared.Files[0].Mode) + require.Equal(t, "main.tf", prepared.Files[1].Path) + require.Zero(t, prepared.Files[1].Mode) +} + func TestPreparedConfigurationRetainsSensitiveInputs(t *testing.T) { atmosio.Reset() t.Cleanup(atmosio.Reset) diff --git a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go index 5ec7330748a..b89af5a5ba7 100644 --- a/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go +++ b/pkg/plugin/proto/atmos/plugin/v1/plugin.pb.go @@ -2739,8 +2739,12 @@ type ComponentGeneratedFile struct { Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // The adapter must reject unknown ownership policies, never overwrite by // default. Content is evaluated bytes, not another template language. - IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` - Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` + Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + // Optional POSIX permission bits. Zero means the host default (0644, or 0600 + // for sensitive files). The host keeps only owner/group/other read and + // execute bits plus owner write, and ignores the field on Windows. + Mode uint32 `protobuf:"varint,5,opt,name=mode,proto3" json:"mode,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2803,6 +2807,13 @@ func (x *ComponentGeneratedFile) GetSensitive() bool { return false } +func (x *ComponentGeneratedFile) GetMode() uint32 { + if x != nil { + return x.Mode + } + return 0 +} + type PrepareComponentResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Engine string `protobuf:"bytes,1,opt,name=engine,proto3" json:"engine,omitempty"` @@ -3201,12 +3212,13 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + "\tworkspace\x18\x03 \x01(\tR\tworkspace\x12+\n" + - "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x81\x01\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x95\x01\n" + "\x16ComponentGeneratedFile\x12\x12\n" + "\x04path\x18\x01 \x01(\tR\x04path\x12\x18\n" + "\acontent\x18\x02 \x01(\fR\acontent\x12\x1b\n" + "\tif_exists\x18\x03 \x01(\tR\bifExists\x12\x1c\n" + - "\tsensitive\x18\x04 \x01(\bR\tsensitive\"\x80\x04\n" + + "\tsensitive\x18\x04 \x01(\bR\tsensitive\x12\x12\n" + + "\x04mode\x18\x05 \x01(\rR\x04mode\"\x80\x04\n" + "\x18PrepareComponentResponse\x12\x16\n" + "\x06engine\x18\x01 \x01(\tR\x06engine\x12+\n" + "\x11working_directory\x18\x02 \x01(\tR\x10workingDirectory\x12#\n" + diff --git a/pkg/schema/component_configuration.go b/pkg/schema/component_configuration.go index b09320417bb..088fc090169 100644 --- a/pkg/schema/component_configuration.go +++ b/pkg/schema/component_configuration.go @@ -61,6 +61,9 @@ type ComponentConfigurationFile struct { Content []byte IfExists string Sensitive bool + // Mode carries optional POSIX permission bits. Zero selects the host default. + // The writer clamps it, so a provider cannot request setuid or writable-by-others files. + Mode uint32 } // ConfigurationOwned reports whether a configuration provider owns a component's settings. diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md index c6106b2af65..8fc6162796f 100644 --- a/plugins/terragrunt/README.md +++ b/plugins/terragrunt/README.md @@ -38,7 +38,7 @@ plugins: path: /absolute/path/to/this/plugins/terragrunt ``` -Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. Unit files travel as content only, so a unit directory that contains a committed `.terraform.lock.hcl` or an executable file is rejected until the file is listed in `exclude_from_copy`. +Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. Unit files keep their execute bit, with setuid, setgid, and group or other write bits removed. A unit directory that contains a committed `.terraform.lock.hcl` is rejected until the file is listed in `exclude_from_copy`. Preparation receives Atmos's sanitized environment after authentication, the selected executable, toolchain PATH, and managed Terraform RC configuration. Child commands use the invocation PATH. Neither identity changes nor HCL evaluation replace the plugin process environment. diff --git a/plugins/terragrunt/bridge/overlay.go b/plugins/terragrunt/bridge/overlay.go index 0e48a57657a..8cd3f876f59 100644 --- a/plugins/terragrunt/bridge/overlay.go +++ b/plugins/terragrunt/bridge/overlay.go @@ -17,7 +17,9 @@ import ( var ErrUnsupportedOverlay = errors.New("unit file cannot be exported through the overlay") // UnitOverlay applies upstream default copy rules without writing to the unit or module. -func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.TerraformConfig) (map[string][]byte, error) { +// It returns file contents and, for files whose permission bits differ from the +// default, the unit file's mode so executables keep their execute bit. +func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.TerraformConfig) (map[string][]byte, map[string]uint32, error) { memory := afero.NewMemMapFs() fsys := afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(env.FS), memory) destination := filepath.Join(filepath.Dir(unit), ".atmos-unit-overlay") @@ -31,9 +33,10 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te } if err := util.CopyFolderContents(logger, fsys, unit, destination, ".terragrunt-module-manifest", util.WithIncludeInCopy(include...), util.WithExcludeFromCopy(exclude...)); err != nil { - return nil, err + return nil, nil, err } files := map[string][]byte{} + modes := map[string]uint32{} err := afero.Walk(memory, destination, func(path string, info os.FileInfo, err error) error { if err != nil { return err @@ -48,7 +51,7 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te if name == ".terragrunt-module-manifest" { return nil } - if err := checkOverlayFile(name, info); err != nil { + if err := checkOverlayFile(name); err != nil { return err } content, err := afero.ReadFile(memory, path) @@ -56,23 +59,20 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te return err } files[filepath.ToSlash(name)] = content + if perm := info.Mode().Perm(); perm&0o111 != 0 { + modes[filepath.ToSlash(name)] = uint32(perm) + } return nil }) - return files, err + return files, modes, err } -// checkOverlayFile rejects files whose meaning is lost by the contract. The -// contract carries content only: a committed provider lock file belongs to -// Atmos' per-instance lock management and the host refuses it as a runtime -// artifact, and file modes are not carried, so an executable would be written -// without its execute permission. Failing here reports the unit file by name -// instead of failing later or changing behavior silently. -func checkOverlayFile(name string, info os.FileInfo) error { +// checkOverlayFile rejects a committed provider lock file. Atmos manages the +// lock per component instance and the host refuses it as a runtime artifact, so +// failing here reports the unit file by name instead of failing later. +func checkOverlayFile(name string) error { if filepath.Base(name) == util.TerraformLockFile { return fmt.Errorf("%w: %s is a dependency lock file, which Atmos manages per component instance; list it in exclude_from_copy to proceed without the committed pins", ErrUnsupportedOverlay, filepath.ToSlash(name)) } - if info.Mode()&0o111 != 0 { - return fmt.Errorf("%w: %s is executable, and file modes are not preserved; list it in exclude_from_copy if only parse-time functions use it", ErrUnsupportedOverlay, filepath.ToSlash(name)) - } return nil } diff --git a/plugins/terragrunt/internal/engine/environment_test.go b/plugins/terragrunt/internal/engine/environment_test.go index 9e6456ce545..cd939c8c704 100644 --- a/plugins/terragrunt/internal/engine/environment_test.go +++ b/plugins/terragrunt/internal/engine/environment_test.go @@ -44,11 +44,7 @@ func TestEvaluatorUsesScopedEnvironmentForFunctionsAndCommands(t *testing.T) { require.NoError(t, os.WriteFile(filepath.Join(root, name), content, 0o755)) sourceJSON, err := json.Marshal(filepath.ToSlash(module)) require.NoError(t, err) - // Executables are parse-time helpers here; the overlay contract cannot carry their mode. - config := `terraform { - source = ` + string(sourceJSON) + ` - exclude_from_copy = ["bin", "` + name + `"] -} + config := `terraform { source = ` + string(sourceJSON) + ` } inputs = { direct = get_env("CUSTOM_VALUE") child = jsondecode(run_cmd("` + name + `")) diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index 3316e2e4db1..3daf6316fd6 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -68,7 +68,7 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* return nil, err } if request.Phase != "backend" { - result.Overlay, err = atmosbridge.UnitOverlay(logger, environment, filepath.Dir(path), cfg.Terraform) + result.Overlay, result.OverlayModes, err = atmosbridge.UnitOverlay(logger, environment, filepath.Dir(path), cfg.Terraform) if err != nil { return nil, err } diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 9947051b001..f431a73e4b2 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -246,7 +246,7 @@ remote_state { require.Contains(t, result.WorkingDir, "custom-cache") } -func TestOverlayRejectsFilesTheHostContractCannotCarry(t *testing.T) { +func TestOverlayRejectsLockFilesAndCarriesModes(t *testing.T) { t.Run("committed dependency lock file", func(t *testing.T) { request := nativeUnit(t, "") require.NoError(t, os.WriteFile(filepath.Join(filepath.Dir(request.Path), ".terraform.lock.hcl"), []byte("# lock"), 0o644)) @@ -266,20 +266,21 @@ func TestOverlayRejectsFilesTheHostContractCannotCarry(t *testing.T) { require.NoError(t, err) require.NotContains(t, result.Overlay, ".terraform.lock.hcl") }) - t.Run("executable file", func(t *testing.T) { + t.Run("executable file keeps its mode", func(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("Windows has no executable permission bit.") } request := nativeUnit(t, "") - script := filepath.Join(filepath.Dir(request.Path), "probe.sh") + dir := filepath.Dir(request.Path) + script := filepath.Join(dir, "probe.sh") require.NoError(t, os.WriteFile(script, []byte("#!/bin/sh\n"), 0o755)) require.NoError(t, os.Chmod(script, 0o755)) - _, err := Resolve(t.Context(), request) - require.ErrorIs(t, err, atmosbridge.ErrUnsupportedOverlay) - require.ErrorContains(t, err, "probe.sh") - require.NoError(t, os.Chmod(script, 0o644)) + plain := filepath.Join(dir, "plain.tf") + require.NoError(t, os.WriteFile(plain, []byte("# plain"), 0o644)) result, err := Resolve(t.Context(), request) require.NoError(t, err) require.Contains(t, result.Overlay, "probe.sh") + require.Equal(t, uint32(0o755), result.OverlayModes["probe.sh"]) + require.NotContains(t, result.OverlayModes, "plain.tf", "default modes are not exported") }) } diff --git a/plugins/terragrunt/internal/model/model.go b/plugins/terragrunt/internal/model/model.go index 9f4115c4e1c..6c12bd7635a 100644 --- a/plugins/terragrunt/internal/model/model.go +++ b/plugins/terragrunt/internal/model/model.go @@ -20,6 +20,7 @@ type Request struct { type Resolution struct { Overlay map[string][]byte `json:"overlay,omitempty"` + OverlayModes map[string]uint32 `json:"overlay_modes,omitempty"` Inventory []DiscoveredUnit `json:"inventory,omitempty"` Path string `json:"path,omitempty"` OutputDependencies []string `json:"output_dependencies,omitempty"` diff --git a/plugins/terragrunt/internal/provider/preparation.go b/plugins/terragrunt/internal/provider/preparation.go index 9db30b35494..09014f66035 100644 --- a/plugins/terragrunt/internal/provider/preparation.go +++ b/plugins/terragrunt/internal/provider/preparation.go @@ -151,7 +151,12 @@ func preparedResponse(req model.Request, result *model.Resolution) (*pluginv1.Pr files[name] = []byte(content) } for _, name := range slices.Sorted(maps.Keys(files)) { - response.Files = append(response.Files, &pluginv1.ComponentGeneratedFile{Path: name, Content: files[name], IfExists: "overwrite"}) + // A generated file replaces an overlay file of the same name, so the overlay mode no longer applies. + mode := result.OverlayModes[name] + if _, generated := result.Generated[name]; generated { + mode = 0 + } + response.Files = append(response.Files, &pluginv1.ComponentGeneratedFile{Path: name, Content: files[name], IfExists: "overwrite", Mode: mode}) } return response, nil } diff --git a/plugins/terragrunt/internal/provider/provider_test.go b/plugins/terragrunt/internal/provider/provider_test.go index 5d81e927e85..59785a115d9 100644 --- a/plugins/terragrunt/internal/provider/provider_test.go +++ b/plugins/terragrunt/internal/provider/provider_test.go @@ -177,3 +177,24 @@ func TestDiscoveryDiagnosticsRedactPayloads(t *testing.T) { }) } } + +func TestPreparationExportsOverlayModes(t *testing.T) { + request := componentRequest(t) + p := New(func(_ context.Context, _ model.Request) (*model.Resolution, error) { + return &model.Resolution{ + Source: filepath.Join(request.RootDirectory, "module"), WorkingDir: filepath.Join(request.RootDirectory, "cache"), Inputs: map[string]any{}, BackendType: "local", Backend: map[string]any{"path": "relative.tfstate"}, + Overlay: map[string][]byte{"bin/run.sh": []byte("#!/bin/sh\n"), "plain.tf": []byte("# plain"), "shadow.sh": []byte("old")}, + OverlayModes: map[string]uint32{"bin/run.sh": 0o755, "shadow.sh": 0o755}, + Generated: map[string]string{"shadow.sh": "new"}, + }, nil + }) + result, err := p.Prepare(t.Context(), request) + require.NoError(t, err) + modes := map[string]uint32{} + for _, file := range result.Files { + modes[file.Path] = file.Mode + } + require.Equal(t, map[string]uint32{"bin/run.sh": 0o755, "plain.tf": 0, "shadow.sh": 0}, modes) + require.Equal(t, "bin/run.sh", result.Files[0].Path) + require.Equal(t, "shadow.sh", result.Files[len(result.Files)-1].Path) +} diff --git a/proto/atmos/plugin/v1/plugin.proto b/proto/atmos/plugin/v1/plugin.proto index 3d29a021107..f08e84787ff 100644 --- a/proto/atmos/plugin/v1/plugin.proto +++ b/proto/atmos/plugin/v1/plugin.proto @@ -249,6 +249,10 @@ message ComponentGeneratedFile { // default. Content is evaluated bytes, not another template language. string if_exists = 3; bool sensitive = 4; + // Optional POSIX permission bits. Zero means the host default (0644, or 0600 + // for sensitive files). The host keeps only owner/group/other read and + // execute bits plus owner write, and ignores the field on Windows. + uint32 mode = 5; } message PrepareComponentResponse { string engine = 1; diff --git a/sdk/proto/atmos/plugin/v1/plugin.pb.go b/sdk/proto/atmos/plugin/v1/plugin.pb.go index 5ec7330748a..b89af5a5ba7 100644 --- a/sdk/proto/atmos/plugin/v1/plugin.pb.go +++ b/sdk/proto/atmos/plugin/v1/plugin.pb.go @@ -2739,8 +2739,12 @@ type ComponentGeneratedFile struct { Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // The adapter must reject unknown ownership policies, never overwrite by // default. Content is evaluated bytes, not another template language. - IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` - Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + IfExists string `protobuf:"bytes,3,opt,name=if_exists,json=ifExists,proto3" json:"if_exists,omitempty"` + Sensitive bool `protobuf:"varint,4,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + // Optional POSIX permission bits. Zero means the host default (0644, or 0600 + // for sensitive files). The host keeps only owner/group/other read and + // execute bits plus owner write, and ignores the field on Windows. + Mode uint32 `protobuf:"varint,5,opt,name=mode,proto3" json:"mode,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2803,6 +2807,13 @@ func (x *ComponentGeneratedFile) GetSensitive() bool { return false } +func (x *ComponentGeneratedFile) GetMode() uint32 { + if x != nil { + return x.Mode + } + return 0 +} + type PrepareComponentResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Engine string `protobuf:"bytes,1,opt,name=engine,proto3" json:"engine,omitempty"` @@ -3201,12 +3212,13 @@ const file_atmos_plugin_v1_plugin_proto_rawDesc = "" + "\fbackend_type\x18\x01 \x01(\tR\vbackendType\x129\n" + "\abackend\x18\x02 \x01(\v2\x1f.atmos.plugin.v1.ComponentValueR\abackend\x12\x1c\n" + "\tworkspace\x18\x03 \x01(\tR\tworkspace\x12+\n" + - "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x81\x01\n" + + "\x11working_directory\x18\x04 \x01(\tR\x10workingDirectory\"\x95\x01\n" + "\x16ComponentGeneratedFile\x12\x12\n" + "\x04path\x18\x01 \x01(\tR\x04path\x12\x18\n" + "\acontent\x18\x02 \x01(\fR\acontent\x12\x1b\n" + "\tif_exists\x18\x03 \x01(\tR\bifExists\x12\x1c\n" + - "\tsensitive\x18\x04 \x01(\bR\tsensitive\"\x80\x04\n" + + "\tsensitive\x18\x04 \x01(\bR\tsensitive\x12\x12\n" + + "\x04mode\x18\x05 \x01(\rR\x04mode\"\x80\x04\n" + "\x18PrepareComponentResponse\x12\x16\n" + "\x06engine\x18\x01 \x01(\tR\x06engine\x12+\n" + "\x11working_directory\x18\x02 \x01(\tR\x10workingDirectory\x12#\n" + From 22b3766a754616a0ace0c08a13b413f4c5404f83 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 14 Nov 2026 21:57:35 -0600 Subject: [PATCH 46/52] test(plugin): compare the default file mode against a umask-aware reference An absent mode skips chmod, so the created file keeps whatever the process umask leaves of 0644. Compare it with an independently created 0644 file instead of asserting a fixed mode; explicit modes keep exact assertions. Co-Authored-By: Claude Sonnet 5.5 --- pkg/component/configuration/files_test.go | 24 +++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pkg/component/configuration/files_test.go b/pkg/component/configuration/files_test.go index 7652d5c072e..4aceadc9a1f 100644 --- a/pkg/component/configuration/files_test.go +++ b/pkg/component/configuration/files_test.go @@ -87,8 +87,10 @@ func TestWriteFilesAppliesClampedMode(t *testing.T) { mode uint32 sensitive bool want os.FileMode + // umaskDefault expects the creation default (0644) as the process umask leaves it. + umaskDefault bool }{ - {name: "absent mode keeps the default", mode: 0, want: 0o644}, + {name: "absent mode keeps the default", mode: 0, umaskDefault: true}, {name: "executable keeps the execute bit", mode: 0o755, want: 0o755}, {name: "owner-only executable", mode: 0o700, want: 0o700}, {name: "group and other write are stripped", mode: 0o777, want: 0o755}, @@ -104,7 +106,11 @@ func TestWriteFilesAppliesClampedMode(t *testing.T) { require.NoError(t, WriteFiles(root, []schema.ComponentConfigurationFile{file})) stat, err := os.Stat(filepath.Join(root, file.Path)) require.NoError(t, err) - require.Equal(t, tt.want, stat.Mode()) + want := tt.want + if tt.umaskDefault { + want = umaskedDefaultMode(t) + } + require.Equal(t, want, stat.Mode()) }) } t.Run("overwrite updates the mode of an existing file", func(t *testing.T) { @@ -118,6 +124,20 @@ func TestWriteFilesAppliesClampedMode(t *testing.T) { }) } +// umaskedDefaultMode creates an independent 0644 reference file under the current +// process umask and returns the mode the filesystem granted it. An absent mode skips +// chmod, so the writer must match this rather than a fixed 0644. +func umaskedDefaultMode(t *testing.T) os.FileMode { + t.Helper() + reference := filepath.Join(t.TempDir(), "reference") + output, err := os.OpenFile(reference, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) + require.NoError(t, err) + require.NoError(t, output.Close()) + stat, err := os.Stat(reference) + require.NoError(t, err) + return stat.Mode() +} + func TestWriteFilesRejectsModesBeyondPermissionBits(t *testing.T) { root := t.TempDir() err := WriteFiles(root, []schema.ComponentConfigurationFile{{Path: "a.sh", IfExists: "error", Mode: 1 << 31}}) From 01212059e2c10cf86405b2c7a00a42ed43d247f2 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 14 Nov 2026 22:01:41 -0600 Subject: [PATCH 47/52] fix(terragrunt): keep copied private unit files private The unit overlay only exported modes for executable files, so a nonexecutable 0600 key reached the host with no mode and was written as 0644. Export the mode whenever it differs from the 0644 default (executable, or group/other read missing); the host clamp keeps owner-only files at 0600. Co-Authored-By: Claude Sonnet 5.5 --- pkg/component/configuration/files_test.go | 2 ++ plugins/terragrunt/bridge/overlay.go | 15 +++++++++++++-- .../terragrunt/internal/engine/resolve_test.go | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/pkg/component/configuration/files_test.go b/pkg/component/configuration/files_test.go index 4aceadc9a1f..53cd7729291 100644 --- a/pkg/component/configuration/files_test.go +++ b/pkg/component/configuration/files_test.go @@ -95,6 +95,8 @@ func TestWriteFilesAppliesClampedMode(t *testing.T) { {name: "owner-only executable", mode: 0o700, want: 0o700}, {name: "group and other write are stripped", mode: 0o777, want: 0o755}, {name: "setuid setgid sticky are stripped", mode: 0o7755, want: 0o755}, + {name: "owner-only file stays private", mode: 0o600, want: 0o600}, + {name: "group-readable file is not widened", mode: 0o640, want: 0o640}, {name: "owner read-write is guaranteed", mode: 0o111, want: 0o711}, {name: "sensitive stays private", mode: 0o755, sensitive: true, want: 0o700}, {name: "sensitive without mode", mode: 0, sensitive: true, want: 0o600}, diff --git a/plugins/terragrunt/bridge/overlay.go b/plugins/terragrunt/bridge/overlay.go index 8cd3f876f59..c06956838f4 100644 --- a/plugins/terragrunt/bridge/overlay.go +++ b/plugins/terragrunt/bridge/overlay.go @@ -18,7 +18,10 @@ var ErrUnsupportedOverlay = errors.New("unit file cannot be exported through the // UnitOverlay applies upstream default copy rules without writing to the unit or module. // It returns file contents and, for files whose permission bits differ from the -// default, the unit file's mode so executables keep their execute bit. +// default, the unit file's mode so executables keep their execute bit and +// owner-only or otherwise unreadable-by-others files, such as copied keys, stay +// private. The host ignores modes on Windows, so the exported modes only take +// effect on platforms with POSIX permission bits. func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.TerraformConfig) (map[string][]byte, map[string]uint32, error) { memory := afero.NewMemMapFs() fsys := afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(env.FS), memory) @@ -59,7 +62,7 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te return err } files[filepath.ToSlash(name)] = content - if perm := info.Mode().Perm(); perm&0o111 != 0 { + if perm := info.Mode().Perm(); exportsMode(perm) { modes[filepath.ToSlash(name)] = uint32(perm) } return nil @@ -67,6 +70,14 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te return files, modes, err } +// exportsMode reports whether a unit file's permission bits differ from the +// default the host applies to files without a mode (0644): it is executable, or +// group or other lacks read access. +func exportsMode(perm os.FileMode) bool { + const groupAndOtherRead = 0o044 + return perm&0o111 != 0 || perm&groupAndOtherRead != groupAndOtherRead +} + // checkOverlayFile rejects a committed provider lock file. Atmos manages the // lock per component instance and the host refuses it as a runtime artifact, so // failing here reports the unit file by name instead of failing later. diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index f431a73e4b2..0510f7f5c6e 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -283,4 +283,21 @@ func TestOverlayRejectsLockFilesAndCarriesModes(t *testing.T) { require.Equal(t, uint32(0o755), result.OverlayModes["probe.sh"]) require.NotContains(t, result.OverlayModes, "plain.tf", "default modes are not exported") }) + t.Run("private file keeps its restrictive mode", func(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Windows ignores POSIX permission bits.") + } + request := nativeUnit(t, "") + dir := filepath.Dir(request.Path) + for name, mode := range map[string]os.FileMode{"private_key.pem": 0o600, "group.pem": 0o640, "plain.tf": 0o644} { + path := filepath.Join(dir, name) + require.NoError(t, os.WriteFile(path, []byte("# "+name), mode)) + require.NoError(t, os.Chmod(path, mode)) + } + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, uint32(0o600), result.OverlayModes["private_key.pem"], "a nonexecutable 0600 key must not widen to the 0644 default") + require.Equal(t, uint32(0o640), result.OverlayModes["group.pem"]) + require.NotContains(t, result.OverlayModes, "plain.tf", "default modes are not exported") + }) } From a21fee6e01197a2193794dff0bd7d8f08c47fba7 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Sat, 14 Nov 2026 22:02:21 -0600 Subject: [PATCH 48/52] docs(terragrunt): qualify file-mode behavior on Windows Scope the retained execute bit, owner-only permissions, and removed write bits to platforms with POSIX file modes, and state that Windows ignores file modes. Co-Authored-By: Claude Sonnet 5.5 --- plugins/terragrunt/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/terragrunt/README.md b/plugins/terragrunt/README.md index 8fc6162796f..e0cd6e0fc49 100644 --- a/plugins/terragrunt/README.md +++ b/plugins/terragrunt/README.md @@ -38,7 +38,7 @@ plugins: path: /absolute/path/to/this/plugins/terragrunt ``` -Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. Unit files keep their execute bit, with setuid, setgid, and group or other write bits removed. A unit directory that contains a committed `.terraform.lock.hcl` is rejected until the file is listed in `exclude_from_copy`. +Run `atmos list instances`, `atmos describe stacks`, and `atmos terraform plan --all`. No per-unit YAML is required. Discovery uses an in-memory overlay for explicit stacks. It does not create `.terragrunt-stack` or read dependency state. Apply generates explicit stacks and evaluates each unit after its dependencies. Discovered units use Atmos workdirs to isolate generated files by stack and component. State retains its Terragrunt backend identity. On platforms with POSIX file modes, unit files keep their execute bit and owner-only or group-restricted permissions, with setuid, setgid, and group or other write bits removed. Windows ignores file modes, so generated files use the default permissions there. A unit directory that contains a committed `.terraform.lock.hcl` is rejected until the file is listed in `exclude_from_copy`. Preparation receives Atmos's sanitized environment after authentication, the selected executable, toolchain PATH, and managed Terraform RC configuration. Child commands use the invocation PATH. Neither identity changes nor HCL evaluation replace the plugin process environment. From 3e150f33b0c33c39b7f478ac02187ae7ee0cfcc4 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Mon, 16 Nov 2026 07:19:21 -0600 Subject: [PATCH 49/52] fix(terragrunt): read download_dir without evaluating unrelated inputs Backend reads restored download_dir through a full parse that also evaluated inputs, so a command-valued input ran during backend resolution. The probe now reads configuration files without their top-level inputs attribute. Co-Authored-By: Claude Sonnet 5.5 --- plugins/terragrunt/go.mod | 2 +- plugins/terragrunt/internal/engine/resolve.go | 53 ++++++++++++++++++- .../internal/engine/resolve_test.go | 27 ++++++++++ 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/plugins/terragrunt/go.mod b/plugins/terragrunt/go.mod index 6ae44b7312a..5ad34e800fb 100644 --- a/plugins/terragrunt/go.mod +++ b/plugins/terragrunt/go.mod @@ -9,6 +9,7 @@ require ( github.com/gruntwork-io/terragrunt v1.2.1 github.com/gruntwork-io/terragrunt/pkg/atmosbridge v0.0.0-00010101000000-000000000000 github.com/hashicorp/go-version v1.9.0 + github.com/hashicorp/hcl/v2 v2.25.0 github.com/spf13/afero v1.15.0 github.com/stretchr/testify v1.12.1 github.com/zclconf/go-cty v1.19.0 @@ -139,7 +140,6 @@ require ( github.com/hashicorp/go-sockaddr v1.0.7 // indirect github.com/hashicorp/go-uuid v1.0.4 // indirect github.com/hashicorp/hcl v1.0.1-vault-7 // indirect - github.com/hashicorp/hcl/v2 v2.25.0 // indirect github.com/hashicorp/terraform-svchost v0.2.1 // indirect github.com/hashicorp/vault/api v1.23.0 // indirect github.com/hashicorp/yamux v0.1.2 // indirect diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index 3daf6316fd6..99566fe84cb 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -14,6 +14,8 @@ import ( "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/gruntwork-io/terragrunt/pkg/log/format" "github.com/gruntwork-io/terragrunt/pkg/options" + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/hclwrite" "github.com/spf13/afero" "github.com/zclconf/go-cty/cty" @@ -184,7 +186,9 @@ func parseUnit(ctx context.Context, logger log.Logger, environment *atmosbridge. // decoding has no section for that attribute, but the working directory (and so // every relative local-state path) depends on it. The extra parse skips // dependency output resolution (an unknown placeholder replaces every -// dependency), so backend reads still never read outputs. +// dependency), so backend reads still never read outputs, and it reads every +// configuration file without its top-level inputs attribute so unrelated input +// expressions, such as command calls, are never evaluated. func withDownloadDir(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*config.TerragruntConfig, error) { if request.Environment["TG_DOWNLOAD_DIR"] != "" { return cfg, nil @@ -192,7 +196,8 @@ func withDownloadDir(ctx context.Context, logger log.Logger, environment *atmosb placeholder := cty.DynamicVal probe := pctx.WithSkipOutputsResolution() probe.DecodedDependencies = &placeholder - full, err := config.ParseConfigFile(ctx, logger, environment, probe, path, nil) + // Fresh caches keep the stripped files apart from the partial parse's cached ones. + full, err := config.ParseConfigFile(config.WithCaches(ctx), logger, environment.WithFS(withoutInputsFS{Fs: environment.FS}), probe, path, nil) if err != nil { return nil, err } @@ -200,6 +205,50 @@ func withDownloadDir(ctx context.Context, logger log.Logger, environment *atmosb return cfg, nil } +// withoutInputsFS serves HCL configuration files without their top-level inputs +// attribute. Reading download_dir needs the locals, includes and functions that +// attribute might use, but never the inputs themselves. +type withoutInputsFS struct { + afero.Fs +} + +// Open reads through OpenFile so every read path strips inputs. +func (f withoutInputsFS) Open(name string) (afero.File, error) { + return f.OpenFile(name, os.O_RDONLY, 0) +} + +// OpenFile returns the stripped content for read-only opens of HCL files. +func (f withoutInputsFS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) { + file, err := f.Fs.OpenFile(name, flag, perm) + if err != nil || flag != os.O_RDONLY || !strings.HasSuffix(name, ".hcl") { + return file, err + } + if info, err := file.Stat(); err != nil || info.IsDir() { + return file, nil + } + data, err := io.ReadAll(file) + _ = file.Close() + if err != nil { + return nil, err + } + memory := afero.NewMemMapFs() + if err := afero.WriteFile(memory, name, withoutInputs(name, data), 0o644); err != nil { + return nil, err + } + return memory.Open(name) +} + +// withoutInputs removes the top-level inputs attribute. Content that does not +// parse is returned unchanged so upstream reports its own syntax errors. +func withoutInputs(name string, data []byte) []byte { + file, diags := hclwrite.ParseConfig(data, name, hcl.InitialPos) + if diags.HasErrors() { + return data + } + file.Body().RemoveAttribute("inputs") + return file.Bytes() +} + // unitResolution converts the parsed unit into its local module identity. func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*model.Resolution, error) { result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)} diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 0510f7f5c6e..74e45a21188 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -226,6 +226,33 @@ remote_state { require.Equal(t, full.Backend["path"], backend.Backend["path"]) } +func TestBackendResolutionNeverEvaluatesUnrelatedInputs(t *testing.T) { + configuration := `download_dir = "custom-cache" +remote_state { + backend = "local" + config = { path = "state.tfstate" } +} +inputs = { value = run_cmd("atmos-missing-command-that-must-not-run") } +` + request := nativeUnit(t, configuration) + _, err := Resolve(t.Context(), request) + require.Error(t, err, "a full read evaluates the command-valued input") + request.Phase = "backend" + backend, err := Resolve(t.Context(), request) + require.NoError(t, err, "a backend read never evaluates unrelated inputs") + require.Equal(t, "local", backend.BackendType) + require.Contains(t, backend.WorkingDir, "custom-cache") + t.Run("included inputs", func(t *testing.T) { + request := nativeUnit(t, "include \"root\" {\n path = \"root.hcl\"\n}\n") + dir := filepath.Dir(request.Path) + require.NoError(t, os.WriteFile(filepath.Join(dir, "root.hcl"), []byte(configuration), 0o644)) + request.Phase = "backend" + backend, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, backend.WorkingDir, "custom-cache") + }) +} + func TestBackendDownloadDirectoryNeverReadsDependencyOutputs(t *testing.T) { request := nativeUnit(t, `download_dir = "custom-cache" dependency "other" { From 995e635702285e34c7aba73dfc42ad943be0e033 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Mon, 16 Nov 2026 07:22:04 -0600 Subject: [PATCH 50/52] fix(terragrunt): preserve directory restrictions on copied credentials The overlay exports file modes only, so a 0644 credential inside a private directory became readable once the directory was recreated with default modes. Files now lose group and other access when a containing subdirectory cannot be traversed by that class. Co-Authored-By: Claude Sonnet 5.5 --- plugins/terragrunt/bridge/overlay.go | 26 ++++++++++++++++++- .../internal/engine/resolve_test.go | 20 ++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/plugins/terragrunt/bridge/overlay.go b/plugins/terragrunt/bridge/overlay.go index c06956838f4..aef719d6418 100644 --- a/plugins/terragrunt/bridge/overlay.go +++ b/plugins/terragrunt/bridge/overlay.go @@ -62,7 +62,8 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te return err } files[filepath.ToSlash(name)] = content - if perm := info.Mode().Perm(); exportsMode(perm) { + perm := restrictByDirectories(env.FS, unit, filepath.Dir(name), info.Mode().Perm()) + if exportsMode(perm) { modes[filepath.ToSlash(name)] = uint32(perm) } return nil @@ -70,6 +71,29 @@ func UnitOverlay(logger log.Logger, env *Venv, unit string, terraform *config.Te return files, modes, err } +// restrictByDirectories conservatively narrows a file's permission bits by the +// subdirectories that contain it. The overlay carries file modes only, so a +// readable file inside a private directory (for example 0644 under 0700) would +// otherwise become readable once the directory is recreated with default modes. +// A group or other class that cannot traverse a containing directory loses all +// access to the file. The unit directory itself is not considered because the +// host owns the working directory's mode. +func restrictByDirectories(fsys afero.Fs, unit, dir string, perm os.FileMode) os.FileMode { + for dir != "." && dir != string(filepath.Separator) && dir != "" { + if info, err := fsys.Stat(filepath.Join(unit, dir)); err == nil { + mode := info.Mode().Perm() + if mode&0o010 == 0 { + perm &^= 0o070 + } + if mode&0o001 == 0 { + perm &^= 0o007 + } + } + dir = filepath.Dir(dir) + } + return perm +} + // exportsMode reports whether a unit file's permission bits differ from the // default the host applies to files without a mode (0644): it is executable, or // group or other lacks read access. diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 74e45a21188..8688a73a958 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -327,4 +327,24 @@ func TestOverlayRejectsLockFilesAndCarriesModes(t *testing.T) { require.Equal(t, uint32(0o640), result.OverlayModes["group.pem"]) require.NotContains(t, result.OverlayModes, "plain.tf", "default modes are not exported") }) + t.Run("readable file in a private directory is restricted", func(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Windows ignores POSIX permission bits.") + } + request := nativeUnit(t, "") + dir := filepath.Dir(request.Path) + for name, mode := range map[string]os.FileMode{"private": 0o700, "shared": 0o755, "group": 0o750} { + require.NoError(t, os.MkdirAll(filepath.Join(dir, name, "nested"), 0o755)) + require.NoError(t, os.Chmod(filepath.Join(dir, name), mode)) + for _, file := range []string{filepath.Join(name, "credential.pem"), filepath.Join(name, "nested", "deep.pem")} { + require.NoError(t, os.WriteFile(filepath.Join(dir, file), []byte("# secret"), 0o644)) + } + } + result, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, uint32(0o600), result.OverlayModes["private/credential.pem"], "a 0644 credential in a 0700 directory must not be exposed") + require.Equal(t, uint32(0o600), result.OverlayModes["private/nested/deep.pem"], "a private ancestor restricts descendants") + require.Equal(t, uint32(0o640), result.OverlayModes["group/credential.pem"], "a 0750 directory hides the file from other") + require.NotContains(t, result.OverlayModes, "shared/credential.pem", "a traversable directory keeps the default mode") + }) } From 2efba5f05ebcb8b1889589f9a18dd05e45d56aef Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 17 Nov 2026 06:58:32 -0600 Subject: [PATCH 51/52] fix(terragrunt): preserve backend download directory input references Retain statically referenced settings inputs during backend parsing without evaluating unrelated unit or object inputs. Cover direct and local config reads, state-path consistency, projection behavior, and filesystem errors. Propagate probe Stat errors and simplify the download directory helper. --- .../internal/engine/input_projection.go | 161 ++++++++++++++++++ plugins/terragrunt/internal/engine/resolve.go | 86 +++++----- .../internal/engine/resolve_test.go | 97 +++++++++++ 3 files changed, 302 insertions(+), 42 deletions(-) create mode 100644 plugins/terragrunt/internal/engine/input_projection.go diff --git a/plugins/terragrunt/internal/engine/input_projection.go b/plugins/terragrunt/internal/engine/input_projection.go new file mode 100644 index 00000000000..5303d70d386 --- /dev/null +++ b/plugins/terragrunt/internal/engine/input_projection.go @@ -0,0 +1,161 @@ +package engine + +import ( + "sync" + + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl/v2/hclwrite" + "github.com/zclconf/go-cty/cty" +) + +const inputsAttribute = "inputs" + +// inputReferences tracks input keys used by the probe, including references in +// retained input values. A whole-map or dynamic reference requires all inputs. +// The parser may read included files concurrently. +type inputReferences struct { + mu sync.Mutex + root string + keys map[string]bool + all bool +} + +func newInputReferences(root string) *inputReferences { + return &inputReferences{root: root, keys: map[string]bool{}} +} + +// project preserves syntax errors for the upstream parser to diagnose. +func (r *inputReferences) project(name string, data []byte) []byte { + parsed, diags := hclsyntax.ParseConfig(data, name, hcl.InitialPos) + if diags.HasErrors() { + return data + } + body := parsed.Body.(*hclsyntax.Body) + r.mu.Lock() + defer r.mu.Unlock() + r.collectBody(body) + inputs := body.Attributes[inputsAttribute] + if inputs == nil { + return data + } + file, _ := hclwrite.ParseConfig(data, name, hcl.InitialPos) + if name == r.root || (!r.all && len(r.keys) == 0) { + file.Body().RemoveAttribute(inputsAttribute) + return file.Bytes() + } + if r.all { + return data + } + object, ok := inputs.Expr.(*hclsyntax.ObjectConsExpr) + if !ok { + // Computed maps cannot be safely pruned without evaluating their expression. + r.collect(inputs.Expr) + return data + } + r.expand(object) + if r.all { + return data + } + file.Body().SetAttributeRaw(inputsAttribute, r.objectTokens(object, data, name)) + return file.Bytes() +} + +func (r *inputReferences) collectBody(body *hclsyntax.Body) { + for name, attr := range body.Attributes { + if name != inputsAttribute { + r.collect(attr.Expr) + } + } + for _, block := range body.Blocks { + r.collect(block.Body) + } +} + +func (r *inputReferences) expand(object *hclsyntax.ObjectConsExpr) { + // A selected value may reference another input key. Reach a fixed point before + // pruning so source order does not determine which values survive. + for { + count := len(r.keys) + for _, item := range object.Items { + key, diags := item.KeyExpr.Value(nil) + if diags.HasErrors() || !key.IsKnown() || key.IsNull() || key.Type() != cty.String { + // Preserve computed keys rather than silently selecting a fallback path. + r.all = true + return + } + if r.keys[key.AsString()] { + r.collect(item.ValueExpr) + } + } + if r.all { + return + } + if count == len(r.keys) { + return + } + } +} + +func (r *inputReferences) objectTokens(object *hclsyntax.ObjectConsExpr, data []byte, name string) hclwrite.Tokens { + var attributes []hclwrite.ObjectAttrTokens + for _, item := range object.Items { + key, _ := item.KeyExpr.Value(nil) + if !r.keys[key.AsString()] { + continue + } + // Reparse the value as an attribute to preserve arbitrary HCL expressions. + value := item.ValueExpr.Range().SliceBytes(data) + expression, _ := hclwrite.ParseConfig(append(append([]byte("value = "), value...), '\n'), name, hcl.InitialPos) + attributes = append(attributes, hclwrite.ObjectAttrTokens{ + Name: hclwrite.TokensForValue(key), + Value: expression.Body().GetAttribute("value").Expr().BuildTokens(nil), + }) + } + return hclwrite.TokensForObject(attributes) +} + +func (r *inputReferences) collect(node hclsyntax.Node) { + _ = hclsyntax.VisitAll(node, func(node hclsyntax.Node) hcl.Diagnostics { + switch expression := node.(type) { + case *hclsyntax.ScopeTraversalExpr: + r.traversal(expression.Traversal) + case *hclsyntax.RelativeTraversalExpr: + r.traversal(expression.Traversal) + } + return nil + }) +} + +func (r *inputReferences) traversal(traversal hcl.Traversal) { + for i, step := range traversal { + name, _ := traversalName(step) + if name != inputsAttribute { + continue + } + if i+1 == len(traversal) { + r.all = true + return + } + key, known := traversalName(traversal[i+1]) + if known { + r.keys[key] = true + } else { + r.all = true + } + } +} + +func traversalName(step hcl.Traverser) (string, bool) { + switch step := step.(type) { + case hcl.TraverseRoot: + return step.Name, true + case hcl.TraverseAttr: + return step.Name, true + case hcl.TraverseIndex: + if step.Key.IsKnown() && !step.Key.IsNull() && step.Key.Type() == cty.String { + return step.Key.AsString(), true + } + } + return "", false +} diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index 99566fe84cb..fdf4f30b756 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -14,8 +14,6 @@ import ( "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/gruntwork-io/terragrunt/pkg/log/format" "github.com/gruntwork-io/terragrunt/pkg/options" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclwrite" "github.com/spf13/afero" "github.com/zclconf/go-cty/cty" @@ -69,7 +67,7 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* if err := resolveBackend(result, cfg); err != nil { return nil, err } - if request.Phase != "backend" { + if request.Phase != phaseBackend { result.Overlay, result.OverlayModes, err = atmosbridge.UnitOverlay(logger, environment, filepath.Dir(path), cfg.Terraform) if err != nil { return nil, err @@ -82,8 +80,12 @@ func resolve(ctx context.Context, request model.Request, filesystem afero.Fs) (* } const ( - stackFile = "terragrunt.stack.hcl" - unitFile = "terragrunt.hcl" + downloadDirEnv = "TG_DOWNLOAD_DIR" + phaseBackend = "backend" + phaseDiscover = "discover" + probeFileMode = 0o644 + stackFile = "terragrunt.stack.hcl" + unitFile = "terragrunt.hcl" // Nested-stack recursion for generation and discovery stops at maxStackDepth. maxStackDepth = 32 ) @@ -92,12 +94,12 @@ const ( // copy-on-write overlay before a backend read of a stack-generated unit. The // returned filesystem is the one the unit is then parsed from. func backendGenerationOverlay(ctx context.Context, request model.Request, filesystem afero.Fs) (afero.Fs, error) { - if request.Phase != "backend" || request.GenerationRoot == "" { + if request.Phase != phaseBackend || request.GenerationRoot == "" { return filesystem, nil } filesystem = afero.NewCopyOnWriteFs(afero.NewReadOnlyFs(afero.NewOsFs()), afero.NewMemMapFs()) generation := request - generation.Path, generation.Phase, generation.Command = request.GenerationRoot, "discover", "generate" + generation.Path, generation.Phase, generation.Command = request.GenerationRoot, phaseDiscover, "generate" if _, err := resolve(ctx, generation, filesystem); err != nil { return nil, err } @@ -127,11 +129,11 @@ func evaluationLogger(level string) (log.Logger, error) { } func discovering(request model.Request) bool { - return request.Phase == "discover" || request.Command == "discover" + return request.Phase == phaseDiscover || request.Command == phaseDiscover } func generating(request model.Request) bool { - return request.Command == "generate" && request.Phase != "backend" + return request.Command == "generate" && request.Phase != phaseBackend } // evaluationEnvironment uses the local maintained facade, which exposes the @@ -145,7 +147,7 @@ func evaluationEnvironment(request model.Request, filesystem afero.Fs, path stri if _, err := environment.FS.Stat(path); err != nil { return nil, err } - if discovering(request) || request.Phase == "backend" || generating(request) { + if discovering(request) || request.Phase == phaseBackend || generating(request) { environment = atmosbridge.Discovery(environment, generating(request)) } return environment, nil @@ -153,7 +155,7 @@ func evaluationEnvironment(request model.Request, filesystem afero.Fs, path stri func parsingContext(request model.Request, path string) *config.ParsingContext { command := request.Command - if command == "" || command == "discover" || command == "generate" { + if command == "" || command == phaseDiscover || command == "generate" { command = "plan" } pctx := config.NewParsingContext().WithFileReadTracking() @@ -163,7 +165,7 @@ func parsingContext(request model.Request, path string) *config.ParsingContext { pctx.OriginalTerraformCommand = command pctx.TerraformCliArgs.SetCommand(command).AppendArgument(request.Arguments...) pctx.DownloadDir = filepath.Join(filepath.Dir(path), ".terragrunt-cache") - if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { + if configured := request.Environment[downloadDirEnv]; configured != "" { pctx.DownloadDir = localPath(filepath.Dir(path), configured) } pctx.AutoInit = true @@ -172,44 +174,45 @@ func parsingContext(request model.Request, path string) *config.ParsingContext { } func parseUnit(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, path string) (*config.TerragruntConfig, error) { - if request.Phase == "backend" { + if request.Phase == phaseBackend { + environment = environment.WithFS(withoutInputsFS{Fs: environment.FS, inputs: newInputReferences(path)}) cfg, err := config.PartialParseConfigFile(ctx, logger, environment, pctx.WithDecodeList(config.TerraformSource, config.RemoteStateBlock), path, nil) if err != nil { return nil, err } - return withDownloadDir(ctx, logger, environment, pctx, request, cfg, path) + if request.Environment[downloadDirEnv] == "" { + cfg.DownloadDir, err = downloadDir(ctx, logger, environment, pctx) + } + return cfg, err } return config.ParseConfigFile(ctx, logger, environment, pctx, path, nil) } -// withDownloadDir restores download_dir on a partially parsed unit. Partial +// downloadDir restores download_dir on a partially parsed unit. Partial // decoding has no section for that attribute, but the working directory (and so // every relative local-state path) depends on it. The extra parse skips // dependency output resolution (an unknown placeholder replaces every // dependency), so backend reads still never read outputs, and it reads every -// configuration file without its top-level inputs attribute so unrelated input +// configuration file with only the referenced inputs so unrelated input // expressions, such as command calls, are never evaluated. -func withDownloadDir(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*config.TerragruntConfig, error) { - if request.Environment["TG_DOWNLOAD_DIR"] != "" { - return cfg, nil - } +func downloadDir(ctx context.Context, logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext) (string, error) { placeholder := cty.DynamicVal probe := pctx.WithSkipOutputsResolution() probe.DecodedDependencies = &placeholder // Fresh caches keep the stripped files apart from the partial parse's cached ones. - full, err := config.ParseConfigFile(config.WithCaches(ctx), logger, environment.WithFS(withoutInputsFS{Fs: environment.FS}), probe, path, nil) + full, err := config.ParseConfigFile(config.WithCaches(ctx), logger, environment, probe, pctx.TerragruntConfigPath, nil) if err != nil { - return nil, err + return "", err } - cfg.DownloadDir = full.DownloadDir - return cfg, nil + return full.DownloadDir, nil } -// withoutInputsFS serves HCL configuration files without their top-level inputs -// attribute. Reading download_dir needs the locals, includes and functions that -// attribute might use, but never the inputs themselves. +// withoutInputsFS projects inputs to the keys referenced by the configuration. +// References are shared across reads so read_terragrunt_config can supply inputs +// needed by download_dir without evaluating unrelated input expressions. type withoutInputsFS struct { afero.Fs + inputs *inputReferences } // Open reads through OpenFile so every read path strips inputs. @@ -223,7 +226,17 @@ func (f withoutInputsFS) OpenFile(name string, flag int, perm os.FileMode) (afer if err != nil || flag != os.O_RDONLY || !strings.HasSuffix(name, ".hcl") { return file, err } - if info, err := file.Stat(); err != nil || info.IsDir() { + return f.projectFile(file, name) +} + +// projectFile closes failed reads and preserves directory handles for callers. +func (f withoutInputsFS) projectFile(file afero.File, name string) (afero.File, error) { + info, err := file.Stat() + if err != nil { + _ = file.Close() + return nil, err + } + if info.IsDir() { return file, nil } data, err := io.ReadAll(file) @@ -232,23 +245,12 @@ func (f withoutInputsFS) OpenFile(name string, flag int, perm os.FileMode) (afer return nil, err } memory := afero.NewMemMapFs() - if err := afero.WriteFile(memory, name, withoutInputs(name, data), 0o644); err != nil { + if err := afero.WriteFile(memory, name, f.inputs.project(name, data), probeFileMode); err != nil { return nil, err } return memory.Open(name) } -// withoutInputs removes the top-level inputs attribute. Content that does not -// parse is returned unchanged so upstream reports its own syntax errors. -func withoutInputs(name string, data []byte) []byte { - file, diags := hclwrite.ParseConfig(data, name, hcl.InitialPos) - if diags.HasErrors() { - return data - } - file.Body().RemoveAttribute("inputs") - return file.Bytes() -} - // unitResolution converts the parsed unit into its local module identity. func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*model.Resolution, error) { result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)} @@ -262,10 +264,10 @@ func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *conf return nil, fmt.Errorf("native adapter source must be an existing local directory: %s", result.Source) } download := pctx.DownloadDir - if cfg.DownloadDir != "" && request.Environment["TG_DOWNLOAD_DIR"] == "" { + if cfg.DownloadDir != "" && request.Environment[downloadDirEnv] == "" { download = localPath(filepath.Dir(path), cfg.DownloadDir) } - if configured := request.Environment["TG_DOWNLOAD_DIR"]; configured != "" { + if configured := request.Environment[downloadDirEnv]; configured != "" { download = localPath(filepath.Dir(path), configured) } workingDir, err := atmosbridge.WorkingDir(logger, environment, result.Source, download, filepath.Dir(path)) diff --git a/plugins/terragrunt/internal/engine/resolve_test.go b/plugins/terragrunt/internal/engine/resolve_test.go index 8688a73a958..5409252c98d 100644 --- a/plugins/terragrunt/internal/engine/resolve_test.go +++ b/plugins/terragrunt/internal/engine/resolve_test.go @@ -9,6 +9,9 @@ import ( "testing" "github.com/gruntwork-io/terragrunt/pkg/atmosbridge" + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/spf13/afero" "github.com/stretchr/testify/require" "github.com/cloudposse/atmos/plugins/terragrunt/internal/model" @@ -348,3 +351,97 @@ func TestOverlayRejectsLockFilesAndCarriesModes(t *testing.T) { require.NotContains(t, result.OverlayModes, "shared/credential.pem", "a traversable directory keeps the default mode") }) } + +func TestBackendDownloadDirectoryFromReadConfigInputs(t *testing.T) { + for name, expression := range map[string]string{ + "direct": `download_dir = try(read_terragrunt_config("settings.hcl").inputs.cache, "fallback-cache")`, + "local": `locals { settings = read_terragrunt_config("settings.hcl") } +download_dir = try(local.settings.inputs.cache, "fallback-cache")`, + } { + t.Run(name, func(t *testing.T) { + request := nativeUnit(t, expression+` +remote_state { + backend = "local" + config = { path = "state.tfstate" } +} +`) + settings := filepath.Join(filepath.Dir(request.Path), "settings.hcl") + require.NoError(t, os.WriteFile(settings, []byte(`inputs = { cache = "configured-cache" }`), 0o644)) + full, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Contains(t, full.WorkingDir, "configured-cache") + request.Phase = "backend" + backend, err := Resolve(t.Context(), request) + require.NoError(t, err) + require.Equal(t, full.WorkingDir, backend.WorkingDir) + require.Equal(t, full.Backend["path"], backend.Backend["path"]) + require.NoError(t, os.WriteFile(settings, []byte(`inputs = { + cache = "configured-cache" + unrelated = run_cmd("atmos-missing-command-that-must-not-run") +}`), 0o644)) + root, err := os.ReadFile(request.Path) + require.NoError(t, err) + root = append(root, []byte(` +inputs = { cache = run_cmd("atmos-missing-command-that-must-not-run") } +`)...) + require.NoError(t, os.WriteFile(request.Path, root, 0o644)) + backend, err = Resolve(t.Context(), request) + require.NoError(t, err, "unreferenced settings inputs must not execute") + require.Equal(t, full.WorkingDir, backend.WorkingDir) + }) + } +} + +func TestInputProjection(t *testing.T) { + for _, test := range []struct { + name, reference, inputs string + present, absent []string + }{ + {"unrelated", `download_dir = "cache"`, `inputs = { unrelated = run_cmd("must-not-run") }`, nil, []string{"inputs", "run_cmd"}}, + {"attribute", `download_dir = read_terragrunt_config("settings.hcl").inputs.cache`, `inputs = { cache = "configured", unrelated = run_cmd("must-not-run") }`, []string{"configured"}, []string{"run_cmd"}}, + {"index", `download_dir = read_terragrunt_config("settings.hcl")["inputs"]["cache"]`, `inputs = { cache = "configured", unrelated = run_cmd("must-not-run") }`, []string{"configured"}, []string{"run_cmd"}}, + {"transitive", `download_dir = read_terragrunt_config("settings.hcl").inputs.cache`, `inputs = { base = "configured", cache = read_terragrunt_config("other.hcl").inputs.base, unrelated = run_cmd("must-not-run") }`, []string{"configured", "other.hcl"}, []string{"run_cmd"}}, + {"whole map", `download_dir = lookup(read_terragrunt_config("settings.hcl").inputs, "cache", "fallback")`, `inputs = { cache = "configured" }`, []string{"configured"}, nil}, + {"computed map", `download_dir = read_terragrunt_config("settings.hcl").inputs.cache`, `inputs = merge({cache = "configured"}, {})`, []string{"configured", "merge"}, nil}, + } { + t.Run(test.name, func(t *testing.T) { + references := newInputReferences("terragrunt.hcl") + references.project("terragrunt.hcl", []byte(test.reference)) + projected := references.project("settings.hcl", []byte(test.inputs)) + _, diagnostics := hclsyntax.ParseConfig(projected, "settings.hcl", hcl.InitialPos) + require.False(t, diagnostics.HasErrors(), diagnostics.Error()) + for _, want := range test.present { + require.Contains(t, string(projected), want) + } + for _, unwanted := range test.absent { + require.NotContains(t, string(projected), unwanted) + } + }) + } + t.Run("invalid syntax", func(t *testing.T) { + data := []byte("inputs = {") + require.Equal(t, data, newInputReferences("terragrunt.hcl").project("invalid.hcl", data)) + }) +} + +func TestBackendProbePropagatesStatFailure(t *testing.T) { + file, err := os.CreateTemp(t.TempDir(), "closed-*.hcl") + require.NoError(t, err) + require.NoError(t, file.Close()) + probe := withoutInputsFS{Fs: afero.NewOsFs(), inputs: newInputReferences(file.Name())} + result, err := probe.projectFile(file, file.Name()) + require.ErrorIs(t, err, os.ErrClosed) + require.Nil(t, result) +} + +func TestBackendProbePreservesDirectoryHandle(t *testing.T) { + dir := filepath.Join(t.TempDir(), "directory.hcl") + require.NoError(t, os.Mkdir(dir, 0o755)) + probe := withoutInputsFS{Fs: afero.NewOsFs(), inputs: newInputReferences("terragrunt.hcl")} + file, err := probe.Open(dir) + require.NoError(t, err) + defer file.Close() + info, err := file.Stat() + require.NoError(t, err) + require.True(t, info.IsDir()) +} From b57bdccd9eaf58010d295cdb17aa2d83a0109b79 Mon Sep 17 00:00:00 2001 From: Erik Osterman Date: Tue, 17 Nov 2026 10:13:04 -0600 Subject: [PATCH 52/52] refactor(terragrunt): colocate backend input projection helpers Move the unchanged input projection helpers next to their resolver filesystem wrapper, preserving all assertions while reducing the L4 diff to 149 files. --- .../internal/engine/input_projection.go | 161 ------------------ plugins/terragrunt/internal/engine/resolve.go | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 161 deletions(-) delete mode 100644 plugins/terragrunt/internal/engine/input_projection.go diff --git a/plugins/terragrunt/internal/engine/input_projection.go b/plugins/terragrunt/internal/engine/input_projection.go deleted file mode 100644 index 5303d70d386..00000000000 --- a/plugins/terragrunt/internal/engine/input_projection.go +++ /dev/null @@ -1,161 +0,0 @@ -package engine - -import ( - "sync" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/hashicorp/hcl/v2/hclwrite" - "github.com/zclconf/go-cty/cty" -) - -const inputsAttribute = "inputs" - -// inputReferences tracks input keys used by the probe, including references in -// retained input values. A whole-map or dynamic reference requires all inputs. -// The parser may read included files concurrently. -type inputReferences struct { - mu sync.Mutex - root string - keys map[string]bool - all bool -} - -func newInputReferences(root string) *inputReferences { - return &inputReferences{root: root, keys: map[string]bool{}} -} - -// project preserves syntax errors for the upstream parser to diagnose. -func (r *inputReferences) project(name string, data []byte) []byte { - parsed, diags := hclsyntax.ParseConfig(data, name, hcl.InitialPos) - if diags.HasErrors() { - return data - } - body := parsed.Body.(*hclsyntax.Body) - r.mu.Lock() - defer r.mu.Unlock() - r.collectBody(body) - inputs := body.Attributes[inputsAttribute] - if inputs == nil { - return data - } - file, _ := hclwrite.ParseConfig(data, name, hcl.InitialPos) - if name == r.root || (!r.all && len(r.keys) == 0) { - file.Body().RemoveAttribute(inputsAttribute) - return file.Bytes() - } - if r.all { - return data - } - object, ok := inputs.Expr.(*hclsyntax.ObjectConsExpr) - if !ok { - // Computed maps cannot be safely pruned without evaluating their expression. - r.collect(inputs.Expr) - return data - } - r.expand(object) - if r.all { - return data - } - file.Body().SetAttributeRaw(inputsAttribute, r.objectTokens(object, data, name)) - return file.Bytes() -} - -func (r *inputReferences) collectBody(body *hclsyntax.Body) { - for name, attr := range body.Attributes { - if name != inputsAttribute { - r.collect(attr.Expr) - } - } - for _, block := range body.Blocks { - r.collect(block.Body) - } -} - -func (r *inputReferences) expand(object *hclsyntax.ObjectConsExpr) { - // A selected value may reference another input key. Reach a fixed point before - // pruning so source order does not determine which values survive. - for { - count := len(r.keys) - for _, item := range object.Items { - key, diags := item.KeyExpr.Value(nil) - if diags.HasErrors() || !key.IsKnown() || key.IsNull() || key.Type() != cty.String { - // Preserve computed keys rather than silently selecting a fallback path. - r.all = true - return - } - if r.keys[key.AsString()] { - r.collect(item.ValueExpr) - } - } - if r.all { - return - } - if count == len(r.keys) { - return - } - } -} - -func (r *inputReferences) objectTokens(object *hclsyntax.ObjectConsExpr, data []byte, name string) hclwrite.Tokens { - var attributes []hclwrite.ObjectAttrTokens - for _, item := range object.Items { - key, _ := item.KeyExpr.Value(nil) - if !r.keys[key.AsString()] { - continue - } - // Reparse the value as an attribute to preserve arbitrary HCL expressions. - value := item.ValueExpr.Range().SliceBytes(data) - expression, _ := hclwrite.ParseConfig(append(append([]byte("value = "), value...), '\n'), name, hcl.InitialPos) - attributes = append(attributes, hclwrite.ObjectAttrTokens{ - Name: hclwrite.TokensForValue(key), - Value: expression.Body().GetAttribute("value").Expr().BuildTokens(nil), - }) - } - return hclwrite.TokensForObject(attributes) -} - -func (r *inputReferences) collect(node hclsyntax.Node) { - _ = hclsyntax.VisitAll(node, func(node hclsyntax.Node) hcl.Diagnostics { - switch expression := node.(type) { - case *hclsyntax.ScopeTraversalExpr: - r.traversal(expression.Traversal) - case *hclsyntax.RelativeTraversalExpr: - r.traversal(expression.Traversal) - } - return nil - }) -} - -func (r *inputReferences) traversal(traversal hcl.Traversal) { - for i, step := range traversal { - name, _ := traversalName(step) - if name != inputsAttribute { - continue - } - if i+1 == len(traversal) { - r.all = true - return - } - key, known := traversalName(traversal[i+1]) - if known { - r.keys[key] = true - } else { - r.all = true - } - } -} - -func traversalName(step hcl.Traverser) (string, bool) { - switch step := step.(type) { - case hcl.TraverseRoot: - return step.Name, true - case hcl.TraverseAttr: - return step.Name, true - case hcl.TraverseIndex: - if step.Key.IsKnown() && !step.Key.IsNull() && step.Key.Type() == cty.String { - return step.Key.AsString(), true - } - } - return "", false -} diff --git a/plugins/terragrunt/internal/engine/resolve.go b/plugins/terragrunt/internal/engine/resolve.go index fdf4f30b756..4832be86de8 100644 --- a/plugins/terragrunt/internal/engine/resolve.go +++ b/plugins/terragrunt/internal/engine/resolve.go @@ -8,12 +8,16 @@ import ( "os" "path/filepath" "strings" + "sync" "github.com/gruntwork-io/terragrunt/pkg/atmosbridge" "github.com/gruntwork-io/terragrunt/pkg/config" "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/gruntwork-io/terragrunt/pkg/log/format" "github.com/gruntwork-io/terragrunt/pkg/options" + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl/v2/hclwrite" "github.com/spf13/afero" "github.com/zclconf/go-cty/cty" @@ -251,6 +255,157 @@ func (f withoutInputsFS) projectFile(file afero.File, name string) (afero.File, return memory.Open(name) } +const inputsAttribute = "inputs" + +// inputReferences tracks input keys used by the probe, including references in +// retained input values. A whole-map or dynamic reference requires all inputs. +// The parser may read included files concurrently. +type inputReferences struct { + mu sync.Mutex + root string + keys map[string]bool + all bool +} + +func newInputReferences(root string) *inputReferences { + return &inputReferences{root: root, keys: map[string]bool{}} +} + +// project preserves syntax errors for the upstream parser to diagnose. +func (r *inputReferences) project(name string, data []byte) []byte { + parsed, diags := hclsyntax.ParseConfig(data, name, hcl.InitialPos) + if diags.HasErrors() { + return data + } + body := parsed.Body.(*hclsyntax.Body) + r.mu.Lock() + defer r.mu.Unlock() + r.collectBody(body) + inputs := body.Attributes[inputsAttribute] + if inputs == nil { + return data + } + file, _ := hclwrite.ParseConfig(data, name, hcl.InitialPos) + if name == r.root || (!r.all && len(r.keys) == 0) { + file.Body().RemoveAttribute(inputsAttribute) + return file.Bytes() + } + if r.all { + return data + } + object, ok := inputs.Expr.(*hclsyntax.ObjectConsExpr) + if !ok { + // Computed maps cannot be safely pruned without evaluating their expression. + r.collect(inputs.Expr) + return data + } + r.expand(object) + if r.all { + return data + } + file.Body().SetAttributeRaw(inputsAttribute, r.objectTokens(object, data, name)) + return file.Bytes() +} + +func (r *inputReferences) collectBody(body *hclsyntax.Body) { + for name, attr := range body.Attributes { + if name != inputsAttribute { + r.collect(attr.Expr) + } + } + for _, block := range body.Blocks { + r.collect(block.Body) + } +} + +func (r *inputReferences) expand(object *hclsyntax.ObjectConsExpr) { + // A selected value may reference another input key. Reach a fixed point before + // pruning so source order does not determine which values survive. + for { + count := len(r.keys) + for _, item := range object.Items { + key, diags := item.KeyExpr.Value(nil) + if diags.HasErrors() || !key.IsKnown() || key.IsNull() || key.Type() != cty.String { + // Preserve computed keys rather than silently selecting a fallback path. + r.all = true + return + } + if r.keys[key.AsString()] { + r.collect(item.ValueExpr) + } + } + if r.all { + return + } + if count == len(r.keys) { + return + } + } +} + +func (r *inputReferences) objectTokens(object *hclsyntax.ObjectConsExpr, data []byte, name string) hclwrite.Tokens { + var attributes []hclwrite.ObjectAttrTokens + for _, item := range object.Items { + key, _ := item.KeyExpr.Value(nil) + if !r.keys[key.AsString()] { + continue + } + // Reparse the value as an attribute to preserve arbitrary HCL expressions. + value := item.ValueExpr.Range().SliceBytes(data) + expression, _ := hclwrite.ParseConfig(append(append([]byte("value = "), value...), '\n'), name, hcl.InitialPos) + attributes = append(attributes, hclwrite.ObjectAttrTokens{ + Name: hclwrite.TokensForValue(key), + Value: expression.Body().GetAttribute("value").Expr().BuildTokens(nil), + }) + } + return hclwrite.TokensForObject(attributes) +} + +func (r *inputReferences) collect(node hclsyntax.Node) { + _ = hclsyntax.VisitAll(node, func(node hclsyntax.Node) hcl.Diagnostics { + switch expression := node.(type) { + case *hclsyntax.ScopeTraversalExpr: + r.traversal(expression.Traversal) + case *hclsyntax.RelativeTraversalExpr: + r.traversal(expression.Traversal) + } + return nil + }) +} + +func (r *inputReferences) traversal(traversal hcl.Traversal) { + for i, step := range traversal { + name, _ := traversalName(step) + if name != inputsAttribute { + continue + } + if i+1 == len(traversal) { + r.all = true + return + } + key, known := traversalName(traversal[i+1]) + if known { + r.keys[key] = true + } else { + r.all = true + } + } +} + +func traversalName(step hcl.Traverser) (string, bool) { + switch step := step.(type) { + case hcl.TraverseRoot: + return step.Name, true + case hcl.TraverseAttr: + return step.Name, true + case hcl.TraverseIndex: + if step.Key.IsKnown() && !step.Key.IsNull() && step.Key.Type() == cty.String { + return step.Key.AsString(), true + } + } + return "", false +} + // unitResolution converts the parsed unit into its local module identity. func unitResolution(logger log.Logger, environment *atmosbridge.Venv, pctx *config.ParsingContext, request model.Request, cfg *config.TerragruntConfig, path string) (*model.Resolution, error) { result := &model.Resolution{Path: path, Inputs: cfg.Inputs, Source: *cfg.Terraform.Source, Generated: map[string]string{}, Files: append(pctx.FilesRead.Paths(), path)}