@@ -87,7 +87,6 @@ func TestAccComputeGlobalForwardingRule_ipv6(t *testing.T) {
87
87
})
88
88
}
89
89
90
- {{ if ne $.TargetVersionName `ga` -}}
91
90
func TestAccComputeGlobalForwardingRule_labels(t *testing.T) {
92
91
t.Parallel()
93
92
@@ -123,7 +122,72 @@ func TestAccComputeGlobalForwardingRule_labels(t *testing.T) {
123
122
},
124
123
})
125
124
}
126
- {{- end }}
125
+
126
+ func TestAccComputeGlobalForwardingRule_allApisLabels(t *testing.T) {
127
+ t.Parallel()
128
+
129
+ fr := fmt.Sprintf("frtest%s", acctest.RandString(t, 10))
130
+ address := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10))
131
+
132
+ acctest.VcrTest(t, resource.TestCase{
133
+ PreCheck: func() { acctest.AccTestPreCheck(t) },
134
+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
135
+ CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t),
136
+ Steps: []resource.TestStep{
137
+ {
138
+ Config: testAccComputeGlobalForwardingRule_allApisLabels(fr, address),
139
+ },
140
+ {
141
+ ResourceName: "google_compute_global_forwarding_rule.forwarding_rule",
142
+ ImportState: true,
143
+ ImportStateVerify: true,
144
+ ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"},
145
+ },
146
+ {
147
+ Config: testAccComputeGlobalForwardingRule_allApisLabelsUpdated(fr, address),
148
+ },
149
+ {
150
+ ResourceName: "google_compute_global_forwarding_rule.forwarding_rule",
151
+ ImportState: true,
152
+ ImportStateVerify: true,
153
+ ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"},
154
+ },
155
+ },
156
+ })
157
+ }
158
+
159
+ func TestAccComputeGlobalForwardingRule_vpcscLabels(t *testing.T) {
160
+ t.Parallel()
161
+
162
+ fr := fmt.Sprintf("frtest%s", acctest.RandString(t, 10))
163
+ address := fmt.Sprintf("forwardrule-test-%s", acctest.RandString(t, 10))
164
+
165
+ acctest.VcrTest(t, resource.TestCase{
166
+ PreCheck: func() { acctest.AccTestPreCheck(t) },
167
+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
168
+ CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t),
169
+ Steps: []resource.TestStep{
170
+ {
171
+ Config: testAccComputeGlobalForwardingRule_vpcscLabels(fr, address),
172
+ },
173
+ {
174
+ ResourceName: "google_compute_global_forwarding_rule.forwarding_rule",
175
+ ImportState: true,
176
+ ImportStateVerify: true,
177
+ ImportStateVerifyIgnore: []string{"port_range", "target", "labels", "terraform_labels"},
178
+ },
179
+ {
180
+ Config: testAccComputeGlobalForwardingRule_vpcscLabelsUpdated(fr, address),
181
+ },
182
+ {
183
+ ResourceName: "google_compute_global_forwarding_rule.forwarding_rule",
184
+ ImportState: true,
185
+ ImportStateVerify: true,
186
+ ImportStateVerifyIgnore: []string{"port_range", "labels", "terraform_labels"},
187
+ },
188
+ },
189
+ })
190
+ }
127
191
128
192
{{ if ne $.TargetVersionName `ga` -}}
129
193
func TestAccComputeGlobalForwardingRule_internalLoadBalancing(t *testing.T) {
@@ -361,7 +425,6 @@ resource "google_compute_url_map" "url_map" {
361
425
`, fr, targetProxy, proxy, proxy2, backend, hc, urlmap)
362
426
}
363
427
364
- {{ if ne $.TargetVersionName `ga` -}}
365
428
func testAccComputeGlobalForwardingRule_labels(fr, proxy, backend, hc, urlmap string) string {
366
429
return fmt.Sprintf(`
367
430
resource "google_compute_global_forwarding_rule" "forwarding_rule" {
@@ -416,9 +479,7 @@ resource "google_compute_url_map" "urlmap" {
416
479
}
417
480
`, fr, proxy, backend, hc, urlmap)
418
481
}
419
- {{- end }}
420
482
421
- {{ if ne $.TargetVersionName `ga` -}}
422
483
func testAccComputeGlobalForwardingRule_labelsUpdated(fr, proxy, backend, hc, urlmap string) string {
423
484
return fmt.Sprintf(`
424
485
resource "google_compute_global_forwarding_rule" "forwarding_rule" {
@@ -473,7 +534,106 @@ resource "google_compute_url_map" "urlmap" {
473
534
}
474
535
`, fr, proxy, backend, hc, urlmap)
475
536
}
476
- {{- end }}
537
+
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
+ }
477
637
478
638
func testAccComputeGlobalForwardingRule_ipv6(fr, proxy, backend, hc, urlmap string) string {
479
639
return fmt.Sprintf(`
0 commit comments