Skip to content

Commit

Permalink
Add disable_http2 to google_network_services_edge_cache_service resou…
Browse files Browse the repository at this point in the history
…rce (#5780) (#11258)

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Mar 11, 2022
1 parent 35ae0eb commit 5295c21
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/5780.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
networkservices: added `disable_http2` property to `google_network_services_edge_cache_service` resource
```
36 changes: 36 additions & 0 deletions google/resource_network_services_edge_cache_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,15 @@ The supported values are:
Optional: true,
Description: `A human-readable description of the resource.`,
},
"disable_http2": {
Type: schema.TypeBool,
Optional: true,
Description: `Disables HTTP/2.
HTTP/2 (h2) is enabled by default and recommended for performance. HTTP/2 improves connection re-use and reduces connection setup overhead by sending multiple streams over the same connection.
Some legacy HTTP clients may have issues with HTTP/2 connections due to broken HTTP/2 implementations. Setting this to true will prevent HTTP/2 from being advertised and negotiated.`,
},
"disable_quic": {
Type: schema.TypeBool,
Computed: true,
Expand Down Expand Up @@ -862,6 +871,12 @@ func resourceNetworkServicesEdgeCacheServiceCreate(d *schema.ResourceData, meta
} else if v, ok := d.GetOkExists("disable_quic"); !isEmptyValue(reflect.ValueOf(disableQuicProp)) && (ok || !reflect.DeepEqual(v, disableQuicProp)) {
obj["disableQuic"] = disableQuicProp
}
disableHttp2Prop, err := expandNetworkServicesEdgeCacheServiceDisableHttp2(d.Get("disable_http2"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("disable_http2"); !isEmptyValue(reflect.ValueOf(disableHttp2Prop)) && (ok || !reflect.DeepEqual(v, disableHttp2Prop)) {
obj["disableHttp2"] = disableHttp2Prop
}
requireTlsProp, err := expandNetworkServicesEdgeCacheServiceRequireTls(d.Get("require_tls"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -988,6 +1003,9 @@ func resourceNetworkServicesEdgeCacheServiceRead(d *schema.ResourceData, meta in
if err := d.Set("disable_quic", flattenNetworkServicesEdgeCacheServiceDisableQuic(res["disableQuic"], d, config)); err != nil {
return fmt.Errorf("Error reading EdgeCacheService: %s", err)
}
if err := d.Set("disable_http2", flattenNetworkServicesEdgeCacheServiceDisableHttp2(res["disableHttp2"], d, config)); err != nil {
return fmt.Errorf("Error reading EdgeCacheService: %s", err)
}
if err := d.Set("require_tls", flattenNetworkServicesEdgeCacheServiceRequireTls(res["requireTls"], d, config)); err != nil {
return fmt.Errorf("Error reading EdgeCacheService: %s", err)
}
Expand Down Expand Up @@ -1050,6 +1068,12 @@ func resourceNetworkServicesEdgeCacheServiceUpdate(d *schema.ResourceData, meta
} else if v, ok := d.GetOkExists("disable_quic"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, disableQuicProp)) {
obj["disableQuic"] = disableQuicProp
}
disableHttp2Prop, err := expandNetworkServicesEdgeCacheServiceDisableHttp2(d.Get("disable_http2"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("disable_http2"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, disableHttp2Prop)) {
obj["disableHttp2"] = disableHttp2Prop
}
requireTlsProp, err := expandNetworkServicesEdgeCacheServiceRequireTls(d.Get("require_tls"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -1107,6 +1131,10 @@ func resourceNetworkServicesEdgeCacheServiceUpdate(d *schema.ResourceData, meta
updateMask = append(updateMask, "disableQuic")
}

if d.HasChange("disable_http2") {
updateMask = append(updateMask, "disableHttp2")
}

if d.HasChange("require_tls") {
updateMask = append(updateMask, "requireTls")
}
Expand Down Expand Up @@ -1238,6 +1266,10 @@ func flattenNetworkServicesEdgeCacheServiceDisableQuic(v interface{}, d *schema.
return v
}

func flattenNetworkServicesEdgeCacheServiceDisableHttp2(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenNetworkServicesEdgeCacheServiceRequireTls(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}
Expand Down Expand Up @@ -1914,6 +1946,10 @@ func expandNetworkServicesEdgeCacheServiceDisableQuic(v interface{}, d Terraform
return v, nil
}

func expandNetworkServicesEdgeCacheServiceDisableHttp2(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandNetworkServicesEdgeCacheServiceRequireTls(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ resource "google_network_services_edge_cache_service" "instance" {
name = "tf-test-my-service%{random_suffix}"
description = "some description"
disable_quic = true
disable_http2 = true
labels = {
a = "b"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ resource "google_network_services_edge_cache_service" "instance" {
name = "my-service"
description = "some description"
disable_quic = true
disable_http2 = true
labels = {
a = "b"
}
Expand Down Expand Up @@ -777,6 +778,12 @@ The following arguments are supported:
(Optional)
HTTP/3 (IETF QUIC) and Google QUIC are enabled by default.

* `disable_http2` -
(Optional)
Disables HTTP/2.
HTTP/2 (h2) is enabled by default and recommended for performance. HTTP/2 improves connection re-use and reduces connection setup overhead by sending multiple streams over the same connection.
Some legacy HTTP clients may have issues with HTTP/2 connections due to broken HTTP/2 implementations. Setting this to true will prevent HTTP/2 from being advertised and negotiated.

* `require_tls` -
(Optional)
Require TLS (HTTPS) for all clients connecting to this service.
Expand Down

0 comments on commit 5295c21

Please sign in to comment.