Skip to content

Commit

Permalink
update meta/runtime.yml, modules and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Oct 15, 2024
1 parent bd9ffb7 commit 96c0f97
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 81 deletions.
12 changes: 7 additions & 5 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ action_groups:
- ec2_vpc_endpoint_service_info
- ec2_vpc_igw
- ec2_vpc_igw_info
- ec2_vpc_nacl
- ec2_vpc_nacl_info
- ec2_vpc_nat_gateway
- ec2_vpc_nat_gateway_info
- ec2_vpc_net
Expand Down Expand Up @@ -162,14 +164,14 @@ plugin_routing:
rds_param_group:
redirect: amazon.aws.rds_instance_param_group
deprecation:
removal_version: 10.0.0
warning_text: >-
rds_param_group has been renamed to rds_instance_param_group.
Please update your tasks.
removal_version: 10.0.0
warning_text: >-
rds_param_group has been renamed to rds_instance_param_group.
Please update your tasks.
lookup:
aws_ssm:
# Deprecation for this alias should not *start* prior to 2024-09-01
redirect: amazon.aws.ssm_parameter
aws_secret:
# Deprecation for this alias should not *start* prior to 2024-09-01
redirect: amazon.aws.secretsmanager_secret
redirect: amazon.aws.secretsmanager_secret
13 changes: 7 additions & 6 deletions plugins/modules/ec2_vpc_nacl.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
module: ec2_vpc_nacl
short_description: create and delete Network ACLs
version_added: 1.0.0
version_added_collection: community.aws
description:
- Read the AWS documentation for Network ACLS
U(https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html)
Expand Down Expand Up @@ -88,7 +89,7 @@
# Complete example to create and delete a network ACL
# that allows SSH, HTTP and ICMP in, and all traffic out.
- name: "Create and associate production DMZ network ACL with DMZ subnets"
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
region: ap-southeast-2
Expand All @@ -111,7 +112,7 @@
state: 'present'
- name: "Remove the ingress and egress rules - defaults to deny all"
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
region: ap-southeast-2
Expand All @@ -125,20 +126,20 @@
state: present
- name: "Remove the NACL subnet associations and tags"
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: 'vpc-12345678'
name: prod-dmz-nacl
region: ap-southeast-2
state: present
- name: "Delete nacl and subnet associations"
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: vpc-12345678
name: prod-dmz-nacl
state: absent
- name: "Delete nacl by its id"
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
nacl_id: acl-33b4ee5b
state: absent
"""
Expand Down Expand Up @@ -166,7 +167,7 @@
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import replace_network_acl_association

from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule

# VPC-supported IANA protocol numbers
# http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/ec2_vpc_nacl_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
---
module: ec2_vpc_nacl_info
version_added: 1.0.0
version_added_collection: community.aws
short_description: Gather information about Network ACLs in an AWS VPC
description:
- Gather information about Network ACLs in an AWS VPC
Expand Down Expand Up @@ -44,13 +45,13 @@
# Gather information about all Network ACLs:
- name: Get All NACLs
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
region: us-west-2
register: all_nacls
# Retrieve default Network ACLs:
- name: Get Default NACLs
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
region: us-west-2
filters:
'default': 'true'
Expand Down Expand Up @@ -114,7 +115,7 @@
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.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule

# VPC-supported IANA protocol numbers
# http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Test Ingress and Egress rules
block:
- name: Create ingress and egress rules using subnet IDs
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -24,7 +24,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl.nacl_id }}"
register: nacl_facts
Expand All @@ -39,7 +39,7 @@
# ============================================================

- name: Remove an ingress rule
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -60,7 +60,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl.nacl_id }}"
register: nacl_facts
Expand All @@ -75,7 +75,7 @@
# ============================================================

- name: Remove the egress rule
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -95,7 +95,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl.nacl_id }}"
register: nacl_facts
Expand All @@ -110,7 +110,7 @@
# ============================================================

- name: Add egress rules
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -132,7 +132,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl.nacl_id }}"
register: nacl_facts
Expand All @@ -147,7 +147,7 @@
# ============================================================

- name: Remove the network ACL
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
state: absent
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ============================================================

- name: Create ingress and egress rules using subnet names
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_ipv6_id }}"
name: "{{ nacl_name }}"
subnets:
Expand All @@ -30,7 +30,7 @@
nacl_id: "{{ nacl.nacl_id }}"

- name: Add ipv6 entries
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_ipv6_id }}"
name: "{{ nacl_name }}"
subnets:
Expand All @@ -56,7 +56,7 @@
- nacl.nacl_id == nacl_id

- name: Get network ACL facts (test that it works with ipv6 entries)
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl_id }}"
register: nacl_facts
Expand All @@ -69,7 +69,7 @@
- nacl_facts.nacls[0].egress | length == 2

- name: Purge ingress entries
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_ipv6_id }}"
name: "{{ nacl_name }}"
subnets:
Expand All @@ -90,7 +90,7 @@
- nacl.nacl_id == nacl_id

- name: Purge egress entries
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_ipv6_id }}"
name: "{{ nacl_name }}"
subnets:
Expand All @@ -108,7 +108,7 @@
- nacl.changed

- name: Get network ACL facts (test that removed entries are gone)
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl_id }}"
register: nacl_facts
Expand All @@ -123,7 +123,7 @@
always:

- name: Remove network ACL
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_ipv6_id }}"
name: "{{ nacl_name }}"
state: absent
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/ec2_vpc_nacl/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ============================================================

- name: Test without any parameters
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
register: result
ignore_errors: true

Expand All @@ -22,7 +22,7 @@
- "result.msg == 'one of the following is required: name, nacl_id'"

- name: Get network ACL info without any parameters
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
register: nacl_facts

- name: Assert we don't error
Expand All @@ -31,7 +31,7 @@
- nacl_facts is succeeded

- name: Get network ACL info with invalid ID
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- 'acl-000000000000'
register: nacl_facts
Expand Down Expand Up @@ -139,7 +139,7 @@
always:

- name: Remove network ACL
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
state: absent
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ============================================================

- name: Create ingress and egress rules using subnet IDs
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -27,7 +27,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl_id }}"
register: nacl_facts
Expand All @@ -46,7 +46,7 @@
# ============================================================

- name: Test idempotence
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets: "{{ subnet_ids }}"
Expand All @@ -69,7 +69,7 @@
- nacl.nacl_id.startswith('acl-')

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_ids:
- "{{ nacl.nacl_id }}"
register: nacl_facts_idem
Expand All @@ -82,7 +82,7 @@
# ============================================================

- name: Remove a subnet from the network ACL
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
subnets:
Expand All @@ -108,7 +108,7 @@
- nacl.nacl_id == nacl_id

- name: Get network ACL facts
community.aws.ec2_vpc_nacl_info:
amazon.aws.ec2_vpc_nacl_info:
nacl_id:
- "{{ nacl.nacl_id }}"
register: nacl_facts
Expand All @@ -127,7 +127,7 @@
# ============================================================

- name: Remove the network ACL
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
state: absent
Expand All @@ -139,7 +139,7 @@
- nacl.changed

- name: Re-remove the network ACL by name (test idempotency)
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
name: "{{ nacl_name }}"
state: absent
Expand All @@ -151,7 +151,7 @@
- nacl is not changed

- name: Re-remove the network ACL by id (test idempotency)
community.aws.ec2_vpc_nacl:
amazon.aws.ec2_vpc_nacl:
vpc_id: "{{ vpc_id }}"
nacl_id: "{{ nacl_id }}"
state: absent
Expand Down
Loading

0 comments on commit 96c0f97

Please sign in to comment.