Fixed issue with tag changes affecting vpc attach

This commit is contained in:
naslanidis 2016-02-22 20:32:18 +10:00
parent 526ee48c0d
commit 20df1189b9

View file

@ -364,8 +364,6 @@ def ensure_vgw_present(client, module):
vpn_gateway_id = existing_vgw[0]['VpnGatewayId']
vgw, changed = check_tags(client, module, existing_vgw, vpn_gateway_id)
if not changed:
# if a vpc_id was provided, check if it exists and if it's attached
if params['VpcId']:
@ -383,10 +381,12 @@ def ensure_vgw_present(client, module):
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
time.sleep(5)
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
vgw = find_vgw(client, module, [vpn_gateway_id])
changed = True
else:
# attach the vgw to the supplied vpc
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
vgw = find_vgw(client, module, [vpn_gateway_id])
changed = True
# if params['VpcId'] is not provided, check the vgw is attached to a vpc. if so, detach it.
@ -468,7 +468,7 @@ def ensure_vgw_absent(client, module):
else:
changed = False
deleted_vgw = None
deleted_vgw = "Nothing to do"
else:
#Check that a name and type argument has been supplied if no vgw-id