Skip to content

Commit 55b6090

Browse files
fix: Resolved the tag-related issue (#2090)
1 parent 77caef8 commit 55b6090

2 files changed

Lines changed: 122 additions & 117 deletions

File tree

infra/main.bicep

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ var allTags = union(
371371
tags
372372
)
373373

374+
var existingTags = resourceGroup().tags ?? {}
375+
374376
@description('Optional. Created by user name.')
375377
param createdBy string = contains(deployer(), 'userPrincipalName')
376378
? split(deployer().userPrincipalName, '@')[0]
@@ -379,12 +381,14 @@ param createdBy string = contains(deployer(), 'userPrincipalName')
379381
resource resourceGroupTags 'Microsoft.Resources/tags@2025-04-01' = {
380382
name: 'default'
381383
properties: {
382-
tags: {
383-
...resourceGroup().tags
384-
...allTags
385-
TemplateName: 'CWYD'
386-
CreatedBy: createdBy
387-
}
384+
tags: union(
385+
existingTags,
386+
allTags,
387+
{
388+
TemplateName: 'CWYD'
389+
CreatedBy: createdBy
390+
}
391+
)
388392
}
389393
}
390394

0 commit comments

Comments
 (0)