Azure / terraform-azurerm-avm-ptn-virtualwan

MIT License
5 stars 11 forks source link

Bug: Azure Firewall does not set Public IP count for vHub #10

Open OmnipotentOwl opened 10 months ago

OmnipotentOwl commented 10 months ago

Summary

When provisioning a secured virtual hub using Azure Firewall and attempting to configure the variable defined vhub_public_ip_count property to use more then 1 public ip the module fails to configure the firewall with the desired public ip count.

Reproduction

  firewalls = {
    "aue-vhub-fw" = {
      sku_name         = "AZFW_Hub"
      sku_tier         = "Standard"
      name             = "aue-hub-fw"
      virtual_hub_name = "aue-vhub"
      vhub_public_ip_count = 2
    }
  }

Remediation

Include public_ip_count argument in virtual_hub block and utilize input variable argument.

resource "azurerm_firewall" "fw" {
  for_each = var.firewalls

  name                = each.value.name
  location            = azurerm_virtual_hub.virtual_hub[each.value.virtual_hub_name].location
  resource_group_name = azurerm_virtual_hub.virtual_hub[each.value.virtual_hub_name].resource_group_name
  sku_name            = each.value.sku_name
  sku_tier            = each.value.sku_tier
  tags                = try(each.value.tags, {})

  virtual_hub {
    virtual_hub_id  = azurerm_virtual_hub.virtual_hub[each.value.virtual_hub_name].id
    public_ip_count = each.value.vhub_public_ip_count
  }
}