@@ -1109,3 +1109,69 @@ resource "google_compute_global_address" "my_global_ip" {
11091109}
11101110` , fr, percentage, proxy, urlmap, backendservice, address)
11111111}
1112+
1113+ func TestAccComputeGlobalForwardingRule_ExternalPassthrough(t *testing.T ) {
1114+ t.Parallel ()
1115+
1116+ fr := fmt.Sprintf (" tf-test-fr-%s " , acctest.RandString (t, 10))
1117+ backendservice := fmt.Sprintf (" tf-test-bs-%s " , acctest.RandString (t, 10))
1118+ address0 := fmt.Sprintf (" tf-test-addr0-%s " , acctest.RandString (t, 10))
1119+ address1 := fmt.Sprintf (" tf-test-addr1-%s " , acctest.RandString (t, 10))
1120+
1121+ acctest.VcrTest (t, resource.TestCase {
1122+ PreCheck: func() { acctest.AccTestPreCheck (t) },
1123+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories (t),
1124+ CheckDestroy: testAccCheckComputeGlobalForwardingRuleDestroyProducer(t),
1125+ Steps: []resource.TestStep {
1126+ {
1127+ Config: testAccComputeGlobalForwardingRule_externalPassthrough(fr, backendservice, address0, address1, " google_compute_backend_service.my_backend_service.name" ),
1128+ },
1129+ {
1130+ ResourceName: " google_compute_global_forwarding_rule.forwarding_rule" ,
1131+ ImportState: true,
1132+ ImportStateVerify: true,
1133+ ImportStateVerifyIgnore: []string{" port_range" },
1134+ },
1135+ {
1136+ Config: testAccComputeGlobalForwardingRule_externalPassthrough(fr, backendservice, address0, address1, " google_compute_backend_service.my_backend_service.id" ),
1137+ ConfigPlanChecks: resource.ConfigPlanChecks {
1138+ PreApply: []plancheck.PlanCheck {
1139+ plancheck.ExpectEmptyPlan (),
1140+ },
1141+ },
1142+ },
1143+ },
1144+ })
1145+ }
1146+
1147+ func testAccComputeGlobalForwardingRule_externalPassthrough(fr, backendservice, address0, address1, backendServiceRef string) string {
1148+ return fmt.Sprintf (`
1149+ resource "google_compute_global_forwarding_rule" "forwarding_rule" {
1150+ name = "%s "
1151+ ip_protocol = "TCP"
1152+ port_range = "80"
1153+ load_balancing_scheme = "EXTERNAL_PASSTHROUGH"
1154+ backend_service = %s
1155+ ip_addresses = [
1156+ google_compute_global_address.my_global_ip0.address,
1157+ google_compute_global_address.my_global_ip1.address
1158+ ]
1159+ }
1160+
1161+ resource "google_compute_backend_service" "my_backend_service" {
1162+ name = "%s "
1163+ protocol = "UNSPECIFIED"
1164+ load_balancing_scheme = "EXTERNAL_PASSTHROUGH"
1165+ }
1166+
1167+ resource "google_compute_global_address" "my_global_ip0" {
1168+ name = "%s "
1169+ purpose = "PASSTHROUGH_LOAD_BALANCER_AVAILABILITY_GROUP0"
1170+ }
1171+
1172+ resource "google_compute_global_address" "my_global_ip1" {
1173+ name = "%s "
1174+ purpose = "PASSTHROUGH_LOAD_BALANCER_AVAILABILITY_GROUP1"
1175+ }
1176+ ` , fr, backendServiceRef, backendservice, address0, address1)
1177+ }
0 commit comments