You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a number of resource types in Azure that require a name that is globally unique (across the whole of Azure). Examples include storage accounts and key vaults. The constraints on names are somewhat restrictive:
A vault's name must be between 3-24 alphanumeric characters. The name must begin with a letter, end with a letter or digit, and not contain consecutive hyphens. Follow this link for more information https://go.microsoft.com/fwlink/?linkid=2147742
It would be useful to be able to generate a random string that complies with these constraints whilst also making use of the full universe of valid names, to minimise the chance of collisions.
I've assumed that the random provider is deliberately cloud provider agnostic, so I've proposed HCL that makes no reference to Azure. The result is somewhat unsatisfactory - the user needs to understand the (slightly woolly) Azure documentation, the configuration is slightly complicated, and it's hard to use the full universe of valid names. It might be better to have a resource type that is explicitly for Azure names.
Azure's failure messages are a bit ambiguous, for example the one above specifies only 'alphanumeric characters', but then goes on to talk about rules for hyphens.
Although the failure doesn't mention it, I believe the names are case-insensitive, because they are used as leaf labels in domain names.
Given the above, I think we have 26 letters + 10 digits + '-' = 37 valid characters, meaning 3724 = 4 x 1037 valid full length names (minus a few banned combinations). We can squeeze a few more out if we also include non-full length names (about 8 x 1037), This is still an order of magnitude short of the number of valid UUIDs, but I believe it's sufficiently large to make the chance of random collisions very small. Thought needs to be give to whether effort should be made to reduce the chance of malicious collisions.
The text was updated successfully, but these errors were encountered:
There are a number of resource types in Azure that require a name that is globally unique (across the whole of Azure). Examples include storage accounts and key vaults. The constraints on names are somewhat restrictive:
It would be useful to be able to generate a random string that complies with these constraints whilst also making use of the full universe of valid names, to minimise the chance of collisions.
Terraform Version
Affected Resource(s)
Provider
hashicorp/random
version3.1.0
Proposed Terraform Configuration
Important Factoids
The text was updated successfully, but these errors were encountered: