Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Public IP Address Prefix on Load Balancer frontend IP and Azure Public IP resources in loadbalancer sub-module #55

Closed
jinkang23 opened this issue Jun 25, 2024 · 3 comments · Fixed by #80
Assignees
Labels
enhancement New feature or request

Comments

@jinkang23
Copy link

Is your feature request related to a problem?

In loadbalancer sub-module, both azurerm_public_ip resource and azurerm_lb resource does not allow a way to pass in a public_ip_prefix_id. This is necessary in cases where we want to either 1) BYO-IP with Custom IP Prefix, or 2) reserve a static range of Azure public IPs. In our case, we have onboarded a /24 range via BYO-IP with Custom IP Prefix and have created a smaller /28 range as Azure Public IP prefix. We want to be able to have the Public IP of the Load Balancer to be allocated from this Azure Public IP Prefix instead.

Describe the solution you'd like

Here's an example of adding azure_public_ip_prefix_id...

resource "azurerm_public_ip" "this" {
  for_each = { for k, v in var.frontend_ips : k => v if v.create_public_ip }

  name                = each.value.public_ip_name
  resource_group_name = var.resource_group_name
  location            = var.region
  allocation_method   = "Static"
  sku                 = "Standard"
  zones               = var.zones

  public_ip_prefix_id = each.value.public_ip_prefix_id

  tags                = var.tags
}
resource "azurerm_lb" "this" {
  name                = var.name
  resource_group_name = var.resource_group_name
  location            = var.region
  sku                 = "Standard"
  tags                = var.tags

  dynamic "frontend_ip_configuration" {
    for_each = var.frontend_ips
    iterator = frontend_ip
    content {
      name = frontend_ip.value.name
      public_ip_address_id = frontend_ip.value.create_public_ip ? (
        azurerm_public_ip.this[frontend_ip.key].id
      ) : try(data.azurerm_public_ip.this[frontend_ip.key].id, null)


      public_ip_prefix_id = frontend_ip.value.create_public_ip ? null : try(frontend_ip.value.public_ip_prefix_id, null)


      subnet_id                     = frontend_ip.value.subnet_id
      private_ip_address_allocation = frontend_ip.value.private_ip_address != null ? "Static" : null
      private_ip_address            = frontend_ip.value.private_ip_address
      zones                         = frontend_ip.value.subnet_id != null ? var.zones : null

      gateway_load_balancer_frontend_ip_configuration_id = frontend_ip.value.gwlb_fip_id
    }
  }

 ....

Describe alternatives you've considered.

No response

Additional context

No response

@acelebanski
Copy link
Contributor

Hello @jinkang23, thanks for raising this. I suppose you wanted to use a Public IP Prefix as an LB frontend for outbound traffic from VM-Series firewalls. I implemented the improvements in PR #64. Should be released soon when approved.

@jinkang23
Copy link
Author

Hi @acelebanski - Yes, and thank you for working this feature request!

@acelebanski acelebanski linked a pull request Jul 28, 2024 that will close this issue
4 tasks
@acelebanski
Copy link
Contributor

acelebanski commented Jul 28, 2024

Hello @jinkang23, I changed the PR associated with this issue. We changed the approach and we're going to offer this functionality with the new public_ip module (PR #80).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants