Azure / Azure/bicep

decompile does not handle conditional outputs

Open
#3,247 1 comment 1 reaction 0 assignees View on GitHub
revisit
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.