Skip to content

Commit 2dcd327

Browse files
authored
Merge branch 'main' into main
2 parents 19b95dd + b8bbb15 commit 2dcd327

File tree

3 files changed

+132
-18
lines changed

3 files changed

+132
-18
lines changed

cloud_sql/mysql_instance_psc/main.tf

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,49 @@ data "google_sql_database_instance" "default" {
5151
}
5252

5353
resource "google_compute_forwarding_rule" "default" {
54-
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
55-
region = "us-central1"
56-
network = "default"
57-
ip_address = google_compute_address.default.self_link
58-
load_balancing_scheme = ""
59-
target = data.google_sql_database_instance.default.psc_service_attachment_link
54+
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
55+
region = "us-central1"
56+
network = "default"
57+
ip_address = google_compute_address.default.self_link
58+
load_balancing_scheme = ""
59+
target = data.google_sql_database_instance.default.psc_service_attachment_link
60+
allow_psc_global_access = true
6061
}
6162
# [END cloud_sql_mysql_instance_psc_endpoint]
63+
64+
# [START cloud_sql_mysql_instance_ipv6_psc_endpoint]
65+
resource "google_compute_network" "ipv6_default" {
66+
name = "net-ipv6"
67+
auto_create_subnetworks = false
68+
enable_ula_internal_ipv6 = true
69+
}
70+
71+
resource "google_compute_subnetwork" "ipv6_default" {
72+
name = "subnet-internal-ipv6"
73+
ip_cidr_range = "10.0.0.0/16"
74+
region = "us-central1"
75+
stack_type = "IPV4_IPV6"
76+
ipv6_access_type = "INTERNAL"
77+
network = google_compute_network.ipv6_default.id
78+
}
79+
80+
resource "google_compute_address" "ipv6_default" {
81+
name = "psc-compute-ipv6-address-${google_sql_database_instance.default.name}"
82+
region = "us-central1"
83+
address_type = "INTERNAL"
84+
subnetwork = google_compute_subnetwork.ipv6_default.name
85+
ip_version = "IPV6"
86+
}
87+
88+
resource "google_compute_forwarding_rule" "ipv6_ilb_example" {
89+
name = "ipv6-psc-forwarding-rule-${google_sql_database_instance.default.name}"
90+
region = "us-central1"
91+
92+
load_balancing_scheme = ""
93+
target = data.google_sql_database_instance.default.psc_service_attachment_link
94+
network = google_compute_network.ipv6_default.name
95+
subnetwork = google_compute_subnetwork.ipv6_default.name
96+
ip_address = google_compute_address.ipv6_default.id
97+
allow_psc_global_access = true
98+
}
99+
# [END cloud_sql_mysql_instance_ipv6_psc_endpoint]

cloud_sql/postgres_instance_psc/main.tf

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,49 @@ data "google_sql_database_instance" "default" {
5050
}
5151

