Support nested and runtime for-loops by generating `lambda()` instead of `copy` properties
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 81
Description
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:
```bicep
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
Contributor guide
Research direction
Start by reviewing #7083 and the related issues #6863, #4555, and #7273, then reproduce the nested and runtime loop examples from this issue. Done means the compiler can generate the proposed map()-based alternative to copy properties and those examples are no longer blocked, once Deployment engine support is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100