Open takekazuomi opened 3 years ago
IMO the CAF naming convention is highly opinionated and should not be taken as a general guideline for naming resources in Azure. Resource type prefixes is not at all a golden standard of naming resources in my opinion.
It would be cool if we let you set a regex based naming convention that the linter could look out for. Naming conventions tend to be very particular to the customer/user. cc @MarcusFelling / @jfleisher
Can it be simpler to add a decorator that supports regex for value? We already have @allowed decorator... Can it be extended for example?
We are working on something in this regard that can be configured working for ARM or Bicep is similar to PSRule for Azure. PSRule for Cloud Adoption Framework is early in it's lifecycle so we'd appreciate your thoughts.
https://azure.github.io/PSRule.Rules.Azure/using-bicep/ https://github.com/microsoft/PSRule.Rules.CAF
I actvely discourage use of resource naming conventions and instead recommend that in the mass majority of cases using Tags with more descriptive metadata is a less painful and much better mechanism to use. This is particularly true of Globally Unique resources like Storage which have a limited number of potential resouce names & can easily end up with collisions. It's also bad from a security perspective for easiliy guessable resource names.
This is why i'd prefer to see this not baked into bicep but instead as @alex-frankel suggested have a mechanism to enable regex based validation or perhaps add @pavel-kurnosov suggestion as this would enable flexibilty without enforcing down a path that would make me instantly disable that rule for all bicep projects.
Azure Cloud Adoption Framework best practices define a naming convention, which recommends a resource type prefix. Linter should check the naming convention for resources, such as the resource type prefix.
https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming
Currently, the resource type prefix is not widespread. Most Azure Quickstart Templates, let alone the Azure portal, don't use a resource type prefix. Linter helps end the mess.