Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions terraform/apps/shehryar.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ module "shehryar_db" {
runtime_sa_email = module.shehryar_identity.runtime_sa_email
}

# CI/CD reads these at deploy time to run database migrations from the
# GitHub Actions runner. Scoped per-secret rather than project-wide so
# the CI SA can't read other apps' creds or the OCI admin password.
locals {
shehryar_ci_db_secrets = [
"db-host",
"shehryar-db-user",
"shehryar-db-pass",
"shehryar-db-name",
]
}

resource "google_secret_manager_secret_iam_member" "shehryar_ci_db_read" {
for_each = toset(local.shehryar_ci_db_secrets)
project = var.project_id
secret_id = each.value
role = "roles/secretmanager.secretAccessor"
member = "serviceAccount:${module.shehryar_identity.ci_cd_sa_email}"
}

# ── Cloud Run (inlined to wire Secret Manager refs) ─────────
resource "google_cloud_run_v2_service" "shehryar_api" {
provider = google-beta
Expand Down
Loading