Hi all! :slightly_smiling_face: I am having an is...
# azure
c
Hi all! 🙂 I am having an issue with Pulumi error handling using Typescript. I have created some resources on Azure: • Virtual Network + subnets • storage account • blob privatelink When I try to create several other privatelinks I am not able to validate if one of them already exists and only create the ones that don't exist yet. I have followed the following logic: • used a try-catch block • in the try block I validate if the private DNS zone exists with the respective get function ◦ This will result in passing for the blob one, but failing to retrieve that information for the other 3 that don't exist yet ◦ I try to catch the errors and execute additional logic on the catch block • in the catch block I implemented the logic to create the privatelinks ans DNS zone configurations, as well as private endpoints for the services that caused the error What happens: • the errors are not suppressed quietly by the catch block • when I run
pulumi up
the errors are thrown and provisioning fails Is there any way I can implement the logic I have mentioned without having those errors blocking my deployment?
a
I'm not sure if this applies to you, but as I understand it, it is not possible to try-catch these errors today? At-least I have had the same issue and had to solve another way. https://github.com/pulumi/pulumi/issues/3364
c
You understood correctly. I am trying to validate if a resource exists via get() function, but an error is thrown instead of being "handled" in the try-catch block. I see from the URL you have shared that there seem to be a lot more people being affected by this behavior. Were you able to find a workaround for this?
a
No, sorry. Ended up solving it another way, this was a more "nice to have" req so didn't dig deeper. (made sure resource is created in a stack run earlier, and if it hadn't been created when running the stack that assumes it is created = crash. Bit uglier but enough for the req we had)
👍 1
c
yeah, I ended up doing a similar workaround, but it is something that I need to improve so it doesn't happen on other scenarios 😄 Thank you for answering, though!
🎉 1