github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/uuid.html.md (about)

     1  ---
     2  layout: "language"
     3  page_title: "uuid - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-crypto-uuid"
     5  description: |-
     6    The uuid function generates a unique id.
     7  ---
     8  
     9  # `uuid` Function
    10  
    11  `uuid` generates a unique identifier string.
    12  
    13  The id is a generated and formatted as required by
    14  [RFC 4122 section 4.4](https://tools.ietf.org/html/rfc4122#section-4.4),
    15  producing a Version 4 UUID. The result is a UUID generated only from
    16  pseudo-random numbers.
    17  
    18  This function produces a new value each time it is called, and so using it
    19  directly in resource arguments will result in spurious diffs. We do not
    20  recommend using the `uuid` function in resource configurations, but it can
    21  be used with care in conjunction with
    22  [the `ignore_changes` lifecycle meta-argument](/docs/language/meta-arguments/lifecycle.html#ignore_changes).
    23  
    24  In most cases we recommend using [the `random` provider](https://registry.terraform.io/providers/hashicorp/random/latest/docs)
    25  instead, since it allows the one-time generation of random values that are
    26  then retained in the Terraform [state](/docs/language/state/index.html) for use by
    27  future operations. In particular,
    28  [`random_id`](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) can generate results with
    29  equivalent randomness to the `uuid` function.
    30  
    31  ## Examples
    32  
    33  ```
    34  > uuid()
    35  b5ee72a3-54dd-c4b8-551c-4bdc0204cedb
    36  ```
    37  
    38  ## Related Functions
    39  
    40  * [`uuidv5`](./uuidv5.html), which generates name-based UUIDs.