Skip to content

Commit 33770fb

Browse files
Fixed the tag issue
1 parent c7bc996 commit 33770fb

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

infra/main.bicep

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,22 @@ param aiDeploymentsLocation string
106106
@description('Optional created by user name')
107107
param createdBy string = contains(deployer(), 'userPrincipalName')? split(deployer().userPrincipalName, '@')[0]: deployer().objectId
108108

109+
var existingTags = resourceGroup().tags ?? {}
110+
109111
// ========== Resource Group Tag ========== //
110112
resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
111113
name: 'default'
112114
properties: {
113-
tags: {
114-
...resourceGroup().tags
115-
...tags
116-
TemplateName: 'DKM'
117-
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
118-
CreatedBy: createdBy
119-
DeploymentName: deployment().name
120-
}
115+
tags: union(
116+
existingTags,
117+
tags,
118+
{
119+
TemplateName: 'DKM'
120+
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
121+
CreatedBy: createdBy
122+
DeploymentName: deployment().name
123+
}
124+
)
121125
}
122126
}
123127

0 commit comments

Comments
 (0)