#azure (2024-12)
Archive: https://archive.sweetops.com/azure/
2024-12-09
I was previously an avid user of the https://github.com/cloudposse/terraform-null-label module to maintain good naming when doing stuff in AWS, but now have found myself working with a client that sits firmly in the Azure world, would it still be possible to use this module, and if not, can somebody recommend something similar that fits with Azure?
Many thanks!
Terraform Module to define a consistent naming convention by (namespace, stage, name, [attributes])
you can use it
Terraform Module to define a consistent naming convention by (namespace, stage, name, [attributes])
in conjunction with https://github.com/Azure/terraform-azurerm-naming, which has only one maintainer
if I was you, I will find a way to feed https://github.com/Azure/terraform-azurerm-naming/blob/master/resourceDefinition.json into the null label ( maybe with a wrapper module) to then have a module that knows about all the azure standards
``` [ { “name”: “analysis_services_server”, “length”: { “min”: 3, “max”: 63 }, “regex”: “^(?=.{3,63}$)[a-z][a-z0-9]+$”, “scope”: “resourceGroup”, “slug”: “as”, “dashes”: false }, { “name”: “api_management”, “length”: { “min”: 1, “max”: 50 }, “regex”: “^(?=.{1,50}$)[a-z][a-zA-Z0-9]+$”, “scope”: “global”, “slug”: “apim”, “dashes”: false }, { “name”: “app_configuration”, “length”: { “min”: 5, “max”: 50 }, “regex”: “^(?=.{5,50}$)[a-zA-Z0-9-]+$”, “scope”: “resourceGroup”, “slug”: “appcg”, “dashes”: true }, { “name”: “app_service_plan”, “length”: { “min”: 1, “max”: 40 }, “regex”: “^(?=.{1,40}$)[a-zA-Z0-9-]+$”, “scope”: “resourceGroup”, “slug”: “plan”, “dashes”: true }, { “name”: “app_service_environment”, “length”: { “min”: 1, “max”: 40 }, “regex”: “^(?=.{1,40}$)[a-zA-Z0-9-]+$”, “scope”: “resourceGroup”, “slug”: “ase”, “dashes”: true }, { “name”: “app_service”, “length”: { “min”: 2, “max”: 60 }, “regex”: “^(?=.{2,60}$)[a-z0-9][a-zA-Z0-9-]+[a-z0-9]”, “scope”: “global”, “slug”: “app”, “dashes”: true }, { “name”: “application_gateway”, “length”: { “min”: 1, “max”: 80 }, “regex”: “^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-.]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “agw”, “dashes”: true }, { “name”: “application_insights”, “length”: { “min”: 10, “max”: 260 }, “regex”: “^[^%\\&?/]+$”, “scope”: “resourceGroup”, “slug”: “appi”, “dashes”: true }, { “name”: “application_security_group”, “length”: { “min”: 1, “max”: 80 }, “regex”: “^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-.]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “asg”, “dashes”: true }, { “name”: “automation_account”, “length”: { “min”: 6, “max”: 50 }, “regex”: “^(?=.{6,50}$)[a-zA-Z][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “aa”, “dashes”: true }, { “name”: “automation_certificate”, “length”: { “min”: 1, “max”: 128 }, “regex”: “^(?=.{1,128}$)[^<>*%:.?\\+\\/]+[^<>*%:.?\\+\\/ ]$”, “scope”: “parent”, “slug”: “aacert”, “dashes”: true }, { “name”: “automation_credential”, “length”: { “min”: 1, “max”: 128 }, “regex”: “^(?=.{1,128}$)[^<>*%:.?\\+\\/]+[^<>*%:.?\\+\\/ ]$”, “scope”: “parent”, “slug”: “aacred”, “dashes”: true }, { “name”: “automation_runbook”, “length”: { “min”: 1, “max”: 63 }, “regex”: “^(?=.{1,63}$)[a-zA-Z][a-zA-Z0-9-]+$”, “scope”: “parent”, “slug”: “aacred”, “dashes”: true }, { “name”: “automation_schedule”, “length”: { “min”: 1, “max”: 128 }, “regex”: “^(?=.{1,128}$)[^<>*%:.?\\+\\/]+[^<>*%:.?\\+\\/ ]$”, “scope”: “parent”, “slug”: “aasched”, “dashes”: true }, { “name”: “automation_variable”, “length”: { “min”: 1, “max”: 128 }, “regex”: “^(?=.{1,128}$)[^<>*%:.?\\+\\/]+[^<>*%:.?\\+\\/ ]$”, “scope”: “parent”, “slug”: “aavar”, “dashes”: true }, { “name”: “availability_set”, “length”: { “min”: 1, “max”: 80 }, “regex”: “^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-.]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “avail”, “dashes”: true }, { “name”: “bastion_host”, “length”: { “min”: 1, “max”: 80 }, “regex”: “^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9-.]+[a-zA-Z0-9]$”, “scope”: “parent”, “slug”: “snap”, “dashes”: true }, { “name”: “batch_account”, “length”: { “min”: 3, “max”: 24 }, “regex”: “^(?=.{3,24}$)[a-z0-9]+$”, “scope”: “region”, “slug”: “ba”, “dashes”: false }, { “name”: “batch_application”, “length”: { “min”: 1, “max”: 64 }, “regex”: “^(?=.{1,64}$)[a-zA-Z0-9-]+$”, “scope”: “parent”, “slug”: “baapp”, “dashes”: true }, { “name”: “batch_certificate”, “length”: { “min”: 5, “max”: 45 }, “regex”: “^(?=.{5,45}$)[a-zA-Z0-9-]+$”, “scope”: “parent”, “slug”: “bacert”, “dashes”: true }, { “name”: “batch_pool”, “length”: { “min”: 3, “max”: 24 }, “regex”: “^(?=.{1,64}$)[a-zA-Z0-9-]+$”, “scope”: “parent”, “slug”: “bapool”, “dashes”: true }, { “name”: “bot_channel_directline”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botline”, “dashes”: true }, { “name”: “bot_channel_email”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botmail”, “dashes”: true }, { “name”: “bot_channel_ms_teams”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botteams”, “dashes”: true }, { “name”: “bot_channel_slack”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botslack”, “dashes”: true }, { “name”: “bot_channels_registration”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botchan”, “dashes”: true }, { “name”: “bot_connection”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-.]+$”, “scope”: “parent”, “slug”: “botcon”, “dashes”: true }, { “name”: “bot_web_app”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{2,64}$)[a-zA-Z0-9][a-zA-Z0-9-_.]+$”, “scope”: “global”, “slug”: “bot”, “dashes”: true }, { “name”: “cdn_endpoint”, “length”: { “min”: 1, “max”: 50 }, “regex”: “^(?=.{1,50}$)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “global”, “slug”: “cdn”, “dashes”: true }, { “name”: “cdn_profile”, “length”: { “min”: 1, “max”: 260 }, “regex”: “^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “cdnprof”, “dashes”: true }, { “name”: “cognitive_account”, “length”: { “min”: 2, “max”: 64 }, “regex”: “^(?=.{1,260}$)[a-zA-Z0-9][a-zA-Z0-9-]+$”, “scope”: “resourceGroup”, “slug”: “cog”, “dashes”: true }, { “name”: “container_app”, “length”: { “min”: 1, “max”: 32 }, “regex”: “^(?=.{1,32}$)(?!.–)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “ca”, “dashes”: true }, { “name”: “container_app_environment”, “length”: { “min”: 1, “max”: 60 }, “regex”: “^(?=.{1,32}$)(?!.–)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “cae”, “dashes”: true }, { “name”: “container_group”, “length”: { “min”: 1, “max”: 63 }, “regex”: “^(?=.{1,63}$)(?!.*–)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]$”, “scope”: “resourceGroup”, “slug”: “cg”, “dashes”: true }, { “name”: “container_registry”, “length”: { “min”: 1, “max”: 63 }, “regex”: “^(?=.{1,63}$)[a-zA-Z0-9]+$”, “scope”: “resourceGroup”, “slug”: “acr”, “dashes”: false }, { “name”: “container_registry_webhook”, “length”: { “min”: 1, “max”: 50 }, “regex”: “^(?=.{5,50}$)[a-zA-Z0-9]+$”, “scope”: “resourceGroup”, “slug”: “crwh”, “dashes”: false }, { “name”: “cosmosdb_acc…
the reason this is an issue in azure is because AZURE DOES NOT HAVE NAMING STANDARDS for their resources
and even the Azure maintained module does not support it’s own standards
We also have a more modern implementation
Terrform provider for managing a context in Terraform.
This uses a Terraform provider, so you don’t even need to pass context around
It’s not opinionated, and you can create any convention you want.
And enforce it.
Thanks guys, I’ll definitely check out the new provider, looks way smoother than the context-passing of previous, even thought that worked just fine.