Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return all infos of a VPC peering connection in ec2_vpc_peer module #355

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/355-ec2_vpc_peer_improvements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_vpc_peer - More return info added, also simplified module code a bit and extended tests (https://github.com/ansible-collections/community.aws/pull/355)
18 changes: 15 additions & 3 deletions plugins/modules/ec2_vpc_peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,19 @@
vpc_peering_connection:
description: The details of the VPC peering connection as returned by Boto3 (snake cased).
returned: success
type: dict
type: complex
contains:
vpc_peering_connection_id:
type: str
sample: pcx-034223d7c0aec3cde
accepter_vpc_info:
type: dict
requester_vpc_info:
type: dict
tags:
type: dict
status:
type: dict
stefanhorning marked this conversation as resolved.
Show resolved Hide resolved
'''

try:
Expand Down Expand Up @@ -353,9 +365,9 @@ def remove_peer_connection(client, module):
else:
pcx_id = pcx_id or peering_conn['VpcPeeringConnectionId']

if peering_conn[0]['Status']['Code'] == 'deleted':
if peering_conn['Status']['Code'] == 'deleted':
module.exit_json(msg='Connection in deleted state.', changed=False)
if peering_conn[0]['Status']['Code'] == 'rejected':
if peering_conn['Status']['Code'] == 'rejected':
module.exit_json(msg='Connection has been rejected. State cannot be changed and will be removed automatically by AWS', changed=False)

try:
Expand Down