Commit 01541b6
feat: add required field to identities for multi-account Terraform components (#2180)
* feat: support concurrent identities for multi-account Terraform components via auth.needs
Add `auth.needs` field to component auth config, enabling components to declare
which identities they require. All listed identities are authenticated before
Terraform runs, with their profiles written to the shared credentials file.
The first identity becomes primary (sets AWS_PROFILE). This fixes CI failures
when using multiple AWS provider aliases (e.g., hub-spoke networking) with OIDC,
where only one profile was previously written to the credentials file.
Changes:
- Add Needs field to AuthConfig schema with comprehensive documentation
- Update resolveTargetIdentityName() to prioritize auth.needs first entry as primary
- Add authenticateAdditionalIdentities() for non-primary identity authentication with non-fatal error handling
- Call authenticateAdditionalIdentities() from authenticateAndWriteEnv() after primary auth succeeds
- Add 7 test cases covering needs list resolution, CLI override, fallback, success auth, skipping primary, non-fatal errors, and empty needs
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* feat: add auth section to stack manifest JSON schema
Add the `auth` definition to the Atmos stack manifest JSON schema, including
the new `needs` field, along with `realm`, `providers`, `identities`, and
`integrations`. Reference it from `terraform_component_manifest` so IDE
autocompletion and schema validation recognize the component-level auth config.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add needs field to all auth JSON schemas with validation tests
Update all three copies of the manifest schema to include auth.needs:
- pkg/datafetcher/schema (source, already had auth definition)
- website/static/schemas (published, add needs/realm/integrations to component_auth)
- tests/fixtures/schemas (test fixture, same as website)
Add schema validation tests:
- TestManifestSchema_AuthDefinitionExists: verify auth definition in embedded schema
- TestManifestSchema_AuthNeedsField: verify needs is array of strings
- TestManifestSchema_ValidAuthConfig: validate realistic auth configs against schema
- TestAuthConfig_Needs: struct-level tests for Needs field
- TestAuthConfig_NeedsWithMapstructure: verify Needs works with full AuthConfig
Also changed component_auth additionalProperties from false to true to allow
fields like logs, keyring, and realm that exist in the Go struct.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add blog post, roadmap milestone, and docs page for auth.needs
Add announcement blog post for the auth.needs feature enabling concurrent
identity authentication for multi-account Terraform components. Update the
roadmap with a shipped milestone and add a dedicated documentation page
at /cli/configuration/auth/needs with configuration examples and behavior
reference.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: align embedded auth schema with structured definitions and allow slash-delimited identity names
The embedded manifest schema had a loose auth definition with unstructured
providers/identities, while the website and fixture schemas used rich structured
definitions. This aligns all three copies and widens the identity/provider key
pattern to accept slash-delimited names like core/network.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: make auth.needs purely additive — default identity stays primary
Previously, the first entry in auth.needs became the primary identity,
requiring users to re-list the default. Now the default identity is always
primary, and needs only lists additional identities. If no default exists,
the first needs entry becomes the primary as a fallback.
Precedence: --identity CLI flag > default identity > needs[0] > error
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: discriminate sentinel errors in resolveTargetIdentityName
GetDefaultIdentity can return multiple error types beyond ErrNoDefaultIdentity
(e.g., ErrUserAborted, ErrIdentitySelectionRequiresTTY). Previously all errors
fell through to the auth.needs fallback, masking real failures. Now only
ErrNoDefaultIdentity triggers the fallback; other errors are returned immediately.
Also properly surfaces decodeAuthConfigFromStack errors instead of silently
ignoring them, and documents the Azure credential overwrite limitation for
multi-identity scenarios.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: replace auth.needs with per-identity required field
Move the multi-identity declaration from a centralized `auth.needs`
string array on AuthConfig to a `required: true` boolean on each
Identity. Required identities are automatically authenticated without
prompting. The `required` field is orthogonal to `default`: default
sets the primary identity, required means auto-authenticate.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add missing ComponentAuthConfig fields and clarify docs examples
Add Realm and Integrations fields to ComponentAuthConfig struct to match
the JSON schema, preventing silent data loss during unmarshalling. Mark
aws/assume-role examples in blog and docs as partial overrides with notes
linking to full identity configuration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: harden schema validation tests with safe type assertions and negative case
- Convert bare type assertions to two-value form with require.True for
clear failure messages instead of cryptic panics
- Add negative test case: identity with string "required" field rejected
by JSON schema (validates the expectErr path)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: aknysh <andriy.knysh@gmail.com>1 parent 8e576bf commit 01541b6
File tree
15 files changed
+1043
-23
lines changed- pkg
- auth
- datafetcher
- schema/atmos/manifest
- schema
- tests/fixtures/schemas/atmos/atmos-manifest/1.0
- website
- blog
- docs/cli/configuration/auth
- src/data
- static/schemas/atmos/atmos-manifest/1.0
15 files changed
+1043
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
92 | | - | |
| 97 | + | |
| 98 | + | |
93 | 99 | | |
94 | | - | |
95 | | - | |
96 | | - | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
118 | 130 | | |
119 | 131 | | |
120 | 132 | | |
| |||
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
147 | 184 | | |
148 | 185 | | |
149 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| |||
0 commit comments