Azure / terraform-azurerm-avm-res-network-natgateway

Terraform Module for Nat Gateway
MIT License
6 stars 5 forks source link

Support controlling public ip-prefix #2

Closed davidkarlsen closed 11 months ago

davidkarlsen commented 11 months ago

Would it make sense to either take a prefix-length as parameter, or a reference to an existing azurerm_public_ip_prefix?

Something like this:

resource "azurerm_nat_gateway_public_ip_prefix_association" "nat-gw" {
  nat_gateway_id      = azurerm_nat_gateway.nat-gw.id
  public_ip_prefix_id = azurerm_public_ip_prefix.nat-gw.id
}

resource "azurerm_public_ip_prefix" "nat-gw" {
  name                = join("-", [local.nat_gw_name_prefix, module.naming.public_ip_prefix.name])
  location            = data.azurerm_resource_group.network_rg.location
  resource_group_name = data.azurerm_resource_group.network_rg.name
  prefix_length       = 30

  tags = var.tags
}
davidkarlsen commented 11 months ago

@mbilalamjad I have a PR for it. PTAL.

mbilalamjad commented 11 months ago

Thank you @davidkarlsen for raising the issue and also submitting a PR to fix it, appreciate it.