mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Fixed issue with tag changes affecting vpc attach
This commit is contained in:
parent
e5ead91439
commit
6de163cbb2
1 changed files with 40 additions and 40 deletions
|
@ -364,8 +364,6 @@ def ensure_vgw_present(client, module):
|
||||||
vpn_gateway_id = existing_vgw[0]['VpnGatewayId']
|
vpn_gateway_id = existing_vgw[0]['VpnGatewayId']
|
||||||
vgw, changed = check_tags(client, module, existing_vgw, vpn_gateway_id)
|
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 a vpc_id was provided, check if it exists and if it's attached
|
||||||
if params['VpcId']:
|
if params['VpcId']:
|
||||||
|
|
||||||
|
@ -383,10 +381,12 @@ def ensure_vgw_present(client, module):
|
||||||
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
|
detach_vgw(client, module, vpn_gateway_id, vpc_to_detach)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
|
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
|
||||||
|
vgw = find_vgw(client, module, [vpn_gateway_id])
|
||||||
changed = True
|
changed = True
|
||||||
else:
|
else:
|
||||||
# attach the vgw to the supplied vpc
|
# attach the vgw to the supplied vpc
|
||||||
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
|
attached_vgw = attach_vgw(client, module, vpn_gateway_id)
|
||||||
|
vgw = find_vgw(client, module, [vpn_gateway_id])
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
# if params['VpcId'] is not provided, check the vgw is attached to a vpc. if so, detach it.
|
# 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:
|
else:
|
||||||
changed = False
|
changed = False
|
||||||
deleted_vgw = None
|
deleted_vgw = "Nothing to do"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
#Check that a name and type argument has been supplied if no vgw-id
|
#Check that a name and type argument has been supplied if no vgw-id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue