To simplify my question. I have an example like this. Here is an array of objects I would like to create through a loop. All objects have both names and values as '0'. The array has 4 objects.
var result = [
{
'name': '0'
'value': '0'
}
{
'name': '0'
'value': '0'
}
{
'name': '0'
'value': '0'
}
{
'name': '0'
'value': '0'
}
]
here is the solution that has been verified working. It loops 4 times to create an array of objects. As a result, each Iteration creates 1 object only.
#loop 4 times
var result = [for i in range(0, 3): {
name: '0'
value: '0'
}]
However, let say I only want to make the above result by a loop with fewer iterations (let say 2 iterations only). Therefore with each iteration, I have to create an array of 2 objects
Here is the code I tried but not working, but through it, you may understand what I try to get
#loop 2 times only
var result = [for i in range(0, 1):
{
name: '0'
value: '0'
}
{
name: '0'
value: '0'
}]
Note that I have tried with many other ways (not only the one above) but not working (etc: using union function). I always get syntax errors or something else. Therefore I wonder if bicep has the capability to do what I want to achieve. Would anyone help me with this Thanks and best regards