Merge remote-tracking branch 'origin/master' into fast-dev

This commit is contained in:
Ludo
2025-06-12 15:38:26 +02:00
3 changed files with 3 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@@ -78,7 +78,7 @@ resource "google_compute_backend_service" "default" {
for_each = { for b in coalesce(each.value.backends, []) : b.backend => b } for_each = { for b in coalesce(each.value.backends, []) : b.backend => b }
content { content {
group = lookup(local.group_ids, backend.key, backend.key) group = lookup(local.group_ids, backend.key, backend.key)
preference = backend.value.preference preference = backend.value.preferred ? "PREFERRED" : null
balancing_mode = backend.value.balancing_mode # UTILIZATION, RATE balancing_mode = backend.value.balancing_mode # UTILIZATION, RATE
capacity_scaler = backend.value.capacity_scaler capacity_scaler = backend.value.capacity_scaler
description = backend.value.description description = backend.value.description

View File

@@ -37,7 +37,7 @@ variable "backend_service_configs" {
backends = list(object({ backends = list(object({
# group renamed to backend # group renamed to backend
backend = string backend = string
preference = optional(string, "DEFAULT") preferred = optional(bool, false)
balancing_mode = optional(string, "UTILIZATION") balancing_mode = optional(string, "UTILIZATION")
capacity_scaler = optional(number, 1) capacity_scaler = optional(number, 1)
description = optional(string, "Terraform managed.") description = optional(string, "Terraform managed.")
@@ -164,15 +164,6 @@ variable "backend_service_configs" {
])) ]))
error_message = "When specified, balancing mode needs to be 'RATE' or 'UTILIZATION'." error_message = "When specified, balancing mode needs to be 'RATE' or 'UTILIZATION'."
} }
validation {
condition = alltrue(flatten([
for backend_service in values(var.backend_service_configs) : [
for backend in backend_service.backends : contains(
["DEFAULT", "PREFERRED"], coalesce(backend.preference, "DEFAULT")
)]
]))
error_message = "When specified, balancing mode needs to be 'DEFAULT' or 'PREFERRED'."
}
validation { validation {
condition = alltrue([ condition = alltrue([
for backend_service in values(var.backend_service_configs) : for backend_service in values(var.backend_service_configs) :