Skip to content

Commit

Permalink
Rename ec2_group to ec2_security_group (ansible-collections#897)
Browse files Browse the repository at this point in the history
Rename ec2_group to ec2_security_group

SUMMARY
Rename ec2_group to ec2_security_group
There are multiple "groups" of resources in EC2 these days.  Amazon documentation specifically refers to them as "security groups".
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_group
ec2_group_info
ec2_security_group
ec2_security_group_info
ADDITIONAL INFORMATION
This PR does not update integration tests with the renames to demonstrate that all of the aliasing pieces work.

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored and jatorcasso committed Jun 24, 2022
1 parent e56c49c commit f7a48a7
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 23 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/897-ec2_security_group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- ec2_group - The ``ec2_group`` module has been renamed to ``ec2_security_group``, ``ec2_group`` remains as an alias (https://github.com/ansible-collections/amazon.aws/pull/897).
- ec2_group_info - The ``ec2_group_info`` module has been renamed to ``ec2_security_group_info``, ``ec2_group_info`` remains as an alias (https://github.com/ansible-collections/amazon.aws/pull/897).
8 changes: 8 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ action_groups:
- ec2_instance
- ec2_instance_info
- ec2_key
- ec2_security_group
- ec2_security_group_info
- ec2_snapshot
- ec2_snapshot_info
- ec2_spot_instance
Expand Down Expand Up @@ -60,6 +62,12 @@ plugin_routing:
redirect: amazon.aws.s3_object
ec2_elb_lb:
redirect: amazon.aws.elb_classic_lb
ec2_group:
# Deprecation for this alias should not *start* prior to 2024-09-01
redirect: amazon.aws.ec2_security_group
ec2_group_info:
# Deprecation for this alias should not *start* prior to 2024-09-01
redirect: amazon.aws.ec2_security_group_info
ec2_eni_facts:
deprecation:
removal_date: 2021-12-01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

DOCUMENTATION = '''
---
module: ec2_group
module: ec2_security_group
version_added: 1.0.0
author:
- "Andrew de Quincey (@adq)"
- "Razique Mahroua (@Razique)"
short_description: Maintain an ec2 VPC security group
short_description: Maintain an EC2 security group
description:
- Maintains ec2 security groups.
- Maintains EC2 security groups.
options:
name:
description:
Expand Down Expand Up @@ -246,12 +246,13 @@
- If a rule declares a group_name and that group doesn't exist, it will be
automatically created. In that case, group_desc should be provided as well.
The module will refuse to create a depended-on group without a description.
- Preview diff mode support is added in version 2.7.
- Prior to release 5.0.0 this module was called C(amazon.aws.ec2_group_info). The usage did not
change.
'''

EXAMPLES = '''
- name: example using security group rule descriptions
amazon.aws.ec2_group:
amazon.aws.ec2_security_group:
name: "{{ name }}"
description: sg with rule descriptions
vpc_id: vpc-xxxxxxxx
Expand All @@ -265,7 +266,7 @@
rule_desc: allow all on port 80
- name: example using ICMP types and codes
amazon.aws.ec2_group:
amazon.aws.ec2_security_group:
name: "{{ name }}"
description: sg for ICMP
vpc_id: vpc-xxxxxxxx
Expand All @@ -278,7 +279,7 @@
cidr_ip: 0.0.0.0/0
- name: example ec2 group
amazon.aws.ec2_group:
amazon.aws.ec2_security_group:
name: example
description: an example EC2 group
vpc_id: 12345
Expand Down Expand Up @@ -338,7 +339,7 @@
group_desc: other example EC2 group
- name: example2 ec2 group
amazon.aws.ec2_group:
amazon.aws.ec2_security_group:
name: example2
description: an example2 EC2 group
vpc_id: 12345
Expand Down Expand Up @@ -378,7 +379,7 @@
diff: True
- name: "Delete group by its id"
amazon.aws.ec2_group:
amazon.aws.ec2_security_group:
region: eu-west-1
group_id: sg-33b4ee5b
state: absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

DOCUMENTATION = '''
---
module: ec2_group_info
module: ec2_security_group_info
version_added: 1.0.0
short_description: Gather information about ec2 security groups in AWS
short_description: Gather information about EC2 security groups in AWS
description:
- Gather information about ec2 security groups in AWS.
- Gather information about EC2 security groups in AWS.
author:
- Henrique Rodrigues (@Sodki)
options:
Expand All @@ -26,7 +26,10 @@
default: {}
type: dict
notes:
- By default, the module will return all security groups. To limit results use the appropriate filters.
- By default, the module will return all security groups in a region. To limit results use the
appropriate filters.
- Prior to release 5.0.0 this module was called C(amazon.aws.ec2_group_info). The usage did not
change.
extends_documentation_fragment:
- amazon.aws.aws
Expand All @@ -38,36 +41,36 @@
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather information about all security groups
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
# Gather information about all security groups in a specific VPC
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
vpc-id: vpc-12345678
# Gather information about all security groups in a specific VPC
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
vpc-id: vpc-12345678
# Gather information about a security group
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
group-name: example-1
# Gather information about a security group by id
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
group-id: sg-12345678
# Gather information about a security group with multiple filters, also mixing the use of underscores as filter keys
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
group_id: sg-12345678
vpc-id: vpc-12345678
# Gather information about various security groups
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
group-name:
- example-1
Expand All @@ -76,7 +79,7 @@
# Gather information about any security group with a tag key Name and value Example.
# The quotes around 'tag:name' are important because of the colon in the value
- amazon.aws.ec2_group_info:
- amazon.aws.ec2_security_group_info:
filters:
"tag:Name": Example
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ slow

cloud/aws

ec2_group_info
ec2_security_group_info
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

from ansible_collections.amazon.aws.plugins.modules import ec2_group as group_module
from ansible_collections.amazon.aws.plugins.modules import ec2_security_group as group_module


def test_from_permission():
Expand Down

0 comments on commit f7a48a7

Please sign in to comment.