Skip to content

Commit c9dcd1d

Browse files
Call the variable outside the resource
1 parent 997381b commit c9dcd1d

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

infra/main.bicep

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ var allTags = union(
225225
},
226226
tags
227227
)
228+
var existingTags = resourceGroup().tags ?? {}
228229
@description('Tag, Created by user name')
229230
param createdBy string = contains(deployer(), 'userPrincipalName')
230231
? split(deployer().userPrincipalName, '@')[0]
@@ -235,7 +236,7 @@ resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
235236
name: 'default'
236237
properties: {
237238
tags: union(
238-
resourceGroup().tags ?? {},
239+
existingTags,
239240
allTags,
240241
{
241242
TemplateName: 'MACAE'

infra/main_custom.bicep

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ var allTags = union(
224224
},
225225
tags
226226
)
227+
var existingTags = resourceGroup().tags ?? {}
227228
@description('Tag, Created by user name')
228229
param createdBy string = contains(deployer(), 'userPrincipalName')
229230
? split(deployer().userPrincipalName, '@')[0]
@@ -234,7 +235,7 @@ resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
234235
name: 'default'
235236
properties: {
236237
tags: union(
237-
resourceGroup().tags ?? {},
238+
existingTags,
238239
allTags,
239240
{
240241
TemplateName: 'MACAE'

0 commit comments

Comments
 (0)