nomad_csi_volume_registration

Manages the registration of a CSI volume in Nomad

This can be used to register and deregister CSI volumes in a Nomad cluster. The volume must already exist to be registered. Use the nomad_csi_volume resource to create a new volume.

Example Usage

Registering a volume:

# It can sometimes be helpful to wait for a particular plugin to be available
data "nomad_plugin" "ebs" {
  plugin_id        = "aws-ebs0"
  wait_for_healthy = true
}

resource "nomad_csi_volume_registration" "mysql_volume" {
  depends_on = [data.nomad_plugin.ebs]

  plugin_id   = "aws-ebs0"
  volume_id   = "mysql_volume"
  name        = "mysql_volume"
  external_id = module.hashistack.ebs_test_volume_id

  capability {
    access_mode     = "single-node-writer"
    attachment_mode = "file-system"
  }

  mount_options {
    fs_type = "ext4"
  }

  topology_request {
    required {
      topology {
        segments = {
          rack = "R1"
          zone = "us-east-1a"
        }
      }

      topology {
        segments = {
          rack = "R2"
        }
      }
    }
  }
}

Argument Reference

The following arguments are supported:

Capability

Topology Request

Topology

In addition to the above arguments, the following attributes are exported and can be referenced:

Timeouts

nomad_csi_volume_registration provides the following Timeouts configuration options.

Importing CSI Volume Registrations

CSI volume registrations are imported using the pattern <volume ID>@<namespace>.

$ terraform import nomad_csi_volume.mysql mysql@my-namespace
nomad_csi_volume_registration.mysql: Importing from ID "mysql@my-namespace"...
nomad_csi_volume_registration.mysql: Import prepared!
  Prepared nomad_csi_volume_registration for import
nomad_csi_volume_registration.mysql: Refreshing state... [id=mysql@my-namespace]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.