Skip to content
Merged
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
25 changes: 25 additions & 0 deletions cloud_sql/mysql_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,28 @@ resource "google_compute_forwarding_rule" "default" {

# [END cloud_sql_mysql_instance_psa_psc_parent_tag]

// Configure a Cloud SQL MySQL instance with Private Service Connect disabled.
# [START cloud_sql_mysql_instance_disable_psc_instance]
resource "google_sql_database_instance" "disable_psc_example" {
name = "mysql-disable-psc-example"
region = "us-central1"
database_version = "MYSQL_8_0"

depends_on = [google_service_networking_connection.default]

settings {
tier = "db-f1-micro"
ip_configuration {
psc_config {
psc_enabled = false
allowed_consumer_projects = [] # clear consumer projects
}
ipv4_enabled = false
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_disable_psc_instance]
30 changes: 30 additions & 0 deletions cloud_sql/postgres_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,33 @@ resource "google_compute_forwarding_rule" "default" {
}

# [END cloud_sql_postgres_instance_psa_psc_parent_tag]

// Configure a Cloud SQL Postgres instance with Private Service Connect disabled.
# [START cloud_sql_postgres_instance_disable_psc_instance]
resource "google_sql_database_instance" "disable_psc_example" {
name = "postgres-disable-psc-example"
region = "us-central1"
database_version = "POSTGRES_17"

depends_on = [google_service_networking_connection.default]

settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
backup_configuration {
enabled = true
}
ip_configuration {
psc_config {
psc_enabled = false
allowed_consumer_projects = [] # clear consumer projects
}
ipv4_enabled = false
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_disable_psc_instance]
26 changes: 26 additions & 0 deletions cloud_sql/sqlserver_instance_psa_psc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,29 @@ resource "google_compute_forwarding_rule" "default" {

# [END cloud_sql_sqlserver_instance_psa_psc_parent_tag]

// Configure a Cloud SQL SQL server instance with Private Service Connect disabled.
# [START cloud_sql_sqlserver_instance_disable_psc_instance]
resource "google_sql_database_instance" "disable_psc_example" {
name = "sqlserver-disable-psc-example"
region = "us-central1"
database_version = "SQLSERVER_2019_STANDARD"
root_password = "INSERT-PASSWORD-HERE"

depends_on = [google_service_networking_connection.default]

settings {
tier = "db-custom-2-7680"
ip_configuration {
psc_config {
psc_enabled = false
allowed_consumer_projects = [] # clear consumer projects
}
ipv4_enabled = false
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_disable_psc_instance]