Skip to content

Instantly share code, notes, and snippets.

@cloudchristoph
Last active November 5, 2021 14:33
Show Gist options
  • Save cloudchristoph/8b93d9a4e3468a030179d9d8a94e0981 to your computer and use it in GitHub Desktop.
Save cloudchristoph/8b93d9a4e3468a030179d9d8a94e0981 to your computer and use it in GitHub Desktop.
Bicep - nested loop with module
param sbNamespaceName string = 'sbnamespace'
param topics array = [
{
name: 'topic1'
subscriptions: [
'sub1.1'
'sub1.2'
]
}
{
name: 'topic2'
subscriptions: [
'sub2.1'
]
}
]
module servicebusTopic 'sbtopic.bicep' = [for topic in topics: {
name: topic.name
params: {
topic: topic
sbNamespaceName: sbNamespaceName
}
}]
param sbNamespaceName string
param topic object
resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' existing = {
name: sbNamespaceName
}
resource serviceBusTopic 'Microsoft.ServiceBus/namespaces/topics@2021-06-01-preview' = {
name: topic.name
parent: serviceBusNamespace
resource serviceBusSubscription 'subscriptions@2021-06-01-preview' = [for sub in topic.subscriptions: {
name: sub
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment