You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When referencing resources using existing keyword, there's no way to create an explicit dependency to make it avoid erroring with a "not found" error.
To give some context, my templates are organised as such:
a main.bicep file using module to create all resources
modules files under modules/<name>.bicep
Inside a module, sometimes I need to access a resource created in other modules.
For that, I'm using the existing keyword, sometimes even with a condition based on parameters. For example, in module/staticwebapp.bicep I have something like this:
When referencing that existing container app, if it's not deployed yet I'll get a "Not found" error, which is expected. But it would like to have an option so that when the conditions are met, making that existing reference also creates a dependency to the containerApp resource, to avoid the error.
Adding the dependency explicitly at the module level in my main.bicep file would be possible, but it would mean duplicating all the parameter processing in that file too to determine the dependencies, defeating the purpose of having an isolated module.
Unless I missed something, I don't thing there's currently a way to "wait" for a resource referenced by an existing keyword to be created?
Describe the solution you'd like
I would like a feature so that when referencing resources using existing keyword, an explicit dependency is added to avoid "not found" errors. The dependency of course would be added only if the if condition on the resource is met.
The text was updated successfully, but these errors were encountered:
The workaround is to find where you are using that existing resource and put the dependsOn in that resource to the module that creates the resource. Something like:
Is your feature request related to a problem? Please describe.
When referencing resources using
existing
keyword, there's no way to create an explicit dependency to make it avoid erroring with a "not found" error.To give some context, my templates are organised as such:
main.bicep
file usingmodule
to create all resourcesmodules/<name>.bicep
Inside a module, sometimes I need to access a resource created in other modules.
For that, I'm using the
existing
keyword, sometimes even with a condition based on parameters. For example, inmodule/staticwebapp.bicep
I have something like this:When referencing that existing container app, if it's not deployed yet I'll get a "Not found" error, which is expected. But it would like to have an option so that when the conditions are met, making that existing reference also creates a dependency to the containerApp resource, to avoid the error.
Adding the dependency explicitly at the module level in my
main.bicep
file would be possible, but it would mean duplicating all the parameter processing in that file too to determine the dependencies, defeating the purpose of having an isolated module.Unless I missed something, I don't thing there's currently a way to "wait" for a resource referenced by an
existing
keyword to be created?Describe the solution you'd like
I would like a feature so that when referencing resources using
existing
keyword, an explicit dependency is added to avoid "not found" errors. The dependency of course would be added only if theif
condition on the resource is met.The text was updated successfully, but these errors were encountered: