diff --git a/changelogs/fragments/20241024-ec2_vpc_peer-rename.yml b/changelogs/fragments/20241024-ec2_vpc_peer-rename.yml new file mode 100644 index 00000000000..6a8e741e727 --- /dev/null +++ b/changelogs/fragments/20241024-ec2_vpc_peer-rename.yml @@ -0,0 +1,3 @@ +deprecated_features: + - ec2_vpc_peer - the ``ec2_vpc_peer`` module has been renamed to ``ec2_vpc_peering``. + The usage of the module has not changed. The ec2_vpc_peer alias will be removed in version 13.0.0 (https://github.com/ansible-collections/amazon.aws/pull/2356). diff --git a/meta/runtime.yml b/meta/runtime.yml index bb4ed9597e6..3c150b66db5 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -81,6 +81,7 @@ action_groups: - ec2_vpc_net - ec2_vpc_net_info - ec2_vpc_peer + - ec2_vpc_peering - ec2_vpc_peering_info - ec2_vpc_route_table - ec2_vpc_route_table_info @@ -195,6 +196,13 @@ plugin_routing: warning_text: >- rds_param_group has been renamed to rds_instance_param_group. Please update your tasks. + ec2_vpc_peer: + redirect: amazon.aws.ec2_vpc_peering + deprecation: + removal_version: 13.0.0 + warning_text: >- + ec2_vpc_peer has been renamed to ec2_vpc_peering. + Please update your tasks. lookup: aws_ssm: # Deprecation for this alias should not *start* prior to 2024-09-01 diff --git a/plugins/modules/ec2_vpc_peer.py b/plugins/modules/ec2_vpc_peering.py similarity index 98% rename from plugins/modules/ec2_vpc_peer.py rename to plugins/modules/ec2_vpc_peering.py index 4f2927090bb..5b94319cea1 100644 --- a/plugins/modules/ec2_vpc_peer.py +++ b/plugins/modules/ec2_vpc_peering.py @@ -5,7 +5,7 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" -module: ec2_vpc_peer +module: ec2_vpc_peering short_description: create, delete, accept, and reject VPC peering connections between two VPCs. version_added: 1.0.0 version_added_collection: community.aws @@ -66,7 +66,7 @@ EXAMPLES = r""" # Complete example to create and accept a local peering connection. - name: Create local account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-87654321" @@ -78,7 +78,7 @@ register: vpc_peer - name: Accept local EC2 VPC Peering request - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" state: "accept" @@ -86,7 +86,7 @@ # Complete example to delete a local peering connection. - name: Create local account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-87654321" @@ -98,7 +98,7 @@ register: vpc_peer - name: Delete a local EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" state: "absent" @@ -106,7 +106,7 @@ # Complete example to create and accept a cross account peering connection. - name: Create cross account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-12345678" @@ -119,7 +119,7 @@ register: vpc_peer - name: Accept EC2 VPC Peering Connection from remote account - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" profile: "bot03_profile_for_cross_account" @@ -128,7 +128,7 @@ # Complete example to create and accept an intra-region peering connection. - name: Create intra-region EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "us-east-1" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-87654321" @@ -149,7 +149,7 @@ # Complete example to create and reject a local peering connection. - name: Create local account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-87654321" @@ -161,14 +161,14 @@ register: vpc_peer - name: Reject a local EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" state: "reject" # Complete example to create and accept a cross account peering connection. - name: Create cross account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-12345678" @@ -181,7 +181,7 @@ register: vpc_peer - name: Accept a cross account EC2 VPC Peering Connection request - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" profile: "bot03_profile_for_cross_account" @@ -193,7 +193,7 @@ # Complete example to create and reject a cross account peering connection. - name: Create cross account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: region: "ap-southeast-2" vpc_id: "vpc-12345678" peer_vpc_id: "vpc-12345678" @@ -206,7 +206,7 @@ register: vpc_peer - name: Reject a cross account EC2 VPC Peering Connection - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peeriing: region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" profile: "bot03_profile_for_cross_account" diff --git a/tests/integration/targets/ec2_security_group/tasks/multi_account.yml b/tests/integration/targets/ec2_security_group/tasks/multi_account.yml index 5636195054a..ba627da9cbe 100644 --- a/tests/integration/targets/ec2_security_group/tasks/multi_account.yml +++ b/tests/integration/targets/ec2_security_group/tasks/multi_account.yml @@ -11,14 +11,14 @@ Description: Created by ansible-test register: vpc_result_2 - name: Peer the secondary-VPC to the main VPC - community.aws.ec2_vpc_peer: + community.aws.ec2_vpc_peering: vpc_id: "{{ vpc_result_2.vpc.id }}" peer_vpc_id: "{{ vpc_result.vpc.id }}" peer_owner_id: "{{ caller_facts.account }}" peer_region: "{{ aws_region }}" register: peer_origin - name: Accept the secondary-VPC peering connection in the main VPC - community.aws.ec2_vpc_peer: + community.aws.ec2_vpc_peering: peer_vpc_id: "{{ vpc_result_2.vpc.id }}" vpc_id: "{{ vpc_result.vpc.id }}" state: accept @@ -83,7 +83,7 @@ always: - ansible.builtin.pause: seconds=5 - name: Delete secondary-VPC side of peer - community.aws.ec2_vpc_peer: + community.aws.ec2_vpc_peering: vpc_id: "{{ vpc_result_2.vpc.id }}" peer_vpc_id: "{{ vpc_result.vpc.id }}" peering_id: "{{ peer_origin.peering_id }}" @@ -92,7 +92,7 @@ peer_region: "{{ aws_region }}" ignore_errors: true - name: Delete main-VPC side of peer - community.aws.ec2_vpc_peer: + community.aws.ec2_vpc_peering: peer_vpc_id: "{{ vpc_result_2.vpc.id }}" vpc_id: "{{ vpc_result.vpc.id }}" state: absent diff --git a/tests/integration/targets/ec2_vpc_peer/aliases b/tests/integration/targets/ec2_vpc_peering/aliases similarity index 100% rename from tests/integration/targets/ec2_vpc_peer/aliases rename to tests/integration/targets/ec2_vpc_peering/aliases diff --git a/tests/integration/targets/ec2_vpc_peer/defaults/main.yml b/tests/integration/targets/ec2_vpc_peering/defaults/main.yml similarity index 100% rename from tests/integration/targets/ec2_vpc_peer/defaults/main.yml rename to tests/integration/targets/ec2_vpc_peering/defaults/main.yml diff --git a/tests/integration/targets/ec2_vpc_peer/meta/main.yml b/tests/integration/targets/ec2_vpc_peering/meta/main.yml similarity index 100% rename from tests/integration/targets/ec2_vpc_peer/meta/main.yml rename to tests/integration/targets/ec2_vpc_peering/meta/main.yml diff --git a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml b/tests/integration/targets/ec2_vpc_peering/tasks/main.yml similarity index 96% rename from tests/integration/targets/ec2_vpc_peer/tasks/main.yml rename to tests/integration/targets/ec2_vpc_peering/tasks/main.yml index a915b5581fe..15cf6cb57bd 100644 --- a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_peering/tasks/main.yml @@ -7,7 +7,7 @@ region: '{{ aws_region }}' block: - name: Get ARN of calling user - aws_caller_info: + amazon.aws.aws_caller_info: register: aws_caller_info - name: Store Account ID for later use @@ -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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: vpc_id: '{{ vpc_2 }}' peer_vpc_id: '{{ vpc_1 }}' state: present @@ -262,7 +262,7 @@ requester_details: '{{ peer_details["requester_vpc_info"] }}' - name: Update tags on the EC2 VPC Peering Connection (check_mode) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present @@ -346,7 +346,7 @@ peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - name: Accept local EC2 VPC Peering request (check_mode) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: peering_id: '{{ vpc_peer.peering_id }}' state: accept wait: true @@ -433,7 +433,7 @@ requester_details: '{{ peer_details["requester_vpc_info"] }}' - name: Accept local EC2 VPC Peering request (idempotency check_mode) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: peering_id: '{{ vpc_peer.peering_id }}' state: accept check_mode: true @@ -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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: peering_id: '{{ vpc_peer.peering_id }}' state: absent register: delete_peer @@ -534,7 +534,7 @@ requester_details: '{{ peer_details["requester_vpc_info"] }}' - name: Delete a local EC2 VPC Peering Connection (idempotency check_mode) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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) - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: 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 - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: peering_id: '{{ vpc_peer2.peering_id }}' state: absent register: delete_peer @@ -640,7 +640,7 @@ # ============================================================ - name: Delete remaining EC2 VPC Peering Connections - amazon.aws.ec2_vpc_peer: + amazon.aws.ec2_vpc_peering: peering_id: '{{ item }}' state: absent ignore_errors: true diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt index 09a7e9cbb50..d2b612d67ad 100644 --- a/tests/sanity/ignore-2.18.txt +++ b/tests/sanity/ignore-2.18.txt @@ -1 +1,2 @@ plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this +plugins/modules/ec2_vpc_peering.py pylint:collection-deprecated-version