nanochat/terraform/backend.tf
Manmohan Sharma b381933c3b
feat(terraform): provision full AWS stack for samosaChaat (issue #4)
Add reusable Terraform modules and per-environment configs (dev/uat/prod)
in us-west-2 covering: VPC (3 AZ public/private), EKS 1.29 with IRSA and
ALB/EBS/EFS CSI add-ons, RDS PostgreSQL 15, four ECR repos, IAM roles
(EKS node, ALB controller IRSA, GitHub Actions OIDC), Route53 + ACM for
samosachaat.art, and EFS for model weights. State backend on S3
(samosachaat-terraform-state) with DynamoDB lock table.

terraform validate passes for dev, uat, and prod.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-16 11:11:02 -07:00

36 lines
1.3 KiB
HCL

# Shared remote-state configuration.
#
# Each environment overrides the `key` via `terraform init -backend-config="key=..."`
# (the harness in environments/<env>/main.tf passes `terraform { backend "s3" {} }`
# with no inline values so the same bucket can host multiple state files).
#
# Bootstrap (run once, manually):
#
# aws s3api create-bucket \
# --bucket samosachaat-terraform-state \
# --region us-west-2 \
# --create-bucket-configuration LocationConstraint=us-west-2
# aws s3api put-bucket-versioning \
# --bucket samosachaat-terraform-state \
# --versioning-configuration Status=Enabled
# aws s3api put-bucket-encryption \
# --bucket samosachaat-terraform-state \
# --server-side-encryption-configuration \
# '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"AES256"}}]}'
# aws dynamodb create-table \
# --table-name samosachaat-terraform-locks \
# --attribute-definitions AttributeName=LockID,AttributeType=S \
# --key-schema AttributeName=LockID,KeyType=HASH \
# --billing-mode PAY_PER_REQUEST \
# --region us-west-2
terraform {
backend "s3" {
bucket = "samosachaat-terraform-state"
key = "global/placeholder.tfstate"
region = "us-west-2"
encrypt = true
dynamodb_table = "samosachaat-terraform-locks"
}
}