vault_transform_template

This resource supports the /transform/template/{name} Vault endpoint.

It creates or updates a template with the given name. If a template with the name does not exist, it will be created. If the template exists, it will be updated with the new attributes.

Example Usage

Please note that the pattern below holds a regex. The regex shown is identical to the one in our Setup docs, (\d{4})-(\d{4})-(\d{4})-(\d{4}). However, due to HCL, the backslashes must be escaped to appear correctly in Vault. For further assistance escaping your own custom regex, see String Literals.

resource "vault_mount" "transform" {
  path = "transform"
  type = "transform"
}

resource "vault_transform_alphabet" "numerics" {
  path      = vault_mount.transform.path
  name      = "numerics"
  alphabet  = "0123456789"
}

resource "vault_transform_template" "test" {
  path           = vault_transform_alphabet.numerics.path
  name           = "ccn"
  type           = "regex"
  pattern        = "(\\d{4})[- ](\\d{4})[- ](\\d{4})[- ](\\d{4})"
  alphabet       = "numerics"
  encode_format  = "$1-$2-$3-$4"
  decode_formats = {
    "last-four-digits" = "$4"
  }
}

Argument Reference

The following arguments are supported: