Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
eafa0ec
feat(terragrunt): support terraform_binary, errors, exclude, features…
osterman Oct 31, 2026
5a1e670
test(terragrunt): remove a data race and an ANSI sensitivity from the…
osterman Nov 1, 2026
200a06d
refactor(stack): move applyUnitOverrides into configuration_imports.go
osterman Nov 9, 2026
1aeeeb0
fix(terragrunt): address review findings on exclusions, IAM, registry…
osterman Nov 10, 2026
167e3c4
fix(terragrunt): preserve signal numbers and literal templates
osterman Nov 11, 2026
f7e2a95
fix(execution): safely write and report error signals
osterman Nov 11, 2026
9e00d92
fix(execution): match recovery policies against stderr
osterman Nov 11, 2026
6925b32
test(terragrunt): assert complete token file path
osterman Nov 11, 2026
a8007af
test(terragrunt): verify registry authentication per endpoint
osterman Nov 11, 2026
a64fbd6
test(plugin): verify decoded sensitive strings are masked
osterman Nov 11, 2026
da275f1
test(terragrunt): count exhausted retry attempts
osterman Nov 11, 2026
e038e76
fix(affected): resolve project aliases for watch exclusions
osterman Nov 11, 2026
30a1c9c
test(terraform): assert overlapping retry warning
osterman Nov 11, 2026
eba397f
test(execution): generate recovery reporter mock
osterman Nov 11, 2026
b262570
fix(terraform): report excluded components without failing checks
osterman Nov 11, 2026
84bb256
fix(terraform): exclude units before graph validation
osterman Nov 11, 2026
c5a3f99
test(terraform): generate configuration import runtime mocks
osterman Nov 11, 2026
25bbea1
fix(terraform): warn when a kept backend file drops state encryption
osterman Nov 13, 2026
8d3680f
fix(plugin): require component preparation contract version 2
osterman Nov 13, 2026
98321bf
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 13, 2026
01b873b
fix: harden Terragrunt native execution and recovery
osterman Nov 13, 2026
eb5f5c2
fix(terragrunt): stage unit IAM and registry auth across the preparat…
osterman Nov 13, 2026
5eb2df1
fix(configuration): wrap generated-file manifest write failures
osterman Nov 13, 2026
07fc9f7
docs(plugin): describe the wired stack and execution integration
osterman Nov 13, 2026
f0fff1c
fix(terragrunt): address L7 review findings for IAM, lint, encryption…
osterman Nov 13, 2026
88b1059
fix(auth): resolve inline role base credentials from the invocation e…
osterman Nov 13, 2026
9c26b90
Merge published L6 head 9dcaf4d90a into feat/terragrunt-native-semantics
osterman Nov 13, 2026
42eb785
Merge published L6 head 5b256735e6 into feat/terragrunt-native-semantics
osterman Nov 13, 2026
109523f
Merge L6 plugin package authentication into L7
osterman Nov 13, 2026
a127de7
fix(terragrunt): preserve local root subdirectory modules
osterman Nov 13, 2026
b8716a8
fix(terraform): scope backend generation to invocation
osterman Nov 13, 2026
4a793a8
fix(schema): accept local module source subdirectories
osterman Nov 13, 2026
ef72d66
fix(ci): retain DNS repair for autofix runner reporting
osterman Nov 14, 2026
a07fd1d
fix(auth): apply the invocation STS endpoint to profile role chains a…
osterman Nov 14, 2026
84aab45
fix(plugin): attribute the registry duration inside the provider span
osterman Nov 14, 2026
d78fc87
fix(terragrunt): bind TFLint inputs after the host merges stack varia…
osterman Nov 14, 2026
6dcf3be
test(terraform): generate the IAM-probing runtime mock
osterman Nov 14, 2026
f45b715
fix(terragrunt): make generated units available during the IAM probe
osterman Nov 14, 2026
be2a736
fix(terragrunt): use one OpenTofu detection rule in the engine and pr…
osterman Nov 14, 2026
11648f1
fix(component): resolve a missing source_subdir after provisioning, n…
osterman Nov 14, 2026
96f4b43
fix(terraform): skip plan recording when an ignored main command fails
osterman Nov 14, 2026
8f3c07e
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 14, 2026
dafa35b
refactor(source): split local source and vendor validation helpers
osterman Nov 14, 2026
34f6e1d
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 14, 2026
a92e1d8
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 14, 2026
2494d0b
test: carry three tests moved up from the previous layer
osterman Nov 14, 2026
0616a70
fix(terragrunt): read ignore policies before retrying registry resolu…
osterman Nov 14, 2026
518ec3d
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 14, 2026
ab3823c
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 14, 2026
e8b1eb8
test(terraform): strip ANSI styling before matching the ignored-run w…
osterman Nov 14, 2026
e046b2a
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 14, 2026
9e9bc36
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 15, 2026
be832b5
fix(terragrunt): match retry patterns on cleaned text and probe IAM w…
osterman Nov 15, 2026
bde9cce
fix(component): clear the applied subpath marker when the workdir roo…
osterman Nov 15, 2026
a20d07b
fix(auth): resolve inline role base credentials from the invocation f…
osterman Nov 15, 2026
2ae1a64
docs(proto): describe how the host reads fields 13 to 18 of PrepareCo…
osterman Nov 15, 2026
b490703
Merge feat/terragrunt-native-hardening into feat/terragrunt-native-se…
osterman Nov 15, 2026
a50f5d2
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 15, 2026
352bc74
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 16, 2026
a171e10
fix: address the review findings on the native Terragrunt semantics l…
osterman Nov 16, 2026
d9801ad
Merge branch 'feat/terragrunt-native-hardening' into feat/terragrunt-…
osterman Nov 16, 2026
5e3e30d
test(terragrunt): compare the terraform_binary path as the unit wrote it
osterman Nov 16, 2026
bc52e37
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 16, 2026
6a886b2
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 16, 2026
0188597
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 16, 2026
131b794
fix(auth): bound container credential requests with timeouts
osterman Nov 16, 2026
967c4fc
fix(terragrunt): keep resolved URL credentials out of the rejected-so…
osterman Nov 16, 2026
a56eee9
fix(terragrunt): resolve a bare terraform_binary on the invocation PA…
osterman Nov 16, 2026
6e0784a
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 16, 2026
7f6723b
fix(terragrunt): warn instead of probing a unit binary the stack over…
osterman Nov 16, 2026
8e2c34d
Merge remote-tracking branch 'origin/feat/terragrunt-native-hardening…
osterman Nov 16, 2026
5170cfb
fix(terragrunt): isolate credentials and refresh ignored run signals
osterman Nov 17, 2026
7a42432
Merge L6 main integration into Terragrunt native semantics
osterman Nov 17, 2026
d1a74d8
Merge final L6 consolidation and group L7 parity helpers
osterman Nov 17, 2026
815b93f
Merge final Terragrunt hardening and close credential cache safety gaps
osterman Nov 17, 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
8 changes: 5 additions & 3 deletions .github/actions/harden-runner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ proxy binds or its eBPF block policy finishes initializing, especially while
upstream API requests retry. The helper does not widen firewall permissions or
change Docker DNS. Other runner types retain StepSecurity's normal behavior.

