Problem Statement
SmartWealthAI needs reproducible AWS infrastructure (S3 data lake, GitHub OIDC IAM, Secrets Manager) but has no IaC in the repo. M2 Terraform unblocks ingest-smoke without provisioning empty ECS before the pipeline Docker image exists (M3).
Solution
Terraform v1 scoped to CI/CD milestone M2: bootstrap remote state, dev/prod S3 buckets, GitHub OIDC roles, Secrets Manager placeholder for SIMFIN_API_KEY. ECR/ECS/MLflow deferred to M3–M6.
Spec
spec/prds/terraform/terraform-prd.md
Canonical docs
- Feature spec:
spec/features/014-cicd-infrastructure/spec.md
- PRD:
spec/prds/terraform/terraform-prd.md
- ADR:
spec/adr/0003-terraform-for-aws-iac.md
- Parent CI/CD PRD:
spec/prds/ci-cd/ci-cd-prd.md
Implementation Decisions (summary)
- v1 scope: M2 only — S3 dev+prod, OIDC IAM, Secrets Manager skeleton
- Tool: Terraform (
infra/terraform/)
- State: S3 + DynamoDB (bootstrap module, one-time manual apply)
- Accounts: Single AWS account; dev/prod isolated by bucket + IAM role
- OIDC: Repo
JLaborda/SmartWealthAI; dev = develop + Environment dev; prod = main + Environment production
- Apply:
workflow_dispatch only; prod requires GitHub Environment approval
- Out of v1: ECR, ECS, EC2, EventBridge, application
LAKE_URI/boto3 (#112)
User Stories
See full list in spec/prds/terraform/terraform-prd.md.
Testing Decisions
- CI:
terraform fmt -check, validate, plan on PRs touching infra/terraform/
- Post-apply: ingest-smoke workflow proves OIDC → dev S3 write
- No automatic
apply on merge
Out of Scope
Multi-account AWS, OpenTofu, Terraform Cloud, auto-apply on merge, ECS/ECR/EC2 in v1.
Child issues
Problem Statement
SmartWealthAI needs reproducible AWS infrastructure (S3 data lake, GitHub OIDC IAM, Secrets Manager) but has no IaC in the repo. M2 Terraform unblocks ingest-smoke without provisioning empty ECS before the pipeline Docker image exists (M3).
Solution
Terraform v1 scoped to CI/CD milestone M2: bootstrap remote state, dev/prod S3 buckets, GitHub OIDC roles, Secrets Manager placeholder for
SIMFIN_API_KEY. ECR/ECS/MLflow deferred to M3–M6.Spec
spec/prds/terraform/terraform-prd.md
Canonical docs
spec/features/014-cicd-infrastructure/spec.mdspec/prds/terraform/terraform-prd.mdspec/adr/0003-terraform-for-aws-iac.mdspec/prds/ci-cd/ci-cd-prd.mdImplementation Decisions (summary)
infra/terraform/)JLaborda/SmartWealthAI; dev =develop+ Environmentdev; prod =main+ Environmentproductionworkflow_dispatchonly; prod requires GitHub Environment approvalLAKE_URI/boto3 (#112)User Stories
See full list in
spec/prds/terraform/terraform-prd.md.Testing Decisions
terraform fmt -check,validate,planon PRs touchinginfra/terraform/applyon mergeOut of Scope
Multi-account AWS, OpenTofu, Terraform Cloud, auto-apply on merge, ECS/ECR/EC2 in v1.
Child issues