Skip to content

Commit

Permalink
fix: fixed Conditionally Include ip_configuration_id for Dynamic NAT …
Browse files Browse the repository at this point in the history
…Rules only
  • Loading branch information
renuka-sharma committed Jun 20, 2024
1 parent c97f980 commit 649c3ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/nat-rules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ resource "azurerm_virtual_network_gateway_nat_rule" "rules" {
mode = each.value.mode
type = each.value.type
virtual_network_gateway_id = try(each.value.virtual_network_gateway_id, var.virtual_network_gateway_id)
ip_configuration_id = each.value.ip_configuration_id
resource_group_name = var.resourcegroup
# Conditionally assign ip_configuration_id only if the type is "Dynamic"
ip_configuration_id = each.value.type == "Dynamic" ? each.value.ip_configuration_id : null

resource_group_name = var.resourcegroup

external_mapping {
address_space = each.value.external_mappings.address_space
Expand Down

0 comments on commit 649c3ca

Please sign in to comment.