aztfmod / terraform-provider-azurecaf

Terraform provider for the Terraform platform engineering for Azure
MIT License
174 stars 93 forks source link

allow name precedence to be specified #52

Closed Lucretius closed 3 years ago

Lucretius commented 3 years ago

This PR is to allow someone who is consuming the component to specify the order of the three sections of the name (not including prefix/suffix, which, by their name should always be at the beginning or end). Our use case is that we potentially wanted the ability to put the slug at the end precedence of ["name","random","slug"] with suffixes = []. The restrictions I've placed on the name_precedence require it to be a list of three unique strings, where each string must be one of name, random or slug.

This included changing a line in the composeName function but will result in no change to any current functionality as I did not find any cases of the initialized function arg being set.

All unit tests passed, and I have added a new one to test the name order swap.

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.4% 2.4% Duplication

Nepomuceno commented 3 years ago

First Thank you for your contribution.

We cannot change the default from the ones that exist today and the current way that name precedence works the way that you put here is I modify the name the result will not be always the one expected. change this would require that the whole compose name function would be completely rewritten. to do not mix the order into wich the names are created and the order into which you remove things if they do not fit.