bicep icon indicating copy to clipboard operation
bicep copied to clipboard

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

Open anthony-c-martin opened this issue 3 years ago • 2 comments

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

anthony-c-martin avatar Jun 22 '22 13:06 anthony-c-martin

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

miran-hadz avatar Jun 05 '23 14:06 miran-hadz

We need nested loops as well.

aslan-im avatar Aug 04 '23 12:08 aslan-im