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

fix: StorageAccount - Added implicit dependency to blobServices from container - avm/res/storage/storage-account #3254

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This module deploys a Storage Account Blob Container.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`blobServiceName`](#parameter-blobservicename) | string | The name of the parent Blob Service. Required if the template is used in a standalone deployment. |
| [`defaultEncryptionScope`](#parameter-defaultencryptionscope) | string | Default the container to use specified encryption scope for all writes. |
| [`denyEncryptionScopeOverride`](#parameter-denyencryptionscopeoverride) | bool | Block override of encryption scope from the container default. |
| [`enableNfsV3AllSquash`](#parameter-enablenfsv3allsquash) | bool | Enable NFSv3 all squash on blob container. |
Expand All @@ -59,6 +60,14 @@ The name of the parent Storage Account. Required if the template is used in a st
- Required: Yes
- Type: string

### Parameter: `blobServiceName`

The name of the parent Blob Service. Required if the template is used in a standalone deployment.

- Required: No
- Type: string
- Default: `'default'`

### Parameter: `defaultEncryptionScope`

Default the container to use specified encryption scope for all writes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata owner = 'Azure/module-maintainers'
@description('Conditional. The name of the parent Storage Account. Required if the template is used in a standalone deployment.')
param storageAccountName string

@description('Optional. The name of the parent Blob Service. Required if the template is used in a standalone deployment.')
param blobServiceName string = 'default'

@description('Required. The name of the storage container to deploy.')
param name string

Expand Down Expand Up @@ -105,7 +108,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' existing
name: storageAccountName

resource blobServices 'blobServices@2022-09-01' existing = {
name: 'default'
name: blobServiceName
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "1020003258393866601"
"templateHash": "3558916747425087131"
},
"name": "Storage Account Blob Containers",
"description": "This module deploys a Storage Account Blob Container.",
Expand Down Expand Up @@ -95,6 +95,13 @@
"description": "Conditional. The name of the parent Storage Account. Required if the template is used in a standalone deployment."
}
},
"blobServiceName": {
"type": "string",
"defaultValue": "default",
"metadata": {
"description": "Optional. The name of the parent Blob Service. Required if the template is used in a standalone deployment."
}
},
"name": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -205,7 +212,7 @@
"existing": true,
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}', parameters('storageAccountName'), 'default')]",
"name": "[format('{0}/{1}', parameters('storageAccountName'), parameters('blobServiceName'))]",
"dependsOn": [
"storageAccount"
]
Expand All @@ -219,7 +226,7 @@
"container": {
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"properties": {
"defaultEncryptionScope": "[if(not(empty(parameters('defaultEncryptionScope'))), parameters('defaultEncryptionScope'), null())]",
"denyEncryptionScopeOverride": "[if(equals(parameters('denyEncryptionScopeOverride'), true()), parameters('denyEncryptionScopeOverride'), null())]",
Expand All @@ -240,8 +247,8 @@
},
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"properties": {
"roleDefinitionId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId]",
"principalId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId]",
Expand Down Expand Up @@ -387,7 +394,7 @@
"metadata": {
"description": "The resource ID of the deployed container."
},
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name'))]"
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]"
},
"resourceGroupName": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions avm/res/storage/storage-account/blob-service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ module blobServices_container 'container/main.bicep' = [
name: '${deployment().name}-Container-${index}'
params: {
storageAccountName: storageAccount.name
blobServiceName: blobServices.name
name: container.name
defaultEncryptionScope: container.?defaultEncryptionScope
denyEncryptionScopeOverride: container.?denyEncryptionScopeOverride
Expand Down
25 changes: 18 additions & 7 deletions avm/res/storage/storage-account/blob-service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "17077763197163073998"
"templateHash": "16657059190807174649"
},
"name": "Storage Account blob Services",
"description": "This module deploys a Storage Account Blob Service.",
Expand Down Expand Up @@ -365,6 +365,9 @@
"storageAccountName": {
"value": "[parameters('storageAccountName')]"
},
"blobServiceName": {
"value": "[variables('name')]"
},
"name": {
"value": "[coalesce(parameters('containers'), createArray())[copyIndex()].name]"
},
Expand Down Expand Up @@ -404,7 +407,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "1020003258393866601"
"templateHash": "3558916747425087131"
},
"name": "Storage Account Blob Containers",
"description": "This module deploys a Storage Account Blob Container.",
Expand Down Expand Up @@ -493,6 +496,13 @@
"description": "Conditional. The name of the parent Storage Account. Required if the template is used in a standalone deployment."
}
},
"blobServiceName": {
"type": "string",
"defaultValue": "default",
"metadata": {
"description": "Optional. The name of the parent Blob Service. Required if the template is used in a standalone deployment."
}
},
"name": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -603,7 +613,7 @@
"existing": true,
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}', parameters('storageAccountName'), 'default')]",
"name": "[format('{0}/{1}', parameters('storageAccountName'), parameters('blobServiceName'))]",
"dependsOn": [
"storageAccount"
]
Expand All @@ -617,7 +627,7 @@
"container": {
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"properties": {
"defaultEncryptionScope": "[if(not(empty(parameters('defaultEncryptionScope'))), parameters('defaultEncryptionScope'), null())]",
"denyEncryptionScopeOverride": "[if(equals(parameters('denyEncryptionScopeOverride'), true()), parameters('denyEncryptionScopeOverride'), null())]",
Expand All @@ -638,8 +648,8 @@
},
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"properties": {
"roleDefinitionId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId]",
"principalId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId]",
Expand Down Expand Up @@ -785,7 +795,7 @@
"metadata": {
"description": "The resource ID of the deployed container."
},
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name'))]"
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]"
},
"resourceGroupName": {
"type": "string",
Expand All @@ -798,6 +808,7 @@
}
},
"dependsOn": [
"blobServices",
"storageAccount"
]
}
Expand Down
27 changes: 19 additions & 8 deletions avm/res/storage/storage-account/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "6735651687082765200"
"templateHash": "8986504733456130232"
},
"name": "Storage Accounts",
"description": "This module deploys a Storage Account.",
Expand Down Expand Up @@ -2266,7 +2266,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "17077763197163073998"
"templateHash": "16657059190807174649"
},
"name": "Storage Account blob Services",
"description": "This module deploys a Storage Account Blob Service.",
Expand Down Expand Up @@ -2625,6 +2625,9 @@
"storageAccountName": {
"value": "[parameters('storageAccountName')]"
},
"blobServiceName": {
"value": "[variables('name')]"
},
"name": {
"value": "[coalesce(parameters('containers'), createArray())[copyIndex()].name]"
},
Expand Down Expand Up @@ -2664,7 +2667,7 @@
"_generator": {
"name": "bicep",
"version": "0.29.47.4906",
"templateHash": "1020003258393866601"
"templateHash": "3558916747425087131"
},
"name": "Storage Account Blob Containers",
"description": "This module deploys a Storage Account Blob Container.",
Expand Down Expand Up @@ -2753,6 +2756,13 @@
"description": "Conditional. The name of the parent Storage Account. Required if the template is used in a standalone deployment."
}
},
"blobServiceName": {
"type": "string",
"defaultValue": "default",
"metadata": {
"description": "Optional. The name of the parent Blob Service. Required if the template is used in a standalone deployment."
}
},
"name": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -2863,7 +2873,7 @@
"existing": true,
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}', parameters('storageAccountName'), 'default')]",
"name": "[format('{0}/{1}', parameters('storageAccountName'), parameters('blobServiceName'))]",
"dependsOn": [
"storageAccount"
]
Expand All @@ -2877,7 +2887,7 @@
"container": {
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[format('{0}/{1}/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"properties": {
"defaultEncryptionScope": "[if(not(empty(parameters('defaultEncryptionScope'))), parameters('defaultEncryptionScope'), null())]",
"denyEncryptionScopeOverride": "[if(equals(parameters('denyEncryptionScopeOverride'), true()), parameters('denyEncryptionScopeOverride'), null())]",
Expand All @@ -2898,8 +2908,8 @@
},
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), 'default', parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"scope": "[format('Microsoft.Storage/storageAccounts/{0}/blobServices/{1}/containers/{2}', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]",
"name": "[coalesce(tryGet(coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()], 'name'), guid(resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name')), coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId, coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId))]",
"properties": {
"roleDefinitionId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].roleDefinitionId]",
"principalId": "[coalesce(variables('formattedRoleAssignments'), createArray())[copyIndex()].principalId]",
Expand Down Expand Up @@ -3045,7 +3055,7 @@
"metadata": {
"description": "The resource ID of the deployed container."
},
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), 'default', parameters('name'))]"
"value": "[resourceId('Microsoft.Storage/storageAccounts/blobServices/containers', parameters('storageAccountName'), parameters('blobServiceName'), parameters('name'))]"
},
"resourceGroupName": {
"type": "string",
Expand All @@ -3058,6 +3068,7 @@
}
},
"dependsOn": [
"blobServices",
"storageAccount"
]
}
Expand Down