github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/uuidv5.html.md (about)

     1  ---
     2  layout: "functions"
     3  page_title: "uuidv5 - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-crypto-uuidv5"
     5  description: |-
     6    The uuidv5 function generates a uuid v5 string representation of the value in the specified namespace.
     7  ---
     8  
     9  # `uuidv5` Function
    10  
    11  -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
    12  earlier, see
    13  [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
    14  
    15  `uuidv5` generates a _name-based_ UUID, as described in
    16  [RFC 4122 section 4.3](https://tools.ietf.org/html/rfc4122#section-4.3),
    17  also known as a "version 5" UUID.
    18  
    19  ```
    20  uuidv5(namespace, name)
    21  ```
    22  
    23  Unlike the pseudo-random UUIDs generated by
    24  [`uuid`](./uuid.html), name-based UUIDs derive from namespace and an name,
    25  producing the same UUID value every time if the namespace and name are
    26  unchanged.
    27  
    28  Name-based UUID namespaces are themselves UUIDs, but for readability this
    29  function accepts some keywords as aliases for the namespaces that were
    30  assigned by RFC 4122:
    31  
    32  | Keyword | Namespace ID | Name format |
    33  | ------- | ------------ | ----------- |
    34  | `"dns"` | `6ba7b810-9dad-11d1-80b4-00c04fd430c8` | A fully-qualified DNS domain name. |
    35  | `"url"` | `6ba7b811-9dad-11d1-80b4-00c04fd430c8` | Any valid URL as defined in [RFC 3986](https://tools.ietf.org/html/rfc3986). |
    36  | `"oid"` | `6ba7b812-9dad-11d1-80b4-00c04fd430c8` | An [ISO/IEC object identifier](https://oidref.com/) |
    37  | `"x500"` | `6ba7b814-9dad-11d1-80b4-00c04fd430c8` | [X.500 Distinguished Name](https://tools.ietf.org/html/rfc1779) |
    38  
    39  To use any other namespace not included in the above table, pass its assigned
    40  namespace ID directly in the first argument in the usual UUID string format.
    41  
    42  ## Examples
    43  
    44  Use the namespace keywords where possible, to make the intent more obvious to
    45  a future reader:
    46  
    47  ```
    48  > uuidv5("dns", "www.terraform.io")
    49  a5008fae-b28c-5ba5-96cd-82b4c53552d6
    50  
    51  > uuidv5("url", "https://www.terraform.io/")
    52  9db6f67c-dd95-5ea0-aa5b-e70e5c5f7cf5
    53  
    54  > uuidv5("oid", "1.3.6.1.4")
    55  af9d40a5-7a36-5c07-b23a-851cd99fbfa5
    56  
    57  > uuidv5("x500", "CN=Example,C=GB")
    58  84e09961-4aa4-57f8-95b7-03edb1073253
    59  ```
    60  
    61  The namespace keywords treated as equivalent to their corresponding namespace
    62  UUIDs, and in some special cases it may be more appropriate to use the
    63  UUID form:
    64  
    65  ```
    66  > uuidv5("6ba7b810-9dad-11d1-80b4-00c04fd430c8", "www.terraform.io")
    67  a5008fae-b28c-5ba5-96cd-82b4c53552d6
    68  ```
    69  
    70  If you wish to use a namespace defined outside of RFC 4122, using the namespace
    71  UUID is required because no corresponding keyword is available:
    72  
    73  ```
    74  > uuidv5("743ac3c0-3bf7-4a5b-9e6c-59360447c757", "LIBS:diskfont.library")
    75  ede1a974-df7e-5f17-84b9-76208818b2c8
    76  ```
    77  
    78  When using raw UUID namespaces, consider including a comment alongside the
    79  expression that indicates which namespace this represents in a
    80  human-significant manner, such as by reference to the standard that
    81  defined it.
    82  
    83  ## Related Functions
    84  
    85  * [`uuid`](./uuid.html), which generates pseudorandom UUIDs.