https://pulumi.com logo
#python
Title
e

elegant-crayon-4967

03/11/2020, 12:04 AM
anyone here know the best way to do a test in TS for if a resource exists? eg
Copy code
password = pulumi.output(aws.secretsmanager.getSecret({
          name: `testSecret`,
        },
spits out a unhandled exception. I’d like to capture this nicely and exit and not explode the program. First attempt using try/catch didn’t stop it from exploding
g

gentle-diamond-70147

03/11/2020, 12:13 AM
Unfortunately there's not a way to catch these errors at the moment. Allowing for this is being tracked in https://github.com/pulumi/pulumi/issues/3364.
As a workaround until that is complete, you could use the aws sdk to do the lookup instead and handle the "not found" error from it.
e

elegant-crayon-4967

03/11/2020, 12:35 AM
Ah! Thanks for the heads up. I was doing the lookups in testing but may need to pass those through!