From a93f08e833d571c8f29c87d166442273e4f42e25 Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Mon, 23 Oct 2023 15:23:30 +0200 Subject: [PATCH] improve usage of optionals in FAST stage 2 VPN variables (#1797) --- fast/stages/2-networking-b-vpn/README.md | 2 +- .../2-networking-b-vpn/variables-vpn.tf | 31 +++++++------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/fast/stages/2-networking-b-vpn/README.md b/fast/stages/2-networking-b-vpn/README.md index 68e9a279..1ce344b5 100644 --- a/fast/stages/2-networking-b-vpn/README.md +++ b/fast/stages/2-networking-b-vpn/README.md @@ -424,7 +424,7 @@ DNS configurations are centralised in the `dns-*.tf` files. Spokes delegate DNS | [psa_ranges](variables.tf#L138) | IP ranges used for Private Service Access (CloudSQL, etc.). | object({…}) | | null | | | [regions](variables.tf#L157) | Region definitions. | object({…}) | | {…} | | | [service_accounts](variables.tf#L169) | Automation service accounts in name => email format. | object({…}) | | null | 1-resman | -| [vpn_configs](variables-vpn.tf#L17) | Hub to spokes VPN configurations. | object({…}) | | {…} | | +| [vpn_configs](variables-vpn.tf#L17) | Hub to spokes VPN configurations. | object({…}) | | {} | | | [vpn_onprem_primary_config](variables.tf#L183) | VPN gateway configuration for onprem interconnection in the primary region. | object({…}) | | null | | ## Outputs diff --git a/fast/stages/2-networking-b-vpn/variables-vpn.tf b/fast/stages/2-networking-b-vpn/variables-vpn.tf index 64edb611..c2be1826 100644 --- a/fast/stages/2-networking-b-vpn/variables-vpn.tf +++ b/fast/stages/2-networking-b-vpn/variables-vpn.tf @@ -17,37 +17,28 @@ variable "vpn_configs" { description = "Hub to spokes VPN configurations." type = object({ - dev = object({ - asn = number + dev = optional(object({ + asn = optional(number, 65501) custom_advertise = optional(object({ all_subnets = bool ip_ranges = map(string) })) - }) - landing = object({ - asn = number + }), {}) + landing = optional(object({ + asn = optional(number, 65500) custom_advertise = optional(object({ all_subnets = bool ip_ranges = map(string) })) - }) - prod = object({ - asn = number + }), {}) + prod = optional(object({ + asn = optional(number, 65502) custom_advertise = optional(object({ all_subnets = bool ip_ranges = map(string) })) - }) + }), {}) }) - default = { - dev = { - asn = 65501 - } - landing = { - asn = 65500 - } - prod = { - asn = 65502 - } - } + nullable = false + default = {} }