Bicep decompile on template with variable loop and object gives result that is not valid/buildable Bicep file
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.3.260 (203375fe9d)
**Describe the bug**
using bicep decompile on ARM template with variable loop gives result that is not buildable/valid Bicep file
**To Reproduce**
Steps to reproduce the behavior:
template:
```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"prefix": "prefix-",
"varloop": {
"copy": [
{
"name": "copyLoop",
"count": 5,
"input": {
"name": "[concat(variables('prefix'), copyIndex('copyLoop'))]"
}
}
]
}
},
"resources": [],
"outputs": {
"outputVarLoop": {
"value": "[variables('varloop')]",
"type": "object"
}
}
}
```
bicep decompile template
**Additional context**
Attached file (variableloop.json) to reproduce issue and work around with wrapper (variableloop-fix.bicep).
[variableloop.zip](https://github.com/Azure/bicep/files/6298923/variableloop.zip)
Contributor guide
Research direction
Start by running `bicep decompile` on the attached variableloop.json and compare the result with variableloop-fix.bicep. Then run a build on the decompiled output to reproduce the invalid syntax; done means the decompiler produces a valid, buildable Bicep file for this variable-loop object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100