@@ -52,27 +52,49 @@ data "google_sql_database_instance" "default" {
5252}
5353
5454resource "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
6161 allow_psc_global_access = true
6262}
6363# [END cloud_sql_sqlserver_instance_psc_endpoint]
6464
6565# [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+
6689resource "google_compute_forwarding_rule" "ipv6_ilb_example" {
6790 name = " ipv6-psc-forwarding-rule-${ google_sql_database_instance . default . name } "
6891 region = " us-central1"
6992
70- load_balancing_scheme = " "
71- target = data. google_sql_database_instance . default . psc_service_attachment_link
72- all_ports = true
73- network = " default" # Replace value with the name of the network here.
74- subnetwork = " default" # Replace value with the name of the subnet here.
75- ip_version = " IPV6"
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
7698 allow_psc_global_access = true
7799}
78- # [END cloud_sql_sqlserver_instance_ipv6_psc_endpoint]
100+ # [END cloud_sql_sqlserver_instance_ipv6_psc_endpoint]
0 commit comments