Terraform provider reference / guides / addresses

Public addresses and what they cost

A public address is billed while the project holds it, whether or not anything uses it. That single sentence explains every rule below.

The address outlives the server

Creating a server with public_ipv4 = { new = true } allocates an address to the project and attaches it to the server. Destroying that server detaches the address and leaves it with the project - still held, still billed. Terraform does not see a problem, because nothing in the configuration claims that address.

Two ways to avoid paying for it:

Manage the address explicitly. Then destroy takes it with everything else:

resource "fiberax_ip" "web" {}

resource "fiberax_server" "web" {
  name           = "web-01"
  server_type_id = 4
  image          = data.fiberax_images.os.images[0].id
  cores          = 2
  memory_mb      = 4096
  disk_gb        = 40

  public_ipv4 = { id = fiberax_ip.web.id }
}

Or reuse what the project already holds. reuse = true takes a free address of the project and only allocates a new one when there is none:

  public_ipv4 = { reuse = true }

This is the right default for anything applied more than once: repeated create-and-destroy cycles stop accumulating addresses.

Exactly one form

public_ipv4 takes exactly one of id, new or reuse. The provider refuses a block naming more than one at plan time, even when the extra field is false - a description should read as one unambiguous choice, not as a puzzle.

Omit the block entirely for a server with no public address at all. Such a server needs a private network instead: a machine with no network card is unreachable, and the platform refuses it.

Taking the card off does not release the address

Detaching a network card, or removing the card resource, leaves the address with the project. The only thing that releases an address is destroying the address itself (fiberax_ip), or deleting it through the API.

If you inherited a project with addresses nobody uses, they are the ones with no server attached - list them and destroy what you do not need.

A refused create does not leave one behind

When a create is refused after the address was already reserved - the platform ran out of GPU capacity, for example - the address that this request asked for is released again. An address you named yourself with id stays yours, because it was yours before the request.

The one case that does leave addresses behind is repeating a failed write by hand: the platform does not remember the outcome of a 5xx, so each repeat reserves another address. This is exactly why the provider refuses to repeat writes on 503 - see Retries, 409 and 503.

Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.