Variable substitution logic does not work for variables with loop expressions
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
### Discussed in https://github.com/Azure/bicep/discussions/5009
Originally posted by **oskbor** October 27, 2021
Hi, I want to create an array where the values are extracted from existing resources.
This was my first attempt
```bicep
var envVars = [
'BASE_FRONT_END_URL'
'AZURE_VOLUME_BASE_URL'
]
resource values 'Microsoft.AppConfiguration/configurationStores/keyValues@2021-03-01-preview' existing = [for name in envVars: {
name: '${configStore}/${name}'
}]
var out= [for (env, i) in envVars: {
name: env
value: values[i].properties.value
}]
```
fails with the error:
`This expression is being used in the for-body of the variable "out", which requires values that can be calculated at the start of the deployment. Properties of values which can be calculated at the start include "apiVersion", "id", "name", "type".bicep(BCP182)`
Any ideas if/how I can accomplish this?
Contributor guide
Assessment
This issue has not been assessed yet.