hashicorp / terraform-provider-random

Utility provider that supports the use of randomness within Terraform configurations.
https://registry.terraform.io/providers/hashicorp/random/latest
Mozilla Public License 2.0
200 stars 114 forks source link

Improve uuid generated by making it valid #402

Open dngferreira opened 1 year ago

dngferreira commented 1 year ago

Terraform CLI and Provider Versions

Terraform v1.4.5 - on darwin_amd64

provider 3.5.1

Use Cases or Problem Statement

Currently random_uuid doesn't generate uuid's that follow the RFC 4122 and can be validated against the same RFC.

Some applications we interact with do uuid's validation which is causing some problems with terraform automation of those uuid's across multiple services.

Proposal

migrate from go-uuid to github.com/google/uuid library

How much impact is this issue causing?

Medium

Additional Information

No response

Code of Conduct

bflad commented 1 year ago

Hi @dngferreira 👋 Thank you for raising this. It is a little unfortunate that the resource is named "uuid" when, as its description mentions, its a "UUID-formatted string" rather than following RFC 4122's definition of a UUID.

To be upfront, I'm imagining that if this proposal is accepted (depending on the burden for practitioners to deal with the adjustment) the implementation of the existing resource would not potentially be updated until a future major version, which is not planned at the moment. Another option may be to introduce a separate new resource or potentially offload UUID-based resources onto a different provider.

I will reach out to the product owner for this provider and leave this issue open to determine other community interest, signaled by 👍 reactions on the issue.

dngferreira commented 1 year ago

Hi, Can we add a random_uuid4 resource that generates valid uuid version 4 UUID's that can be validated?

I'm willing to take time and make a PR if the team would validate it.

pablodiazgutierrez commented 6 months ago

We just ran into this issue with an app for Microsoft's ecosystem. Our app is hosted in a number of Office apps (Teams, Outlook, etc), and while it works in most settings, it silently refuses to load when in microsoft365.com, because they use an RFC-compliant validator in that specific host.

I would suspect that, collectively, this issue is costing a lot of engineering time to work out.

rainshen49 commented 4 months ago

To echo Pablo's comment, we (Google) also validate UUID4s in parts of our ecosystem. IMO Terraform should be providing such a uuid4 generator because it's a widely used standard, not specific to any company. I see that equivalent functions already exist in other Hashicorp products such as Packer. Please consider prioritizing this.