Skip to content

Are there any nested loop workarounds? #5054

Answered by brwilkinson
alexwhitmore asked this question in Q&A
Discussion options

You must be logged in to vote

main.bicep

just loop over the app services (only) - Add this extra (outer) layer onto what you have now.

module appService 'appService.bicep' = [for (ws, index) in appServices : {

  • just pass in the whole array of metricAlerts from the param file, you will use that at the next layer.

appService.bicep

for a single app service loop over the Metric alerts

module dealsMetricAlerts '../modules/management/metric-alert.bicep' = [for (alert, index) in alertConfig.metricAlerts: {

  • don't pass in the scope, just pass in the wsname and then use the existing resource in the final layer

metric-alert.bicep

you just have the name of a single app service and a single alert rule

resource WS 'Microsoft.Web…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@brwilkinson
Comment options

@alexwhitmore
Comment options

@brwilkinson
Comment options

@alexwhitmore
Comment options

@brwilkinson
Comment options

Answer selected by alexwhitmore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants