Unable to reference connection status of connection resource in condition #14579
Replies: 2 comments
-
It might not be obvious from the error message, but it's saying that a status property like "connected" cannot be checked at compile time. And if it cannot be checked compile time it cannot be used for conditionals. While I haven't tested your specific use case (so disclaimer about it actually working) I'm guessing you might be able to workaround like this:
|
Beta Was this translation helpful? Give feedback.
-
This is a current design limitation. Moving the relevant property to a parameter as @ahelland suggested is the least-bad workaround. You could either deploy this file directly or call it as a module. If you share the full code sample, we can add more detail on a recommendation. |
Beta Was this translation helpful? Give feedback.
-
Bicep version
0.26.170
Describe the bug
I only want to deploy a series of VM's if a previously deployed VPN connection status is "Connected" however I'm getting the following error:
The expression cannot be evaluated, because the identifier properties of the referenced existing resource including "name" cannot be calculated at the start of the deployment. In this situation, the accessible properties of "dccon" include "apiVersion", "id", "name", "type".bicep(BCP307).
To Reproduce
Try and reference the connection status property for an existing connection resource and use it in an if condition.
Beta Was this translation helpful? Give feedback.
All reactions