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

Replace storage accounts with AVM modules #1826

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
70 changes: 0 additions & 70 deletions infra/core/storage/storage-account.bicep

This file was deleted.

64 changes: 36 additions & 28 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ module searchService 'core/search/search-services.bicep' = {
}
semanticSearch: actualSearchServiceSemanticRankerLevel
publicNetworkAccess: publicNetworkAccess == 'Enabled' ? 'enabled' : (publicNetworkAccess == 'Disabled' ? 'disabled' : null)
sharedPrivateLinkStorageAccounts: usePrivateEndpoint ? [ storage.outputs.id ] : []
sharedPrivateLinkStorageAccounts: usePrivateEndpoint ? [ storage.outputs.resourceId ] : []
}
}

Expand All @@ -492,54 +492,62 @@ module searchDiagnostics 'core/search/search-diagnostics.bicep' = if (useApplica
}
}

module storage 'core/storage/storage-account.bicep' = {
module storage 'br/public:avm/res/storage/storage-account:0.9.1' = {
name: 'storage'
scope: storageResourceGroup
params: {
name: !empty(storageAccountName) ? storageAccountName : '${abbrs.storageStorageAccounts}${resourceToken}'
location: storageResourceGroupLocation
tags: tags

kind: 'StorageV2'
skuName: 'Standard_LRS'
publicNetworkAccess: publicNetworkAccess
bypass: bypass
networkAcls: (publicNetworkAccess == 'Enabled') ? {
bypass: bypass
defaultAction: 'Allow'
} : { defaultAction: 'Deny' }
allowBlobPublicAccess: false
allowSharedKeyAccess: false
sku: {
name: storageSkuName
}
deleteRetentionPolicy: {
enabled: true
days: 2
blobServices: {
deleteRetentionPolicyDays: 2
deleteRetentionPolicyEnabled: true
containers: [
{
name: storageContainerName
publicAccess: 'None'
}
]
}
containers: [
{
name: storageContainerName
publicAccess: 'None'
}
]
}
}

module userStorage 'core/storage/storage-account.bicep' = if (useUserUpload) {
module userStorage 'br/public:avm/res/storage/storage-account:0.9.1' = if (useUserUpload) {
name: 'user-storage'
scope: storageResourceGroup
params: {
name: !empty(userStorageAccountName) ? userStorageAccountName : 'user${abbrs.storageStorageAccounts}${resourceToken}'
location: storageResourceGroupLocation
tags: tags

kind: 'StorageV2'
skuName: 'Standard_LRS'
publicNetworkAccess: publicNetworkAccess
bypass: bypass
networkAcls: (publicNetworkAccess == 'Enabled') ? {
bypass: bypass
defaultAction: 'Allow'
} : { defaultAction: 'Deny' }
allowBlobPublicAccess: false
allowSharedKeyAccess: false
isHnsEnabled: true
sku: {
name: storageSkuName
enableHierarchicalNamespace: true
blobServices: {
containers: [
{
name: userStorageContainerName
publicAccess: 'None'
}
]
}
containers: [
{
name: userStorageContainerName
publicAccess: 'None'
}
]
}
}

Expand Down Expand Up @@ -740,8 +748,8 @@ var otherPrivateEndpointConnections = usePrivateEndpoint ? [
groupId: 'blob'
dnsZoneName: 'privatelink.blob.${environmentData.suffixes.storage}'
resourceIds: concat(
[ storage.outputs.id ],
useUserUpload ? [ userStorage.outputs.id ] : []
[ storage.outputs.resourceId ],
useUserUpload ? [ userStorage.outputs.resourceId ] : []
)
}
{
Expand Down
Loading