Azure / terraform-azurerm-naming

MIT License
218 stars 109 forks source link

How to apply MS recommended naming conventions? #33

Closed svenschiller closed 4 years ago

svenschiller commented 4 years ago

I'm currently looking into naming conventions and much appreciate your work on this module. Having an automated solution for naming resources would be great. However, I'm currently running into an issue that I cannot seem to solve with the existing suffix input.

Here are a couple of recommendations from https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/naming-and-tagging

Virtual network: vnet-<Subscription type>-<Region>-<###>     
Example: vnet-prod-westus-001

Storage account (general use): st<storage name><###>
Example: stnavigatordata001

Your module generates the prefix and adds the defined suffix (e.g. vnet-prod), but I haven't figured out how to add the different recommended name parts as per Microsoft and also the running count at the end. If I add them outside of the module's control, the name length validation no longer works. What am I missing? Thanks!

Nepomuceno commented 4 years ago

If you want to do something like st<storageName><###> you can add a resource

module "naming" {
  count = 3
  source  = "Azure/naming/azurerm"
  suffix = [ "storageName", count.index ]
}