Skip to content

Resource: proxmox_ceph_fs

Warning

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

Manages a CephFS on the Proxmox VE cluster's own Ceph cluster. Proxmox VE creates the filesystem with a new metadata pool and data pool, and only while a metadata server (MDS) is in standby. Mount it with a proxmox_storage_cephfs.

Proxmox VE refuses to create a CephFS while no metadata server is in standby. The provider retries that for about a minute, so a metadata server started in the same apply has time to get there.

Proxmox VE always creates the two pools under the cluster's default CRUSH rule and size. Settings in metadata_pool and data_pool are applied right after creation, so the pools spend a moment on the defaults first. If applying them fails, for example on a misspelled CRUSH rule, the filesystem is kept in state but marked tainted; fix the configuration and run terraform untaint on it rather than letting Terraform replace it.

Danger

Destroying a CephFS is manual. Proxmox VE documents removing a CephFS as a procedure done by hand, and the web UI has no destroy. While the filesystem exists, destroying this resource fails with those steps: disconnect its clients and disable and remove its storages, unmount them on every node, make sure no metadata server serves it (ceph fs fail <name>), then pveceph fs destroy <name> --remove-pools 1. Once it's gone, run the destroy again. The same applies when a change to name or pg_num would replace it.

Example Usage

resource "proxmox_ceph_fs" "shared" {
  node_name = "pve"
  name      = "shared"
  pg_num    = 32

  metadata_pool = {
    size     = 3
    min_size = 2
  }

  data_pool = {
    crush_rule = "replicated_hdd"
    size       = 3
    min_size   = 2
  }
}

resource "proxmox_storage_cephfs" "shared" {
  id      = "shared"
  fs_name = proxmox_ceph_fs.shared.name
  content = ["backup", "iso", "vztmpl", "snippets"]
}

Schema

Required

  • name (String) The filesystem's name. Proxmox VE names its pools <name>_metadata and <name>_data.
  • node_name (String) The node used to dispatch the API calls. Any node running Ceph works; the filesystem is cluster-wide, so changing it only changes the node used.

Optional

  • data_pool (Attributes) The filesystem's data pool, <name>_data. Proxmox VE creates it under the cluster's default CRUSH rule and size; settings given here are applied right after creation and can be changed in place. (see below for nested schema)
  • metadata_pool (Attributes) The filesystem's metadata pool, <name>_metadata. Proxmox VE creates it under the cluster's default CRUSH rule and size; settings given here are applied right after creation and can be changed in place. (see below for nested schema)
  • pg_num (Number) The number of placement groups for the data pool at creation; the metadata pool gets a quarter of it, and at least 8. Proxmox VE defaults to 128. Only used at creation, since the PG autoscaler may change it later; changing it replaces the filesystem.

Read-Only

  • id (String) The unique identifier of the filesystem: its name.

Nested Schema for data_pool

Optional:

  • crush_rule (String) The name of the CRUSH rule that places the pool's data.
  • min_size (Number) The minimum number of replicas for the pool to accept writes.
  • size (Number) The number of replicas per object.

Read-Only:

  • name (String) The pool's name.
  • pool_id (Number) Ceph's numeric ID of the pool. Null with pve-manager releases before 9.1.18, which don't report it.

Nested Schema for metadata_pool

Optional:

  • crush_rule (String) The name of the CRUSH rule that places the pool's data.
  • min_size (Number) The minimum number of replicas for the pool to accept writes.
  • size (Number) The number of replicas per object.

Read-Only:

  • name (String) The pool's name.
  • pool_id (Number) Ceph's numeric ID of the pool. Null with pve-manager releases before 9.1.18, which don't report it.

Import

Import is supported using the following syntax:

#!/usr/bin/env sh
# A CephFS can be imported using the format `node_name/name`, e.g.:
terraform import proxmox_ceph_fs.example pve/shared