Skip to content

Commit

Permalink
Add Terraform support for L3_DEFAULT (all protocol) L4 ILB (#8445) (#…
Browse files Browse the repository at this point in the history
…5967)

* 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 <magic-modules@google.com>
Co-authored-by: Thomas Rodgers <notaraptor@gmail.com>
  • Loading branch information
modular-magician and trodge authored Jul 28, 2023
1 parent 082d7b9 commit 4e9a95e
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .changelog/8445.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note: enhancement
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)

```
57 changes: 57 additions & 0 deletions google-beta/resource_compute_backend_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,63 @@ resource "google_compute_http_health_check" "default" {
`, serviceName, timeout, igName, itName, checkName)
}

func testAccComputeBackendService_withUnspecifiedProtocol(
serviceName, igName, itName, checkName string, timeout int64) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
family = "debian-11"
project = "debian-cloud"
}
resource "google_compute_backend_service" "lipsum" {
name = "%s"
description = "Hello World 1234"
port_name = "http"
protocol = "UNSPECIFIED"
timeout_sec = %v
backend {
group = google_compute_instance_group_manager.foobar.instance_group
}
health_checks = [google_compute_http_health_check.default.self_link]
}
resource "google_compute_instance_group_manager" "foobar" {
name = "%s"
version {
instance_template = google_compute_instance_template.foobar.self_link
name = "primary"
}
base_instance_name = "tf-test-foobar"
zone = "us-central1-f"
target_size = 1
}
resource "google_compute_instance_template" "foobar" {
name = "%s"
machine_type = "e2-medium"
network_interface {
network = "default"
}
disk {
source_image = data.google_compute_image.my_image.self_link
auto_delete = true
boot = true
}
}
resource "google_compute_http_health_check" "default" {
name = "%s"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
`, serviceName, timeout, igName, itName, checkName)
}

func testAccComputeBackendService_withBackendAndMaxUtilization(
serviceName, igName, itName, checkName string, timeout int64) string {
return fmt.Sprintf(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,10 +1037,12 @@ scheme is EXTERNAL.`,
Type: schema.TypeString,
Computed: true,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", ""}),
ValidateFunc: verify.ValidateEnum([]string{"HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", "UNSPECIFIED", ""}),
Description: `The protocol this BackendService uses to communicate with backends.
The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer
types and may result in errors if used with the GA API. Possible values: ["HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC"]`,
types and may result in errors if used with the GA API. **NOTE**: With protocol “UNSPECIFIED”,
the backend service can be used by Layer 4 Internal Load Balancing or Network Load Balancing
with TCP/UDP/L3_DEFAULT Forwarding Rule protocol. Possible values: ["HTTP", "HTTPS", "HTTP2", "TCP", "SSL", "GRPC", "UNSPECIFIED"]`,
},
"security_policy": {
Type: schema.TypeString,
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/compute_backend_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,10 @@ The following arguments are supported:
(Optional)
The protocol this BackendService uses to communicate with backends.
The default is HTTP. **NOTE**: HTTP2 is only valid for beta HTTP/2 load balancer
types and may result in errors if used with the GA API.
Possible values are: `HTTP`, `HTTPS`, `HTTP2`, `TCP`, `SSL`, `GRPC`.
types and may result in errors if used with the GA API. **NOTE**: With protocol “UNSPECIFIED”,
the backend service can be used by Layer 4 Internal Load Balancing or Network Load Balancing
with TCP/UDP/L3_DEFAULT Forwarding Rule protocol.
Possible values are: `HTTP`, `HTTPS`, `HTTP2`, `TCP`, `SSL`, `GRPC`, `UNSPECIFIED`.

* `security_policy` -
(Optional)
Expand Down

0 comments on commit 4e9a95e

Please sign in to comment.