Skip to content

Commit 94a27ca

Browse files
committed
fix(cloudrun): make delete protection explicit
fixes #730
1 parent a6c4ce2 commit 94a27ca

File tree

31 files changed

+65
-1
lines changed

31 files changed

+65
-1
lines changed

eventarc/basic/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ resource "google_cloud_run_v2_service" "default" {
9393
name = "hello-events"
9494
location = "us-central1"
9595

96+
deletion_protection = false # set to "true" in production
97+
9698
template {
9799
containers {
98100
# This container will log received events

run/access_control/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ resource "google_cloud_run_v2_service" "default" {
2020
name = "cloud-run-srv"
2121
location = "us-central1"
2222

23+
deletion_protection = false # set to "true" in production
24+
2325
template {
2426
containers {
2527
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_concurrency/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-concurrency"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_containers/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-containers"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_cpu/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-cpu"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_cpu_allocation/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-cpu-allocation"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_description/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ resource "google_cloud_run_v2_service" "default" {
2323

2424
description = "This service has a custom description"
2525

26+
deletion_protection = false # set to "true" in production
27+
2628
template {
2729
containers {
2830
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_environment_variables/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-env-var"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_http2/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-h2c"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_labels/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-labels"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_max_instances/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-max-instances"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_memory_limits/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-memory-limits"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_min_instances/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-min-instances"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/cloud_run_configuration_request_timeout/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service-request-timeout"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/connect_cloud_sql/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ resource "google_cloud_run_v2_service" "default" {
155155
name = "cloudrun-service"
156156
location = "us-central1"
157157

158+
deletion_protection = false # set to "true" in production
159+
158160
template {
159161
containers {
160162
image = "us-docker.pkg.dev/cloudrun/container/hello:latest" # Image to deploy

run/deploy_tag/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ resource "google_cloud_run_v2_service" "default" {
1919
name = "cloudrun-srv"
2020
location = "us-central1"
2121

22+
deletion_protection = false # set to "true" in production
23+
2224
template {
2325
containers {
2426
# image or tag must be different from previous revision

run/direct_vpc/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ resource "google_cloud_run_v2_service" "default" {
2121
name = "cloudrun-service"
2222
location = "us-central1"
2323

24+
deletion_protection = false # set to "true" in production
25+
2426
template {
2527
containers {
2628
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/healthchecks_liveness_probe_grpc/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ resource "google_cloud_run_v2_service" "default" {
2626
name = "cloudrun-service-healthcheck"
2727
location = "us-central1"
2828

29+
deletion_protection = false # set to "true" in production
30+
2931
template {
3032
containers {
3133
# Note: Change to the name of your image

run/healthchecks_liveness_probe_http/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ resource "google_cloud_run_v2_service" "default" {
2626
name = "cloudrun-service-healthcheck"
2727
location = "us-central1"
2828

29+
deletion_protection = false # set to "true" in production
30+
2931
template {
3032
containers {
3133
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/healthchecks_startup_probe_http/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ resource "google_cloud_run_v2_service" "default" {
2727
name = "cloudrun-service-healthcheck"
2828
location = "us-central1"
2929

30+
deletion_protection = false # set to "true" in production
31+
3032
template {
3133
containers {
3234
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/identity/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ resource "google_cloud_run_v2_service" "default" {
2626
name = "cloud-run-srv"
2727
location = "us-central1"
2828

29+
deletion_protection = false # set to "true" in production
30+
2931
template {
3032
containers {
3133
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/image_processing/main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ output "blurred_bucket_name" {
9191
resource "google_cloud_run_v2_service" "default" {
9292
name = "pubsub-tutorial"
9393
location = "us-central1"
94+
95+
deletion_protection = false # set to "true" in production
96+
9497
template {
9598
containers {
96-
9799
# Replace with newly created image gcr.io/<project_id>/pubsub
98100
image = "us-docker.pkg.dev/cloudrun/container/hello"
99101
env {

run/ingress/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ resource "google_cloud_run_v2_service" "default" {
3030
name = "ingress-service"
3131
location = "us-central1"
3232

33+
deletion_protection = false # set to "true" in production
34+
3335
# For valid annotation values and descriptions, see
3436
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service#ingress
3537
ingress = "INGRESS_TRAFFIC_INTERNAL_ONLY"

run/interservice/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ resource "google_cloud_run_v2_service" "public" {
2222
name = "public-service"
2323
location = "us-central1"
2424

25+
deletion_protection = false # set to "true" in production
26+
2527
template {
2628
containers {
2729
# TODO<developer>: replace this with a public service container

run/multiple_regions/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ resource "google_cloud_run_v2_service" "run_default" {
152152
name = "myservice-run-app-${local.run_regions[count.index]}"
153153
location = local.run_regions[count.index]
154154

155+
deletion_protection = false # set to "true" in production
156+
155157
template {
156158
containers {
157159
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/noauth/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ resource "google_cloud_run_v2_service" "default" {
2222
name = "cloudrun-srv"
2323
location = "us-central1"
2424

25+
deletion_protection = false # set to "true" in production
26+
2527
template {
2628
containers {
2729
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/scheduled/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ resource "google_cloud_run_v2_service" "default" {
4040
name = "my-scheduled-service"
4141
location = "us-central1"
4242

43+
deletion_protection = false # set to "true" in production
44+
4345
template {
4446
containers {
4547
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/secret_manager/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ resource "google_cloud_run_v2_service" "mounted_secret" {
6565
location = "us-central1"
6666
ingress = "INGRESS_TRAFFIC_ALL"
6767

68+
deletion_protection = false # set to "true" in production
69+
6870
template {
6971
volumes {
7072
name = "my-service-volume"
@@ -96,6 +98,8 @@ resource "google_cloud_run_v2_service" "env_variable_secret" {
9698
location = "us-central1"
9799
ingress = "INGRESS_TRAFFIC_ALL"
98100

101+
deletion_protection = false # set to "true" in production
102+
99103
template {
100104
containers {
101105
image = "us-docker.pkg.dev/cloudrun/container/hello"

run/static_outbound/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ resource "google_cloud_run_v2_service" "default" {
114114
name = "cr-static-ip-service"
115115
location = google_compute_subnetwork.default.region
116116

117+
deletion_protection = false # set to "true" in production
118+
117119
template {
118120
containers {
119121
# Replace with the URL of your container

run/system_packages/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ resource "google_cloud_run_v2_service" "default" {
2727
name = "graphviz-example"
2828
location = "us-central1"
2929

30+
deletion_protection = false # set to "true" in production
31+
3032
template {
3133
containers {
3234
# Replace with the URL of your graphviz image

run/tasks/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ resource "google_cloud_run_v2_service" "default" {
2020
name = "cloud-run-task-service"
2121
location = "us-central1"
2222

23+
deletion_protection = false # set to "true" in production
24+
2325
template {
2426
containers {
2527
image = "us-docker.pkg.dev/cloudrun/container/hello"

0 commit comments

Comments
 (0)