Skip to content

frostmoln_postgres_instance (Data Source) ​

Look up a PostgreSQL instance by ID or name. Exactly one of id or name must be specified.

This is how a configuration reaches a database that Terraform did not create: an instance provisioned in the portal or with fm can today be referenced only by a hardcoded UUID or plumbed through terraform_remote_state — both of which tie the configuration to one deployment. Look it up by name instead and the reference survives re-provisioning elsewhere.

A name lookup that matches NOTHING fails the read, and so does one that matches MORE THAN ONE instance: the data source refuses to pick for you (the diagnostic names the colliding ids). A mysql instance never satisfies this data source, by id or by name — use frostmoln_mysql_instance. There is no composed endpoint attribute: the platform serves the instance's address as private_ip/public_ip plus port, which is the wire shape every client composes from.

Example Usage ​

terraform
# Resolve a PostgreSQL instance that Terraform did not create
# (provisioned in the portal or with `fm`) by NAME — no hardcoded UUID.
data "frostmoln_postgres_instance" "billing" {
  name = "billing"
}

# The resolved instance feeds references elsewhere — e.g. an allow-list or an
# application server's connection string (no composed endpoint attribute
# exists on the wire: compose host and port).
locals {
  billing_address = coalesce(data.frostmoln_postgres_instance.billing.public_ip, data.frostmoln_postgres_instance.billing.private_ip)
}

# A lookup by id behaves identically for instances whose UUID is already known.
data "frostmoln_postgres_instance" "by_id" {
  id = data.frostmoln_postgres_instance.billing.id
}

# A name that matches nothing — or more than one PostgreSQL instance — fails
# the read loudly rather than picking an instance for you.

# Point-in-time recovery, as the platform reports it. pitr_capable is fixed
# when the instance was created and is what tells "turned off" apart from
# "cannot be turned on"; the window is null when there is none right now.
output "billing_pitr" {
  value = {
    enabled = data.frostmoln_postgres_instance.billing.pitr_enabled
    capable = data.frostmoln_postgres_instance.billing.pitr_capable
    # Kept as separate values, NOT interpolated into one string: both are null
    # whenever there is no window right now, and Terraform refuses a null inside
    # a string template.
    restorable_from = data.frostmoln_postgres_instance.billing.earliest_restorable_time
    restorable_to   = data.frostmoln_postgres_instance.billing.latest_restorable_time
    paused_why      = data.frostmoln_postgres_instance.billing.pitr_archive_paused_reason
  }
}

Schema ​

Optional ​

  • id (String) The unique identifier of the PostgreSQL instance. Exactly one of id or name must be specified.
  • name (String) The name of the PostgreSQL instance. Exactly one of id or name must be specified.

Read-Only ​

  • admin_username (String) The admin username for the instance. The admin password is never served by the read surface.
  • backup_enabled (Boolean) Whether backups are enabled.
  • backup_retention_days (Number) How many days backups are retained, null when unset.
  • backup_schedule (String) The backup schedule, null when backups are not enabled.
  • created_at (String) The timestamp when the instance was created.
  • earliest_restorable_time (String) The earliest instant the instance can be restored to (RFC 3339, UTC), null when it has no restorable window right now.
  • flavor_id (String) The flavor ID/size of the instance.
  • ha_enabled (Boolean) Whether high availability is enabled.
  • ha_status (String) The high-availability status, null when HA is not enabled.
  • latest_restorable_time (String) The latest instant the instance can be restored to (RFC 3339, UTC), null when it has no restorable window right now. It advances continuously while archiving runs, so it is a reading taken at refresh time, not a value that stays true — the platform checks a restore target against the window it has at that moment.
  • parameter_group_id (String) The parameter group attached to the instance, null when the instance runs on server defaults.
  • pitr_archive_paused_reason (String) Why the platform has paused write-ahead log archiving, null when it is not paused. tenant_cap is the tenant's retained-storage cap; platform_disabled is a fleet-wide pause. Any other value means a reason this provider release does not know about.
  • pitr_capable (Boolean) Whether the instance CAN do point-in-time recovery. Fixed when it was created and never changes, so it is what tells "turned off" apart from "cannot be turned on".
  • pitr_enabled (Boolean) Whether point-in-time recovery is on for this instance, null when the platform does not report it. Archiving actually runs only when this AND backup_enabled are true.
  • port (Number) The port the instance listens on.
  • private_ip (String) The private IP address of the instance. Compose the connection address with port — the platform serves no composed endpoint attribute.
  • public_ip (String) The public IP address of the instance, null when the instance is not publicly reachable.
  • security_group_id (String) The platform-managed security group attached to the instance. The platform creates and owns it: rule writes on it are refused (read it with frostmoln_security_group_rules); import it only to understand it, never to manage it.
  • status (String) The current status of the instance.
  • storage_gb (Number) The storage size in gigabytes.
  • subnet_id (String) The subnet ID where the instance is deployed.
  • tags (Map of String) Every resource tag on the PostgreSQL instance — the same set as the resource's tags_all: your own key/value metadata, never applied to the service itself. An empty map when it has none.
  • tenant_id (String) The tenant ID that owns this instance.
  • type (String) The database type. Always postgresql on this data source — the type is checked on every path, so the value is platform-verified, not a restatement of the configuration.
  • updated_at (String) The timestamp when the instance was last updated, null when the platform has not recorded one.
  • version (String) The PostgreSQL version (the wire's typeVersion).
  • vpc_id (String) The VPC ID where the instance is deployed.