Terraform Infrastructure
Use this skill for infrastructure work in terraform.
When to Use
- Change AWS networking, VPC, subnets, ALB, ECS, RDS, Route53, IAM, KMS, Secrets Manager, or scheduler resources.
- Update ECS task definitions, runtime permissions, or environment-to-secret wiring.
- Modify bootstrap orchestration, GitHub OIDC, remote state, or environment variable provisioning.
- Investigate drift or deployment behavior rooted in Terraform configuration.
Repository Context
- Main stack:
terraform/main.tf, terraform/ecs.tf
- Variable contracts:
terraform/variables.tf, terraform/ecs_variables.tf
- Remote state backend declaration:
terraform/backend.tf
- State bootstrap and backend notes:
terraform/REMOTE_STATE.md
- Bootstrap orchestration:
terraform/bootstrap_orchestration
- GitHub OIDC role module:
terraform/ci_aws_oidc
- GitHub provider module:
terraform/github_provider
Working Rules
- Treat Terraform edits as high-blast-radius changes.
- Call out
prevent_destroy implications and state impact when changing protected resources.
- Treat remote state as part of infrastructure safety: S3 backend for state storage and DynamoDB for state locking.
- Keep API path routing aligned with ALB listener rules and backend
PATH_BASE handling.
- If CI permissions, secrets, or repo/environment variables are affected, update bootstrap/orchestration and workflow assumptions together.
- Prefer scoped, explicit IAM permissions where practical.
Procedure
- Identify the resource, module, or variable contract that directly controls the behavior.
- Read the nearest Terraform files that own that behavior, not the whole stack.
- Make the minimal infrastructure change consistent with current patterns.
- Validate syntax or plan scope if feasible.
- If the change affects CI bootstrapping or deployment inputs, verify the dependent workflow and module surfaces.
Validation
Run Terraform from the relevant folder when practical:
Set-Location terraform
terraform init -reconfigure
terraform plan
When backend/state changes are involved, verify backend inputs are explicit and consistent:
Set-Location terraform
terraform init -reconfigure `
-backend-config="bucket=<tf-state-s3-bucket>" `
-backend-config="key=portfolio/terraform.tfstate" `
-backend-config="region=<aws-region>" `
-backend-config="dynamodb_table=<tf-state-lock-table>" `
-backend-config="encrypt=true"
For bootstrap changes:
Set-Location terraform/bootstrap_orchestration
terraform init
terraform plan -var-file="bootstrap_environments.tfvars"
Common Checks
- Does the change alter state shape, replacement behavior, or protected resources?
- Did remote state config remain valid: S3 bucket pathing, lock table name, and backend key conventions?
- Could this change break state locking or increase risk of concurrent applies?
- Are secret names and environment variable contracts still aligned with the app and workflows?
- Does ECS still have the right subnet, IAM, and secret access assumptions?
- If OIDC or CI permissions changed, does the bootstrap workflow still reconcile them?
- If ALB paths changed, does the backend routing contract still match?
Related Docs
terraform/README.md
terraform/REMOTE_STATE.md
terraform/bootstrap_orchestration/README.md
terraform/ci_aws_oidc/README.md
SECRETS_MANAGER_SETUP.md
Source: healthdots-jzhu/portfolio — distributed by TomeVault.
1---2name: terraform-infrastructure-23description: Work on the Terraform infrastructure in terraform. Use when changing AWS networking, ECS, ALB, RDS, Route53, IAM, Secrets Manager wiring, scheduler resources, bootstrap orchestration, remote state, or GitHub OIDC-related infrastructure configuration. Use when this capability is needed.4---56# Terraform Infrastructure78Use this skill for infrastructure work in `terraform`.910## When to Use1112- Change AWS networking, VPC, subnets, ALB, ECS, RDS, Route53, IAM, KMS, Secrets Manager, or scheduler resources.13- Update ECS task definitions, runtime permissions, or environment-to-secret wiring.14- Modify bootstrap orchestration, GitHub OIDC, remote state, or environment variable provisioning.15- Investigate drift or deployment behavior rooted in Terraform configuration.1617## Repository Context1819- Main stack: `terraform/main.tf`, `terraform/ecs.tf`20- Variable contracts: `terraform/variables.tf`, `terraform/ecs_variables.tf`21- Remote state backend declaration: `terraform/backend.tf`22- State bootstrap and backend notes: `terraform/REMOTE_STATE.md`23- Bootstrap orchestration: `terraform/bootstrap_orchestration`24- GitHub OIDC role module: `terraform/ci_aws_oidc`25- GitHub provider module: `terraform/github_provider`2627## Working Rules2829- Treat Terraform edits as high-blast-radius changes.30- Call out `prevent_destroy` implications and state impact when changing protected resources.31- Treat remote state as part of infrastructure safety: S3 backend for state storage and DynamoDB for state locking.32- Keep API path routing aligned with ALB listener rules and backend `PATH_BASE` handling.33- If CI permissions, secrets, or repo/environment variables are affected, update bootstrap/orchestration and workflow assumptions together.34- Prefer scoped, explicit IAM permissions where practical.3536## Procedure37381. Identify the resource, module, or variable contract that directly controls the behavior.392. Read the nearest Terraform files that own that behavior, not the whole stack.403. Make the minimal infrastructure change consistent with current patterns.414. Validate syntax or plan scope if feasible.425. If the change affects CI bootstrapping or deployment inputs, verify the dependent workflow and module surfaces.4344## Validation4546Run Terraform from the relevant folder when practical:4748```powershell49Set-Location terraform50terraform init -reconfigure51terraform plan52```5354When backend/state changes are involved, verify backend inputs are explicit and consistent:5556```powershell57Set-Location terraform58terraform init -reconfigure `59 -backend-config="bucket=<tf-state-s3-bucket>" `60 -backend-config="key=portfolio/terraform.tfstate" `61 -backend-config="region=<aws-region>" `62 -backend-config="dynamodb_table=<tf-state-lock-table>" `63 -backend-config="encrypt=true"64```6566For bootstrap changes:6768```powershell69Set-Location terraform/bootstrap_orchestration70terraform init71terraform plan -var-file="bootstrap_environments.tfvars"72```7374## Common Checks7576- Does the change alter state shape, replacement behavior, or protected resources?77- Did remote state config remain valid: S3 bucket pathing, lock table name, and backend key conventions?78- Could this change break state locking or increase risk of concurrent applies?79- Are secret names and environment variable contracts still aligned with the app and workflows?80- Does ECS still have the right subnet, IAM, and secret access assumptions?81- If OIDC or CI permissions changed, does the bootstrap workflow still reconcile them?82- If ALB paths changed, does the backend routing contract still match?8384## Related Docs8586- `terraform/README.md`87- `terraform/REMOTE_STATE.md`88- `terraform/bootstrap_orchestration/README.md`89- `terraform/ci_aws_oidc/README.md`90- `SECRETS_MANAGER_SETUP.md`9192---93> Source: [healthdots-jzhu/portfolio](https://github.com/healthdots-jzhu/portfolio) — distributed by [TomeVault](https://tomevault.io).94<!-- tomevault:4.0:skill_md:2026-06-04 -->