Combine two arrays to create every possible combination with Azure Bicep

Viewed 26

I'm investigating using Bicep for setting up Azure resources. Is it possible to define the type of workload in one array and the environments in another, and then combining them to create a resource name for each combination? The concept of nested loop could to the trick, but I'm not sure if that would require creating custom Bicep modules to allow for the nesting.

E.g.

var environments = ['test','prod']
var workloads = ['workload1', 'workload2']

// Do combination work of the two arrays, resulting in:
//names = ['workload1-test', 'workload1-prod', 'workload2-test', 'workload2-prod']

// Loop over names and define resources
0 Answers
Related