Set `dns-repair: 'false'` for jobs that need no DNS, such as the echo-only autofix
workflow, or to observe the original behavior in diagnostics. This disables only
the resolver repair; StepSecurity still runs with the selected policy.
Keep DNS repair enabled even for echo-only jobs: the runner still needs DNS
for cleanup and final job reporting. The helper detects eBPF enforcement and
retains host DNS when no proxy is required. Set `dns-repair: 'false'` only to
observe the original behavior in diagnostics. This disables only the resolver
repair; StepSecurity still runs with the selected policy.
The diagnostic workflow invokes the internal helper later to measure before and
after on the same runner. Normal workflows need only the composite above.

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
- name: Harden Runner
uses: $/.github/actions/harden-runner # nosemgrep: yaml.github-actions.security.github-actions-mutable-action-tag.github-actions-mutable-action-tag
with:
# This job makes no network calls at all (just echo); block all egress.
# No workload endpoints are needed; retain StepSecurity implicit endpoints.
policies: >-
none
# The echo-only job needs no DNS; eBPF agents do not expose the legacy resolver.
dns-repair: 'false'
# Keep default DNS repair: the runner still needs final job reporting.
- run: echo "See Atmos Pro"
6 changes: 4 additions & 2 deletions docs/prd/plugins/platform/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,17 @@ The runtime writes events to caller-provided stdout/stderr writers; callers supp

