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

Do not use resourcePrefix alone when assigning names to resources with uniqueness requirements #498

Closed
glennmusa opened this issue Nov 1, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@glennmusa
Copy link
Contributor

Description

We're generating a resourcePrefix value by default like so:

param resourcePrefix string = 'mlz-${uniqueId}'

And using that to assign names for certain resources that require uniqueness (things like Log Analytics Workspaces and Storage Accounts) like so:

param logAnalyticsWorkspaceName string = take('${resourcePrefix}-laws', 63)

This can introduce failed deployments and unwanted behavior when a user specifies their own resourcePrefix value.

We should instead generate some uniqueness and use it for the resource names that require it.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Provide a user-supplied value for resourcePrefix like foo
  2. Certain items will occasionally fail on redeploy for resources that take longer to clean-up like certain security solutions for Log Analytics Workspaces

Expected behavior

I can provide my own resourcePrefix value to a deployment and re-deploy as often as I want without error.

Actual behavior

Certain items will occasionally fail on redeploy for resources that take longer to clean-up like certain security solutions for Log Analytics Workspaces

Cloud (public, Azure Government, etc.): public

@shawngib
Copy link
Member

shawngib commented Nov 2, 2021

This should merge with #439 as naming conventions will most likely solve for issues. Also think the issue that originally raised this has a different root cause that this will hide since despite documentation the LA Workspace doesn't require global uniqueness but following a naming convention like -<prefix name/workload>- would solve for. The primary concern is LA naming shouldn't be randomized since then its usage via portal, queries or coding becomes difficult.

@brooke-hamilton
Copy link
Contributor

Also please take #393 into consideration when addressing this bug.

@brooke-hamilton
Copy link
Contributor

brooke-hamilton commented Nov 3, 2021

The team recommends a spike on proving the implementation: a resource group that has a storage account that has a unique name based on a user-provided value, but is consistently generated so that idempotency is preserved. #503 is the spike.

@shawngib
Copy link
Member

Just wanted to place this here for reference of future need in unique names. Log Analytics workspace does not require it to be globally unique as per this GA announcement in commercial and gov: https://azure.microsoft.com/en-us/updates/general-availability-log-analytics-workspace-name-uniqueness-is-now-per-resource-group/

This may need further investigation as it may not be GA in all clouds.

@brooke-hamilton
Copy link
Contributor

This issue was resolved with #556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants