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

Adding description and comments for readability of stoarge bicep files #170

Merged
merged 2 commits into from
Sep 30, 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
4 changes: 4 additions & 0 deletions modules/storage-param.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ var stgName = toLower(paramStorageName)
@description('The flag that set the geo-redundant storage.')
param geoRedundancy bool = false

@description('The Azure region where the storage account will be created.')
param azureRegion string = resourceGroup().location

// Create a storage account
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
name: stgName
location: azureRegion
Expand All @@ -30,6 +32,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
}
}

// Lock the storage account
resource lockResourceGroup 'Microsoft.Authorization/locks@2016-09-01' = {
name: 'DontDelete'
scope: storageAccount
Expand All @@ -38,5 +41,6 @@ resource lockResourceGroup 'Microsoft.Authorization/locks@2016-09-01' = {
}
}

// Output the storage account ID
output storageId string = storageAccount.id // output resourceId of storage account
output blobEndpoint string = storageAccount.properties.primaryEndpoints.blob // [reference(cariables('storagename')).properties.primaryEndpoints.blob]
5 changes: 5 additions & 0 deletions modules/storage-w-containers.bicep
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// storage-w-containers.bicep

@description('Parameter for a storage account name')
param storageAccountName string = 'stor${uniqueString(resourceGroup().id)}'

@description('The name of the container that will be created in the storage account')
param containerName string = 'logs'
// param inputContainerName string = 'inputs'
// param outputContainerName string = 'outputs'

@description('The Azure region where the storage account will be created.')
param azureRegion string = resourceGroup().location

// Createa a storage account
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
name: storageAccountName
location: azureRegion
Expand Down
12 changes: 9 additions & 3 deletions modules/storage-w-loop-containers.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
// Add a child resource to parent resource
// Add conatiners to the parent blob service from list of values

@description('The prefix that will appear infront of storage account name.')
param storageAccountName string = 'ftc${uniqueString(resourceGroup().id)}'

@description('The Azure region where the storage account will be created.')
param azureregion string = resourceGroup().location

@description('The list of containers that will be created in the storage account')
var containerNames = [
'logs'
'inputs'
'outputs'
]

// Creates a storage account
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
name: storageAccountName
location: azureregion
Expand All @@ -24,23 +29,24 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2021-02-01' = {
}
}

// Create a blob service
resource myStorageBlobServices 'Microsoft.Storage/storageAccounts/blobServices@2021-06-01' = {
name: 'default'
parent: storageAccount
}

// Creates a container
resource myStorageContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-06-01' = {
name: 'data-log'
parent: myStorageBlobServices
}

// using enumaration
// Creates containers by using enumaration
resource container 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-02-01' = [ for containerName in containerNames: {
name: '${storageAccount.name}/default/${containerName}'
}]


// lock the storage account to prevent accidential deletion
// Lock the storage account to prevent accidential deletion
resource lockResourceGroup 'Microsoft.Authorization/locks@2016-09-01' = {
name: 'DontDelete'
scope: storageAccount
Expand Down
Loading