https://pulumi.com logo
Title
c

clean-engineer-75963

11/27/2019, 11:41 PM
I'm trying to use pulumi_aws.ebs.get_volume to fetch a volume. It can't find the volume, so it's raising an Exception, and I can't seem to catch the exception.
I have the call to
get_volume
wrapped in a
try:
with an
except:
, but even so, I get
Exception: invocation of aws:ebs/getVolume:getVolume returned an error: invoking aws:ebs/getVolume:getVolume: Your query returned no results. Please change your search criteria and try again.
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
I want to do one thing if this volume exists and another if it doesn't, so I need to be able to handle this case correctly.
m

mysterious-egg-7415

12/04/2019, 4:07 AM
How should these
get_
functions be used in this example? I'm facing the same issue with looking up the route tables of a VPC that is only provisioned after
pulumi up
is executed.