@@ -68,13 +68,14 @@ var regionShortNames = {
6868 westus : 'wus'
6969 westus2 : 'wus2'
7070 westus3 : 'wus3'
71+ centralus : 'cus'
7172 northeurope : 'neu'
7273 westeurope : 'weu'
7374}
7475
7576// Short names for geographies, used in resource naming.
7677var geoShortNames = {
77- northamerica : 'us '
78+ northamerica : 'na '
7879 europe : 'eu'
7980 asia : 'apac'
8081}
@@ -106,15 +107,15 @@ resource globalResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
106107// Create a resource group for each region
107108// Each region gets its own RG for isolation and quota management.
108109resource regionResourceGroups 'Microsoft.Resources/resourceGroups@2021-04-01' = [for region in regions : {
109- name : 'rg-stamps-region-${region .geoName }-${region .regionName }-${envShort }'
110+ name : 'rg-stamps-region-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }-${envShort }'
110111 location : region .regionName
111112 tags : union (tags , { geo : region .geoName , region : region .regionName , scope : 'region' })
112113}]
113114
114115// Create a resource group for each CELL
115116// CELLs are the core isolation boundary for tenants; each gets its own RG.
116117resource cellResourceGroups 'Microsoft.Resources/resourceGroups@2021-04-01' = [for cell in cells : {
117- name : 'rg-stamps-cell-${cell .geoName }-${cell .regionName }-${cell .cellName }-${envShort }'
118+ name : 'rg-stamps-cell-${( geoShortNames [? cell .geoName ] ?? substring ( cell . geoName , 0 , 2 )) }-${cell .regionName }-${cell .cellName }-${envShort }'
118119 location : cell .regionName
119120 tags : union (tags , {
120121 geo : cell .geoName
@@ -135,8 +136,8 @@ resource cellResourceGroups 'Microsoft.Resources/resourceGroups@2021-04-01' = [f
135136
136137// Deploy regional modules into their region RGs
137138module regionalNetworks './regionalNetwork.bicep' = [for (region , idx ) in regions : {
138- name : 'regionalNetwork-${region .geoName }-${region .regionName }'
139- scope : resourceGroup ('rg-stamps-region-${region .geoName }-${region .regionName }-${envShort }' )
139+ name : 'regionalNetwork-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }'
140+ scope : resourceGroup ('rg-stamps-region-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }-${envShort }' )
140141 params : {
141142 location : region .regionName
142143 geoName : region .geoName
@@ -151,8 +152,8 @@ module regionalNetworks './regionalNetwork.bicep' = [for (region, idx) in region
151152
152153// Deploy monitoring and regional layers into their region RGs
153154module monitoringLayers './monitoringLayer.bicep' = [for (region , idx ) in regions : {
154- name : 'monitoring-${region .geoName }-${region .regionName }'
155- scope : resourceGroup ('rg-region-${region .geoName }-${region .regionName }' )
155+ name : 'monitoring-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }'
156+ scope : resourceGroup ('rg-stamps- region-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }-${ envShort }' )
156157 params : {
157158 location : region .regionName
158159 logAnalyticsWorkspaceName : 'law-stamps-${(regionShortNames [?region .regionName ] ?? substring (region .regionName , 0 , 3 ))}-${envShort }'
@@ -162,8 +163,8 @@ module monitoringLayers './monitoringLayer.bicep' = [for (region, idx) in region
162163}]
163164
164165module regionalLayers './regionalLayer.bicep' = [for (region , idx ) in regions : {
165- name : 'regional-${region .geoName }-${region .regionName }'
166- scope : resourceGroup ('rg-region-${region .geoName }-${region .regionName }' )
166+ name : 'regional-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }'
167+ scope : resourceGroup ('rg-stamps- region-${( geoShortNames [? region .geoName ] ?? substring ( region . geoName , 0 , 2 )) }-${region .regionName }-${ envShort }' )
167168 params : {
168169 location : region .regionName
169170 appGatewayName : 'agw-${(geoShortNames [?region .geoName ] ?? substring (region .geoName , 0 , 2 ))}-${(regionShortNames [?region .regionName ] ?? substring (region .regionName , 0 , 3 ))}-${envShort }'
@@ -183,17 +184,17 @@ module regionalLayers './regionalLayer.bicep' = [for (region, idx) in regions: {
183184
184185// Deploy the CELL module into each dedicated RG
185186module deploymentStampLayers './deploymentStampLayer.bicep' = [for (cell , idx ) in cells : {
186- name : 'cell-${cell .geoName }-${cell .regionName }-${cell .cellName }'
187- scope : resourceGroup ('rg-stamps-cell-${cell .geoName }-${cell .regionName }-${cell .cellName }-${envShort }' )
187+ name : 'cell-${( geoShortNames [? cell .geoName ] ?? substring ( cell . geoName , 0 , 2 )) }-${cell .regionName }-${cell .cellName }'
188+ scope : resourceGroup ('rg-stamps-cell-${( geoShortNames [? cell .geoName ] ?? substring ( cell . geoName , 0 , 2 )) }-${cell .regionName }-${cell .cellName }-${envShort }' )
188189 params : {
189190 location : cell .regionName
190- sqlServerName : toLower ('sql-${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}-${envShort }' )
191+ sqlServerName : toLower ('sql-${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}-${envShort }' )
191192 sqlAdminUsername : sqlAdminUsername
192193 sqlAdminPassword : sqlAdminPassword
193- sqlDbName : toLower ('sqldb-cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}-z${string (length (cell .availabilityZones ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-${envShort }' )
194- storageAccountName : toLower ('st${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}z${string (length (cell .availabilityZones ))}${envShort }${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName , deployment ().name ), 0 , 2 )}' )
195- keyVaultName : toLower ('kv-${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}-${envShort }-${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName ), 0 , 2 )}' )
196- cosmosDbStampName : toLower ('cosmos${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}z${string (length (cell .availabilityZones ))}${envShort }${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName , deployment ().name ), 0 , 6 )}' )
194+ sqlDbName : toLower ('sqldb-cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}-z${string (length (cell .availabilityZones ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-${envShort }' )
195+ storageAccountName : toLower ('st${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}z${string (length (cell .availabilityZones ))}${envShort }${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName , deployment ().name ), 0 , 2 )}' )
196+ keyVaultName : toLower ('kv-${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}-${envShort }-${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName ), 0 , 2 )}' )
197+ cosmosDbStampName : toLower ('cosmos${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}z${string (length (cell .availabilityZones ))}${envShort }${substring (uniqueString (subscription ().id , cell .regionName , cell .cellName , deployment ().name ), 0 , 6 )}' )
197198 tags : union (tags , {
198199 geo : cell .geoName
199200 region : cell .regionName
@@ -204,7 +205,7 @@ module deploymentStampLayers './deploymentStampLayer.bicep' = [for (cell, idx) i
204205 })
205206 containerRegistryName : toLower ('acr${(geoShortNames [?cell .geoName ] ?? substring (cell .geoName , 0 , 2 ))}${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}${envShort }' )
206207 enableContainerRegistry : false
207- containerAppName : toLower ('ca-cell${( substring (substring ( cell .cellName , length (cell .cellName ) - 3 , 3 ), 0 , 2 ) == '00' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 2 , 1 ) : ( substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 0 , 1 ) == '0' ? substring ( substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 ), 1 , 2 ) : substring ( cell . cellName , length ( cell . cellName ) - 3 , 3 )) )}-z${string (length (cell .availabilityZones ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-${envShort }' )
208+ containerAppName : toLower ('ca-cell${substring (cell .cellName , length (cell .cellName ) - 2 , 2 )}-z${string (length (cell .availabilityZones ))}-${(regionShortNames [?cell .regionName ] ?? substring (cell .regionName , 0 , 3 ))}-${envShort }' )
208209 baseDomain : cell .baseDomain
209210 globalLogAnalyticsWorkspaceId : globalLogAnalyticsWorkspaceId
210211 cosmosAdditionalLocations : cell .?cosmosAdditionalLocations ?? []
0 commit comments