Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.26k stars 753 forks source link

Support nested and runtime for-loops by generating `lambda()` instead of `copy` properties #7329

Open anthony-c-martin opened 2 years ago

anthony-c-martin commented 2 years ago

Once #7083 has been merged and is fully supported in the Deployment engine, it should be possible to codegen an alternative to "copy", using map(). This should allow us to relax the limitation that property copy loops cannot be nested, and must be calculated at deploy time.

For example, both nested and runtime are currently blocked in the following sample:

resource foo 'Microsoft.Storage/storageAccounts@2021-09-01' existing = {
  name: 'foo'
}

var nested = [for item in range(0, 10): {
  array: [for item2 in range(0, 10): item2]
}]

var runtime = [for item in items(foo.properties.secondaryEndpoints): {
  endpointType: item.key
}]

Related: #6863, #4555, #7273

miran-hadz commented 1 year ago

Any idea when this might be enabled? We really see a need for nested loops in our work

aslan-im commented 1 year ago

We need nested loops as well.