Skip to content

frostmoln_public_ip (Data Source)

Look up one of your tenant's public IPs by ID or by address, without managing it. Looking one up BY ADDRESS is what lets a configuration name an address that already exists — one already published in DNS or sitting in a partner's allow-list — and hand it to frostmoln_gateway.public_ip_id so a VPC egresses from it, without importing the address into Terraform's management.

Reading a public IP does not attach it to anything, and this data source never allocates one.

Example Usage

terraform
# Look up one of your tenant's public IPs without managing it. Reading one never
# allocates an address and never attaches it to anything.

# By address. This is what lets a configuration name an address that ALREADY
# exists — one published in DNS, or already sitting in a partner's allow-list —
# so a VPC can be given that exact address as its outbound source without
# importing the address into Terraform's management.
data "frostmoln_public_ip" "published" {
  address = "203.0.113.10"
}

resource "frostmoln_gateway" "partner_facing" {
  vpc_id       = frostmoln_vpc.example.id
  mode         = "public_ip"
  public_ip_id = data.frostmoln_public_ip.published.id
}

# By id.
data "frostmoln_public_ip" "by_id" {
  id = "pip-0f2c8e1a"
}

# What is holding the address. Read this rather than inferring "unused" from an
# absent private IP: an address that is a VPC's outbound source has no instance
# and no port, so it looks idle from every other angle.
#
#   "none"           allocated, nothing using it
#   "port"           attached to an instance or load balancer
#   "gateway" it is a VPC's outbound source address
output "published_address_is_used_for" {
  value = data.frostmoln_public_ip.published.attachment.kind
}

Schema

Optional

  • address (String) The IPv4 address itself, e.g. "203.0.113.10". Exactly one of id or address must be set. The lookup matches the whole address exactly and refuses anything but a single result, so it can never silently resolve to a neighbouring address.
  • id (String) The public IP's identifier. Exactly one of id or address must be set.

Read-Only

  • attachment (Attributes) What is currently using this address. Never null — an address nothing is using reports kind = "none". Read this, not the absence of a private IP, to tell whether the address is free: an address serving a VPC's outbound traffic has no instance and no port, and giving such an address away cannot be undone. (see below for nested schema)
  • created_at (String) The timestamp when the public IP was allocated.
  • private_ip (String) The private IP this address is attached to, when it is attached to an instance. Null otherwise.
  • status (String) The status of the public IP.
  • tags (Map of String) The tags on the public IP.

Nested Schema for attachment

Read-Only:

  • kind (String) "none" (allocated, nothing using it), "port" (attached to an instance or load balancer), "gateway" (it is a VPC's outbound source address) or "unknown". An address that is already "port" or "gateway" cannot be given to another gateway.

"unknown" means the platform did not report an attachment for this address. Read it as "not established", never as "free": an address serving a VPC's outbound path has no port either, so nothing here tells the two apart. New kinds can appear without a provider upgrade and are passed through unchanged.

  • resource_id (String) What holds the address: the network port for "port", the gateway for "gateway". Null for "none".
  • vpc_id (String) The VPC whose outbound traffic leaves from this address. Set only for "gateway".