sylve_vm (Resource)
A bhyve virtual machine managed by Sylve. Covers the VM object itself (CPU/RAM/VNC/boot options), its first disk and first NIC (set at creation time – see sylve_vm_storage for additional disks), boot/cloud-init media (iso), and cloud-init itself (cloud_init plus its data/metadata/network-config payloads). Additional NICs and PCI passthrough are not yet covered – see the provider’s dev notes.
Example Usage
resource "sylve_vm" "example" {
rid = 100 # 1-9999, unique, chosen by you -- never auto-assigned
name = "example-vm"
description = "created by terraform"
ram = 1073741824 # 1GiB, in BYTES -- not MiB
cpu_sockets = 1
cpu_cores = 2
cpu_threads = 1
vnc_port = 5900
# vnc_wait defaults to false -- leave unset for normal headless use
# First disk, created fresh (empty) at VM creation time. For a disk
# seeded from a downloaded image, use storage_type = "none" here and
# attach one separately via sylve_vm_storage instead.
storage_type = "zvol"
storage_pool = "tank"
storage_size = 10737418240 # 10GiB
storage_emulation_type = "virtio-blk"
# First NIC. switch_emulation_type is required whenever switch_name is set.
switch_name = "lan" # an existing sylve_manual_switch or standard switch
switch_emulation_type = "virtio"
qemu_guest_agent = true
start_at_boot = false
}
Schema
Required
cpu_cores(Number) CPU cores per socket.cpu_sockets(Number) Number of CPU sockets.cpu_threads(Number) Threads per core.name(String) VM name.ram(Number) Memory in BYTES (not MiB – matches the real API; minimum enforced by Sylve is 128 MiB, i.e. 134217728).rid(Number) Sylve’s resource ID for this VM, 1-9999, unique across VMs. Sylve does NOT auto-assign this despite some docs implying it – validateCreate rejects rid <= 0 outright with invalid_rid (confirmed live, 2026-08-31; see the provider’s dev notes). The caller must pick one, same as a Proxmox VMID.vnc_port(Number) VNC display port. Required by Sylve’s own API (zero is rejected). Changing it recreates the VM.
Optional
cloud_init(Boolean) Enable cloud-init for this VM. Genuinely create-time-only: Sylve has no persisted “is cloud-init enabled” column at all (confirmed against its VM model) – this flag only steers create-time validation of iso (does it need to resolve to a cloud-init-capable download or not). Nothing to read back, so changing it forces replacement rather than silently doing nothing.cloud_init_data(String) cloud-init user-data. Updatable in place via a dedicated endpoint (unlike iso itself).cloud_init_metadata(String) cloud-init meta-data. Updatable in place, see cloud_init_data.cloud_init_network_config(String) cloud-init network-config. Updatable in place, see cloud_init_data.description(String) Free-text description shown in the Sylve UI.iso(String) UUID of a sylve_download to boot from / use as a cloud-init source (typically one with utype “cloud-init” when cloud_init is enabled – Sylve validates that combination and rejects a non-cloud-init-capable image). Write-only, see storage_pool.mac_id(Number) ID of an existing Sylve MAC network-object to use for the first NIC, instead of letting Sylve generate one. Write-only, see storage_pool.qemu_guest_agent(Boolean) Enable the QEMU guest agent channel (the enable flag only – reading live guest info such as its IP addresses via GET /vm/qga/:rid is not covered by this provider at all; there are no data sources yet). Updated in place via ModifyQemuGuestAgent.serial(Boolean) Enable the serial console. Updated in place via ModifySerialConsole.start_at_boot(Boolean) Start this VM automatically when Sylve/the host boots. Updated in place via ModifyBootOrder (shares one endpoint with start_order – both travel in the same request).start_order(Number) Boot order among auto-started guests. Updated in place, see start_at_boot.storage_emulation_type(String) First disk emulation: “virtio-blk”, “virtio-9p”, “ahci-hd”, “ahci-cd”, or “nvme”. Write-only, see storage_pool.storage_pool(String) ZFS pool for the VM’s first disk, e.g. “tank”. Write-only: not read back (see resource description); changing it recreates the VM.storage_size(Number) First disk size in bytes. Write-only, see storage_pool.storage_type(String) First disk type: “zvol”, “raw”, “image”, or “filesystem”. Write-only, see storage_pool.switch_emulation_type(String) NIC emulation type, e.g. “virtio” (confirmed against a live VM’s own network entry – not the same value space as storage_emulation_type’s “virtio-blk”). Required whenever switch_name is set to a real switch (not “none”). Write-only, see storage_pool.switch_name(String) Name of an existing Sylve network switch to attach the first NIC to. Write-only, see storage_pool. Requires switch_emulation_type to be set too (found live, 2026-09-01: omitting it fails with no_switch_emulation_type_selected – this field was missed entirely when this resource was first fixed, since no earlier test actually attached networking).time_offset(String) “utc” (default) or “localtime”.tpm_emulation(Boolean) Emulate a TPM device. Updated in place via ModifyTPM.vnc_bind(String) IP address the VNC listener binds to on the hypervisor. Defaults to “127.0.0.1” (Sylve’s own default) if left unset – loopback-only, since an empty vnc_password means no auth at all, and an externally-reachable unauthenticated console is a real exposure. Set to a LAN-facing address (e.g. the hypervisor’s own guest-LAN IP) only when you specifically need VNC reachable from off-host, and prefer that over 0.0.0.0 given the lack of built-in auth. Updated in place, does NOT recreate the VM.vnc_password(String, Sensitive) VNC password. An EMPTY STRING means no authentication – there is no magic keyword for this (a literal “disabled” becomes the actual password “disabled”, not a request to disable auth; confirmed against Sylve’s own source). Updated in place, does NOT recreate the VM.vnc_resolution(String) VNC resolution, e.g. “1024x768”. Changing it recreates the VM (see vnc_port).vnc_wait(Boolean) Pause the guest CPU at boot until a VNC client connects. Defaults to false in this resource – Sylve’s own create service defaults an OMITTED value to true, which silently freezes the VM indefinitely (confirmed live, 2026-09-01: a VM created before this field existed sat at ~0s CPU time, reporting domain status “Running” while never actually booting – see the provider’s dev notes). This resource always sends an explicit value for exactly that reason; leave it unset for normal headless/automated use. Changing it recreates the VM (see vnc_port).
Read-Only
id(String) Terraform resource identity – the VM’s resource ID (rid) as a string.