| subcategory | Network |
|---|---|
| layout | azurerm |
| page_title | Azure Resource Manager: azurerm_public_ip_prefix |
| description | Manages a Public IP Prefix. |
Manages a Public IP Prefix.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_public_ip_prefix" "example" {
name = "acceptanceTestPublicIpPrefix1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
prefix_length = 31
tags = {
environment = "Production"
}
}The following arguments are supported:
-
name- (Required) Specifies the name of the Public IP Prefix resource . Changing this forces a new resource to be created. -
resource_group_name- (Required) The name of the resource group in which to create the Public IP Prefix. Changing this forces a new resource to be created. -
location- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
custom_ip_prefix_id- (Optional) The Custom IP Prefix ID associated with the Public IP Prefix. Changing this forces a new resource to be created.
-> Note: When ip_version is set to IPv6, custom_ip_prefix_id must reference a regional (child) range rather than a global (parent) range. For more details on creating a Public IP Prefix from a custom IP prefix, see here.
sku- (Optional) The SKU of the Public IP Prefix. Possible values areStandardandStandardV2. Defaults toStandard. Changing this forces a new resource to be created.
-> Note: Public IP Prefix can only be created with Standard SKUs at this time.
-
sku_tier- (Optional) The SKU Tier that should be used for the Public IP. Possible values areRegionalandGlobal. Defaults toRegional. Changing this forces a new resource to be created. -
ip_version- (Optional) The IP Version to use,IPv6orIPv4. Changing this forces a new resource to be created. Default isIPv4. -
prefix_length- (Optional) Specifies the number of bits of the prefix. The value can be set between 0 (4,294,967,296 addresses) and 31 (2 addresses). Defaults to28(16 addresses). Changing this forces a new resource to be created.
-> Note: There may be Public IP address limits on the subscription . More information available here
-
tags- (Optional) A mapping of tags to assign to the resource. -
zones- (Optional) Specifies a list of Availability Zones in which this Public IP Prefix should be located. Changing this forces a new Public IP Prefix to be created.
-> Note: Availability Zones are only supported in several regions at this time.
In addition to the Arguments listed above - the following Attributes are exported:
id- The Public IP Prefix ID.ip_prefix- The IP address prefix value that was allocated.
The timeouts block allows you to specify timeouts for certain actions:
create- (Defaults to 30 minutes) Used when creating the Public IP Prefix.read- (Defaults to 5 minutes) Used when retrieving the Public IP Prefix.update- (Defaults to 30 minutes) Used when updating the Public IP Prefix.delete- (Defaults to 30 minutes) Used when deleting the Public IP Prefix.
Public IP Prefixes can be imported using the resource id, e.g.
terraform import azurerm_public_ip_prefix.myPublicIpPrefix /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/publicIPPrefixes/myPublicIpPrefix1This resource uses the following Azure API Providers:
Microsoft.Network- 2025-01-01