sylve_vm_storage (Resource)

A disk or CD-ROM attached to a sylve_vm beyond its create-time first disk – the real mechanism for giving a VM a boot disk sourced from a downloaded cloud image (see sylve_zfs_volume’s flash_from_download_uuid to get the image onto a volume first, then attach_type = “import”, storage_type = “zvol”, dataset = that volume’s id here). The target VM MUST be stopped – Sylve rejects attach/update/detach outright with domain_state_not_shutoff otherwise; this resource does not stop/start the VM for you.

Example Usage

# Importing an existing (typically already-flashed, see
# sylve_zfs_volume's flash_from_download_uuid) zvol as a VM's real boot
# disk. The target VM must be stopped for this to succeed.
resource "sylve_vm_storage" "boot_disk" {
  rid          = sylve_vm.example.rid
  name         = "boot-disk"
  attach_type  = "import"
  storage_type = "zvol"
  emulation    = "virtio-blk" # unlike sylve_vm's own `iso`, this can be a real boot device, not just CD-ROM
  pool         = "tank"
  dataset      = sylve_zfs_volume.example.id
}

# A fresh, empty additional disk instead:
resource "sylve_vm_storage" "extra_disk" {
  rid          = sylve_vm.example.rid
  name         = "extra-disk"
  attach_type  = "new"
  storage_type = "zvol"
  emulation    = "virtio-blk"
  pool         = "tank"
  size         = 21474836480 # 20GiB
}

Schema

Required

  • attach_type (String) “new” (create a fresh disk) or “import” (adopt an existing zvol via dataset, or attach a download directly via download_uuid). Immutable.
  • emulation (String) “virtio-blk”, “virtio-9p”, “ahci-hd”, “ahci-cd”, or “nvme”. Note: unlike sylve_vm’s create-time iso attribute (which always hardcodes “ahci-cd”), attaching a storage_type = “image” download here with emulation = “virtio-blk” makes it usable as a real boot disk, not just CD-ROM media. Updatable in place.
  • name (String) Storage entry name, shown in the Sylve UI.
  • rid (Number) RID of the sylve_vm to attach this storage to. Immutable – moving storage between VMs isn’t supported by this resource.
  • storage_type (String) “raw”, “zvol”, “image”, or “filesystem”. Immutable.

Optional

  • boot_order (Number) Boot order among this VM’s storage entries. Defaults to the next free index if unset at create. Updatable in place.
  • dataset (String) Source zvol’s dataset GUID, for attach_type = “import” + storage_type = “zvol” – typically a sylve_zfs_volume already flashed from a downloaded cloud image. Sylve renames/clones this dataset into the VM’s own dataset namespace; the source sylve_zfs_volume resource should generally be considered consumed afterward. Immutable.
  • download_uuid (String) sylve_download UUID, for attach_type = “import” + storage_type = “image” – attaches the download directly by reference (not copied), with emulation as the caller’s choice (see that attribute’s own description). Immutable.
  • enable (Boolean) Whether this storage entry is active. Updatable in place.
  • filesystem_target (String) Target name, for storage_type = “filesystem”. Updatable in place.
  • pool (String) ZFS pool, required by Sylve for storage_type raw/zvol (either attach_type). Immutable.
  • raw_path (String) Absolute filesystem path to an existing raw disk image, for attach_type = “import” + storage_type = “raw”. Immutable.
  • read_only (Boolean) Attach as read-only. Updatable in place.
  • size (Number) Size in bytes, for attach_type = “new”. Updatable in place (grows the disk; shrinking is not validated client-side, same as elsewhere in this provider).

Read-Only

  • id (String) Terraform resource identity – this storage entry’s own numeric ID (distinct from the VM’s rid).

Not published on the Terraform Registry yet -- see the repo's README for local dev_overrides usage in the meantime.

This site uses Just the Docs, a documentation theme for Jekyll.