Skip to content
Closed
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bf70a89
fix: Resolve template regression with {{ .atmos_component }} in non-.…
aknysh Jan 28, 2026
82f9336
fix: Add --verify=false to helm plugin install in Dockerfile
aknysh Jan 28, 2026
b290594
fix: propagate AuthManager to YAML functions in terraform shell command
aknysh Jan 28, 2026
0e7c438
docs: add date to fix documentation files
aknysh Jan 28, 2026
b71eb42
update packages
aknysh Jan 28, 2026
1d11c47
fix: correctly parse YAML strings ending with colons in yq expressions
aknysh Jan 28, 2026
1dff997
fix: add JIT vendoring support to generate varfile and generate backend
aknysh Jan 28, 2026
028146a
fix: support quoted two-word terraform commands like "providers lock"
aknysh Jan 28, 2026
9b3dc6a
fix: route shell subcommand correctly when invoked from Atmos UI
aknysh Jan 28, 2026
0f181b6
fix: enable settings to reference locals in stack manifests
aknysh Jan 28, 2026
7e3071b
test: increase test coverage for branch changes
aknysh Jan 28, 2026
404b884
fix: make new tests Windows-compatible
aknysh Jan 28, 2026
0f57abb
fix: resolve locals and spacelift_stack templates in describe component
aknysh Jan 29, 2026
eb56bbf
update tests
aknysh Jan 29, 2026
f12d993
update docs
aknysh Jan 29, 2026
6867784
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 29, 2026
2cc8323
fix: address CodeRabbit review comments and improve test coverage
aknysh Jan 29, 2026
b95ca74
fix: address additional CodeRabbit nitpick comments
aknysh Jan 29, 2026
6d19bc7
fix: address latest CodeRabbit review comments
aknysh Jan 29, 2026
2e62a27
fix: use filepath.Join for Windows-compatible path assertion
aknysh Jan 29, 2026
2b59bc1
refactor: rename "two-word command" to "compound subcommand" terminology
aknysh Jan 29, 2026
a695c8c
feat: register terraform compound subcommands in Cobra command tree
aknysh Jan 29, 2026
5c97aa0
test: increase coverage for compound subcommand handling
aknysh Jan 29, 2026
46299bb
docs: add dedicated documentation pages for terraform compound subcom…
aknysh Jan 29, 2026
3ca2e94
fix: use platform-appropriate absolute paths in NeedsPathResolution t…
aknysh Jan 29, 2026
3edf956
refactor: extract shared auth manager creation to eliminate duplication
aknysh Jan 29, 2026
3686813
Merge branch 'main' into aknysh/fix-issues-5
aknysh Jan 29, 2026
c234a15
Merge branch 'main' into aknysh/fix-issues-5
aknysh Jan 30, 2026
34d5b7a
fix: register Viper defaults for template settings to survive config …
aknysh Jan 30, 2026
dd84577
fix: address CodeRabbit review comments
aknysh Jan 30, 2026
af93517
fix: address additional CodeRabbit review comments
aknysh Jan 30, 2026
0050089
fix: improve Windows compatibility in test path helpers and assertions
aknysh Jan 30, 2026
6e3ad09
refactor: split compound subcommands and website updates to fix-issues-6
aknysh Jan 30, 2026
6bfa444
test: improve patch coverage for varfile, backend, describe-stacks, a…
aknysh Jan 30, 2026
044ba4f
ci: re-trigger Windows CI to verify flaky test
aknysh Jan 30, 2026
3f37b47
fix: address CodeRabbit review comments on test files
aknysh Jan 31, 2026
ef668cd
fix: use forward-slash literals in TestBuildComponentInfo path assert…
aknysh Jan 31, 2026
cf28a7d
fix: address CodeRabbit review comments on PR #2035
aknysh Jan 31, 2026
a888273
Merge branch 'main' into aknysh/fix-issues-5
aknysh Jan 31, 2026
f896f27
updates
aknysh Feb 1, 2026
65f75e3
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 1, 2026
1027de4
refactor: route terraform shell through ExecuteTerraformShell directly
aknysh Feb 2, 2026
d96ea18
Merge branch 'main' into aknysh/fix-issues-5
aknysh Feb 2, 2026
4472f3a
fix: restore files accidentally deleted by split commit and add auth …
aknysh Feb 2, 2026
359729b
Merge branch 'main' into aknysh/fix-issues-5
aknysh Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ RUN set -ex; \
curl -1sSLf "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- /usr/local/bin; \
# Install toolchain used with Atmos \
apt-get -y install --no-install-recommends terraform kubectl helmfile helm; \
# Install the helm-diff plugin required by Helmfile
helm plugin install https://github.com/databus23/helm-diff; \
# Install the helm-diff plugin required by Helmfile.
# Helm 4 requires --verify=false because helm-diff does not ship .prov signature files.
helm plugin install --verify=false https://github.com/databus23/helm-diff; \
# Clean up the package lists to keep the image clean
rm -rf /var/lib/apt/lists/*

Expand Down
38 changes: 19 additions & 19 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- cloud.google.com/go/auth
License: Apache-2.0
URL: https://github.com/googleapis/google-cloud-go/blob/auth/v0.18.0/auth/LICENSE
URL: https://github.com/googleapis/google-cloud-go/blob/auth/v0.18.1/auth/LICENSE

- cloud.google.com/go/auth/oauth2adapt
License: Apache-2.0
Expand Down Expand Up @@ -51,7 +51,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- cloud.google.com/go/storage
License: Apache-2.0
URL: https://github.com/googleapis/google-cloud-go/blob/storage/v1.58.0/storage/LICENSE
URL: https://github.com/googleapis/google-cloud-go/blob/storage/v1.59.2/storage/LICENSE

- cuelang.org/go
License: Apache-2.0
Expand Down Expand Up @@ -119,7 +119,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- github.com/aws/aws-sdk-go-v2/feature/s3/manager
License: Apache-2.0
URL: https://github.com/aws/aws-sdk-go-v2/blob/feature/s3/manager/v1.20.19/feature/s3/manager/LICENSE.txt
URL: https://github.com/aws/aws-sdk-go-v2/blob/feature/s3/manager/v1.21.1/feature/s3/manager/LICENSE.txt

- github.com/aws/aws-sdk-go-v2/internal/configsources
License: Apache-2.0
Expand Down Expand Up @@ -159,7 +159,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- github.com/aws/aws-sdk-go-v2/service/s3
License: Apache-2.0
URL: https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.95.1/service/s3/LICENSE.txt
URL: https://github.com/aws/aws-sdk-go-v2/blob/service/s3/v1.96.0/service/s3/LICENSE.txt

- github.com/aws/aws-sdk-go-v2/service/secretsmanager
License: Apache-2.0
Expand Down Expand Up @@ -307,7 +307,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- github.com/googleapis/enterprise-certificate-proxy/client
License: Apache-2.0
URL: https://github.com/googleapis/enterprise-certificate-proxy/blob/v0.3.9/LICENSE
URL: https://github.com/googleapis/enterprise-certificate-proxy/blob/v0.3.11/LICENSE

- github.com/gosimple/unidecode
License: Apache-2.0
Expand Down Expand Up @@ -363,15 +363,15 @@ APACHE 2.0 LICENSED DEPENDENCIES

- github.com/open-policy-agent/opa
License: Apache-2.0
URL: https://github.com/open-policy-agent/opa/blob/v1.12.2/LICENSE
URL: https://github.com/open-policy-agent/opa/blob/v1.12.3/LICENSE

- github.com/open-policy-agent/opa/internal/gojsonschema
License: Apache-2.0
URL: https://github.com/open-policy-agent/opa/blob/v1.12.2/internal/gojsonschema/LICENSE-APACHE-2.0.txt
URL: https://github.com/open-policy-agent/opa/blob/v1.12.3/internal/gojsonschema/LICENSE-APACHE-2.0.txt

- github.com/open-policy-agent/opa/internal/semver
License: Apache-2.0
URL: https://github.com/open-policy-agent/opa/blob/v1.12.2/internal/semver/LICENSE
URL: https://github.com/open-policy-agent/opa/blob/v1.12.3/internal/semver/LICENSE

- github.com/opencontainers/go-digest
License: Apache-2.0
Expand Down Expand Up @@ -507,7 +507,7 @@ APACHE 2.0 LICENSED DEPENDENCIES

- google.golang.org/genproto/googleapis/rpc
License: Apache-2.0
URL: https://github.com/googleapis/go-genproto/blob/0a764e51fe1b/googleapis/rpc/LICENSE
URL: https://github.com/googleapis/go-genproto/blob/8e98ce8d340d/googleapis/rpc/LICENSE

- google.golang.org/grpc
License: Apache-2.0
Expand Down Expand Up @@ -688,7 +688,7 @@ BSD LICENSED DEPENDENCIES

- github.com/open-policy-agent/opa/internal/edittree/bitvector
License: BSD-3-Clause
URL: https://github.com/open-policy-agent/opa/blob/v1.12.2/internal/edittree/bitvector/license.txt
URL: https://github.com/open-policy-agent/opa/blob/v1.12.3/internal/edittree/bitvector/license.txt

- github.com/pierrec/lz4/v4
License: BSD-3-Clause
Expand All @@ -712,7 +712,7 @@ BSD LICENSED DEPENDENCIES

- github.com/redis/go-redis/v9
License: BSD-2-Clause
URL: https://github.com/redis/go-redis/blob/v9.17.2/LICENSE
URL: https://github.com/redis/go-redis/blob/v9.17.3/LICENSE

- github.com/rogpeppe/go-internal/fmtsort
License: BSD-3-Clause
Expand Down Expand Up @@ -788,11 +788,11 @@ BSD LICENSED DEPENDENCIES

- google.golang.org/api
License: BSD-3-Clause
URL: https://github.com/googleapis/google-api-go-client/blob/v0.260.0/LICENSE
URL: https://github.com/googleapis/google-api-go-client/blob/v0.264.0/LICENSE

- google.golang.org/api/internal/third_party/uritemplates
License: BSD-3-Clause
URL: https://github.com/googleapis/google-api-go-client/blob/v0.260.0/internal/third_party/uritemplates/LICENSE
URL: https://github.com/googleapis/google-api-go-client/blob/v0.264.0/internal/third_party/uritemplates/LICENSE

- google.golang.org/protobuf
License: BSD-3-Clause
Expand Down Expand Up @@ -913,7 +913,7 @@ MOZILLA PUBLIC LICENSE (MPL) 2.0 DEPENDENCIES

- github.com/hashicorp/terraform-config-inspect/tfconfig
License: MPL-2.0
URL: https://github.com/hashicorp/terraform-config-inspect/blob/225c06ed5fd9/LICENSE
URL: https://github.com/hashicorp/terraform-config-inspect/blob/785479628bd7/LICENSE

- github.com/hashicorp/terraform-exec
License: MPL-2.0
Expand Down Expand Up @@ -950,7 +950,7 @@ MIT LICENSED DEPENDENCIES

- al.essio.dev/pkg/shellescape
License: MIT
URL: https://github.com/alessio/shellescape/blob/v1.5.1/LICENSE
URL: https://github.com/alessio/shellescape/blob/v1.6.0/LICENSE

- github.com/99designs/keyring
License: MIT
Expand Down Expand Up @@ -1034,7 +1034,7 @@ MIT LICENSED DEPENDENCIES

- github.com/alecthomas/chroma/v2
License: MIT
URL: https://github.com/alecthomas/chroma/blob/v2.23.0/COPYING
URL: https://github.com/alecthomas/chroma/blob/v2.23.1/COPYING

- github.com/alecthomas/participle/v2/lexer
License: MIT
Expand Down Expand Up @@ -1078,7 +1078,7 @@ MIT LICENSED DEPENDENCIES

- github.com/bmatcuk/doublestar/v4
License: MIT
URL: https://github.com/bmatcuk/doublestar/blob/v4.9.2/LICENSE
URL: https://github.com/bmatcuk/doublestar/blob/v4.10.0/LICENSE

- github.com/catppuccin/go
License: MIT
Expand Down Expand Up @@ -1506,7 +1506,7 @@ MIT LICENSED DEPENDENCIES

- github.com/posthog/posthog-go
License: MIT
URL: https://github.com/posthog/posthog-go/blob/v1.9.0/LICENSE.md
URL: https://github.com/posthog/posthog-go/blob/v1.9.1/LICENSE.md

- github.com/rivo/uniseg
License: MIT
Expand Down Expand Up @@ -1610,7 +1610,7 @@ MIT LICENSED DEPENDENCIES

- github.com/yuin/goldmark
License: MIT
URL: https://github.com/yuin/goldmark/blob/v1.7.8/LICENSE
URL: https://github.com/yuin/goldmark/blob/v1.7.16/LICENSE

- github.com/yuin/goldmark-emoji
License: MIT
Expand Down
2 changes: 2 additions & 0 deletions cmd/terraform/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ as you would in a typical setup, but within the configured Atmos environment.`,
processFunctions := v.GetBool("process-functions")
skip := v.GetStringSlice("skip")
dryRun := v.GetBool("dry-run")
identity := v.GetString("identity")

// Prompt for stack if missing.
if stack == "" {
Expand Down Expand Up @@ -103,6 +104,7 @@ as you would in a typical setup, but within the configured Atmos environment.`,
Component: component,
Stack: stack,
DryRun: dryRun,
Identity: identity,
ProcessingOptions: e.ProcessingOptions{
ProcessTemplates: processTemplates,
ProcessFunctions: processFunctions,
Expand Down
142 changes: 142 additions & 0 deletions docs/fixes/atmos-pro-template-regression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Regression: Template variables `.atmos_component` and `.atmos_stack` fail in 1.205

**Date:** 2026-01-28

## Issue Summary

Starting in Atmos 1.205, stack manifests that use `{{ .atmos_component }}` or `{{ .atmos_stack }}`
in non-template files (without `.tmpl` extension) fail with:

```text
Error: failed to execute describe stacks: invalid stack manifest: template: mixins/atmos-pro.yaml:4:21:
executing "mixins/atmos-pro.yaml" at <.atmos_component>: map has no entry for key "atmos_component"
```

This worked correctly in Atmos 1.204.

## Affected Configuration

Example `mixins/atmos-pro.yaml`:

```yaml
plan-wf-config: &plan-wf-config
atmos-terraform-plan.yaml:
inputs:
component: "{{ .atmos_component }}"
stack: "{{ .atmos_stack }}"

apply-wf-config: &apply-wf-config
atmos-terraform-apply.yaml:
inputs:
component: "{{ .atmos_component }}"
stack: "{{ .atmos_stack }}"
github_environment: "{{ .atmos_stack }}"

settings:
pro:
enabled: true
pull_request:
opened:
workflows: *plan-wf-config
# ... more workflow configs
```

## Root Cause Analysis

The regression was introduced in commit `6ae0a2715` ("Resolve file-scoped locals in stack configurations").

### Previous Behavior (1.204)

In 1.204, template processing during import was controlled by this condition in `stack_processor_utils.go`:

```go
if !skipTemplatesProcessingInImports && (u.IsTemplateFile(filePath) || len(context) > 0) {
stackManifestTemplatesProcessed, tmplErr = ProcessTmpl(...)
}
```

For non-`.tmpl` files imported without explicit context:
- `u.IsTemplateFile(filePath)` = false (no `.tmpl` extension)
- `len(context)` = 0 (no context passed)
- **Result: Templates NOT processed during import** ✓

Templates like `{{ .atmos_component }}` were left unresolved during import and only processed
later in `describe_stacks.go` when component context was available.

### New Behavior (1.205)

The locals feature added `extractAndAddLocalsToContext()` which extracts `settings`, `vars`,
`env`, and `locals` from the file itself and adds them to the context:

```go
// New code in extractAndAddLocalsToContext
if extractResult.settings != nil {
context[cfg.SettingsSectionName] = extractResult.settings
}
if extractResult.vars != nil {
context[cfg.VarsSectionName] = extractResult.vars
}
```

Now for files with a `settings`, `vars`, `env`, or `locals` section:
- `u.IsTemplateFile(filePath)` = false (no `.tmpl` extension)
- `len(context)` > 0 (context now contains settings/vars/env/locals from the file!)
- **Result: Templates ARE processed during import** ✗

But `atmos_component` and `atmos_stack` are NOT in the context because they're only set
later during component processing in `describe_stacks.go`.

## Fix

The fix tracks whether context was "originally provided" vs "populated from file extraction".
Template processing during import should only occur when:

1. The file has a `.tmpl` extension, OR
2. Context was explicitly passed from outside (not just extracted from the file itself)

### Implementation

Modified `ProcessBaseStackConfig` in `internal/exec/stack_processor_utils.go`:

1. Added tracking of original context before locals extraction:
```go
// Track whether context was originally provided from outside (e.g., via import context).
originalContextProvided := len(context) > 0
```

2. Changed the template processing condition from:
```go
// OLD (1.205 bug):
if !skipTemplatesProcessingInImports && (u.IsTemplateFile(filePath) || len(context) > 0) {
```

To:
```go
// NEW (fixed):
if !skipTemplatesProcessingInImports && (u.IsTemplateFile(filePath) || originalContextProvided) {
```

This ensures templates like `{{ .atmos_component }}` are NOT processed during import when the
only reason context is non-empty is because of file-extracted locals/settings/vars/env.

## Steps to Reproduce

1. Create `mixins/atmos-pro.yaml` with `settings` section and `{{ .atmos_component }}` templates
2. Import this mixin in a stack
3. Run `atmos describe stacks`

### Expected Result (1.204)

Stack description succeeds. Template variables are resolved later when component context is available.

### Actual Result (1.205)

```text
Error: failed to execute describe stacks: invalid stack manifest: template: mixins/atmos-pro.yaml:4:21:
executing "mixins/atmos-pro.yaml" at <.atmos_component>: map has no entry for key "atmos_component"
```

## Test Case

See `internal/exec/stack_processor_utils_test.go`:
- `TestTemplateProcessingWithAtmosComponentInNonTemplateFile`
Loading