Skip to content

Instantly share code, notes, and snippets.

@ehrnst
Created June 16, 2022 07:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehrnst/168b44255189ddff93196eaf8097dfb7 to your computer and use it in GitHub Desktop.
Save ehrnst/168b44255189ddff93196eaf8097dfb7 to your computer and use it in GitHub Desktop.
bicep alter params to sub modules
param storageAccountName string
resource container 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-09-01' = {
name: '${storageAccountName}/default/mycontainer'
}
targetScope = 'subscription'
var tags = {
'owner': 'john doe'
}
var resourceGroupName = 'rg-ehrnst-test2'
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: deployment().location
tags: tags
}
module storage 'teststorage.bicep' = {
scope: rg
name: 'strdeploy4'
params: {
storageAccountName: 'qwsssdddvvvv'
containerDeploy: false
}
}
@minLength(4)
@maxLength(24)
param storageAccountName string
param resourceLocation string = 'westeurope'
param containerDeploy bool = true
resource storage 'Microsoft.Storage/storageAccounts@2021-09-01' = {
name: toLower(storageAccountName) // force lowercase letters
location: resourceLocation
kind:'StorageV2'
sku: {
name: 'Premium_LRS'
}
properties: {
}
}
module container 'containertest.bicep' = if (containerDeploy) {
name: 'containerDeploy'
params: {
storageAccountName: storage.name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment