Skip to content

Commit 7342afa

Browse files
authored
Add missing deletion_protection variable for terraform resource (#1909)
Some GCP terraform resources have an optional property named deletion_protection. With it, terraform will not delete it. It defaults to true for staging and prod.\ But false when deploying your own [copy](https://github.com/GoogleChrome/webstatus.dev/blob/main/DEPLOYMENT.md#deploying-your-own-copy). When I was cleaning up old dev environments, I could not cleanly delete them because this particular resource had deletion_protection set to true by default. This change uses the global variable which allows us to explicitly tell if we want that given resource to have deletion_protection.
1 parent 575956a commit 7342afa

File tree

1 file changed

+7
-6
lines changed
  • infra/modules/single_stage_go_workflow

1 file changed

+7
-6
lines changed

infra/modules/single_stage_go_workflow/main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ resource "google_cloud_run_v2_job_iam_member" "job_status" {
6565
}
6666

6767
resource "google_workflows_workflow" "workflow" {
68-
for_each = module.job.regional_job_map
69-
provider = google.internal_project
70-
name = "${var.env_id}-${var.short_name}-${each.key}"
71-
region = each.key
72-
description = "${var.full_name}. Env id: ${var.env_id}"
73-
service_account = google_service_account.service_account.id
68+
for_each = module.job.regional_job_map
69+
provider = google.internal_project
70+
name = "${var.env_id}-${var.short_name}-${each.key}"
71+
region = each.key
72+
description = "${var.full_name}. Env id: ${var.env_id}"
73+
service_account = google_service_account.service_account.id
74+
deletion_protection = var.deletion_protection
7475
source_contents = templatefile(
7576
"${path.root}/modules/single_stage_go_workflow/workflows.yaml.tftpl",
7677
{

0 commit comments

Comments
 (0)