Open mwillebrandscreates opened 4 days ago
Same solution as there https://github.com/Azure/bicep/issues/15270#issuecomment-2401399279 (Do the ternary in a variable and reference your variable inside the resourceGroup()
call).
Also please upvote this https://github.com/Azure/bicep/issues/1876 so that we can get the Bicep or ARM team to unblock this.
@GABRIELNGBTUC you just saved my life. For the bicep team, as long as the example above isn't supported, is it possible to make sure that the linter returns an error when specifying the above scenario?
Bicep version Bicep CLI version 0.31.92 (b06509316a)
Describe the bug Using the resourceGroup function that references a parameter, omits the resourcegroup from being outputted in the compiled ARM template.
To Reproduce Create the following bicep files: main.bicep
module.bicep
Run az bicep build --file main.bicep Open the compiled ARM template and note that there's no resourcegroup parameter that contains an expression (there's no resourcegroup parameter at all), and thus the resource will be deployed on subscription level.
Additional context This might be related to https://github.com/Azure/bicep/pull/15570 and https://github.com/Azure/bicep/issues/15517. These issues should be solved in the latest version, but do not seem to fix the fact that the resourcegroup is omitted in the compiled ARM template. When not directly referencing a parameter but a static value (like true) the resourcegroup is added to the ARM template.