opentofu icon indicating copy to clipboard operation
opentofu copied to clipboard

Support for UUIDv7 (adding function uuidv7)

Open joaocc opened this issue 2 years ago • 2 comments

OpenTofu Version

1.6.x

Use Cases

As 1.6.x, UUID formats v4 and v5 are supported. https://developer.hashicorp.com/terraform/language/functions/uuid https://developer.hashicorp.com/terraform/language/functions/uuidv5

Some time ago, new UUID formats were launched by IETF and, one of them (UUID v7) has some very interesting properties that make it a need in many scenarios where distributed generation of quasi-sequential numbers is desired (up to 50ns resolution + 48 random bits) Currently generating them requires launching external commands. This request is to add support for UUID v7.

Attempted Solutions

Launching external commands

Proposal

Add uuidv7 function.

References

Some supporting material:

  • https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format#name-uuid-version-7
  • https://buildkite.com/blog/goodbye-integers-hello-uuids

joaocc avatar Oct 07 '23 16:10 joaocc

I've looked at replacing the Hashicorp UUID library used in Opentofu outright. Because Hashi's UUID library is being used for encryption purposes as well as generating UUIDs some care should be taken to make sure that encryption primitives don't get nerfed.

alrs avatar Oct 07 '23 16:10 alrs

Please consider that this format specification is still in draft mode - which in the link above has expired by the way - and has not been accepted yet.

Refer to the newest draft for further discussion here: https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/12/

maunzCache avatar Oct 07 '23 18:10 maunzCache

Hey folks, thank you for your input. We have discussed this issue in the core team and we have decided that this feature won't be implemented until UUIDv7 is standardized. (It is currently a draft and may change.) Please reopen this issue when UUIDv7 is fully standardized.

janosdebugs avatar Jan 29 '24 18:01 janosdebugs