Skip to content

Commit

Permalink
Updated key vault name for global uniqueness (#831)
Browse files Browse the repository at this point in the history
* Updated key vault name for global uniqueness

* GitHub Action: Build Bicep to JSON

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
jamasten and github-actions authored Jan 31, 2024
1 parent 3f2b9c8 commit 9d4eac8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions src/bicep/mlz.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ var namingConvention = '${toLower(resourcePrefix)}-${resourceToken}-${nameToken}
`storageAccountNamingConvention` is a unique naming convention:
In an effort to reduce the likelihood of naming collisions,
we replace `unique_storage_token` with a uniqueString() calculated by resourcePrefix, resourceSuffix, and the subscription ID
we replace `unique_token` with a uniqueString() calculated by resourcePrefix, resourceSuffix, and the subscription ID
*/

Expand All @@ -541,7 +541,7 @@ var diskEncryptionSetNamingConvention = replace(namingConvention, resourceToken,
var diskNamingConvention = replace(namingConvention, resourceToken, 'disk')
var firewallNamingConvention = replace(namingConvention, resourceToken, 'afw')
var firewallPolicyNamingConvention = replace(namingConvention, resourceToken, 'afwp')
var keyVaultNamingConvention = replace(namingConvention, resourceToken, 'kv')
var keyVaultNamingConvention = '${replace(replace(namingConvention, resourceToken, 'kv'), '-', '')}unique_token'
var ipConfigurationNamingConvention = replace(namingConvention, resourceToken, 'ipconf')
var logAnalyticsWorkspaceNamingConvention = replace(namingConvention, resourceToken, 'log')
var networkInterfaceNamingConvention = replace(namingConvention, resourceToken, 'nic')
Expand All @@ -550,7 +550,7 @@ var networkWatcherNamingConvention = replace(namingConvention, resourceToken, 'n
var publicIpAddressNamingConvention = replace(namingConvention, resourceToken, 'pip')
var resourceGroupNamingConvention = replace(namingConvention, resourceToken, 'rg')
var routeTableNamingConvention = replace(namingConvention, resourceToken, 'rt')
var storageAccountNamingConvention = toLower('${replace(replace(namingConvention, resourceToken, 'st'), '-', '')}unique_storage_token')
var storageAccountNamingConvention = toLower('${replace(replace(namingConvention, resourceToken, 'st'), '-', '')}unique_token')
var subnetNamingConvention = replace(namingConvention, resourceToken, 'snet')
var userAssignedIdentityNamingConvention = replace(namingConvention, resourceToken, 'uaid')
var virtualMachineNamingConvention = replace(namingConvention, resourceToken, 'vm')
Expand All @@ -562,7 +562,7 @@ var hubName = 'hub'
var hubShortName = 'hub'
var hubLogStorageAccountName = take(hubLogStorageAccountUniqueName, 24)
var hubLogStorageAccountShortName = replace(storageAccountNamingConvention, nameToken, hubShortName)
var hubLogStorageAccountUniqueName = replace(hubLogStorageAccountShortName, 'unique_storage_token', uniqueString(resourcePrefix, resourceSuffix, hubSubscriptionId))
var hubLogStorageAccountUniqueName = replace(hubLogStorageAccountShortName, 'unique_token', uniqueString(resourcePrefix, resourceSuffix, hubSubscriptionId))
var hubNetworkWatcherName = replace(networkWatcherNamingConvention, nameToken, hubName)
var hubNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, nameToken, hubName)
var hubResourceGroupName = replace(resourceGroupNamingConvention, nameToken, hubName)
Expand All @@ -576,7 +576,7 @@ var identityName = 'identity'
var identityShortName = 'id'
var identityLogStorageAccountName = take(identityLogStorageAccountUniqueName, 24)
var identityLogStorageAccountShortName = replace(storageAccountNamingConvention, nameToken, identityShortName)
var identityLogStorageAccountUniqueName = replace(identityLogStorageAccountShortName, 'unique_storage_token', uniqueString(resourcePrefix, resourceSuffix, identitySubscriptionId))
var identityLogStorageAccountUniqueName = replace(identityLogStorageAccountShortName, 'unique_token', uniqueString(resourcePrefix, resourceSuffix, identitySubscriptionId))
var identityNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, nameToken, identityName)
var identityResourceGroupName = replace(resourceGroupNamingConvention, nameToken, identityName)
var identityRouteTableName = replace(routeTableNamingConvention, nameToken, identityName)
Expand All @@ -588,10 +588,12 @@ var identityVirtualNetworkName = replace(virtualNetworkNamingConvention, nameTok
var operationsName = 'operations'
var operationsShortName = 'ops'
var operationsDiskEncryptionSetName = replace(diskEncryptionSetNamingConvention, nameToken, operationsName)
var operationsKeyVaultName = replace(keyVaultNamingConvention, nameToken, operationsShortName)
var operationsKeyVaultName = take(operationsKeyVaultUniqueName, 24)
var operationsKeyVaultShortName = replace(keyVaultNamingConvention, nameToken, operationsShortName)
var operationsKeyVaultUniqueName = replace(operationsKeyVaultShortName, 'unique_token', uniqueString(resourcePrefix, resourceSuffix, operationsSubscriptionId))
var operationsLogStorageAccountName = take(operationsLogStorageAccountUniqueName, 24)
var operationsLogStorageAccountShortName = replace(storageAccountNamingConvention, nameToken, operationsShortName)
var operationsLogStorageAccountUniqueName = replace(operationsLogStorageAccountShortName, 'unique_storage_token', uniqueString(resourcePrefix, resourceSuffix, operationsSubscriptionId))
var operationsLogStorageAccountUniqueName = replace(operationsLogStorageAccountShortName, 'unique_token', uniqueString(resourcePrefix, resourceSuffix, operationsSubscriptionId))
var operationsNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, nameToken, operationsName)
var operationsResourceGroupName = replace(resourceGroupNamingConvention, nameToken, operationsName)
var operationsRouteTableName = replace(routeTableNamingConvention, nameToken, operationsName)
Expand All @@ -605,7 +607,7 @@ var sharedServicesName = 'sharedServices'
var sharedServicesShortName = 'svcs'
var sharedServicesLogStorageAccountName = take(sharedServicesLogStorageAccountUniqueName, 24)
var sharedServicesLogStorageAccountShortName = replace(storageAccountNamingConvention, nameToken, sharedServicesShortName)
var sharedServicesLogStorageAccountUniqueName = replace(sharedServicesLogStorageAccountShortName, 'unique_storage_token', uniqueString(resourcePrefix, resourceSuffix, sharedServicesSubscriptionId))
var sharedServicesLogStorageAccountUniqueName = replace(sharedServicesLogStorageAccountShortName, 'unique_token', uniqueString(resourcePrefix, resourceSuffix, sharedServicesSubscriptionId))
var sharedServicesNetworkSecurityGroupName = replace(networkSecurityGroupNamingConvention, nameToken, sharedServicesName)
var sharedServicesResourceGroupName = replace(resourceGroupNamingConvention, nameToken, sharedServicesName)
var sharedServicesRouteTableName = replace(routeTableNamingConvention, nameToken, sharedServicesName)
Expand Down
18 changes: 10 additions & 8 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.24.24.22086",
"templateHash": "7889693018590170190"
"templateHash": "6223699048141403655"
}
},
"parameters": {
Expand Down Expand Up @@ -1219,7 +1219,7 @@
"diskNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'disk')]",
"firewallNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'afw')]",
"firewallPolicyNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'afwp')]",
"keyVaultNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'kv')]",
"keyVaultNamingConvention": "[format('{0}unique_token', replace(replace(variables('namingConvention'), variables('resourceToken'), 'kv'), '-', ''))]",
"ipConfigurationNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'ipconf')]",
"logAnalyticsWorkspaceNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'log')]",
"networkInterfaceNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'nic')]",
Expand All @@ -1228,7 +1228,7 @@
"publicIpAddressNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'pip')]",
"resourceGroupNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'rg')]",
"routeTableNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'rt')]",
"storageAccountNamingConvention": "[toLower(format('{0}unique_storage_token', replace(replace(variables('namingConvention'), variables('resourceToken'), 'st'), '-', '')))]",
"storageAccountNamingConvention": "[toLower(format('{0}unique_token', replace(replace(variables('namingConvention'), variables('resourceToken'), 'st'), '-', '')))]",
"subnetNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'snet')]",
"userAssignedIdentityNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'uaid')]",
"virtualMachineNamingConvention": "[replace(variables('namingConvention'), variables('resourceToken'), 'vm')]",
Expand All @@ -1237,7 +1237,7 @@
"hubShortName": "hub",
"hubLogStorageAccountName": "[take(variables('hubLogStorageAccountUniqueName'), 24)]",
"hubLogStorageAccountShortName": "[replace(variables('storageAccountNamingConvention'), variables('nameToken'), variables('hubShortName'))]",
"hubLogStorageAccountUniqueName": "[replace(variables('hubLogStorageAccountShortName'), 'unique_storage_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('hubSubscriptionId')))]",
"hubLogStorageAccountUniqueName": "[replace(variables('hubLogStorageAccountShortName'), 'unique_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('hubSubscriptionId')))]",
"hubNetworkWatcherName": "[replace(variables('networkWatcherNamingConvention'), variables('nameToken'), variables('hubName'))]",
"hubNetworkSecurityGroupName": "[replace(variables('networkSecurityGroupNamingConvention'), variables('nameToken'), variables('hubName'))]",
"hubResourceGroupName": "[replace(variables('resourceGroupNamingConvention'), variables('nameToken'), variables('hubName'))]",
Expand All @@ -1248,7 +1248,7 @@
"identityShortName": "id",
"identityLogStorageAccountName": "[take(variables('identityLogStorageAccountUniqueName'), 24)]",
"identityLogStorageAccountShortName": "[replace(variables('storageAccountNamingConvention'), variables('nameToken'), variables('identityShortName'))]",
"identityLogStorageAccountUniqueName": "[replace(variables('identityLogStorageAccountShortName'), 'unique_storage_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('identitySubscriptionId')))]",
"identityLogStorageAccountUniqueName": "[replace(variables('identityLogStorageAccountShortName'), 'unique_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('identitySubscriptionId')))]",
"identityNetworkSecurityGroupName": "[replace(variables('networkSecurityGroupNamingConvention'), variables('nameToken'), variables('identityName'))]",
"identityResourceGroupName": "[replace(variables('resourceGroupNamingConvention'), variables('nameToken'), variables('identityName'))]",
"identityRouteTableName": "[replace(variables('routeTableNamingConvention'), variables('nameToken'), variables('identityName'))]",
Expand All @@ -1257,10 +1257,12 @@
"operationsName": "operations",
"operationsShortName": "ops",
"operationsDiskEncryptionSetName": "[replace(variables('diskEncryptionSetNamingConvention'), variables('nameToken'), variables('operationsName'))]",
"operationsKeyVaultName": "[replace(variables('keyVaultNamingConvention'), variables('nameToken'), variables('operationsShortName'))]",
"operationsKeyVaultName": "[take(variables('operationsKeyVaultUniqueName'), 24)]",
"operationsKeyVaultShortName": "[replace(variables('keyVaultNamingConvention'), variables('nameToken'), variables('operationsShortName'))]",
"operationsKeyVaultUniqueName": "[replace(variables('operationsKeyVaultShortName'), 'unique_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('operationsSubscriptionId')))]",
"operationsLogStorageAccountName": "[take(variables('operationsLogStorageAccountUniqueName'), 24)]",
"operationsLogStorageAccountShortName": "[replace(variables('storageAccountNamingConvention'), variables('nameToken'), variables('operationsShortName'))]",
"operationsLogStorageAccountUniqueName": "[replace(variables('operationsLogStorageAccountShortName'), 'unique_storage_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('operationsSubscriptionId')))]",
"operationsLogStorageAccountUniqueName": "[replace(variables('operationsLogStorageAccountShortName'), 'unique_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('operationsSubscriptionId')))]",
"operationsNetworkSecurityGroupName": "[replace(variables('networkSecurityGroupNamingConvention'), variables('nameToken'), variables('operationsName'))]",
"operationsResourceGroupName": "[replace(variables('resourceGroupNamingConvention'), variables('nameToken'), variables('operationsName'))]",
"operationsRouteTableName": "[replace(variables('routeTableNamingConvention'), variables('nameToken'), variables('operationsName'))]",
Expand All @@ -1271,7 +1273,7 @@
"sharedServicesShortName": "svcs",
"sharedServicesLogStorageAccountName": "[take(variables('sharedServicesLogStorageAccountUniqueName'), 24)]",
"sharedServicesLogStorageAccountShortName": "[replace(variables('storageAccountNamingConvention'), variables('nameToken'), variables('sharedServicesShortName'))]",
"sharedServicesLogStorageAccountUniqueName": "[replace(variables('sharedServicesLogStorageAccountShortName'), 'unique_storage_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('sharedServicesSubscriptionId')))]",
"sharedServicesLogStorageAccountUniqueName": "[replace(variables('sharedServicesLogStorageAccountShortName'), 'unique_token', uniqueString(parameters('resourcePrefix'), parameters('resourceSuffix'), parameters('sharedServicesSubscriptionId')))]",
"sharedServicesNetworkSecurityGroupName": "[replace(variables('networkSecurityGroupNamingConvention'), variables('nameToken'), variables('sharedServicesName'))]",
"sharedServicesResourceGroupName": "[replace(variables('resourceGroupNamingConvention'), variables('nameToken'), variables('sharedServicesName'))]",
"sharedServicesRouteTableName": "[replace(variables('routeTableNamingConvention'), variables('nameToken'), variables('sharedServicesName'))]",
Expand Down

0 comments on commit 9d4eac8

Please sign in to comment.