5252
resource "google_compute_forwarding_rule" "default" {
53-
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
54-
region = "us-central1"
55-
network = "default"
56-
ip_address = google_compute_address.default.self_link
57-
load_balancing_scheme = ""
58-
target = data.google_sql_database_instance.default.psc_service_attachment_link
53+
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
54+
region = "us-central1"
55+
network = "default"
56+
ip_address = google_compute_address.default.self_link
57+
load_balancing_scheme = ""
58+
target = data.google_sql_database_instance.default.psc_service_attachment_link
59+
allow_psc_global_access = true
5960
}
6061
# [END cloud_sql_postgres_instance_psc_endpoint]
62+
63+
# [START cloud_sql_postgres_instance_ipv6_psc_endpoint]
64+
resource "google_compute_network" "ipv6_default" {
65+
name = "net-ipv6"
66+
auto_create_subnetworks = false
67+
enable_ula_internal_ipv6 = true
68+
}
69+
70+
resource "google_compute_subnetwork" "ipv6_default" {
71+
name = "subnet-internal-ipv6"
72+
ip_cidr_range = "10.0.0.0/16"
73+
region = "us-central1"
74+
stack_type = "IPV4_IPV6"
75+
ipv6_access_type = "INTERNAL"
76+
network = google_compute_network.ipv6_default.id
77+
}
78+
79+
resource "google_compute_address" "ipv6_default" {
80+
name = "psc-compute-ipv6-address-${google_sql_database_instance.default.name}"
81+
region = "us-central1"
82+
address_type = "INTERNAL"
83+
subnetwork = google_compute_subnetwork.ipv6_default.name
84+
ip_version = "IPV6"
85+
}
86+
87+
resource "google_compute_forwarding_rule" "ipv6_ilb_example" {
88+
name = "ipv6-psc-forwarding-rule-${google_sql_database_instance.default.name}"
89+
region = "us-central1"
90+
91+
load_balancing_scheme = ""
92+
target = data.google_sql_database_instance.default.psc_service_attachment_link
93+
network = google_compute_network.ipv6_default.name
94+
subnetwork = google_compute_subnetwork.ipv6_default.name
95+
ip_address = google_compute_address.ipv6_default.id
96+
allow_psc_global_access = true
97+
}
98+
# [END cloud_sql_postgres_instance_ipv6_psc_endpoint]

cloud_sql/sqlserver_instance_psc/main.tf

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,49 @@ data "google_sql_database_instance" "default" {
5252
}
5353

5454
resource "google_compute_forwarding_rule" "default" {
55-
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
56-
region = "us-central1"
57-
network = "default"
58-
ip_address = google_compute_address.default.self_link
59-
load_balancing_scheme = ""
60-
target = data.google_sql_database_instance.default.psc_service_attachment_link
55+
name = "psc-forwarding-rule-${google_sql_database_instance.default.name}"
56+
region = "us-central1"
57+
network = "default"
58+
ip_address = google_compute_address.default.self_link
59+
load_balancing_scheme = ""
60+
target = data.google_sql_database_instance.default.psc_service_attachment_link
61+
allow_psc_global_access = true
6162
}
6263
# [END cloud_sql_sqlserver_instance_psc_endpoint]
64+
65+
# [START cloud_sql_sqlserver_instance_ipv6_psc_endpoint]
66+
resource "google_compute_network" "ipv6_default" {
67+
name = "net-ipv6"
68+
auto_create_subnetworks = false
69+
enable_ula_internal_ipv6 = true
70+
}
71+
72+
resource "google_compute_subnetwork" "ipv6_default" {
73+
name = "subnet-internal-ipv6"
74+
ip_cidr_range = "10.0.0.0/16"
75+
region = "us-central1"
76+
stack_type = "IPV4_IPV6"
77+
ipv6_access_type = "INTERNAL"
78+
network = google_compute_network.ipv6_default.id
79+
}
80+
81+
resource "google_compute_address" "ipv6_default" {
82+
name = "psc-compute-ipv6-address-${google_sql_database_instance.default.name}"
83+
region = "us-central1"
84+
address_type = "INTERNAL"
85+
subnetwork = google_compute_subnetwork.ipv6_default.name
86+
ip_version = "IPV6"
87+
}
88+
89+
resource "google_compute_forwarding_rule" "ipv6_ilb_example" {
90+
name = "ipv6-psc-forwarding-rule-${google_sql_database_instance.default.name}"
91+
region = "us-central1"
92+
93+
load_balancing_scheme = ""
94+
target = data.google_sql_database_instance.default.psc_service_attachment_link
95+
network = google_compute_network.ipv6_default.name
96+
subnetwork = google_compute_subnetwork.ipv6_default.name
97+
ip_address = google_compute_address.ipv6_default.id
98+
allow_psc_global_access = true
99+
}
100+
# [END cloud_sql_sqlserver_instance_ipv6_psc_endpoint]

0 commit comments

Comments
 (0)