Remove incompatible balancing_mode (#1769)
## net-lb-int * Fix error on apply of example: ``` Error creating RegionBackendService: googleapi: Error 400: Invalid value for field 'resource.backends[0].balancingMode': 'UTILIZATION'. Balancing mode must be CONNECTION for an INTERNAL backend service., invalid ``` * remove unused `balancing_mode` variable, as only one value is possible anyhow ## net-lb-ext * update in the `backends` description ## net-lb-proxy-int * update in the `backends` description ## net-lb-app-int * added validation of `balancing_mode` * fixed other validations ## net-lb-app-ext * added validation of `balancing_mode` * fixed other validations * removed validation for `locality_lb_policy` as this variable is not used in this module Closes: #1767
This commit is contained in:
committed by
GitHub
parent
6c48512f7e
commit
c21fa4558f
@@ -128,23 +128,24 @@ variable "backend_service_configs" {
|
||||
default = {}
|
||||
nullable = false
|
||||
validation {
|
||||
condition = contains(
|
||||
[
|
||||
"-", "ROUND_ROBIN", "LEAST_REQUEST", "RING_HASH",
|
||||
"RANDOM", "ORIGINAL_DESTINATION", "MAGLEV"
|
||||
],
|
||||
try(var.backend_service_configs.locality_lb_policy, "-")
|
||||
)
|
||||
error_message = "Invalid locality lb policy value."
|
||||
}
|
||||
validation {
|
||||
condition = contains(
|
||||
[
|
||||
"NONE", "CLIENT_IP", "CLIENT_IP_NO_DESTINATION",
|
||||
"CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO"
|
||||
],
|
||||
try(var.backend_service_configs.session_affinity, "NONE")
|
||||
)
|
||||
condition = alltrue([
|
||||
for backend_service in values(var.backend_service_configs) : contains(
|
||||
[
|
||||
"NONE", "CLIENT_IP", "CLIENT_IP_NO_DESTINATION",
|
||||
"CLIENT_IP_PORT_PROTO", "CLIENT_IP_PROTO"
|
||||
],
|
||||
coalesce(backend_service.session_affinity, "NONE")
|
||||
)
|
||||
])
|
||||
error_message = "Invalid session affinity value."
|
||||
}
|
||||
validation {
|
||||
condition = alltrue(flatten([
|
||||
for backend_service in values(var.backend_service_configs) : [
|
||||
for backend in backend_service.backends : contains(
|
||||
["RATE", "UTILIZATION"], coalesce(backend.balancing_mode, "UTILIZATION")
|
||||
)]
|
||||
]))
|
||||
error_message = "When specified, balancing mode needs to be 'RATE' or 'UTILIZATION'."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user