Skip to content

fix: align Terraform DB config and reorganize docs#33

Merged
ChingEnLin merged 2 commits into
devfrom
feat/terraform-db-align
May 17, 2026
Merged

fix: align Terraform DB config and reorganize docs#33
ChingEnLin merged 2 commits into
devfrom
feat/terraform-db-align

Conversation

@ChingEnLin
Copy link
Copy Markdown
Owner

Summary

  • Aligns terraform/database.tf backup configuration with the actual Cloud SQL instance state (backup was disabled in prod; the config had it enabled, which would cause a spurious diff on every plan)
  • Splits the README into focused docs/ files to reduce length and improve navigability

Changes

terraform/database.tf — backup config corrected to match real instance:

  • enabled: true → false
  • start_time: "02:00" → "03:00"
  • point_in_time_recovery_enabled: true → false

docs/ — new files extracted from README:

  • ARCHITECTURE.md — BFF pattern, auth flow, ReAct agent loop, security model
  • INFRASTRUCTURE.md — Cloud topology, network security, Secret Manager, Terraform setup, CI/CD
  • AZURE_SETUP.md — Entra ID app registrations, Cosmos DB permissions, frontend auth config
  • DEVELOPMENT.md — local setup, testing commands, code style

README.md — trimmed to a lean landing page (~60 lines) with a docs reference table.

Test plan

  • terraform plan shows no changes on Cloud SQL (backup config aligned)
  • README links resolve correctly

🤖 Generated with Claude Code

ChingEnLin and others added 2 commits May 17, 2026 12:11
…tate

Backup was disabled on the real instance; syncing so terraform plan is clean
with no spurious diff on next apply.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
README trimmed to a lean landing page. Detailed content moved to:
- docs/ARCHITECTURE.md (BFF pattern, ReAct agent, security model)
- docs/INFRASTRUCTURE.md (Cloud topology, Terraform, Secret Manager, CI/CD)
- docs/AZURE_SETUP.md (Entra ID registration, Cosmos DB, frontend config)
- docs/DEVELOPMENT.md (local setup, testing, code style)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ChingEnLin ChingEnLin merged commit 8cc3d18 into dev May 17, 2026
3 checks passed
@ChingEnLin ChingEnLin deleted the feat/terraform-db-align branch May 17, 2026 10:17
@ChingEnLin ChingEnLin mentioned this pull request May 17, 2026
8 tasks
ChingEnLin added a commit that referenced this pull request May 17, 2026
* feat: harden Cloud Run security with Secret Manager, VPC connector, and private backend

- Secret Manager: move all sensitive env vars (Azure credentials, Gemini key,
  DB credentials) out of GitHub Secrets and into GCP Secret Manager; Cloud Run
  reads them at runtime via --set-secrets, so secrets are never exposed in
  workflow logs or build args.

- VPC Connector: add Serverless VPC Access connector (terraform/network.tf) so
  Cloud Run services can reach Cloud SQL and each other over the private VPC
  network.

- Private backend: set backend Cloud Run ingress to 'internal', blocking all
  public internet access. Frontend nginx now proxies /api/* to the backend's
  internal URL (with BACKEND_URL injected as a runtime env var), so the browser
  never needs a direct connection to the backend.

- Terraform IaC: terraform/ directory manages the VPC connector, Secret Manager
  secrets, Cloud Run service account, and Cloud SQL (importable via import.sh).
  CI continues to own image builds and Cloud Run deployments.

- Data migration script: scripts/migrate_db.sh migrates PostgreSQL data between
  Cloud SQL instances via Cloud SQL Auth Proxy if the database ever needs to be
  rebuilt.

https://claude.ai/code/session_01SRRzCWrpwgMpdYFurMVn7m

* fix: construct Cloud Run SA email inline to use PROJECT_ID, clarify VITE_API_BASE_URL

GitHub Actions does not interpolate ${{ env.X }} inside the top-level env:
block, so the full SA email could not reference PROJECT_ID there. Replaced
CLOUD_RUN_SA with CLOUD_RUN_SA_NAME and build the email inline in the flags
blocks where expression context is available.

Added a comment explaining VITE_API_BASE_URL=/api — it is the nginx location
prefix, not a full URL, because the browser calls the frontend's own origin
and nginx proxies /api/* to the internal backend.

https://claude.ai/code/session_01SRRzCWrpwgMpdYFurMVn7m

* docs: add infrastructure documentation with architecture diagrams to README

- Add production architecture Mermaid diagram showing Cloud Run services,
  VPC connector, Secret Manager, Cloud SQL, and external dependencies
- Add network security model table (frontend public / backend internal)
- Add secret management table listing all Secret Manager secrets
- Add IaC ownership table (Terraform vs CI pipeline)
- Add CI/CD pipeline Mermaid flowchart showing Workload Identity auth,
  image build/push, and deploy steps with secret injection
- Add Terraform to technology stack table

Also remove overly broad github_actions_secret_accessor IAM binding from
terraform/iam.tf — the GitHub Actions SA never reads secret values directly;
Cloud Run reads them at startup using the Cloud Run SA identity.

https://claude.ai/code/session_01SRRzCWrpwgMpdYFurMVn7m

* fix: align Terraform DB config and reorganize docs (#33)

* fix: align database.tf backup config with actual Cloud SQL instance state

Backup was disabled on the real instance; syncing so terraform plan is clean
with no spurious diff on next apply.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: reorganize README into focused docs/ files

README trimmed to a lean landing page. Detailed content moved to:
- docs/ARCHITECTURE.md (BFF pattern, ReAct agent, security model)
- docs/INFRASTRUCTURE.md (Cloud topology, Terraform, Secret Manager, CI/CD)
- docs/AZURE_SETUP.md (Entra ID registration, Cosmos DB, frontend config)
- docs/DEVELOPMENT.md (local setup, testing, code style)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request May 17, 2026
## [2.10.1](v2.10.0...v2.10.1) (2026-05-17)

### Maintenance

* merge dev into production ([#34](#34)) ([b363f16](b363f16)), closes [#33](#33)
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