File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed
postgres_instance_psa_psc
sqlserver_instance_psa_psc Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change @@ -89,5 +89,30 @@ resource "google_compute_forwarding_rule" "default" {
8989 target = data. google_sql_database_instance . default . psc_service_attachment_link
9090}
9191
92+ # [START cloud_sql_mysql_instance_disable_psc_instance]
93+ resource "google_sql_database_instance" "disable_psc_example" {
94+ name = " mysql-disable-psc-example"
95+ region = " us-central1"
96+ database_version = " MYSQL_8_0"
97+
98+ depends_on = [google_service_networking_connection . default ]
99+
100+ settings {
101+ tier = " db-f1-micro"
102+ ip_configuration {
103+ psc_config {
104+ psc_enabled = false
105+ allowed_consumer_projects = [] # clear consumer projects
106+ }
107+ ipv4_enabled = false
108+ private_network = google_compute_network. peering_network . id
109+ }
110+ }
111+ # set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
112+ # use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
113+ deletion_protection = false
114+ }
115+ # [END cloud_sql_mysql_instance_disable_psc_instance]
116+
92117# [END cloud_sql_mysql_instance_psa_psc_parent_tag]
93118
Original file line number Diff line number Diff line change @@ -93,4 +93,34 @@ resource "google_compute_forwarding_rule" "default" {
9393 target = data. google_sql_database_instance . default . psc_service_attachment_link
9494}
9595
96+
97+ # [START cloud_sql_postgres_instance_disable_psc_instance]
98+ resource "google_sql_database_instance" "disable_psc_example" {
99+ name = " postgres-disable-psc-example"
100+ region = " us-central1"
101+ database_version = " POSTGRES_17"
102+
103+ depends_on = [google_service_networking_connection . default ]
104+
105+ settings {
106+ tier = " db-custom-2-7680"
107+ availability_type = " REGIONAL"
108+ backup_configuration {
109+ enabled = true
110+ }
111+ ip_configuration {
112+ psc_config {
113+ psc_enabled = false
114+ allowed_consumer_projects = [] # clear consumer projects
115+ }
116+ ipv4_enabled = false
117+ private_network = google_compute_network. peering_network . id
118+ }
119+ }
120+ # set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
121+ # use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
122+ deletion_protection = false # Set to "true" to prevent destruction of the resource
123+ }
124+ # [END cloud_sql_postgres_instance_disable_psc_instance]
125+
96126# [END cloud_sql_postgres_instance_psa_psc_parent_tag]
Original file line number Diff line number Diff line change @@ -90,5 +90,31 @@ resource "google_compute_forwarding_rule" "default" {
9090 target = data. google_sql_database_instance . default . psc_service_attachment_link
9191}
9292
93+ # [START cloud_sql_sqlserver_instance_disable_psc_instance]
94+ resource "google_sql_database_instance" "disable_psc_example" {
95+ name = " sqlserver-disable-psc-example"
96+ region = " us-central1"
97+ database_version = " SQLSERVER_2019_STANDARD"
98+ root_password = " INSERT-PASSWORD-HERE"
99+
100+ depends_on = [google_service_networking_connection . default ]
101+
102+ settings {
103+ tier = " db-custom-2-7680"
104+ ip_configuration {
105+ psc_config {
106+ psc_enabled = false
107+ allowed_consumer_projects = [] # clear consumer projects
108+ }
109+ ipv4_enabled = false
110+ private_network = google_compute_network. peering_network . id
111+ }
112+ }
113+ # set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
114+ # use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
115+ deletion_protection = false
116+ }
117+ # [END cloud_sql_sqlserver_instance_disable_psc_instance]
118+
93119# [END cloud_sql_sqlserver_instance_psa_psc_parent_tag]
94120
You can’t perform that action at this time.
0 commit comments