Skip to content

Commit

Permalink
enable DB deletion protection across all GCP API surfaces (#1150)
Browse files Browse the repository at this point in the history
* enable DB deletion protection across all GCP API surfaces

Signed-off-by: Bob Callaway <[email protected]>

* move into settings block

Signed-off-by: Bob Callaway <[email protected]>

---------

Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway authored Jun 24, 2024
1 parent 8381c7f commit 0c046ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion terraform/gcp/modules/mysql-shard/mysql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ resource "google_sql_database_instance" "trillian" {
database_version = var.database_version
region = var.region

# Set to false to delete this database
# Set to false to delete this database using terraform
deletion_protection = var.deletion_protection

settings {
tier = var.tier
activation_policy = "ALWAYS"
availability_type = var.availability_type

# this sets the flag on the GCP platform to prevent deletion across all API surfaces
deletion_protection_enabled = var.deletion_protection

ip_configuration {
ipv4_enabled = var.ipv4_enabled
private_network = var.network
Expand Down
5 changes: 4 additions & 1 deletion terraform/gcp/modules/mysql/mysql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ resource "google_sql_database_instance" "sigstore" {
database_version = var.database_version
region = var.region

# Set to false to delete this database
# Set to false to delete this database using terraform
deletion_protection = var.deletion_protection

depends_on = [google_service_networking_connection.private_vpc_connection]
Expand All @@ -119,6 +119,9 @@ resource "google_sql_database_instance" "sigstore" {
activation_policy = "ALWAYS"
availability_type = var.availability_type

# this sets the flag on the GCP platform to prevent deletion across all API surfaces
deletion_protection_enabled = var.deletion_protection

ip_configuration {
ipv4_enabled = var.ipv4_enabled
private_network = var.network
Expand Down

0 comments on commit 0c046ff

Please sign in to comment.