Skip to content

frostmoln_mysql_instance (Data Source) ​

Look up a MySQL 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 postgresql instance never satisfies this data source, by id or by name — use frostmoln_postgres_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 MySQL instance that Terraform did not create
# (provisioned in the portal or with `fm`) by NAME — no hardcoded UUID.
data "frostmoln_mysql_instance" "orders" {
  name = "orders"
}

# 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 {
  orders_address = coalesce(data.frostmoln_mysql_instance.orders.public_ip, data.frostmoln_mysql_instance.orders.private_ip)
}

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

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

Schema ​

Optional ​

  • id (String) The unique identifier of the MySQL instance. Exactly one of id or name must be specified.
  • name (String) The name of the MySQL 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.
  • 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.
  • parameter_group_id (String) The parameter group attached to the instance, null when the instance runs on server defaults.
  • 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 MySQL 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 mysql 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 MySQL version (the wire's typeVersion).
  • vpc_id (String) The VPC ID where the instance is deployed.