You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/website/content/docs/templates/hcl_templates/functions/uuid/uuidv4.mdx

33 lines
1.4 KiB

---
page_title: uuidv4 function reference
description: The `uuidv4` function generates a unique string ID according to RFC 4122 version 4.
---
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
# `uuidv4` Function
`uuidv4` generates a unique identifier string.
The ID is a generated and formatted as required by [RFC 4122 section
4.4](https://tools.ietf.org/html/rfc4122#section-4.4), producing a Version 4
UUID. The result is a UUID generated only from pseudo-random numbers.
This function produces a new value each time it is called, and so using it
directly in resource arguments will result in spurious diffs. We do not
recommend using the `uuidv4` function in resource configurations.
## Examples
```shell-session
> uuidv4()
9fc99a70-7cd5-482d-bb2b-03af016e4e94
```
## Related Functions
- [`uuidv5`](/packer/docs/templates/hcl_templates/functions/uuid/uuidv5), which generates name-based UUIDs.