Ternary operator on module scope #10417
Closed
TacticalNuclearSpud
started this conversation in
Authoring Help
Replies: 1 comment 1 reply
-
Thank you for reporting this, I believe it should work, so I have converted this discussion into an issue, which you can track: I will mark this as answered and please comment or follow the open. issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to use the ternary operator on the scope tag of a bicep module? The template I have validates fine but fails on deployment.
I'd like to be able to specify if a new resource group is required, if it is, deploy it and subsequently deploy the module resources into it, but, if not, take the name of an existing resource group and deploy the resources to that.
I'm relatively new to bicep and really struggling to get my head round this one.
Current main.bicep
The deployment fails with
If I leave the
newResourceGroupRequired
value set as false and set the scope on the module declaration to reference thenewResourceGroup
resource directly, as below, it deploys fine.Same if I change the bool to true and set the scope to
existingResourceGroup
, the storage module deploys without issue.If used the ternary operator successfully on other parameters recently but I'm unable to do so in this case. Is there a another/better way to accomplish this?
Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions