[#455] net-glb: add support for null health_checks_config_defaults (#456)

This commit is contained in:
Luca Prete
2022-01-25 14:06:02 +01:00
committed by GitHub
parent f29cc67abc
commit c30d29bf9b
2 changed files with 25 additions and 3 deletions

View File

@@ -27,12 +27,18 @@ locals {
)
]
# If at least one group backend service without
# HC is defined, create also a default HC
health_checks_config_defaults = (
try(var.health_checks_config_defaults, null) == null
? null
: { default = var.health_checks_config_defaults }
)
# If at least one group backend service without HC is defined,
# create also a default HC (if default HC is not null)
health_checks_config = (
length(local._backends_without_hcs) > 0
? merge(
{ default = var.health_checks_config_defaults },
coalesce(local.health_checks_config_defaults, {}),
coalesce(var.health_checks_config, {})
)
: coalesce(var.health_checks_config, {})