decompile does not handle conditional outputs
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
0.4.63
**Describe the bug**
When decompiling a json file with a conditional output, the condition is not transferred, this can cause a deployment to fail if the resource does not exist.
**To Reproduce**
see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/outputs?tabs=azure-powershell#conditional-output
```json
"outputs": {
"fqdn": {
"condition": "[equals(parameters('publicIpNewOrExisting'), 'new')]",
"type": "string",
"value": "[reference(resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_name')).dnsSettings.fqdn]"
}
}
```
Contributor guide
Research direction
Start by reproducing the linked conditional-output example with the Bicep decompiler and trace how ARM JSON outputs are handled. Verify that the output condition is preserved in the decompiled result, then confirm the generated template does not evaluate a reference to a resource that was not deployed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, json
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100