@@ -50,6 +50,57 @@ If you look at `components/terraform/`, you'll see a bunch of directories. These
5050 <AtmosWorkflow workflow = " vendor" fileName = " quickstart/foundation/accounts" />
5151
5252 </Step >
53+
54+ <details >
55+ <summary >Why Do We Use Wildcard Patterns with IAM?</summary >
56+
57+ The ` tfstate-backend ` component creates IAM roles with trust policies that control which principals can assume them.
58+ Understanding how these policies work is important for security.
59+
60+ ### The Character Limit Problem
61+
62+ IAM role trust policies have a ** hard limit of 4096 characters** (after requesting a quota increase from the default
63+ 2048). For organizations with multiple accounts, listing every role and permission set by explicit ARN would easily
64+ exceed this limit—even with the maximum quota.
65+
66+ Instead, the reference architecture uses wildcard ARN patterns like:
67+ - ` arn:aws:iam::*:role/acme-*-gbl-*-terraform ` for Terraform execution roles
68+ - ` arn:aws:iam::*:role/aws-reserved/sso.amazonaws.com/*/AWSReservedSSO_Terraform*Access_* ` for SSO permission sets
69+
70+ ### The Two-Way Security Handshake
71+
72+ Using wildcards in trust policies is secure because access requires a ** two-way handshake** :
73+
74+ 1 . ** Trust Policy (this side):** The tfstate role's trust policy allows principals matching the pattern to attempt
75+ assumption, but only if they're within your AWS Organization (` aws:PrincipalOrgID ` condition).
76+
77+ 2 . ** Principal's Policy (other side):** The principal (e.g., a Terraform role or SSO permission set) must also have
78+ an IAM policy granting ` sts:AssumeRole ` on the specific tfstate role ARN.
79+
80+ A role matching the wildcard pattern cannot access Terraform state unless it also has explicit permission to assume
81+ the tfstate role. This defense-in-depth approach maintains security while staying within IAM limits.
82+
83+ ### Requesting a Quota Increase (If Needed)
84+
85+ If you customize the trust policies and approach the 2048 character default limit, you can request an increase up to
86+ the maximum of 4096 characters. Requests within this limit are auto-approved instantly:
87+
88+ ``` bash
89+ atmos auth exec --identity core-root/terraform -- \
90+ aws service-quotas request-service-quota-increase \
91+ --service-code iam \
92+ --quota-code L-C07B4B0D \
93+ --desired-value 4096 \
94+ --region us-east-1
95+ ```
96+
97+ :::note
98+ This is only needed if you customize trust policies beyond the defaults. The reference architecture's wildcard
99+ patterns fit comfortably within the default 2048 character limit.
100+ :::
101+
102+ </details >
103+
53104 <Step >
54105 ## <StepNumber /> Initialize the Terraform State Backend
55106
0 commit comments