Closed darrylb-github closed 2 years ago
I could lookup the nat ID and use it but I'd rather avoid that extra step if possible.
This isn't what you want to hear, so maybe someone else has more ideas, but that is exactly what I would do.
@darrylb-github,
You indeed should use the ID instead.
From lib/awspec/helper/finder/vpc.rb
:
def find_route_table(route_table_id)
res = ec2_client.describe_route_tables({
filters: [{ name: 'route-table-id', values: [route_table_id] }]
})
resource = res.route_tables.single_resource(route_table_id)
return resource if resource
res = ec2_client.describe_route_tables({
filters: [{ name: 'tag:Name', values: [route_table_id] }]
})
res.route_tables.single_resource(route_table_id)
end
It is already searching for ID
or tag:Name
, but by tag:Name
I guess it should not work due the time is required for the purging to occur.
What could happen from inside awspec is to raise an exception when searching by tag:Name
returns more than one result: you could capture that and do something else, like checking the status of the route.
Hey,
I'm using this like so:
This works on the first run, however if I run my tests again it fails because there are two matching NAT gateways - one deleted and one available. If I wait ~30mins until AWS purges the deleted NAT from the results, my tests pass again.
How can I work around this so that it only matches a NAT if it hasn't been deleted? I could lookup the nat ID and use it but I'd rather avoid that extra step if possible.
Thanks, Darryl