fix(terraform/gcp): abandon SQL user on destroy (#29855)

google_sql_user.app issues DROP ROLE on destroy, which Postgres refuses
because the role owns every table the migrations job created (75
objects). The previous deletion_policy=ABANDON on google_sql_database
keeps the DB intact through destroy, so the role still owns its
objects. Set the same policy on the user; the instance deletion takes
both the database and the role with it anyway.
This commit is contained in:
Yassin Kortam 2026-06-06 13:42:35 -07:00 committed by GitHub
parent 43c10370ee
commit 38b28b96ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,6 +108,8 @@ resource "google_sql_user" "app" {
name = var.db_username name = var.db_username
instance = google_sql_database_instance.writer.name instance = google_sql_database_instance.writer.name
password = random_password.db_password.result password = random_password.db_password.result
deletion_policy = "ABANDON"
} }
resource "google_secret_manager_secret" "db_password" { resource "google_secret_manager_secret" "db_password" {