Description
openedon Oct 23, 2024
What happened?
I was trying to create a storage account with an auto-generated name to avoid collisions since they need to be globally unique.
However, since storage accounts only allow lowercase alphanumeric characters, my PascalCase naming strategy caused an incorrect name to be generated.
error: Code="AccountNameInvalid" Message="MyAccountab50c96d is not a valid storage account name. Storage account name must be between 3 and 24 characters in length and use numbers and lower-case letters only."
I think the auto-generated name should be lowercased to follow the upstream rules.
I've currently worked around this by using a RandomId with the resource name in lowercase as the prefix.
I had the same issue with my BlobContainer after I created the storage account (though those seem to allow hyphens and lowercase alphanumerics).
Example
Does not work:
new Storage.StorageAccount("MyAccount", new()
{
ResourceGroupName = resourceGroup.Name,
AccessTier = Storage.AccessTier.Hot,
... more properties
}
Workaround:
var storageAccountName = new Pulumi.Random.RandomId("MyAccountName", new()
{
ByteLength = 4,
Prefix = "myaccount",
});
new Storage.StorageAccount("MyAccount", new()
{
ResourceGroupName = resourceGroup.Name,
AccessTier = Storage.AccessTier.Hot,
AccountName = storageAccountName.Hex,
Output of pulumi about
CLI
Version 3.134.1
Go Version go1.23.1
Go Compiler gc
Plugins
KIND NAME VERSION
resource azure-native 2.68.0
language dotnet unknown
resource random 4.16.7
Host
OS arch
Version
Arch x86_64
This project is written in dotnet: executable='/usr/bin/dotnet' version='8.0.108'
[Sensitive stuff about my customer's stack]
Dependencies:
NAME VERSION
Pulumi 3.67.1
Pulumi.AzureNative 2.68.0
Pulumi.Random 4.16.7
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).