The terraform/org/ module manages AWS Organizations and Service Control Policies (SCPs). It is deliberately excluded from CI -- only humans apply it.
The org module controls the organization structure and SCPs. A compromised CI pipeline must not be able to:
- Modify SCPs (which could remove the permission boundary requirement)
- Change the organization structure
- Detach security policies
This is enforced structurally: the javabin-ci-infra role has an explicit Deny on organizations:*, and the org module has no CI workflow.
- Identity Center credentials (preferred) or IAM admin credentials
- AWS CLI v2 configured with a profile that has Organizations permissions
- Terraform >= 1.7 installed
- The state backend must already exist (run bootstrap first -- see
docs/bootstrap-runbook.md)
Apply this module only after:
- The state backend exists and is migrated to S3 (Task 0b complete)
- The
javabin-developer-boundaryIAM policy exists in AWS (created byterraform/platform/iam/boundary.tf) - The
javabin-ci-infrarole exists (created by the platform iam module) - You have verified
var.exempt_rolesis correct for your account
Order matters. If you apply the SCP before the boundary policy and CI roles exist, the SCP will block all role creation in the account (including your own attempts to create the CI roles).
Using Identity Center (preferred):
aws sso login --profile javabinOr configure temporary credentials in your shell.
cd terraform/org
terraform initterraform planReview the plan carefully. This module creates:
- An AWS Organization (enabling the account as the management account)
- An SCP requiring permission boundary on role creation
- An attachment of the SCP to the organization root
terraform applyCheck that the organization exists:
aws organizations describe-organization --profile javabinCheck that the SCP is attached:
aws organizations list-policies --filter SERVICE_CONTROL_POLICY --profile javabinThe code should already be committed before applying (write code, commit, then apply). If any variable adjustments were needed, commit those changes.
- Edit
terraform/org/main.tfon a branch - Open a PR -- CODEOWNERS requires board member approval for
terraform/org/ - After merge, authenticate and apply manually:
cd terraform/org terraform plan terraform apply
| Variable | Default | Description |
|---|---|---|
boundary_policy_arn |
arn:aws:iam::553637109631:policy/javabin-developer-boundary |
ARN of the boundary policy the SCP enforces |
exempt_roles |
[javabin-ci-infra, root] |
Roles exempt from the boundary requirement |
Update exempt_roles if you add new platform-level roles that need to create roles without the boundary.
If the SCP is blocking something it should not:
- Sign in as the management account root user (root is always exempt from SCPs)
- Navigate to AWS Organizations > Policies > Service control policies
- Detach or modify the SCP
- Fix the Terraform code, commit, re-apply
Root user access should be an absolute last resort. Prefer updating exempt_roles and re-applying.