Skip to content

Resource: proxmox_ceph_pool

Warning

Experimental. Schema and behavior may change in future releases. Pin the provider version if stability matters.

Manages a Ceph pool on a Proxmox VE cluster.

Erasure-coded pools. With erasure_coding, Proxmox creates no pool named name. It creates an erasure-coded data pool <name>-data and a replicated metadata pool <name>-metadata, as pveceph pool create --erasure-coding does. As in pveceph, size, min_size and crush_rule then apply to the metadata pool, while pg_num, pg_num_min, pg_autoscale_mode, application, target_size and target_size_ratio apply to the data pool. The data pool's own size, minimum size and CRUSH rule follow from the erasure code profile and are reported in data_pool.

Storages. The provider never asks Proxmox to add a storage for the pool; manage RBD storages on it with proxmox_storage_rbd. Destroying the pool removes no storage. Destroying an erasure-coded pool removes both of its pools, and its erasure code profile when Proxmox created that profile (that is, when erasure_coding.profile is not set).

Example Usage

resource "proxmox_ceph_pool" "example" {
  node_name = "pve"
  name      = "tank"

  application       = "rbd"
  size              = 3
  min_size          = 2
  pg_num            = 128
  pg_autoscale_mode = "warn"
}

# An erasure-coded pool: Proxmox creates the data pool "archive-data" and the metadata pool "archive-metadata".
resource "proxmox_ceph_pool" "erasure_coded" {
  node_name = "pve"
  name      = "archive"

  # With erasure_coding, size, min_size and crush_rule apply to the metadata pool.
  size       = 3
  min_size   = 2
  crush_rule = "replicated_rule"

  # The data pool.
  pg_num = 32

  erasure_coding = {
    k              = 4
    m              = 2
    failure_domain = "host"
    device_class   = "hdd"
  }
}

Schema

Required

  • name (String) The pool name. Must be unique within the Ceph cluster. With erasure_coding, Proxmox creates the pools <name>-data and <name>-metadata instead, and no pool of this name.
  • node_name (String) The cluster node used to dispatch the API call. Any node running Ceph is acceptable; the pool itself is cluster-wide.

Optional

  • application (String) The application using the pool. One of rbd, cephfs, rgw. Defaults to rbd server-side. With erasure_coding, this is the data pool's application (Proxmox also sets it on the metadata pool at creation).
  • crush_rule (String) The CRUSH rule name used for object placement. With erasure_coding, it is used solely for the metadata pool; the data pool uses the rule Ceph generates from the erasure code profile (data_pool.crush_rule).
  • erasure_coding (Attributes) Create an erasure-coded pool instead of a replicated one: Proxmox creates an erasure-coded data pool <name>-data and a replicated metadata pool <name>-metadata. While this is set, size, min_size and crush_rule describe the metadata pool. Cannot be changed after creation, except that after an import the configured value is only recorded. (see below for nested schema)
  • force_destroy (Boolean) If true, destroy the pool even when in use. Passed as force=1 on delete. With erasure_coding, this applies to both pools.
  • min_size (Number) Minimum number of replicas per object. With erasure_coding, this is the metadata pool's; the data pool's is data_pool.min_size.
  • pg_autoscale_mode (String) PG autoscaler mode. One of on, off, warn. With erasure_coding, this is the data pool's (Proxmox also applies it to the metadata pool at creation).
  • pg_num (Number) Number of placement groups. With erasure_coding, this is the data pool's (Proxmox creates the metadata pool with 32).
  • pg_num_min (Number) Minimum number of placement groups (used by the autoscaler). With erasure_coding, this is the data pool's (Proxmox also applies it to the metadata pool at creation).
  • size (Number) Number of replicas per object. With erasure_coding, this is the metadata pool's replica count; the data pool's size is k + m (data_pool.size).
  • target_size (String) Estimated target size for the PG autoscaler (e.g. 100G). Write-only: PVE returns this as a bytes integer (e.g. 1073741824) while the input accepts a unit-suffixed string, so the configured spec is not round-tripped from the server. With erasure_coding, this is the data pool's (Proxmox also applies it to the metadata pool at creation).
  • target_size_ratio (Number) Estimated target ratio for the PG autoscaler. Write-only: kept symmetric with target_size (which cannot be round-tripped), so the configured value is not refreshed from the server. With erasure_coding, this is the data pool's (Proxmox also applies it to the metadata pool at creation).

Read-Only

  • data_pool (Attributes) The erasure-coded data pool <name>-data of an erasure-coded pool; null for a replicated pool. Its size, minimum size and CRUSH rule follow from the erasure code profile. (see below for nested schema)
  • id (String) The unique identifier of the Ceph pool, in the form <node_name>/<name>.
  • metadata_pool_id (Number) The numeric ID Ceph assigned to an erasure-coded pool's metadata pool; null for a replicated pool.
  • metadata_pool_name (String) The name of an erasure-coded pool's replicated metadata pool, <name>-metadata; null for a replicated pool. size, min_size and crush_rule describe this pool.
  • pool_id (Number) The numeric pool ID assigned by Ceph. Ceph assigns a new ID when the pool is recreated. Null with erasure_coding, where no pool named name exists; see data_pool.pool_id and metadata_pool_id.

Nested Schema for erasure_coding

Required:

  • k (Number) The number of data chunks. Proxmox requires it even with profile, whose own value then applies.
  • m (Number) The number of coding chunks. Proxmox requires it even with profile, whose own value then applies.

Optional:

  • device_class (String) The CRUSH device class to place the data pool on, e.g. hdd or ssd.
  • failure_domain (String) The CRUSH failure domain for the data pool's chunks, e.g. host or osd. Proxmox defaults to host.
  • profile (String) An existing erasure code profile to use instead of the one Proxmox would create (pve_ec_<name>). Destroying the pool keeps this profile; a profile Proxmox created is removed with the pool.

Nested Schema for data_pool

Read-Only:

  • crush_rule (String) The CRUSH rule Ceph generated for the data pool from the erasure code profile.
  • min_size (Number) The data pool's minimum size. Ceph sets k + 1 at creation, or k when m = 1.
  • name (String) The data pool's name, <name>-data.
  • pool_id (Number) The data pool's numeric ID assigned by Ceph.
  • size (Number) The data pool's size, k + m.

Import

Import is supported using the following syntax:

#!/usr/bin/env sh
# Ceph pools can be imported using the format `node_name/pool_name`, e.g.:
terraform import proxmox_ceph_pool.example pve/tank

# An erasure-coded pool is imported by the name it was created with (without `-data` or `-metadata`); its
# configuration must then include a matching `erasure_coding` attribute.
terraform import proxmox_ceph_pool.erasure_coded pve/archive