### Component configuration services

The component configuration protocol, generated CLI and SDK bindings, and component-specific host descriptors, package loading, and adapters are planned. CLI stack and execution integration are also unavailable. These proposed 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. Stack processing and Terraform execution call the plugin configuration runtime for components that declare a `configuration` settings section, and that call reaches the provider `Prepare` RPC. These independently negotiated services replace the earlier proposed monolithic `Component` service. Discovery, validation, and state use version 1. Preparation uses version 2:

| Capability | RPC | Result |
|---|---|---|
| `component.discovery` | `ComponentDiscovery.Discover` | Logical instances, source watches, and dependency edges for an explicit root/revision. |
| `component.validation` | `ComponentValidation.Validate` | Unsupported mode/command/options diagnostics before effects. |
| `component.preparation` | `ComponentPreparation.Prepare` | Fresh inputs, module, backend identity, and literal generated files. |
| `component.preparation` | `ComponentPreparation.Prepare` | Fresh inputs, module, backend identity, literal generated files, backend ownership, and execution metadata. |
| `component.state` | `ComponentState.Resolve` | Backend/workspace identity without preparation. |

Preparation version 2 adds `terraform_arguments` to the request, and `backend_generated` and `execution` to the response. A host that only speaks version 1 would ignore these fields, drop hooks and extra arguments, and omit the arguments that `prevent_destroy` checks. The version change makes such a host reject the plugin during the handshake, before preparation. The manifest declares the same requirement as `component.preparation: ">=2 <3"`.

