Skip to content

Commit 85c6443

Browse files
♻️ feat: foundation scaffold overhaul — new account-layer components, import support, ssosync, remove core-dns (#885)
2 parents ec9904e + a7d3315 commit 85c6443

4 files changed

Lines changed: 136 additions & 26 deletions

File tree

examples/snippets/.claude/skills/atmos-auth/SKILL.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Profiles are defined in `profiles/<profile-name>/atmos.yaml`. Each maps identiti
6363
| ------------ | -------------------- | -------------------- | --------------------- |
6464
| `devops` | TerraformApplyAccess | TerraformApplyAccess | TerraformApplyAccess |
6565
| `developers` | TerraformStateAccess | TerraformApplyAccess | TerraformPlanAccess |
66-
| `managers` | TerraformStateAccess | TerraformPlanAccess | TerraformPlanAccess |
66+
| `managers` | TerraformApplyAccess | TerraformApplyAccess | TerraformApplyAccess |
67+
68+
Managers also have a `RootAccess` Permission Set for centralized root access to member accounts.
6769

6870
**Permission Set capabilities:**
6971

@@ -83,7 +85,9 @@ Examples:
8385

8486
## Special Cases
8587

86-
**superadmin profile**: IAM user with MFA for breakglass access. Avoid unless SSO is unavailable.
88+
**superadmin profile**: IAM user (`kind: aws/user`) with MFA in the root account. Used for coldstart/bootstrap
89+
before SSO is deployed, or as breakglass access. Assumes `OrganizationAccountAccessRole` into member accounts
90+
via identity chaining. Switch to your assigned SSO profile once the identity layer is deployed.
8791

8892
**github-plan profile**: OIDC-based authentication for CI/CD plan operations. Uses planner roles with read-only access.
8993

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Cold-Start Workflow - Complete Infrastructure Bootstrap
2+
#
3+
# This workflow orchestrates the complete infrastructure deployment from scratch,
4+
# following the proper dependency order:
5+
# 1. Terraform state backend
6+
# 2. AWS Organization and accounts
7+
# 3. IAM Identity Center (SSO) and execution roles
8+
# 4. Network layer (VPCs, Transit Gateway, DNS)
9+
#
10+
# Usage:
11+
# # Complete cold-start deployment:
12+
# atmos workflow all -f quickstart/cold-start
13+
#
14+
# # Individual layers:
15+
# atmos workflow deploy/foundation -f quickstart/cold-start
16+
# atmos workflow deploy/network -f quickstart/cold-start
17+
#
18+
# # Step-by-step validation:
19+
# atmos workflow deploy/tfstate -f quickstart/cold-start
20+
# atmos workflow deploy/accounts -f quickstart/cold-start
21+
# atmos workflow deploy/identity -f quickstart/cold-start
22+
# atmos workflow deploy/network -f quickstart/cold-start
23+
#
24+
# Available workflows:
25+
# - all: Complete cold-start deployment (tfstate → network)
26+
# - deploy/foundation: Deploy foundation layer (accounts + identity)
27+
# - deploy/tfstate: Initialize Terraform state backend
28+
# - deploy/accounts: Deploy accounts layer
29+
# - deploy/identity: Deploy identity layer
30+
# - deploy/network: Deploy network layer
31+
#
32+
33+
workflows:
34+
all:
35+
description: Complete cold-start deployment from tfstate to network
36+
steps:
37+
- command: workflow all -f quickstart/foundation/accounts
38+
- command: workflow vendor -f quickstart/foundation/identity
39+
- command: workflow deploy/sso -f quickstart/foundation/identity
40+
- command: workflow login/managers -f quickstart/cold-start
41+
- command: workflow all -f quickstart/foundation/identity
42+
43+
login/managers:
44+
description: Login as managers profile - used to force a login before deploying the identity layer (which is the first to use SSO)
45+
env:
46+
ATMOS_PROFILE: managers
47+
ATMOS_IDENTITY: core-root/terraform
48+
retry:
49+
initial_delay: 15s
50+
backoff_strategy: constant
51+
max_retries: 3
52+
steps:
53+
- command: auth login

examples/snippets/stacks/workflows/quickstart/foundation/accounts.yaml

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@
2121
# - deploy/cloudtrail: Enable CloudTrail logging
2222
# - deploy/ecr: Deploy ECR registry
2323
#
24+
# NOTE: Use 'superadmin' profile for initial infrastructure setup.
25+
# After SSO is configured and IAM roles are deployed (via identity layer),
26+
# update this to 'managers' for day-to-day operations.
2427
workflows:
2528
all:
29+
env:
30+
ATMOS_PROFILE: superadmin
2631
description: Deploy complete accounts layer
2732
steps:
33+
- command: workflow initial-setup -f quickstart/foundation/accounts
2834
- command: workflow vendor -f quickstart/foundation/accounts
2935
- command: workflow init/tfstate -f quickstart/foundation/accounts
3036
- command: workflow deploy/tfstate -f quickstart/foundation/accounts
@@ -35,9 +41,41 @@ workflows:
3541
- command: workflow deploy/aws-account-settings -f quickstart/foundation/accounts
3642
- command: workflow deploy/budgets -f quickstart/foundation/accounts
3743
- command: workflow deploy/cloudtrail -f quickstart/foundation/accounts
44+
- command: vendor pull --component github-oidc-provider
45+
- command: workflow deploy/github-oidc-provider -f quickstart/foundation/identity
3846
- command: workflow deploy/ecr -f quickstart/foundation/accounts
3947

48+
initial-setup:
49+
description: Initial commands to run before deploying the accounts layer.
50+
env:
51+
ATMOS_PROFILE: superadmin
52+
ATMOS_IDENTITY: core-root/terraform
53+
steps:
54+
- command: auth login
55+
- command: auth whoami
56+
# Request increase for IAM service quota (This is always in us-east-1)
57+
- command: |
58+
QUOTA_VALUE=$(atmos auth exec --identity core-root/terraform -- \
59+
aws service-quotas get-service-quota \
60+
--service-code iam \
61+
--quota-code L-C07B4B0D \
62+
--region us-east-1 | jq '.Quota.Value')
63+
64+
if [[ "$QUOTA_VALUE" != "4096.0" ]]; then
65+
atmos auth exec --identity core-root/terraform -- \
66+
aws service-quotas request-service-quota-increase \
67+
--service-code iam \
68+
--quota-code L-C07B4B0D \
69+
--desired-value 4096 \
70+
--region us-east-1
71+
else
72+
echo "IAM service quota is already at 4096.0"
73+
fi
74+
type: shell
75+
4076
vendor:
77+
env:
78+
ATMOS_PROFILE: superadmin
4179
description: Vendor accounts layer components.
4280
steps:
4381
- command: vendor pull --component aws-organization
@@ -53,33 +91,44 @@ workflows:
5391
- command: vendor pull --component tfstate-backend
5492

5593
init/tfstate:
94+
env:
95+
ATMOS_PROFILE: superadmin
5696
description: Provision Terraform State Backend for initial deployment.
5797
steps:
98+
- command: terraform clean tfstate-backend --stack core-use1-root -f
5899
- command: terraform deploy tfstate-backend -var="access_roles_enabled=false" --stack core-use1-root --auto-generate-backend-file=false
59-
- command: until aws s3 ls acme-core-use1-root-tfstate; do sleep 5; done
100+
- command: until atmos auth exec --identity core-root/terraform -- aws s3 ls acme-core-use1-root-tfstate; do sleep 5; done
60101
type: shell
61102
- command: terraform deploy tfstate-backend -var="access_roles_enabled=false" --stack core-use1-root --init-run-reconfigure=false
62103

63104
deploy/tfstate:
105+
env:
106+
ATMOS_PROFILE: superadmin
64107
description: Deploy Terraform State Backend.
65108
steps:
66109
- command: terraform deploy tfstate-backend --stack core-use1-root
67110

68111
deploy/organization:
112+
env:
113+
ATMOS_PROFILE: superadmin
69114
description: |
70115
Deploy the AWS Organization. This is required before finishing the root account requirements.
71116
steps:
72117
- command: terraform deploy aws-organization -s core-gbl-root
73-
- command: aws ram enable-sharing-with-aws-organization
118+
- command: atmos auth exec --identity core-root/terraform -- aws ram enable-sharing-with-aws-organization
74119
type: shell
75120

76121
deploy/organizational-units:
122+
env:
123+
ATMOS_PROFILE: superadmin
77124
description: Deploy Organizational Units
78125
steps:
79126
- command: terraform deploy aws-organizational-unit/core -s core-gbl-root
80127
- command: terraform deploy aws-organizational-unit/plat -s core-gbl-root
81128

82129
deploy/accounts:
130+
env:
131+
ATMOS_PROFILE: superadmin
83132
description: Deploys all AWS Organization accounts
84133
steps:
85134
- command: terraform deploy aws-account/core-artifacts -s core-gbl-root
@@ -93,12 +142,16 @@ workflows:
93142
- command: terraform deploy aws-account/plat-prod -s core-gbl-root
94143

95144
deploy/scps:
145+
env:
146+
ATMOS_PROFILE: superadmin
96147
description: Deploy Service Control Policies
97148
steps:
98149
- command: terraform deploy aws-scp/deny-leaving-organization -s core-gbl-root
99150
- command: terraform deploy aws-scp/deny-creating-users -s core-gbl-root
100151

101152
deploy/aws-account-settings:
153+
env:
154+
ATMOS_PROFILE: superadmin
102155
description: Apply AWS Account settings for best practices.
103156
steps:
104157
- command: terraform deploy aws-account-settings -s core-gbl-artifacts
@@ -113,6 +166,8 @@ workflows:
113166
- command: terraform deploy aws-account-settings -s plat-gbl-staging
114167

115168
deploy/budgets:
169+
env:
170+
ATMOS_PROFILE: superadmin
116171
description: Deploy budgets to all accounts
117172
steps:
118173
- command: terraform deploy aws-budget -s core-gbl-root
@@ -127,12 +182,16 @@ workflows:
127182
- command: terraform deploy aws-budget -s plat-gbl-prod
128183

129184
deploy/cloudtrail:
185+
env:
186+
ATMOS_PROFILE: superadmin
130187
description: Start AWS Cloudtrail in audit and root accounts to track changes across the org.
131188
steps:
132189
- command: terraform deploy cloudtrail-bucket -s core-use1-audit
133190
- command: terraform deploy cloudtrail -s core-gbl-root
134191

135192
deploy/ecr:
193+
env:
194+
ATMOS_PROFILE: superadmin
136195
description: Deploy ECR in the artifacts account to use as our container registry
137196
steps:
138197
- command: terraform deploy ecr -s core-use1-artifacts

examples/snippets/stacks/workflows/quickstart/foundation/identity.yaml

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,11 @@
1919
# - deploy/iam-role: Deploy Terraform execution roles
2020
# - deploy/github-oidc-provider: Deploy GitHub OIDC Provider to all accounts
2121
#
22-
workflows:
23-
check-setup:
24-
description: Verify that the environment is setup correctly to run these workflows.
25-
steps:
26-
- name: check-setup
27-
type: shell
28-
command : |-
29-
if [[ "$GEODESIC_SHELL" != "true" ]]; then
30-
echo "This workflow must be run from a Geodesic shell." >&2
31-
exit 1
32-
elif [[ -z $ATMOS_BASE_PATH ]] || [[ ! -d "$ATMOS_BASE_PATH/.git" ]]; then
33-
echo "ATMOS_BASE_PATH must be set to the root of the git repository." >&2
34-
echo "This is usually set automatically by Geodesic." >&2
35-
echo "To fix: run the Geodesic shell from the root of the git repository." >&2
36-
echo " ATMOS_BASE_PATH: \"$ATMOS_BASE_PATH\"" >&2
37-
echo " Current directory: \"$(pwd -P)\"" >&2
38-
exit 1
39-
elif [[ ! -d "$ATMOS_BASE_PATH/rootfs/usr/local/bin" ]]; then
40-
printf "No such directory: %s\n" "$ATMOS_BASE_PATH/rootfs/usr/local/bin" >&2
41-
exit 2
42-
fi
4322

23+
workflows:
4424
all:
4525
description: Run all workflows
4626
steps:
47-
- command: workflow check-setup -f quickstart/foundation/identity
4827
- command: workflow vendor -f quickstart/foundation/identity
4928
- command: workflow deploy/all -f quickstart/foundation/identity
5029

@@ -55,17 +34,32 @@ workflows:
5534
- command: vendor pull --component iam-role
5635
- command: vendor pull --component github-oidc-provider
5736

37+
auth:
38+
description: Authenticate to core-root/terraform identity.
39+
env:
40+
ATMOS_PROFILE: managers
41+
ATMOS_IDENTITY: core-root/terraform
42+
steps:
43+
- command: auth login
44+
5845
deploy/all:
5946
description: Deploy all identity components.
6047
steps:
6148
- command: workflow deploy/sso -f quickstart/foundation/identity
49+
- command: workflow auth -f quickstart/foundation/identity
6250
- command: workflow deploy/iam-role -f quickstart/foundation/identity
6351
- command: workflow deploy/github-oidc-provider -f quickstart/foundation/identity
6452

6553
deploy/sso:
6654
description: Update aws-sso configuration.
55+
# NOTE: Use 'superadmin' profile for initial infrastructure setup.
56+
# After SSO is configured and IAM roles are deployed (via identity layer),
57+
# update this to 'managers' for day-to-day operations.
58+
env:
59+
ATMOS_PROFILE: superadmin
6760
steps:
6861
- command: terraform deploy aws-sso -s core-gbl-root
62+
- command: workflow deploy/tfstate -f quickstart/foundation/accounts
6963

7064
deploy/iam-role:
7165
description: |

0 commit comments

Comments
 (0)