github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/demo/csi/ceph-csi-plugin/ceph-csi-id.tf (about)

     1  locals {
     2    # ClusterID: Is a unique ID per cluster that the CSI instance is serving and is restricted to
     3    # lengths that can be accommodated in the encoding scheme.
     4    # must be less than 128 chars. must match the cluster id in the csi plugin conf.
     5    ClusterID = "<clusterid>"
     6  
     7    # EncodingVersion: Carries the version number of the encoding scheme used to encode the CSI ID,
     8    # and is preserved for any future proofing w.r.t changes in the encoding scheme, and to retain
     9    # ability to parse backward compatible encodings.
    10    # https://github.com/ceph/ceph-csi/blob/ef1785ce4db0aa1f6878c770893bcabc71cff300/internal/cephfs/driver.go#L31
    11    EncodingVersion = 1
    12  
    13    # LocationID: 64 bit integer identifier determining the location of the volume on the Ceph cluster.
    14    # It is the ID of the poolname or fsname, for RBD or CephFS backed volumes respectively.
    15    # see https://docs.ceph.com/docs/mimic/rbd/rados-rbd-cmds/
    16    LocationID = 7
    17  
    18    # ObjectUUID: Is the on-disk uuid of the object (image/snapshot) name, for the CSI volume that
    19    # corresponds to this CSI ID.. must be 36 chars long.
    20    ObjectUUID = "abcd"
    21  }
    22  
    23  data "template_file" "csi_id" {
    24    template = "$${versionEncodedHex}-$${clusterIDLength}-$${ciClusterID}-$${poolIDEncodedHex}-$${ciObjectUUID}"
    25  
    26    vars = {
    27      versionEncodedHex = "${format("%02X", local.EncodingVersion)}"
    28      clusterIDLength   = "${format("%02X", length(local.ClusterID))}"
    29      ciClusterID       = "${local.ClusterID}"
    30      poolIDEncodedHex  = "${format("%016X", local.LocationID)}"
    31      ciObjectUUID      = "${local.ObjectUUID}"
    32    }
    33  }