Skip to content

feat(phase-6b): Terraform infrastructure for the production architecture - #23

Merged
Mahakisore7 merged 1 commit into
mainfrom
feat/phase-6b-terraform-infrastructure
Sep 3, 2026
Merged

Mahakisore7 merged 1 commit into
mainfrom
feat/phase-6b-terraform-infrastructure

Conversation

@Mahakisore7

Copy link
Copy Markdown
Contributor

Summary

  • Full infra/terraform/: 3 Cloud Run services (api/web/agents), Cloud SQL (public IP + Auth Proxy volume mount, no VPC needed), Memorystore (Basic tier, direct VPC egress), Pub/Sub (job dispatch + dead-letter), Cloud Storage, Secret Manager (JWT/internal-service-key/Gemini key/full DATABASE_URL), Artifact Registry, least-privilege IAM per service account with an explicit "why" comment on every binding (and every deliberate omission).
  • Grafana Cloud dashboard provisioning (grafana.tf + infra/grafana/dashboards/*.json), gated behind grafana_enabled since it needs a third-party account only the project owner can create.
  • infra/README.md: account setup, cost estimate, and why terraform apply is deliberately not run yet (Cloud SQL + Memorystore bill continuously, unlike this project's per-call Gemini/Firestore usage through Phase 5).

Live verification

  • terraform validate: passes.
  • terraform plan against the real scene-craft-507404 project: clean, 56 resources, no errors/warnings — real credentials, real API calls, no apply.
  • Caught and fixed a real dependency cycle (api's CORS origin ↔ web's API base URL both wired to each other's Cloud Run .uri) with a documented bootstrapping variable, a well-known pattern for this exact Cloud-Run-to-Cloud-Run problem.

Test plan

  • terraform fmt -check, terraform validate
  • terraform plan -var-file=dev.tfvars against the real project (documented above)
  • terraform apply — deliberately deferred, see infra/README.md

Part 2 of 3 for Phase 6.

🤖 Generated with Claude Code

Provisions the full stack from docs/02-TECH-STACK.md and
10-DIAGRAMS.md SS8: 3 Cloud Run services (api/web/agents), Cloud SQL,
Memorystore, Pub/Sub (job dispatch + dead-letter), Cloud Storage,
Secret Manager, Artifact Registry, least-privilege IAM per service
account, and Grafana Cloud dashboard provisioning (gated behind
grafana_enabled, since that's a third-party account only the project
owner can create).

Validated for real: `terraform validate` passes, and `terraform plan`
against the actual scene-craft-507404 GCP project produces a clean
56-resource plan with no errors or warnings. Not yet applied — Cloud
SQL and Memorystore bill continuously once real resources exist, so
infra/README.md documents the deliberate decision to hold off on
`terraform apply` until closer to Phase 7 demo prep, plus the account
setup (Grafana Cloud, WIF) and one-time steps (Firestore import, CORS
bootstrapping around a genuine Cloud-Run-to-Cloud-Run URL dependency
cycle) needed before a real apply.

Part 2 of 3 for Phase 6 — see feat/phase-6a-otel-and-runtime-hardening
(merged prerequisite: app-level OTel/Redis/Pub/Sub code) and
feat/phase-6c-cicd-deploy-pipeline (follows).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Mahakisore7
Mahakisore7 merged commit e670995 into main Sep 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant