@@ -125,6 +125,72 @@ func TestAccComputeGlobalForwardingRule_labels(t *testing.T) {
125125 })
126126}
127127
128+ func TestAccComputeGlobalForwardingRule_allApisLabels (t * testing.T ) {
129+ t .Parallel ()
130+
131+ fr := fmt .Sprintf ("frtest%s" , acctest .RandString (t , 10 ))
132+ address := fmt .Sprintf ("forwardrule-test-%s" , acctest .RandString (t , 10 ))
133+
134+ acctest .VcrTest (t , resource.TestCase {
135+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
136+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
137+ CheckDestroy : testAccCheckComputeGlobalForwardingRuleDestroyProducer (t ),
138+ Steps : []resource.TestStep {
139+ {
140+ Config : testAccComputeGlobalForwardingRule_allApisLabels (fr , address ),
141+ },
142+ {
143+ ResourceName : "google_compute_global_forwarding_rule.forwarding_rule" ,
144+ ImportState : true ,
145+ ImportStateVerify : true ,
146+ ImportStateVerifyIgnore : []string {"port_range" , "target" , "labels" , "terraform_labels" },
147+ },
148+ {
149+ Config : testAccComputeGlobalForwardingRule_allApisLabelsUpdated (fr , address ),
150+ },
151+ {
152+ ResourceName : "google_compute_global_forwarding_rule.forwarding_rule" ,
153+ ImportState : true ,
154+ ImportStateVerify : true ,
155+ ImportStateVerifyIgnore : []string {"port_range" , "target" , "labels" , "terraform_labels" },
156+ },
157+ },
158+ })
159+ }
160+
161+ func TestAccComputeGlobalForwardingRule_vpcscLabels (t * testing.T ) {
162+ t .Parallel ()
163+
164+ fr := fmt .Sprintf ("frtest%s" , acctest .RandString (t , 10 ))
165+ address := fmt .Sprintf ("forwardrule-test-%s" , acctest .RandString (t , 10 ))
166+
167+ acctest .VcrTest (t , resource.TestCase {
168+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
169+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
170+ CheckDestroy : testAccCheckComputeGlobalForwardingRuleDestroyProducer (t ),
171+ Steps : []resource.TestStep {
172+ {
173+ Config : testAccComputeGlobalForwardingRule_vpcscLabels (fr , address ),
174+ },
175+ {
176+ ResourceName : "google_compute_global_forwarding_rule.forwarding_rule" ,
177+ ImportState : true ,
178+ ImportStateVerify : true ,
179+ ImportStateVerifyIgnore : []string {"port_range" , "target" , "labels" , "terraform_labels" },
180+ },
181+ {
182+ Config : testAccComputeGlobalForwardingRule_vpcscLabelsUpdated (fr , address ),
183+ },
184+ {
185+ ResourceName : "google_compute_global_forwarding_rule.forwarding_rule" ,
186+ ImportState : true ,
187+ ImportStateVerify : true ,
188+ ImportStateVerifyIgnore : []string {"port_range" , "labels" , "terraform_labels" },
189+ },
190+ },
191+ })
192+ }
193+
128194func TestAccComputeGlobalForwardingRule_internalLoadBalancing (t * testing.T ) {
129195 t .Parallel ()
130196
@@ -469,6 +535,106 @@ resource "google_compute_url_map" "urlmap" {
469535` , fr , proxy , backend , hc , urlmap )
470536}
471537
538+ func testAccComputeGlobalForwardingRule_allApisLabels (fr , address string ) string {
539+ return fmt .Sprintf (`
540+ resource "google_compute_global_forwarding_rule" "forwarding_rule" {
541+ name = "%s"
542+ network = "default"
543+ target = "all-apis"
544+ ip_address = google_compute_global_address.default.id
545+ load_balancing_scheme = ""
546+ labels = {
547+ my-label = "a-value"
548+ a-different-label = "my-second-label-value"
549+ }
550+ }
551+
552+ resource "google_compute_global_address" "default" {
553+ name = "%s"
554+ address_type = "INTERNAL"
555+ purpose = "PRIVATE_SERVICE_CONNECT"
556+ network = "default"
557+ address = "100.100.100.105"
558+ }
559+
560+ ` , fr , address )
561+ }
562+
563+ func testAccComputeGlobalForwardingRule_allApisLabelsUpdated (fr , address string ) string {
564+ return fmt .Sprintf (`
565+ resource "google_compute_global_forwarding_rule" "forwarding_rule" {
566+ name = "%s"
567+ network = "default"
568+ target = "all-apis"
569+ ip_address = google_compute_global_address.default.id
570+ load_balancing_scheme = ""
571+ labels = {
572+ my-label = "a-value"
573+ a-different-label = "my-third-label-value"
574+ }
575+ }
576+
577+ resource "google_compute_global_address" "default" {
578+ name = "%s"
579+ address_type = "INTERNAL"
580+ purpose = "PRIVATE_SERVICE_CONNECT"
581+ network = "default"
582+ address = "100.100.100.105"
583+ }
584+
585+ ` , fr , address )
586+ }
587+
588+ func testAccComputeGlobalForwardingRule_vpcscLabels (fr , address string ) string {
589+ return fmt .Sprintf (`
590+ resource "google_compute_global_forwarding_rule" "forwarding_rule" {
591+ name = "%s"
592+ network = "default"
593+ target = "vpc-sc"
594+ ip_address = google_compute_global_address.default.id
595+ load_balancing_scheme = ""
596+ labels = {
597+ my-label = "a-value"
598+ a-different-label = "my-second-label-value"
599+ }
600+ }
601+
602+ resource "google_compute_global_address" "default" {
603+ name = "%s"
604+ address_type = "INTERNAL"
605+ purpose = "PRIVATE_SERVICE_CONNECT"
606+ network = "default"
607+ address = "100.100.100.106"
608+ }
609+
610+ ` , fr , address )
611+ }
612+
613+ func testAccComputeGlobalForwardingRule_vpcscLabelsUpdated (fr , address string ) string {
614+ return fmt .Sprintf (`
615+ resource "google_compute_global_forwarding_rule" "forwarding_rule" {
616+ name = "%s"
617+ network = "default"
618+ target = "vpc-sc"
619+ ip_address = google_compute_global_address.default.id
620+ load_balancing_scheme = ""
621+ labels = {
622+ my-label = "a-value"
623+ a-different-label = "my-third-label-value"
624+ }
625+ }
626+
627+ resource "google_compute_global_address" "default" {
628+ name = "%s"
629+ address_type = "INTERNAL"
630+ purpose = "PRIVATE_SERVICE_CONNECT"
631+ network = "default"
632+ address = "100.100.100.106"
633+ }
634+
635+ ` , fr , address )
636+ }
637+
472638func testAccComputeGlobalForwardingRule_ipv6 (fr , proxy , backend , hc , urlmap string ) string {
473639 return fmt .Sprintf (`
474640resource "google_compute_global_forwarding_rule" "forwarding_rule" {
0 commit comments