`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.
Expand Down
8 changes: 8 additions & 0 deletions errors/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ var (
ErrComponentVarFileMissing = errors.New("required variable file does not exist")
// ErrComponentHookWorkingDirectory identifies a hook whose working directory does not exist.
ErrComponentHookWorkingDirectory = errors.New("hook working directory does not exist")
// ErrComponentMaxAttempts identifies a command that kept failing with a retryable error until its retry policy ran out of attempts.
ErrComponentMaxAttempts = errors.New("maximum retry attempts reached")
// ErrComponentBinaryChanged identifies a unit whose terraform_binary differs from the one it was discovered with.
ErrComponentBinaryChanged = errors.New("terraform_binary changed after discovery")
// ErrComponentRunIgnored ends a component run successfully after error handling ignored a failure in a preparatory step.
ErrComponentRunIgnored = errors.New("component run ended by an ignored error")
// ErrComponentExcluded ends a component run successfully because the provider excluded the operation.
ErrComponentExcluded = errors.New("component excluded from this operation")
// ErrComponentOutputCapture identifies command output that could not be recorded for error hook matching.
ErrComponentOutputCapture = errors.New("failed to capture command output for error hooks")

Expand Down
4 changes: 2 additions & 2 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion internal/exec/configuration_imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ func TestConfigurationWatchExclusionsDoNotChangeSharedIndex(t *testing.T) {
filtered, err := configurationWatchIndex(config, settings, index)
require.NoError(t, err)
require.Equal(t, []string{filepath.Join(root, "live", "new.yaml")}, filtered.getAllFiles())
require.Len(t, index.getAllFiles(), 2)
require.ElementsMatch(t, []string{filepath.Join(root, "live", ".terragrunt-cache", "generated.tf"), filepath.Join(root, "live", "new.yaml")}, index.getAllFiles(),
"the shared index keeps both changed files, each once")
again, err := configurationWatchIndex(config, settings, index)
require.NoError(t, err)
require.Same(t, filtered, again, "components sharing exclusions must reuse one filtered index")
Expand Down Expand Up @@ -253,6 +254,17 @@ func TestConfigurationWatchExclusionsFailClosedOnPathsOutsideTheProject(t *testi
filtered, err := configurationWatchIndex(config, settings, index)
require.ErrorIs(t, err, errUtils.ErrPluginInvalidConfig)
require.Nil(t, filtered)

// With an absolute project root, a changed file in a sibling directory is outside the project:
// project-relative exclusions cannot describe it, so it stays watched instead of disappearing.
parent := t.TempDir()
root := filepath.Join(parent, "project")
sibling := filepath.Join(parent, "sibling", "main.tf")
config = &schema.AtmosConfiguration{BasePathAbsolute: root}
index = newChangedFilesIndex(config, []string{sibling, filepath.Join(root, "live", "main.tf")}, "")
filtered, err = configurationWatchIndex(config, settings, index)
require.NoError(t, err)
require.Equal(t, []string{sibling}, filtered.getAllFiles())
}

func TestDependencyChangeCheckReportsInvalidWatchExclusions(t *testing.T) {
Expand Down
17 changes: 2 additions & 15 deletions internal/exec/describe_affected_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
errUtils "github.com/cloudposse/atmos/errors"
"github.com/cloudposse/atmos/pkg/auth"
cfg "github.com/cloudposse/atmos/pkg/config"
"github.com/cloudposse/atmos/pkg/filesystem"
log "github.com/cloudposse/atmos/pkg/logger"
"github.com/cloudposse/atmos/pkg/schema"
u "github.com/cloudposse/atmos/pkg/utils"
Expand All @@ -22,21 +23,7 @@ import (
// the non-existent remainder. The plain filepath.EvalSymlinks errors on
// missing paths, and unused helmfile/packer default dirs routinely do not exist.
func evalSymlinksBestEffort(path string) string {
remainder := ""
current := path
for {
resolved, err := filepath.EvalSymlinks(current)
if err == nil {
return filepath.Join(resolved, remainder)
}
parent := filepath.Dir(current)
if parent == current {
// Nothing along the path resolves — return the input unchanged.
return path
}
remainder = filepath.Join(filepath.Base(current), remainder)
current = parent
}
return filesystem.EvalSymlinksBestEffort(path)
}

// rebaseOnePathOntoWorktree maps one absolute config path from the local repo
Expand Down
145 changes: 145 additions & 0 deletions internal/exec/describe_affected_watch_cache_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
package exec

import (
"encoding/json"
"fmt"
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/cloudposse/atmos/pkg/schema"
)

// BenchmarkConfigurationWatchCacheHitDuringBuild measures cached lookup latency
// while another exclusion set is built from a large shared change set.
func BenchmarkConfigurationWatchCacheHitDuringBuild(b *testing.B) {
root := b.TempDir()
config := &schema.AtmosConfiguration{BasePathAbsolute: root, BasePath: root}
files := make([]string, 9000)
for i := range files {
files[i] = filepath.Join(root, "modules", fmt.Sprintf("unit-%d/main.tf", i))
}
settings := func(pattern string) map[string]any {
return map[string]any{"configuration": map[string]any{"watch_excludes": []any{pattern}}}
}
var worstTotal time.Duration
for i := 0; i < b.N; i++ {
index := newChangedFilesIndex(config, files, root)
if _, err := configurationWatchIndex(config, settings("**/.terragrunt-cache/**"), index); err != nil {
b.Fatal(err)
}
done := make(chan error, 1)
go func() { _, err := configurationWatchIndex(config, settings("**/*.md"), index); done <- err }()
var worst time.Duration
loop:
for {
select {
case err := <-done:
if err != nil {
b.Fatal(err)
}
break loop
default:
}
start := time.Now()
if _, err := configurationWatchIndex(config, settings("**/.terragrunt-cache/**"), index); err != nil {
b.Fatal(err)
}
if elapsed := time.Since(start); elapsed > worst {
worst = elapsed
}
}
worstTotal += worst
}
b.ReportMetric(float64(worstTotal.Nanoseconds())/float64(b.N), "max-hit-ns/build")
}

// TestConfigurationWatchIndexConcurrentViews checks publication to concurrent
// callers, independent keys, and preservation of the original change set.
func TestConfigurationWatchIndexConcurrentViews(t *testing.T) {
root := t.TempDir()
config := &schema.AtmosConfiguration{BasePathAbsolute: root, BasePath: root}
files := make([]string, 9000)
for i := range files {
files[i] = filepath.Join("modules", fmt.Sprintf("unit-%d/main.tf", i))
}
files = append(files, "README.md")
index := newChangedFilesIndex(config, files, root)
type result struct {
key int
view *changedFilesIndex
err error
}
results := make(chan result, 32)
start := make(chan struct{})
for i := 0; i < cap(results); i++ {
go func(key int) {
<-start
patterns := []string{"**/*.tf", "**/*.md"}
settings := map[string]any{"configuration": map[string]any{"watch_excludes": []any{patterns[key]}}}
view, err := configurationWatchIndex(config, settings, index)
results <- result{key, view, err}
}(i % 2)
}
close(start)
views := [2]*changedFilesIndex{}
for i := 0; i < cap(results); i++ {
got := <-results
require.NoError(t, got.err)
if views[got.key] == nil {
views[got.key] = got.view
} else {
require.Same(t, views[got.key], got.view)
}
}
require.NotSame(t, views[0], views[1])
require.Equal(t, []string{filepath.Join(root, "README.md")}, views[0].getAllFiles())
require.Len(t, views[1].getAllFiles(), 9000)
require.Len(t, index.getAllFiles(), 9001)
}

// TestConfigurationWatchIndexBuildsAreIsolated verifies that an in-flight key
// does not prevent cached lookups or a different key from being built.
func TestConfigurationWatchIndexBuildsAreIsolated(t *testing.T) {
root := t.TempDir()
config := &schema.AtmosConfiguration{BasePathAbsolute: root, BasePath: root}
index := newChangedFilesIndex(config, []string{"main.tf", "README.md"}, root)
settings := func(pattern string) map[string]any {
return map[string]any{"configuration": map[string]any{"watch_excludes": []any{pattern}}}
}
cached, err := configurationWatchIndex(config, settings("**/*.md"), index)
require.NoError(t, err)
key, err := json.Marshal([]string{root, "**/*.tf"})
require.NoError(t, err)
entered, release := make(chan struct{}), make(chan struct{})
blocked := index.watchBuilds.DoChan(string(key), func() (any, error) {
close(entered)
<-release
return cached, nil
})
defer func() { close(release); <-blocked }()
<-entered
type lookup struct {
sameView bool
err error
}
done := make(chan lookup, 1)
go func() {
hit, err := configurationWatchIndex(config, settings("**/*.md"), index)
if err != nil {
done <- lookup{err: err}
return
}
_, err = configurationWatchIndex(config, settings("**/*.hcl"), index)
done <- lookup{sameView: hit == cached, err: err}
}()
select {
case result := <-done:
require.NoError(t, result.err)
require.True(t, result.sameView, "the cached view must be returned unchanged")
case <-time.After(5 * time.Second):
t.Fatal("an unrelated cache build blocked other keys")
}
}
109 changes: 109 additions & 0 deletions pkg/auth/identities/aws/inline_role.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package aws

import (
"cmp"
"context"
"fmt"
"strings"
"time"

errUtils "github.com/cloudposse/atmos/errors"
"github.com/cloudposse/atmos/pkg/auth/types"
atmosio "github.com/cloudposse/atmos/pkg/io"
"github.com/cloudposse/atmos/pkg/perf"
"github.com/cloudposse/atmos/pkg/schema"
)

// inlineRoleIdentityName names the transient identity behind a role that a component asks for.
const inlineRoleIdentityName = "component-iam-role"

// InlineRole is an IAM role that a component, rather than the Atmos configuration, asks to assume. It
// reuses the aws/assume-role identity, so STS calls, endpoints, and error reporting behave the same way.
type InlineRole struct {
// Role is the role ARN.
Role string
// SessionName is the STS role session name. It defaults to a generated name.
SessionName string
// Duration is the session length. Zero selects the STS default.
Duration time.Duration
// WebIdentityToken selects AssumeRoleWithWebIdentity, which needs no starting credentials.
WebIdentityToken string
}

// AssumeInlineRole assumes the role on top of the AWS credentials found in environ, a list of KEY=VALUE
// entries in which the last entry of a key wins. The starting credentials come from environ alone, in the
// order of the SDK default chain: static keys, a web identity token file, the profile and files that environ
// names, container credentials, then instance metadata. The process environment is neither read nor changed. It returns the
// environment variables that make the new session the credentials of a child process, and registers the
// secrets with the output masker.
func AssumeInlineRole(ctx context.Context, role InlineRole, environ []string) (map[string]string, error) {
defer perf.Track(nil, "aws.AssumeInlineRole")()

env := environMap(environ)
identity, err := NewAssumeRoleIdentity(inlineRoleIdentityName, inlineRoleConfig(role, env))
if err != nil {
return nil, err
}
var base types.ICredentials
if role.WebIdentityToken != "" {
base = &types.OIDCCredentials{Token: role.WebIdentityToken}
} else if base, err = baseCredentials(ctx, env); err != nil {
return nil, err
}
assumed, err := identity.Authenticate(ctx, base)
if err != nil {
return nil, err
}
session, ok := assumed.(*types.AWSCredentials)
if !ok || session.AccessKeyID == "" {
return nil, fmt.Errorf("%w: STS returned no credentials for role %s", errUtils.ErrAuthenticationFailed, role.Role)
}
atmosio.RegisterSecretValue(session.AccessKeyID)
atmosio.RegisterSecretValue(session.SecretAccessKey)
atmosio.RegisterSecretValue(session.SessionToken)
result := map[string]string{
"AWS_ACCESS_KEY_ID": session.AccessKeyID,
"AWS_SECRET_ACCESS_KEY": session.SecretAccessKey,
"AWS_SESSION_TOKEN": session.SessionToken,
"AWS_SECURITY_TOKEN": session.SessionToken,
// Emptied so that a profile never competes with the session for the child process.
"AWS_PROFILE": "",
}
// The region is left to the invocation's own settings: the session does not choose one.
return result, nil
}

// inlineRoleConfig describes the transient aws/assume-role identity. An STS endpoint in the environment,
// as emulators export, directs the call.
func inlineRoleConfig(role InlineRole, env map[string]string) *schema.Identity {
principal := map[string]any{"assume_role": role.Role}
if role.SessionName != "" {
principal[principalSessionNameKey] = role.SessionName
}
if role.Duration > 0 {
principal[principalDurationKey] = fmt.Sprintf("%ds", int64(role.Duration.Seconds()))
}
if region := cmp.Or(env["AWS_REGION"], env["AWS_DEFAULT_REGION"]); region != "" {
principal["region"] = region
}
identity := &schema.Identity{Kind: "aws/assume-role", Principal: principal}
if endpoint := cmp.Or(env["AWS_ENDPOINT_URL_STS"], env["AWS_ENDPOINT_URL"]); endpoint != "" {
identity.Spec = map[string]any{"endpoint_url": endpoint}
}
return identity
}

func environMap(environ []string) map[string]string {
env := make(map[string]string, len(environ))
for _, entry := range environ {
if key, value, ok := strings.Cut(entry, "="); ok {
env[key] = value
}
}
return env
}

// invocationEnvironmentKeys applies SDK alias precedence without changing the invocation map.
func invocationEnvironmentKeys(env map[string]string) (string, string) {
return cmp.Or(env["AWS_ACCESS_KEY_ID"], env["AWS_ACCESS_KEY"]), cmp.Or(env["AWS_SECRET_ACCESS_KEY"], env["AWS_SECRET_KEY"])
}
Loading
Loading