From f688b9a47de5a0af94f30cb04748efb59660c657 Mon Sep 17 00:00:00 2001 From: bruzzechesse Date: Fri, 10 Mar 2023 10:43:37 +0100 Subject: [PATCH] realign logic to boolean variable --- modules/net-ilb/README.md | 2 +- modules/net-ilb/main.tf | 6 +----- modules/net-ilb/variables.tf | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/net-ilb/README.md b/modules/net-ilb/README.md index 5573e5250..00a17d1d0 100644 --- a/modules/net-ilb/README.md +++ b/modules/net-ilb/README.md @@ -179,7 +179,7 @@ module "ilb" { | [region](variables.tf#L206) | GCP region. | string | ✓ | | | [vpc_config](variables.tf#L217) | 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({…}) | | {} | +| [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({…})) | | [] | | [description](variables.tf#L75) | Optional description used for resources. | string | | "Terraform managed." | | [global_access](variables.tf#L81) | Global access, defaults to false if not set. | bool | | null | diff --git a/modules/net-ilb/main.tf b/modules/net-ilb/main.tf index 177a7cf5f..90a97fede 100644 --- a/modules/net-ilb/main.tf +++ b/modules/net-ilb/main.tf @@ -80,11 +80,7 @@ resource "google_compute_region_backend_service" "default" { : null ) idle_timeout_sec = local.bs_conntrack.idle_timeout_sec - tracking_mode = ( - local.bs_conntrack.tracking_mode != null - ? local.bs_conntrack.tracking_mode - : null - ) + tracking_mode = try(local.bs_conntrack.track_per_session ? "PER_SESSION" : "PER_CONNECTION", null) } } diff --git a/modules/net-ilb/variables.tf b/modules/net-ilb/variables.tf index 4b942edc3..538d10af2 100644 --- a/modules/net-ilb/variables.tf +++ b/modules/net-ilb/variables.tf @@ -27,7 +27,7 @@ variable "backend_service_config" { connection_tracking = optional(object({ idle_timeout_sec = optional(number) persist_conn_on_unhealthy = optional(string) - tracking_mode = optional(string) + track_per_session = optional(true) })) enable_subsetting = optional(bool) failover_config = optional(object({