From 47a9947b18d13abd1405206aa8ac57e3a3780a6c Mon Sep 17 00:00:00 2001 From: Miren Esnaola Date: Mon, 31 Jul 2023 10:01:35 +0200 Subject: [PATCH] Fix in validation of healthchecks variable --- modules/net-lb-int/README.md | 18 ++++++++---------- modules/net-lb-int/variables.tf | 5 ++++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/net-lb-int/README.md b/modules/net-lb-int/README.md index 1282af09..3e3b426d 100644 --- a/modules/net-lb-int/README.md +++ b/modules/net-lb-int/README.md @@ -175,15 +175,14 @@ module "ilb" { # tftest modules=3 resources=7 ``` - ## Variables | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L185) | Name used for all resources. | string | ✓ | | -| [project_id](variables.tf#L196) | Project id where resources will be created. | string | ✓ | | -| [region](variables.tf#L207) | GCP region. | string | ✓ | | -| [vpc_config](variables.tf#L218) | VPC-level configuration. | object({…}) | ✓ | | +| [name](variables.tf#L188) | Name used for all resources. | string | ✓ | | +| [project_id](variables.tf#L199) | Project id where resources will be created. | string | ✓ | | +| [region](variables.tf#L210) | GCP region. | string | ✓ | | +| [vpc_config](variables.tf#L221) | VPC-level configuration. | object({…}) | ✓ | | | [address](variables.tf#L17) | Optional IP address used for the forwarding rule. | string | | null | | [backend_service_config](variables.tf#L23) | Backend service level configuration. | object({…}) | | {} | | [backends](variables.tf#L56) | Load balancer backends, balancing mode is one of 'CONNECTION' or 'UTILIZATION'. | list(object({…})) | | [] | @@ -192,10 +191,10 @@ module "ilb" { | [group_configs](variables.tf#L87) | Optional unmanaged groups to create. Can be referenced in backends via outputs. | map(object({…})) | | {} | | [health_check](variables.tf#L99) | Name of existing health check to use, disables auto-created health check. | string | | null | | [health_check_config](variables.tf#L105) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | {…} | -| [labels](variables.tf#L179) | Labels set on resources. | map(string) | | {} | -| [ports](variables.tf#L190) | Comma-separated ports, leave null to use all ports. | list(string) | | null | -| [protocol](variables.tf#L201) | IP protocol used, defaults to TCP. | string | | "TCP" | -| [service_label](variables.tf#L212) | Optional prefix of the fully qualified forwarding rule name. | string | | null | +| [labels](variables.tf#L182) | Labels set on resources. | map(string) | | {} | +| [ports](variables.tf#L193) | Comma-separated ports, leave null to use all ports. | list(string) | | null | +| [protocol](variables.tf#L204) | IP protocol used, defaults to TCP. | string | | "TCP" | +| [service_label](variables.tf#L215) | Optional prefix of the fully qualified forwarding rule name. | string | | null | ## Outputs @@ -213,5 +212,4 @@ module "ilb" { | [health_check_self_id](outputs.tf#L64) | Auto-created health-check self id. | | | [health_check_self_link](outputs.tf#L69) | Auto-created health-check self link. | | | [id](outputs.tf#L74) | Fully qualified forwarding rule id. | | - diff --git a/modules/net-lb-int/variables.tf b/modules/net-lb-int/variables.tf index 32686eeb..9e90c1db 100644 --- a/modules/net-lb-int/variables.tf +++ b/modules/net-lb-int/variables.tf @@ -170,7 +170,10 @@ variable "health_check_config" { condition = ( (try(var.health_check_config.grpc, null) == null ? 0 : 1) + (try(var.health_check_config.http, null) == null ? 0 : 1) + - (try(var.health_check_config.tcp, null) == null ? 0 : 1) <= 1 + (try(var.health_check_config.http2, null) == null ? 0 : 1) + + (try(var.health_check_config.https, null) == null ? 0 : 1) + + (try(var.health_check_config.tcp, null) == null ? 0 : 1) + + (try(var.health_check_config.ssl, null) == null ? 0 : 1) <= 1 ) error_message = "Only one health check type can be configured at a time." }