From acc198c8fce138ca24ccc3f864fecb7f90c11c9e Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Mon, 19 Jul 2021 18:26:59 +0000 Subject: [PATCH] set optional computed on fields that are conditional to balancing_mode (#4975) Signed-off-by: Modular Magician --- .changelog/4975.txt | 3 +++ google/resource_compute_backend_service.go | 13 +++++++++---- .../docs/r/compute_backend_service.html.markdown | 3 +-- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .changelog/4975.txt diff --git a/.changelog/4975.txt b/.changelog/4975.txt new file mode 100644 index 00000000000..52a41a3adb1 --- /dev/null +++ b/.changelog/4975.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: removed default value of `0.8` from `google_backend_service.backend.max_utilization` and it will now default from API. All `max_connections_xxx` and `max_rate_xxx` will also default from API as these are all conditional on balancing mode. +``` diff --git a/google/resource_compute_backend_service.go b/google/resource_compute_backend_service.go index 54fe839119f..3cf6365944c 100644 --- a/google/resource_compute_backend_service.go +++ b/google/resource_compute_backend_service.go @@ -932,6 +932,7 @@ Provide this property when you create the resource.`, }, "max_connections": { Type: schema.TypeInt, + Computed: true, Optional: true, Description: `The max number of simultaneous connections for the group. Can be used with either CONNECTION or UTILIZATION balancing modes. @@ -942,6 +943,7 @@ as appropriate for group type, must be set.`, }, "max_connections_per_endpoint": { Type: schema.TypeInt, + Computed: true, Optional: true, Description: `The max number of simultaneous connections that a single backend network endpoint can handle. This is used to calculate the @@ -953,6 +955,7 @@ maxConnections or maxConnectionsPerEndpoint must be set.`, }, "max_connections_per_instance": { Type: schema.TypeInt, + Computed: true, Optional: true, Description: `The max number of simultaneous connections that a single backend instance can handle. This is used to calculate the @@ -964,6 +967,7 @@ maxConnectionsPerInstance must be set.`, }, "max_rate": { Type: schema.TypeInt, + Computed: true, Optional: true, Description: `The max requests per second (RPS) of the group. @@ -974,6 +978,7 @@ group type, must be set.`, }, "max_rate_per_endpoint": { Type: schema.TypeFloat, + Computed: true, Optional: true, Description: `The max requests per second (RPS) that a single backend network endpoint can handle. This is used to calculate the capacity of @@ -982,6 +987,7 @@ either maxRate or maxRatePerEndpoint must be set.`, }, "max_rate_per_instance": { Type: schema.TypeFloat, + Computed: true, Optional: true, Description: `The max requests per second (RPS) that a single backend instance can handle. This is used to calculate the capacity of @@ -990,11 +996,10 @@ either maxRate or maxRatePerInstance must be set.`, }, "max_utilization": { Type: schema.TypeFloat, + Computed: true, Optional: true, Description: `Used when balancingMode is UTILIZATION. This ratio defines the -CPU utilization target for the group. The default is 0.8. Valid -range is [0.0, 1.0].`, - Default: 0.8, +CPU utilization target for the group. Valid range is [0.0, 1.0].`, }, }, } @@ -2750,7 +2755,7 @@ func expandComputeBackendServiceBackend(v interface{}, d TerraformResourceData, transformedMaxUtilization, err := expandComputeBackendServiceBackendMaxUtilization(original["max_utilization"], d, config) if err != nil { return nil, err - } else { + } else if val := reflect.ValueOf(transformedMaxUtilization); val.IsValid() && !isEmptyValue(val) { transformed["maxUtilization"] = transformedMaxUtilization } diff --git a/website/docs/r/compute_backend_service.html.markdown b/website/docs/r/compute_backend_service.html.markdown index ca064a9b3c1..37a33dde134 100644 --- a/website/docs/r/compute_backend_service.html.markdown +++ b/website/docs/r/compute_backend_service.html.markdown @@ -489,8 +489,7 @@ The `backend` block supports: * `max_utilization` - (Optional) Used when balancingMode is UTILIZATION. This ratio defines the - CPU utilization target for the group. The default is 0.8. Valid - range is [0.0, 1.0]. + CPU utilization target for the group. Valid range is [0.0, 1.0]. The `circuit_breakers` block supports: