1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ignore main route table association when determining which associations to remove. (#23781)

They can't be removed anyway, and will just throw an error if you try to disassociate them.
This commit is contained in:
Brandon Davidson 2017-08-01 14:10:16 -04:00 committed by Chris Alfonso
parent cc72dead45
commit 4ec8744b8b

View file

@ -404,6 +404,8 @@ def ensure_subnet_association(vpc_conn, vpc_id, route_table_id, subnet_id,
if route_table.id is None:
continue
for a in route_table.associations:
if a.main:
continue
if a.subnet_id == subnet_id:
if route_table.id == route_table_id:
return {'changed': False, 'association_id': a.id}
@ -418,7 +420,7 @@ def ensure_subnet_association(vpc_conn, vpc_id, route_table_id, subnet_id,
def ensure_subnet_associations(vpc_conn, vpc_id, route_table, subnets,
check_mode, purge_subnets):
current_association_ids = [a.id for a in route_table.associations]
current_association_ids = [a.id for a in route_table.associations if not a.main]
new_association_ids = []
changed = False
for subnet in subnets: