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 default tags to Bicep examples #614

Merged
merged 6 commits into from
Jan 18, 2022
Merged

Conversation

brooke-hamilton
Copy link
Contributor

@brooke-hamilton brooke-hamilton commented Jan 18, 2022

Description

Updated Bicep examples to add the same tags as the base MLZ Bicep deployment. Users can supply an optional parameter to add tags, and the example will union those tags with the standard MLZ tags.

I considered adding a new module for calculating the tags, like this:

targetScope = 'subscription'

param tags object = {}
var defaultTags = {
  'DeploymentType': 'MissionLandingZoneARM'
}
var calculatedTags = union(tags, defaultTags)

output tags object = calculatedTags

Which would be called from another template like this:

param tags object = {}
module calculatedTags '../../modules/calculateTags.bicep' = {
  name: 'calculatedTags'
  params: {
    tags: tags
  }
}

The advantage would be that it's a single place to manage the default tags. However, I didn't use it because the amount of code required to call the module was not much less than the code to do the calculation within each template. I'm open to changing my mind if others have a different opinion. 👍

Issue reference

The issue this PR will close: #580

Checklist

Please make sure you've completed the relevant tasks for this PR out of the following list:

  • All acceptance criteria in the backlog item are met
  • The documentation is updated to cover any new or changed features
  • Manual tests have passed
  • Relevant issues are linked to this PR

@brooke-hamilton brooke-hamilton requested a review from a team as a code owner January 18, 2022 13:51
@brooke-hamilton brooke-hamilton enabled auto-merge (squash) January 18, 2022 13:54
@glennmusa glennmusa self-assigned this Jan 18, 2022
@glennmusa
Copy link
Contributor

I considered adding a new module for calculating the tags, like this:
[...] However, I didn't use it because the amount of code required to call the module was not much less than the code to do the calculation within each template. I'm open to changing my mind if others have a different opinion. 👍

I agree with leaving the union implementation in the examples.

@brooke-hamilton brooke-hamilton merged commit 88e3a45 into main Jan 18, 2022
@brooke-hamilton brooke-hamilton deleted the brooke/example-tags branch January 18, 2022 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add default tags to examples
2 participants