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

Modified tags to support add values and removing default #537

Merged
merged 9 commits into from
Nov 19, 2021
13 changes: 8 additions & 5 deletions src/bicep/mlz.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module hubResourceGroup './modules/resourceGroup.bicep' = {
params: {
name: hubResourceGroupName
location: hubLocation
tags: calculatedTags
}
}

Expand All @@ -20,7 +21,7 @@ module spokeResourceGroups './modules/resourceGroup.bicep' = [for spoke in spoke
params: {
name: spoke.resourceGroupName
location: spoke.location
tags: tags
tags: calculatedTags
}
}]

Expand All @@ -32,7 +33,7 @@ module logAnalyticsWorkspace './modules/logAnalyticsWorkspace.bicep' = {
params: {
name: logAnalyticsWorkspaceName
location: logAnalyticsWorkspaceLocation
tags: tags
tags: calculatedTags
deploySentinel: deploySentinel
retentionInDays: logAnalyticsWorkspaceRetentionInDays
skuName: logAnalyticsWorkspaceSkuName
Expand All @@ -50,7 +51,7 @@ module hubNetwork './modules/hubNetwork.bicep' = {
scope: resourceGroup(hubSubscriptionId, hubResourceGroupName)
params: {
location: hubLocation
tags: tags
tags: calculatedTags

logStorageAccountName: hubLogStorageAccountName
logStorageSkuName: hubLogStorageSkuName
Expand Down Expand Up @@ -105,7 +106,7 @@ module spokeNetworks './modules/spokeNetwork.bicep' = [ for spoke in spokes: {
scope: resourceGroup(spoke.subscriptionId, spoke.resourceGroupName)
params: {
location: spoke.location
tags: tags
tags: calculatedTags

logStorageAccountName: spoke.logStorageAccountName
logStorageSkuName: spoke.logStorageSkuName
Expand Down Expand Up @@ -547,10 +548,12 @@ param windowsVmVersion string = 'latest'
param windowsVmCreateOption string = 'FromImage'
param windowsVmStorageAccountType string = 'StandardSSD_LRS'

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

param uniqueId string = uniqueString(deployment().name)
param nowUtc string = utcNow()
Expand Down
23 changes: 14 additions & 9 deletions src/bicep/mlz.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.4.1008.15138",
"templateHash": "11074406747608602454"
"templateHash": "17151661725468237381"
}
},
"parameters": {
Expand Down Expand Up @@ -649,10 +649,7 @@
},
"tags": {
"type": "object",
"defaultValue": {
"resourcePrefix": "[parameters('resourcePrefix')]",
"DeploymentType": "MissionLandingZoneARM"
}
"defaultValue": {}
},
"uniqueId": {
"type": "string",
Expand All @@ -667,6 +664,11 @@
"variables": {
"firewallClientSubnetName": "AzureFirewallSubnet",
"firewallManagementSubnetName": "AzureFirewallManagementSubnet",
"defaultTags": {
"resourcePrefix": "[parameters('resourcePrefix')]",
"DeploymentType": "MissionLandingZoneARM"
},
"calculatedTags": "[union(parameters('tags'), variables('defaultTags'))]",
"spokes": [
{
"name": "operations",
Expand Down Expand Up @@ -745,6 +747,9 @@
},
"location": {
"value": "[parameters('hubLocation')]"
},
"tags": {
"value": "[variables('calculatedTags')]"
}
},
"template": {
Expand Down Expand Up @@ -819,7 +824,7 @@
"value": "[variables('spokes')[copyIndex()].location]"
},
"tags": {
"value": "[parameters('tags')]"
"value": "[variables('calculatedTags')]"
}
},
"template": {
Expand Down Expand Up @@ -890,7 +895,7 @@
"value": "[parameters('logAnalyticsWorkspaceLocation')]"
},
"tags": {
"value": "[parameters('tags')]"
"value": "[variables('calculatedTags')]"
},
"deploySentinel": {
"value": "[parameters('deploySentinel')]"
Expand Down Expand Up @@ -1100,7 +1105,7 @@
"value": "[parameters('hubLocation')]"
},
"tags": {
"value": "[parameters('tags')]"
"value": "[variables('calculatedTags')]"
},
"logStorageAccountName": {
"value": "[parameters('hubLogStorageAccountName')]"
Expand Down Expand Up @@ -2771,7 +2776,7 @@
"value": "[variables('spokes')[copyIndex()].location]"
},
"tags": {
"value": "[parameters('tags')]"
"value": "[variables('calculatedTags')]"
},
"logStorageAccountName": {
"value": "[variables('spokes')[copyIndex()].logStorageAccountName]"
Expand Down