-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using existing along with a conditional if ignores the if #3737
Comments
How is this |
Hi Alex, Apologies i should have included that in my original post. The storage account for me was being used to get the connection string out to store in keyvault:
This setup initially told me the resourcegroup was not found and then told me (once i created the resource group to test whether it just needed that) that the storage account didn't exist. I feel it may be worth mentioning that our condition comes from a variable although not sure why that would make a difference but I've updated the example code to show that. Not sure if it's related or not but I'm also seeing an error of deployment not found when referencing outputs from a module that has a condition, even though everything that references the output has the same condition associated. Thanks |
Hi Alex, I've managed to bypass both issues for now by making the reference conditional as follows:
This allows the deployments to correctly continue. But does feel like it shouldn't be required. Thanks |
Note that this is technically not unique to the |
Thanks for writing that up Anthony. Would the first code sample above validate per your proposal? The condition is on the entire This is also related to (but separate from) the greedy conditional evaluation problem right? |
I'm going to close this in the meantime and we can track with #3750 |
Bicep version
0.4.63
Describe the bug
When using existing for getting an existing resource in a deployment template, if that resource has a condition on it it ignores the condition and still tries to retrieve the resource (which may not exist based on the condition)
To Reproduce
Try to deploy the following when the existing resource does not exist using the deploymentEnvironment value of test
If the resourcegroup/resource does not exist an error is returned to say it doesn't exist even if the deploymentEnvironment is test.
I would expect this code to not be run based on the condition.
The text was updated successfully, but these errors were encountered: