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

Add suffix option to azurecaf_name resources #1294

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hyperfocus1337
Copy link
Contributor

@hyperfocus1337 hyperfocus1337 commented Aug 3, 2022

Issue-id

PR Checklist


Description

Adds the suffix option to the azurecaf_name for all resources across the framework. Also related to PR Azure/caf-terraform-landingzones#407 and issue #1287.

Does this introduce a breaking change

  • YES
  • NO

Testing

Comment on lines +223 to +224
suffix_with_hyphen = try(var.global_settings.suffix_with_hyphen, format("%s-", try(var.global_settings.suffix, try(var.global_settings.suffixes[0], random_string.suffix.0.result))))
suffixes = try(var.global_settings.suffix, null) == "" ? null : try([var.global_settings.suffix], try(var.global_settings.suffixes, [random_string.suffix.0.result]))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure whether these two could also be useful. Just copied over the idea from the prefix.

Choose a reason for hiding this comment

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

This is a CAF convention that basically adds a random prefix if no prefix is provided, but that shouldn't apply to suffixes. The current implementation will add random strings for every legacy CAF deployment that exists since they won't have global_settings.suffix set. The local global_settings.suffix should just stay null if the var global_settings suffix is null. This is what is causing resources to be regenerated if suffix isn't provided.

@hyperfocus1337
Copy link
Contributor Author

This PR is not yet safe to merge. We have noticed existing workloads will get replaced if the suffix = null variable is not present in global_settings.tfvars.

image

@jtdossett
Copy link

@hyperfocus1337 Bumping this -- suffixes would be very useful for a number of use cases. The PR should have the 'set suffix to random if not provided' logic removed so that it won't force replacement on existing workloads if suffix isn't provided.

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.

Feature request - why is the suffixes option missing from the azurecaf_name resource?
2 participants