Resource: proxmox_node_disk_zfs¶
Manages a ZFS pool (zpool) on a Proxmox VE node.
Example Usage¶
resource "proxmox_node_disk_zfs" "example" {
node_name = "pve"
name = "tank"
devices = ["/dev/sdb", "/dev/sdc"]
raidlevel = "mirror"
ashift = 12
compression = "lz4"
add_storage = true
cleanup_config = true
cleanup_disks = false
}
Schema¶
Required¶
devices(List of String) The block devices to use for the ZFS pool (e.g.["/dev/sdb", "/dev/sdc"]).name(String) The name of the ZFS pool (storage identifier).node_name(String) The name of the Proxmox node on which to create the ZFS pool.raidlevel(String) The RAID level for the ZFS pool. One ofsingle,mirror,raid10,raidz,raidz2,raidz3,draid,draid2,draid3.
Optional¶
add_storage(Boolean) Configure a Proxmox storage entry using this zpool after creation. Applied at create time only.ashift(Number) Pool sector size exponent (2^ashift bytes). Defaults to12(4 KiB sectors) server-side.cleanup_config(Boolean) On destroy, mark associated Proxmox storage entries as unavailable (or remove them if configured for this node only). Defaults tofalse.cleanup_disks(Boolean) On destroy, wipe the ZFS member partitions so they can be reused. Defaults tofalse. Note: Proxmox wipes the partition contents but leaves the parent disk's GPT partition table intact. If you plan to reuse the same device immediately, runwipefs -a <disk>andpartprobe <disk>on the node after destroy.compression(String) The compression algorithm for the pool. One ofon,off,gzip,lz4,lzjb,zle,zstd. Defaults toonserver-side.draid_config(Attributes) dRAID configuration. Required whenraidlevelisdraid,draid2, ordraid3. (see below for nested schema)
Read-Only¶
errors(String) Error information reported by the ZFS pool.id(String) The unique identifier of this resource, in the format<node_name>/<name>.state(String) The current state of the ZFS pool (e.g.ONLINE,DEGRADED).
Nested Schema for draid_config¶
Required:
data(Number) Number of data devices per redundancy group.spares(Number) Number of dRAID distributed spare devices.
Device Reuse After Destroy¶
When cleanup_disks = true, Proxmox wipes the contents of each ZFS member partition
(e.g. /dev/nvme0n1p1) but leaves the parent disk's GPT partition table intact.
If you destroy a pool and immediately recreate it on the same device, the create may
fail with "device is already in use".
To fully prepare the device for reuse after destroy, run on the Proxmox node:
Replace /dev/nvme0n1 with the actual disk device (not the partition).
Import¶
Import is supported using the following syntax:
#!/usr/bin/env sh
# ZFS pools can be imported using the format `node_name/pool_name`, e.g.:
terraform import proxmox_node_disk_zfs.example pve/tank
Warning
Note on import: The write-only attributes devices, raidlevel, ashift, compression, draid_config, and add_storage cannot be reconstructed from the Proxmox API and must be added to the configuration manually after import. Once added, the next terraform apply will record them in state without replacing the pool.