diff --git a/plugins/modules/ec2_vpc_peer.py b/plugins/modules/ec2_vpc_peer.py index d7eed64e17d..66b4e262555 100644 --- a/plugins/modules/ec2_vpc_peer.py +++ b/plugins/modules/ec2_vpc_peer.py @@ -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") diff --git a/plugins/modules/ec2_vpc_peering_info.py b/plugins/modules/ec2_vpc_peering_info.py index 3671810226b..1abb94e198a 100644 --- a/plugins/modules/ec2_vpc_peering_info.py +++ b/plugins/modules/ec2_vpc_peering_info.py @@ -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 = {} diff --git a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml b/tests/integration/targets/ec2_vpc_peer/tasks/main.yml index 864b5143975..a915b5581fe 100644 --- a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_peer/tasks/main.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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