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

Require a user-supplied value for resourcePrefix and do not use deployment().name for seeding names #552

Closed
glennmusa opened this issue Dec 3, 2021 · 0 comments · Fixed by #553
Assignees

Comments

@glennmusa
Copy link
Contributor

glennmusa commented Dec 3, 2021

Benefit/Result/Outcome

So that users make conscious decisions about how things are named.

Description

As part of creating uniqueness, update mlz.bicep to require the mandatory input of the resourcePrefix parameter.

Today, the deployment().name property is used today to seed resource names and uniqueness for resources that require global uniqueness. This property is relative to the ARM deployment and not relative to anything Mission Landing Zone or any parameter value the user has provided.

The direction the team has decided in #549 is to start deriving resource names and uniqueness from a user-supplied value instead.

This is where a uniqueId is seeded:

param uniqueId string = uniqueString(deployment().name)

Then it is used to determine the resourcePrefix:

@minLength(3)
@maxLength(24)
@description('A name (3-24 alphanumeric characters in length without whitespace) used to prefix resources and generate uniqueness for resources with globally unique naming requirements like Storage Accounts and Log Analytics Workspaces')
param resourcePrefix string = 'mlz-${uniqueId}'

And then resourcePrefix is used for resource names:

param hubResourceGroupName string = '${resourcePrefix}-hub'

And also used for generating uniqueness:

param hubLogStorageAccountName string = toLower(take('hublogs${uniqueId}', 24))

Instead, take resourcePrefix as a required parameter. Then, use the user-supplied resourcePrefix plus some other uniqueish seed like UtcNow or a GUID to generate uniqueness where it's required.

Acceptance Criteria

  • resourcePrefix is a parameter without a default
  • deployment().name is not used as a seed for resource names
  • deployment().name is not used as a seed for uniqueness
  • resourcePrefix + some uniqueish seed generates uniqueness
@glennmusa glennmusa added this to the Resource Naming milestone Dec 3, 2021
@glennmusa glennmusa self-assigned this Dec 3, 2021
@glennmusa glennmusa changed the title Require a user-supplied value for resourcePrefix Require a user-supplied value for resourcePrefix and do not use deployment().name for seeding names Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant