Pre-flight
Objective
Section titled “Objective”Confirm account context, variable completeness, and credential validity before every terraform apply or terraform destroy in the upstream example repo.
Checklist
Section titled “Checklist”- Set
AWS_PROFILEfor the account you are working in - Confirm identity:
aws sts get-caller-identity - Re-login SSO if the session expired:
aws sso login --profile <profile> - Workload stacks: confirm
pool_idin gitignoredterraform.tfvarsmatches latestipam/outputs - Run from a clone of
terraform-aws-ipamusing-chdir
Identity verification
Section titled “Identity verification”export AWS_PROFILE=ipam-orgaws sts get-caller-identity
export AWS_PROFILE=ipam-networkexport AWS_REGION=ap-southeast-6aws sts get-caller-identity
export AWS_PROFILE=ipam-workload-aexport AWS_REGION=ap-southeast-6aws sts get-caller-identity
export AWS_PROFILE=ipam-workload-bexport AWS_REGION=ap-southeast-2aws sts get-caller-identityCredential verification
Run aws sts get-caller-identity with the correct profile before every apply.
An expired SSO session or wrong profile causes No valid credential sources found and can apply changes to the wrong account.
Init, validate, plan
Section titled “Init, validate, plan”Replace <stack> with the target path (org-bootstrap, ipam, workload-a, workload-b):
terraform -chdir=examples/multi-account/<stack> initterraform -chdir=examples/multi-account/<stack> validateterraform -chdir=examples/multi-account/<stack> plan| Command | Purpose |
|---|---|
init | Download providers and initialize backend |
validate | Confirm HCL syntax and provider schema |
plan | Preview resource graph before apply |
pool_id guardrail
Section titled “pool_id guardrail”Before workload apply, confirm pool IDs match ipam/ outputs:
terraform -chdir=examples/multi-account/ipam output nz_dev_pool_idterraform -chdir=examples/multi-account/ipam output au_sandbox_pool_idgrep pool_id examples/multi-account/workload-a/terraform.tfvarsgrep pool_id examples/multi-account/workload-b/terraform.tfvarsIf they differ, update gitignored terraform.tfvars before continuing.
Dependency sequencing
Section titled “Dependency sequencing”org-bootstrap/applied successfully beforeipam/ipam/applied successfully beforeworkload-a//workload-b/- RAM sharing with Organizations enabled in management account
Next: Org Bootstrap.
Upstream: examples/multi-account/