Per-environment workspace configuration for the Oshun platform.
Bootstrap (one-time)#
Before terraform init succeeds, the state backend must exist:
- Create the S3 state bucket per environment:
oshun-terraform-state-developmentoshun-terraform-state-stagingoshun-terraform-state-productionWith versioning enabled and public-access blocked.
- Create a single DynamoDB table
oshun-terraform-lockswith primary keyLockID(string). - Create a KMS CMK aliased
alias/oshun-terraform-statewith key-rotation enabled.
The bootstrap/ directory contains a minimal Terraform config that provisions
these resources using local state. Run it once per AWS account:
bash
cd bootstrap
terraform init
terraform apply -var="state_bucket_prefix=oshun-terraform-state"
Per-environment workflow#
bash
# development
terraform init -backend-config=environments/development.backend.hcl -reconfigure
terraform plan -var-file=environments/development.tfvars
terraform apply -var-file=environments/development.tfvars
# staging
terraform init -backend-config=environments/staging.backend.hcl -reconfigure
terraform plan -var-file=environments/staging.tfvars
# production (with extra guardrails)
terraform init -backend-config=environments/production.backend.hcl -reconfigure
terraform plan -var-file=environments/production.tfvars -out=prod.tfplan
terraform apply prod.tfplan
Do not rely on Terraform CLI workspaces (terraform workspace new). We use
separate state buckets per environment for hard blast-radius isolation.