I have an issue with error handling. I would like to create a private link only if the key vault resource already exists.
Is it possible to develop a try-catch statement to catch any error that may occur so that the pulumi execution does not fail? It should be okay if the resource does not exist, the PE should just not be created.
Is this a possibility? Also, is it possible to validate this in resources from other Azure subscriptions?
05/30/2023, 7:47 PM
What you describe seems pretty feasible at first glance, but a bit of context would be helpful to better understand what your goals are. Also don’t forget there’s an #azure channel if you need specific guidance.
05/30/2023, 8:38 PM
It sounds like you want to catch an exception that would be thrown at deploy time. You can do this only if you have a Pulumi program specifically for this resource, which is probably not what you want.
You Pulumi code does not deploy any resources: it builds the data that the Pulumi engine uses to deploy the resources. Exceptions thrown during deploy time would be caught by the engine, after your code has finished running.
A better pattern for this might be to import the resource before running your program, so that your code is correct and does not have to know if the resource already exists.