Skip to content

fix(cloud_sql): remove deletion_protection from default #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ steps:
# Add `deletion_protection = false` to google_container_cluster.default resources
find ./gke -name "*.tf" -print | xargs -t -I {} $$GOPATH/bin/hcledit attribute append resource.google_container_cluster.default.deletion_protection 'false' -u -f {} || true

# Add `deletion_protection = false` to google_sql_database_instance.default resources
find ./cloud_sql -name "*.tf" -print | xargs -t -I {} $$GOPATH/bin/hcledit attribute append resource.google_sql_database_instance.default.deletion_protection 'false' -u -f {} || true

- id: prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && prepare_environment']
Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/instance_cmek/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,5 @@ resource "google_sql_database_instance" "default" {
settings {
tier = "db-custom-2-7680"
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_cmek]
3 changes: 0 additions & 3 deletions cloud_sql/instance_ha/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,5 @@ resource "google_sql_database_instance" "default" {
start_time = "20:55"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_ha]
3 changes: 0 additions & 3 deletions cloud_sql/instance_iam_condition/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,4 @@ resource "google_sql_database_instance" "default" {
settings {
tier = "db-n1-standard-2"
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
3 changes: 0 additions & 3 deletions cloud_sql/instance_labels/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,5 @@ resource "google_sql_database_instance" "default" {
billing-code = 34802
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_labels]
3 changes: 0 additions & 3 deletions cloud_sql/instance_pitr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ resource "google_sql_database_instance" "default" {
transaction_log_retention_days = "3"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_pitr]

Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/mysql_enterprise_plus_instance_pvp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ resource "google_sql_database_instance" "default" {
enable_password_policy = true
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_enterprise_plus_instance_pvp]
3 changes: 0 additions & 3 deletions cloud_sql/mysql_instance_backup_location/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ resource "google_sql_database_instance" "default" {
location = "asia-northeast1"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_backup_location]
3 changes: 0 additions & 3 deletions cloud_sql/mysql_instance_backup_retention/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ resource "google_sql_database_instance" "default" {
}
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_backup_retention]
1 change: 0 additions & 1 deletion cloud_sql/mysql_instance_customer_managed_cas_ca/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,5 @@ resource "google_sql_database_instance" "default" {
server_ca_pool = google_privateca_ca_pool.default.id
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_mysql_instance_customer_managed_cas_ca]
1 change: 0 additions & 1 deletion cloud_sql/mysql_instance_google_managed_cas_ca/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ resource "google_sql_database_instance" "default" {
server_ca_mode = "GOOGLE_MANAGED_CAS_CA"
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_mysql_instance_google_managed_cas_ca]
4 changes: 0 additions & 4 deletions cloud_sql/mysql_instance_iam_db_auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ resource "google_sql_database_instance" "default" {
value = "on"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally
# delete this instance by use of Terraform whereas
# `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_iam_db_auth_create_instance]

Expand Down
4 changes: 0 additions & 4 deletions cloud_sql/mysql_instance_iam_group_auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ resource "google_sql_database_instance" "default" {
value = "on"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally
# delete this instance by use of Terraform whereas
# `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}

# Specify the email address of the Cloud Identity group to add to the instance
Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/mysql_instance_pitr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ resource "google_sql_database_instance" "default" {
transaction_log_retention_days = "3"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_pitr]
3 changes: 0 additions & 3 deletions cloud_sql/mysql_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ resource "google_sql_database_instance" "default" {
private_network = google_compute_network.peering_network.id
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_mysql_instance_psa_psc_instance]

Expand Down
1 change: 0 additions & 1 deletion cloud_sql/mysql_instance_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ resource "google_sql_database_instance" "default" {
ipv4_enabled = false
}
}
deletion_protection = false # Set to "true" to prevent destruction of the resource
}
# [END cloud_sql_mysql_instance_psc]

Expand Down
1 change: 0 additions & 1 deletion cloud_sql/postgres_enterprise_edition_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ resource "google_sql_database_instance" "default" {
settings {
tier = "db-g1-small"
}
deletion_protection = "false"
}
# [END cloud_sql_enterprise_instance]
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ resource "google_sql_database_instance" "default" {
tier = "db-perf-optimized-N-96"
edition = "ENTERPRISE_PLUS"
}
deletion_protection = false
}
# [END cloud_sql_enterprise_plus_instance]
3 changes: 0 additions & 3 deletions cloud_sql/postgres_enterprise_plus_instance_labels/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ resource "google_sql_database_instance" "default" {
billing-code = 34802
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_enterprise_plus_instance_labels]
3 changes: 0 additions & 3 deletions cloud_sql/postgres_enterprise_plus_instance_pvp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@ resource "google_sql_database_instance" "default" {
enable_password_policy = true
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_enterprise_plus_instance_pvp]
3 changes: 0 additions & 3 deletions cloud_sql/postgres_instance_authorized_network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ resource "google_sql_database_instance" "default" {
}
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_instance_authorized_network]
3 changes: 0 additions & 3 deletions cloud_sql/postgres_instance_backup_location/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@ resource "google_sql_database_instance" "default" {
location = "us-central1"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_instance_backup_location]
4 changes: 0 additions & 4 deletions cloud_sql/postgres_instance_backup_retention/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ resource "google_sql_database_instance" "default" {
}
}
}

# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_instance_backup_retention]
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,5 @@ resource "google_sql_database_instance" "default" {
server_ca_pool = google_privateca_ca_pool.default.id
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_postgres_instance_google_managed_cas_ca]
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ resource "google_sql_database_instance" "default" {
server_ca_mode = "GOOGLE_MANAGED_CAS_CA"
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_postgres_instance_google_managed_cas_ca]
4 changes: 0 additions & 4 deletions cloud_sql/postgres_instance_iam_db_auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ resource "google_sql_database_instance" "default" {
value = "on"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally
# delete this instance by use of Terraform whereas
# `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_instance_iam_db_auth_create_instance]

Expand Down
4 changes: 0 additions & 4 deletions cloud_sql/postgres_instance_iam_group_auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ resource "google_sql_database_instance" "default" {
value = "on"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally
# delete this instance by use of Terraform whereas
# `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}

# Specify the email address of the Cloud Identity group to add to the instance
Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/postgres_instance_private_ip/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ resource "google_sql_database_instance" "default" {
private_network = google_compute_network.peering_network.id
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_postgres_instance_private_ip_instance]

Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/postgres_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ resource "google_sql_database_instance" "default" {
private_network = google_compute_network.peering_network.id
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false # Set to "true" to prevent destruction of the resource
}
# [END cloud_sql_postgres_instance_psa_psc_instance]

Expand Down
1 change: 0 additions & 1 deletion cloud_sql/postgres_instance_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ resource "google_sql_database_instance" "default" {
ipv4_enabled = false
}
}
deletion_protection = false # Set to "true" to prevent destruction of the resource
}
# [END cloud_sql_postgres_instance_psc]

Expand Down
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_authorized_network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@ resource "google_sql_database_instance" "default" {
}
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_authorized_network]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ resource "google_sql_database_instance" "default" {
start_time = "20:55"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_backup]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_backup_location/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ resource "google_sql_database_instance" "default" {
location = "us-central1"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_backup_location]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_backup_retention/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@ resource "google_sql_database_instance" "default" {
}
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_backup_retention]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_cmek/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,5 @@ resource "google_sql_database_instance" "default" {
settings {
tier = "db-custom-2-7680"
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_cmek]
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,5 @@ resource "google_sql_database_instance" "default" {
server_ca_pool = google_privateca_ca_pool.default.id
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_sqlserver_instance_require_ssl]
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ resource "google_sql_database_instance" "default" {
server_ca_mode = "GOOGLE_MANAGED_CAS_CA"
}
}
deletion_protection = false # set to "true" in production
}
# [END cloud_sql_sqlserver_instance_require_ssl]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_ha/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ resource "google_sql_database_instance" "default" {
start_time = "20:55"
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_ha]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_labels/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ resource "google_sql_database_instance" "default" {
billing-code = 34802
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_labels]
3 changes: 0 additions & 3 deletions cloud_sql/sqlserver_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ resource "google_sql_database_instance" "default" {
private_network = google_compute_network.peering_network.id
}
}
# set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
# use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
deletion_protection = false
}
# [END cloud_sql_sqlserver_instance_psa_psc_instance]

Expand Down
1 change: 0 additions & 1 deletion cloud_sql/sqlserver_instance_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource "google_sql_database_instance" "default" {
ipv4_enabled = false
}
}
deletion_protection = false # Set to "true" to prevent destruction of the resource
}
# [END cloud_sql_sqlserver_instance_psc]

Expand Down
Loading