https://pulumi.com logo
#general
Title
# general
b

bland-camera-22041

08/12/2019, 1:33 PM
Hey, Wondered if anyone new a way to actually capture errors from pulumi
Copy code
try{
      NatGw = aws.ec2.getNatGateway({
        tags: {
          Name: "RCS-CDR"
        }
      });
    } catch(err){
      // Craete a New NAT GW here ... 
    }
The error is not caught but it's thrown in my terminal after pulumi up. I'd like to catch the error and create a new resource if the gatway with the name
RCS-CDR
does not exist
🍿 1
w

white-balloon-205

08/12/2019, 3:17 PM
This is being tracked in https://github.com/pulumi/pulumi-terraform/issues/262. The intention is that this should throw so that you can use try/catch. But currently it just returns a result with an undefined id.