packet_reserved_ip_block

Provides a resource to create and manage blocks of reserved IP addresses in a project.

When user provision first device in a facility, Packet automatically allocates IPv6/56 and private IPv4/25 blocks. The new device then gets IPv6 and private IPv4 addresses from those block. It also gets a public IPv4/31 address. Every new device in the project and facility will automatically get IPv6 and private IPv4 addresses from pre-allocated i blocks. The IPv6 and private IPv4 blocks can't be created, only imported.

It is only possible to create public IPv4 blocks, with masks from /24 (256 addresses) to /32 (1 address).

Once IP block is allocated or imported, an address from it can be assigned to device with the packet_ip_attachment resource.

Example Usage

# Allocate /30 block of max 2 public IPv4 addresses in Parsippany, NJ (ewr1) for myproject

resource "packet_reserved_ip_block" "two_elastic_addresses" {
    project_id = "${packet_project.myproject.id}"
    facility = "ewr1"
    quantity = 2
}

Argument Reference

The following arguments are supported:

  • facility - (Required) The facility where to allocate the address block
  • project_id - (Required) The packet project ID where to allocate the address block
  • quantity - (Required) The number of allocated /32 addresses, a power of 2

Attributes Reference

The following attributes are exported:

  • facility - The facility where the addresses are
  • project_id - To which project the addresses beling
  • quantity - Number of /32 addresses in the block
  • id - The unique ID of the block
  • cidr_notation - Address and mask in CIDR notation, e.g. "147.229.15.30/31"
  • network - Network IP address portion of the block specification
  • netmask - Mask in decimal notation, e.g. "255.255.255.0"
  • cidr - length of CIDR prefix of the block as integer
  • address_family - Address family as integer (4 or 6)
  • public - boolean flag whether addresses from a block are public

Idempotent reference to a first /32 address from a reserved block might look like "${cidrhost(packet_reserved_ip_block.test.cidr_notation,0)}/32".

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/packet/r/reserved_ip_block.html