broad-hairdresser-1495
07/06/2021, 3:31 PMtry:
tmp_vpc = aws.ec2.get_vpc(cidr_block=resource["IPV4"], filters=[{'Name': 'tag:Name', 'Values': [resource["name"]]}])
except: # How do i except only one error when resource not found?
pass
except:
works fine but I would like to except only one error.
getting this, when not using except:
pulumi:pulumi:Stack (aws_project-simple):
error: Program failed with an unhandled exception:
error: Traceback (most recent call last):
File ".\CloudInfrastructure\AWS.py", line 57, in AWS_Cloud
tmp_vpc = aws.ec2.get_vpc(cidr_block=resource["IPV4"], filters=[{'Name': 'tag:Name', 'Values': [resource["name"]]}])
File "C:\Python\Python391\lib\site-packages\pulumi_aws\ec2\get_vpc.py", line 249, in get_vpc
__ret__ = pulumi.runtime.invoke('aws:ec2/getVpc:getVpc', __args__, opts=opts, typ=GetVpcResult).value
File "C:\Python\Python391\lib\site-packages\pulumi\runtime\invoke.py", line 144, in invoke
raise invoke_error
Exception: invoke of aws:ec2/getVpc:getVpc failed: invocation of aws:ec2/getVpc:getVpc returned an error: invoking aws:ec2/getVpc:getVpc: 1 error occurred:
* no matching VPC found
bored-oyster-3147
07/06/2021, 3:50 PM