Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand regex to allow underscores (and periods) #172

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

kpcraig
Copy link
Contributor

@kpcraig kpcraig commented Nov 5, 2024

This expands the "nameRx" - used for vm names and vmss names to allow underscores and periods. Disallows periods and hyphens from being the last character, as described by https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.VM.Name/#description

I also added parens to resource group names, since they seem to be allowed both in https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.ResourceGroup.Name/ and https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules (grep for 'resourcegroup')

I am open to kibitzing on if we should just simplify the regexen to block slashes specifically.

@tomcf-hcp
Copy link

I think the "allow" regex is easier to match the documentation, and less likely to cause an issue. Thanks for adding comments and references to the regex to indicate their intent and source, makes it easier to validate.

Copy link

@tomcf-hcp tomcf-hcp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, the regex's seem to match the rules.
Would like to know if JM has any other comments.

@kpcraig kpcraig merged commit 738d21d into main Nov 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants