Skip to content

Commit 69315c1

Browse files
Add Terraform support for L3_DEFAULT (all protocol) L4 ILB (#8445) (#15328)
* Add Terraform support for L3_DEFAULT (all protocol) L4 ILB * Added test testAccComputeBackendService_withUnspecifiedProtocol * Update mmv1/products/compute/BackendService.yaml * Update mmv1/products/compute/BackendService.yaml --------- Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Thomas Rodgers <[email protected]>
1 parent 20442db commit 69315c1

File tree

4 files changed

+69
-4
lines changed

4 files changed

+69
-4
lines changed

.changelog/8445.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note: enhancement
2+
compute: added protocol type: UNSPECIFIED in `google_compute_backend_service` as per [release note](https://cloud.google.com/load-balancing/docs/release-notes#July_24_2023)
3+
4+
```

google/resource_compute_backend_service_test.go

+57
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,63 @@ resource "google_compute_http_health_check" "default" {
983983
`, serviceName, timeout, igName, itName, checkName)
984984
}
985985

986+
func testAccComputeBackendService_withUnspecifiedProtocol(
987+
serviceName, igName, itName, checkName string, timeout int64) string {
988+
return fmt.Sprintf(`
989+
data "google_compute_image" "my_image" {
990+
family = "debian-11"
991+
project = "debian-cloud"
992+
}
993+
994+
resource "google_compute_backend_service" "lipsum" {
995+
name = "%s"
996+
description = "Hello World 1234"
997+
port_name = "http"
998+
protocol = "UNSPECIFIED"
999+
timeout_sec = %v
1000+
1001+
backend {
1002+
group = google_compute_instance_group_manager.foobar.instance_group
1003+
}
1004+
1005+
health_checks = [google_compute_http_health_check.default.self_link]
1006+
}
1007+
1008+
resource "google_compute_instance_group_manager" "foobar" {
1009+
name = "%s"
1010+
version {
1011+
instance_template = google_compute_instance_template.foobar.self_link
1012+
name = "primary"
1013+
}
1014+
base_instance_name = "tf-test-foobar"
1015+
zone = "us-central1-f"
1016+
target_size = 1
1017+
}
1018+
1019+
resource "google_compute_instance_template" "foobar" {
1020+
name = "%s"
1021+
machine_type = "e2-medium"
1022+
1023+
network_interface {
1024+
network = "default"
1025+
}
1026+
1027+
disk {
1028+
source_image = data.google_compute_image.my_image.self_link
1029+
auto_delete = true
1030+
boot = true
1031+
}
1032+
}
1033+
1034+
resource "google_compute_http_health_check" "default" {
1035+
name = "%s"
1036+
request_path = "/"
1037+
check_interval_sec = 1
1038+
timeout_sec = 1
1039+
}
1040+
`, serviceName, timeout, igName, itName, checkName)
1041+
}
1042+
9861043
func testAccComputeBackendService_withBackendAndMaxUtilization(
9871044
serviceName, igName, itName, checkName string, timeout int64) string {
9881045
return fmt.Sprintf(`

google/services/compute/resource_compute_backend_service.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,12 @@ scheme is EXTERNAL.`,
10121012
Type: schema.TypeString,
10131013
Computed: true,
10141014
Optional: true,
1015-
ValidateFunc: verify.ValidateEnum([]string{"HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", ""}),
1015+
ValidateFunc: verify.ValidateEnum([]string{"HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", "UNSPECIFIED", ""}),
10161016
Description: `The protocol this BackendService uses to communicate with backends.
10171017
The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer
1018-
types and may result in errors if used with the GA API. Possible values: ["HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC"]`,
1018+
types and may result in errors if used with the GA API. **NOTE**: With protocol “UNSPECIFIED”,
1019+
the backend service can be used by Layer 4 Internal Load Balancing or Network Load Balancing
1020+
with TCP/UDP/L3_DEFAULT Forwarding Rule protocol. Possible values: ["HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", "UNSPECIFIED"]`,
10191021
},
10201022
"security_policy": {
10211023
Type: schema.TypeString,

website/docs/r/compute_backend_service.html.markdown

+4-2
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,10 @@ The following arguments are supported:
515515
(Optional)
516516
The protocol this BackendService uses to communicate with backends.
517517
The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer
518-
types and may result in errors if used with the GA API.
519-
Possible values are: `HTTP`, `HTTPS`, `HTTP2`, `TCP`, `SSL`, `GRPC`.
518+
types and may result in errors if used with the GA API. **NOTE**: With protocol “UNSPECIFIED”,
519+
the backend service can be used by Layer 4 Internal Load Balancing or Network Load Balancing
520+
with TCP/UDP/L3_DEFAULT Forwarding Rule protocol.
521+
Possible values are: `HTTP`, `HTTPS`, `HTTP2`, `TCP`, `SSL`, `GRPC`, `UNSPECIFIED`.
520522

521523
* `security_policy` -
522524
(Optional)

0 commit comments

Comments
 (0)