Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set optional computed on fields that are conditional to balancing_mode #9587

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/4975.txt
Original file line number Diff line number Diff line change
@@ -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.
```
13 changes: 9 additions & 4 deletions google/resource_compute_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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].`,
},
},
}
Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 1 addition & 2 deletions website/docs/r/compute_backend_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down