Skip to content

frostmoln_volume (Data Source) ​

Look up a block storage volume by ID or name. Exactly one of id or name must be specified.

This is how a configuration reaches a volume that Terraform did not create: a volume 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 volume: the data source refuses to pick for you (the diagnostic names the colliding ids). The list request carries the name as the service's exact-match filter, but the match is re-verified client-side over the answer — a filter narrows the search, it never earns the resolution.

attachments shows what consumes the volume: one row per attachment, carrying the consuming instance's id and the device path it occupies — the same rows the portal's volume panel shows. A volume nothing consumes renders an empty list, never null.

Example Usage ​

terraform
# Resolve a block volume that Terraform did not create
# (provisioned in the portal or with `fm`) by NAME — no hardcoded UUID.
# (A bucket's name IS its id; a volume's id is distinct from its name, so a
# resolved id is what every other reference takes.)
data "frostmoln_volume" "data_disk" {
  name = "billing-data"
}

# The resolved volume feeds references: attach the out-of-band volume to an
# instance this configuration manages, pinning the device path.
resource "frostmoln_volume_attachment" "data_disk" {
  volume_id   = data.frostmoln_volume.data_disk.id
  instance_id = frostmoln_instance.billing.id
  device_path = "/dev/vdb"
}

# attachments shows what consumes the volume RIGHT NOW — one row per consuming
# instance, with the device path it occupies. Fail a plan when the data disk
# is either consumed unexpectedly or left unconsumed.
check "billing_data_disk_is_attached" {
  assert {
    condition     = length(data.frostmoln_volume.data_disk.attachments) == 1
    error_message = "the billing-data volume must be attached to exactly one instance"
  }
}

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

Schema ​

Optional ​

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

Read-Only ​

  • attachments (Attributes List) What consumes the volume: one row per attachment, with the consuming instance and the device path it occupies. A volume nothing consumes renders as an empty list, never null. (see below for nested schema)
  • availability_zone (String) The availability zone where the volume is located, null when the platform has not recorded one.
  • bootable (Boolean) Whether the volume can be used as a boot volume.
  • created_at (String) The timestamp when the volume was created.
  • description (String) The description of the volume, null when the volume was created without one.
  • encrypted (Boolean) Whether the volume is encrypted.
  • iops (Number) The provisioned IOPS, null when the volume has no provisioned IOPS floor.
  • metadata (Map of String) The customer key-value metadata stored on the volume — the platform's reserved keys (the frostmoln_ namespace) are filtered out, matching the resource's read-back, so metadata means the same thing on both surfaces. Null when the volume carries none.
  • size (Number) The size of the volume in GiB.
  • source_image_id (String) The ID of the image this volume was created from, null when it was not.
  • source_snapshot_id (String) The ID of the snapshot this volume was created from, null when it was not.
  • source_volume_id (String) The ID of the source volume when this volume was cloned from one, null otherwise.
  • status (String) The current status of the volume (creating, available, in-use, attaching, detaching, deleting, error, error_deleting, resizing, migrating).
  • tenant_id (String) The tenant ID that owns this volume.
  • throughput (Number) The provisioned throughput in MiB/s, null when the volume has no provisioned throughput floor.
  • updated_at (String) The timestamp when the volume was last updated.
  • volume_type (String) The type of storage backing this volume (ssd, hdd, nvme, or default).

Nested Schema for attachments ​

Read-Only:

  • attached_at (String) The timestamp when the volume was attached.
  • device (String) The device path on the instance (e.g. /dev/vdb).
  • id (String) The unique identifier of the attachment.
  • instance_id (String) The ID of the instance the volume is attached to — the consumer.
  • volume_id (String) The ID of the attached volume — the same volume this data source resolved.