From fc666d1ce084b91176f592d9d96964c1a7622df6 Mon Sep 17 00:00:00 2001 From: Mtsa Date: Fri, 5 Apr 2024 10:19:21 +0300 Subject: [PATCH] feat(connectivity): Add option to set allow_non_virtual_wan_traffic in express route gateway. (#914) Co-authored-by: Miltos Tsatsakis --- README.md | 1 + ...loy-Virtual-WAN-Resources-With-Custom-Settings.md | 1 + modules/connectivity/locals.tf | 11 ++++++----- modules/connectivity/variables.tf | 3 ++- resources.virtual_wan.tf | 12 ++++++------ tests/modules/settings/settings.connectivity.tf | 3 ++- variables.tf | 3 ++- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d9507eedf..b3c570d1c 100644 --- a/README.md +++ b/README.md @@ -450,6 +450,7 @@ object({ enabled = optional(bool, false) config = optional(object({ scale_unit = optional(number, 1) + allow_non_virtual_wan_traffic = optional(bool, false) }), {}) }), {}) vpn_gateway = optional(object({ diff --git a/docs/wiki/[Examples]-Deploy-Virtual-WAN-Resources-With-Custom-Settings.md b/docs/wiki/[Examples]-Deploy-Virtual-WAN-Resources-With-Custom-Settings.md index 64460d6e5..88a9f61a2 100644 --- a/docs/wiki/[Examples]-Deploy-Virtual-WAN-Resources-With-Custom-Settings.md +++ b/docs/wiki/[Examples]-Deploy-Virtual-WAN-Resources-With-Custom-Settings.md @@ -180,6 +180,7 @@ locals { enabled = true config = { scale_unit = 1 + allow_non_virtual_wan_traffic = false } } vpn_gateway = { diff --git a/modules/connectivity/locals.tf b/modules/connectivity/locals.tf index 7a4e9eeec..bf99cde33 100644 --- a/modules/connectivity/locals.tf +++ b/modules/connectivity/locals.tf @@ -1338,11 +1338,12 @@ locals { resource_id = local.virtual_hub_express_route_gateway_resource_id[location] managed_by_module = local.deploy_virtual_hub_express_route_gateway[location] # Resource definition attributes - name = local.virtual_hub_express_route_gateway_name[location] - resource_group_name = local.virtual_hub_resource_group_name[location] - location = location - virtual_hub_id = local.virtual_hub_resource_id[location] - scale_units = virtual_hub.config.expressroute_gateway.config.scale_unit + name = local.virtual_hub_express_route_gateway_name[location] + resource_group_name = local.virtual_hub_resource_group_name[location] + location = location + virtual_hub_id = local.virtual_hub_resource_id[location] + scale_units = virtual_hub.config.expressroute_gateway.config.scale_unit + allow_non_virtual_wan_traffic = virtual_hub.config.expressroute_gateway.config.allow_non_virtual_wan_traffic # Optional definition attributes tags = try(local.custom_settings.azurerm_express_route_gateway["virtual_wan"][location].tags, local.tags) } diff --git a/modules/connectivity/variables.tf b/modules/connectivity/variables.tf index e31e4f976..efdb9e6e6 100644 --- a/modules/connectivity/variables.tf +++ b/modules/connectivity/variables.tf @@ -165,7 +165,8 @@ variable "settings" { expressroute_gateway = optional(object({ enabled = optional(bool, false) config = optional(object({ - scale_unit = optional(number, 1) + scale_unit = optional(number, 1) + allow_non_virtual_wan_traffic = optional(bool, false) }), {}) }), {}) vpn_gateway = optional(object({ diff --git a/resources.virtual_wan.tf b/resources.virtual_wan.tf index 9aceec5b5..82f405c6f 100644 --- a/resources.virtual_wan.tf +++ b/resources.virtual_wan.tf @@ -75,12 +75,12 @@ resource "azurerm_express_route_gateway" "virtual_wan" { provider = azurerm.connectivity # Mandatory resource attributes - name = each.value.template.name - resource_group_name = each.value.template.resource_group_name - location = each.value.template.location - virtual_hub_id = each.value.template.virtual_hub_id - scale_units = each.value.template.scale_units - + name = each.value.template.name + resource_group_name = each.value.template.resource_group_name + location = each.value.template.location + virtual_hub_id = each.value.template.virtual_hub_id + scale_units = each.value.template.scale_units + allow_non_virtual_wan_traffic = each.value.template.allow_non_virtual_wan_traffic # Optional resource attributes tags = each.value.template.tags diff --git a/tests/modules/settings/settings.connectivity.tf b/tests/modules/settings/settings.connectivity.tf index 935133ef3..1c45a0964 100644 --- a/tests/modules/settings/settings.connectivity.tf +++ b/tests/modules/settings/settings.connectivity.tf @@ -142,7 +142,8 @@ locals { expressroute_gateway = { enabled = true config = { - scale_unit = 1 + scale_unit = 1 + allow_non_virtual_wan_traffic = false } } vpn_gateway = { diff --git a/variables.tf b/variables.tf index 01febda8f..5b8fe85fb 100644 --- a/variables.tf +++ b/variables.tf @@ -278,7 +278,8 @@ variable "configure_connectivity_resources" { expressroute_gateway = optional(object({ enabled = optional(bool, false) config = optional(object({ - scale_unit = optional(number, 1) + scale_unit = optional(number, 1) + allow_non_virtual_wan_traffic = optional(bool, false) }), {}) }), {}) vpn_gateway = optional(object({