Skip to content

Commit

Permalink
Apply isort
Browse files Browse the repository at this point in the history
Signed-off-by: Alina Buzachis <[email protected]>
  • Loading branch information
alinabuzachis committed Oct 21, 2024
1 parent 75db712 commit f650626
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
3 changes: 1 addition & 2 deletions plugins/modules/ec2_vpc_peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,11 @@
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import reject_vpc_peering_connection
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications
from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list

from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule


def wait_for_state(client, module: AnsibleAWSModule, state: str, peering_id: str) -> NoReturn:
waiter = client.get_waiter("vpc_peering_connection_exists")
Expand Down
3 changes: 1 addition & 2 deletions plugins/modules/ec2_vpc_peering_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,10 @@

from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list

from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule


def get_vpc_peers(client, module: AnsibleAWSModule) -> List[Dict[str, Any]]:
params: Dict = {}
Expand Down
60 changes: 30 additions & 30 deletions tests/integration/targets/ec2_vpc_peer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# ============================================================
- name: Fetch EC2 VPC Peering Connections in check_mode
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
register: peers_info
check_mode: true

Expand Down Expand Up @@ -67,7 +67,7 @@
connection_name: Peering connection for VPC {{ vpc_1 }} to VPC {{ vpc_2 }}

- name: Create local account EC2 VPC Peering Connection request (check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -82,7 +82,7 @@
- vpc_peer is changed

- name: Create local account EC2 VPC Peering Connection request
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -105,7 +105,7 @@

- name: Re-create local account EC2 VPC Peering Connection request (idempotency
check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -120,7 +120,7 @@
- vpc_peer is not changed

- name: Re-create local account EC2 VPC Peering Connection request (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -137,7 +137,7 @@

- name: Create local account EC2 VPC Peering Connection request with accepter/requester
reversed (idempotency check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_2 }}'
peer_vpc_id: '{{ vpc_1 }}'
state: present
Expand All @@ -153,7 +153,7 @@

- name: Create local account EC2 VPC Peering Connection request with accepter/requester
reversed (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_2 }}'
peer_vpc_id: '{{ vpc_1 }}'
state: present
Expand All @@ -169,7 +169,7 @@
- vpc_peer.peering_id == peer_id_1

- name: Get details on specific EC2 VPC Peering Connection
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
peer_connection_ids:
- '{{ peer_id_1 }}'
register: peer_info
Expand Down Expand Up @@ -221,7 +221,7 @@
requester_details: '{{ peer_details["requester_vpc_info"] }}'

- name: Get all EC2 VPC Peering Connections with specific filters
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
filters:
status-code: [pending-acceptance]
register: pending_vpc_peers
Expand Down Expand Up @@ -262,7 +262,7 @@
requester_details: '{{ peer_details["requester_vpc_info"] }}'

- name: Update tags on the EC2 VPC Peering Connection (check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -278,7 +278,7 @@
- tag_peer is changed

- name: Update tags on the EC2 VPC Peering Connection
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -295,7 +295,7 @@
- tag_peer.peering_id == peer_id_1

- name: Update tags on the EC2 VPC Peering Connection (idempotency check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -311,7 +311,7 @@
- tag_peer is not changed

- name: Update tags on the EC2 VPC Peering Connection (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -328,7 +328,7 @@
- tag_peer.peering_id == peer_id_1

- name: Get details on specific EC2 VPC Peering Connection
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
peer_connection_ids:
- '{{ peer_id_1 }}'
register: peer_info
Expand All @@ -346,7 +346,7 @@
peer_details: '{{ peer_info.vpc_peering_connections[0] }}'

- name: Accept local EC2 VPC Peering request (check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: accept
wait: true
Expand All @@ -359,7 +359,7 @@
- action_peer is changed

- name: Accept local EC2 VPC Peering request
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: accept
wait: true
Expand All @@ -375,7 +375,7 @@
- action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1

- name: Get details on specific EC2 VPC Peering Connection
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
peer_connection_ids:
- '{{ peer_id_1 }}'
register: peer_info
Expand Down Expand Up @@ -433,7 +433,7 @@
requester_details: '{{ peer_details["requester_vpc_info"] }}'

- name: Accept local EC2 VPC Peering request (idempotency check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: accept
check_mode: true
Expand All @@ -445,7 +445,7 @@
- action_peer is not changed

- name: Accept local EC2 VPC Peering request (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: accept
register: action_peer
Expand All @@ -459,7 +459,7 @@
- action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1

- name: Delete a local EC2 VPC Peering Connection (check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: absent
check_mode: true
Expand All @@ -471,7 +471,7 @@
- delete_peer is changed

- name: Delete a local EC2 VPC Peering Connection
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: absent
register: delete_peer
Expand All @@ -484,7 +484,7 @@
- "'peering_id' in delete_peer"

- name: Get details on specific EC2 VPC Peering Connection
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
peer_connection_ids:
- '{{ peer_id_1}}'
register: peer_info
Expand Down Expand Up @@ -534,7 +534,7 @@
requester_details: '{{ peer_details["requester_vpc_info"] }}'

- name: Delete a local EC2 VPC Peering Connection (idempotency check_mode)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: absent
check_mode: true
Expand All @@ -546,7 +546,7 @@
- delete_peer is not changed

- name: Delete a local EC2 VPC Peering Connection (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer.peering_id }}'
state: absent
register: delete_peer
Expand All @@ -558,7 +558,7 @@
- delete_peer is successful

- name: Create local account EC2 VPC Peering Connection
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
vpc_id: '{{ vpc_1 }}'
peer_vpc_id: '{{ vpc_2 }}'
state: present
Expand All @@ -579,7 +579,7 @@
peer_id_2: '{{ vpc_peer2.peering_id }}'

- name: Reject a local EC2 VPC Peering Connection
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer2.peering_id }}'
state: reject
wait: true
Expand All @@ -593,7 +593,7 @@
- reject_peer.peering_id == peer_id_2

- name: Reject a local EC2 VPC Peering Connection (idempotency)
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer2.peering_id }}'
state: reject
register: reject_peer
Expand All @@ -607,7 +607,7 @@
- reject_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_2

- name: Delete a local EC2 VPC Peering Connections
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ vpc_peer2.peering_id }}'
state: absent
register: delete_peer
Expand All @@ -621,7 +621,7 @@
always:

- name: Find all EC2 VPC Peering Connections for our VPCs
community.aws.ec2_vpc_peering_info:
amazon.aws.ec2_vpc_peering_info:
filters:
accepter-vpc-info.vpc-id: '{{ item }}'
register: peering_info
Expand All @@ -640,7 +640,7 @@
# ============================================================

- name: Delete remaining EC2 VPC Peering Connections
community.aws.ec2_vpc_peer:
amazon.aws.ec2_vpc_peer:
peering_id: '{{ item }}'
state: absent
ignore_errors: true
Expand Down

0 comments on commit f650626

Please sign in to comment.