hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

Support for creating Public IP with specific IP address #16310

Open cstandrew opened 2 years ago

cstandrew commented 2 years ago

Is there an existing issue for this?

Community Note

Description

With the introduction of Bring Your Own IP Address (BYOIP) to Azure https://docs.microsoft.com/en-gb/azure/virtual-network/ip-services/custom-ip-address-prefix it should be possible to specify the desired public IP when a creating a public IP address from a public IP prefix.

At the moment the ip_address after creation is exported, but it’s not possible to set this as an argument.

Using Azure CLI this can be achieved with:

az network public-ip create -g example -n myPublicIpAddress --zone 1 2 3 --ip-address 1.2.3.4 --sku Standard --public-ip-prefix myIpPrefix

One thing I've noticed is that using the CLI, if you don't specify the public-ip-prefix the public-ip is still created, but using a random MS IP address. So there probably needs to be some validation that a public_ip_prefix_id has also been set if ip_address is specified.

New or Affected Resource(s)/Data Source(s)

azurerm_public_ip

Potential Terraform Configuration

resource "azurerm_public_ip" "myIp" {
  name                = "myPublicIpAddress"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  allocation_method   = "Static"
  zones               = [1,2,3]
  sku                 = "Standard"
  public_ip_prefix_id = azurerm_public_ip_prefix.example.id
  ip_address          = "1.2.3.4"
}

References

No response

wcarty commented 1 year ago

Checking to see if there is any update.

pollier commented 2 months ago

Hello,

This issue has been open for some time, and it's causing significant challenges for us. Could you please provide an update on the progress of supporting specific IP allocation from a prefix via Terraform?

In the meantime, can you suggest any workarounds to achieve this functionality until the feature is implemented?

Thank you for your support!