Skip to content

azurermPublicIpPrefix

Manages a Public IP Prefix.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermPublicIpPrefixExample = new azurerm.publicIpPrefix.PublicIpPrefix(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "acceptanceTestPublicIpPrefix1",
    prefix_length: 31,
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      environment: "Production",
    },
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpPrefixExample.overrideLogicalId("example");

Argument Reference

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.

  • resourceGroupName - (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.

  • sku - (Optional) The SKU of the Public IP Prefix. Accepted values are standard. Defaults to standard. Changing this forces a new resource to be created.

-> Note: Public IP Prefix can only be created with Standard SKUs at this time.

  • ipVersion - (Optional) The IP Version to use, iPv6 or iPv4. Changing this forces a new resource to be created. Default is iPv4.

  • prefixLength - (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 to 28(16 addresses). Changing this forces a new resource to be created.

-> Please 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.

-> Please Note: Availability Zones are only supported in several regions at this time.

Attributes Reference

The following attributes are exported:

  • id - The Public IP Prefix ID.
  • ipPrefix - The IP address prefix value that was allocated.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Public IP Prefix.
  • update - (Defaults to 30 minutes) Used when updating the Public IP Prefix.
  • read - (Defaults to 5 minutes) Used when retrieving the Public IP Prefix.
  • delete - (Defaults to 30 minutes) Used when deleting the Public IP Prefix.

Import

Public IP Prefixes can be imported using the resourceId, e.g.

terraform import azurerm_public_ip_prefix.myPublicIpPrefix /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/publicIPPrefixes/myPublicIpPrefix1