Skip to content

Commit

Permalink
Tagging fragment - Move simplest cases over to the docs fragment. (#1182
Browse files Browse the repository at this point in the history
)

Tagging fragment - Move simplest cases over to the docs fragment.

Depends-On: ansible-collections/amazon.aws#844
SUMMARY
Migrate simplest cases over to the new docs fragment and add resource_tags as an alias to tags.
ISSUE TYPE

Docs Pull Request
Feature Pull Request

COMPONENT NAME
changelogs/fragments/1182-tagging.yml
plugins/modules/aws_glue_job.py
plugins/modules/aws_msk_cluster.py
plugins/modules/aws_secret.py
plugins/modules/aws_step_functions_state_machine.py
plugins/modules/dynamodb_table.py
plugins/modules/ec2_eip.py
plugins/modules/ec2_transit_gateway_vpc_attachment.py
plugins/modules/ec2_vpc_peer.py
plugins/modules/elb_application_lb.py
plugins/modules/elb_network_lb.py
plugins/modules/iam_role.py
plugins/modules/iam_user.py
plugins/modules/networkfirewall.py
plugins/modules/networkfirewall_policy.py
plugins/modules/networkfirewall_rule_group.py
plugins/modules/rds_cluster.py
plugins/modules/rds_instance.py
plugins/modules/rds_instance_snapshot.py
plugins/modules/rds_option_group.py
plugins/modules/rds_subnet_group.py
plugins/modules/redshift.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored Jun 1, 2022
1 parent 029333b commit b11ffae
Show file tree
Hide file tree
Showing 19 changed files with 132 additions and 290 deletions.
16 changes: 16 additions & 0 deletions changelogs/fragments/1182-tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
minor_changes:
- aws_glue_job - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- aws_msk_cluster - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- aws_secret - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- aws_step_functions_state_machine - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- ec2_eip - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- ec2_vpc_peer - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- elb_application_lb - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- elb_network_lb - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- iam_role - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- iam_user - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- rds_cluster - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- rds_instance - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- rds_option_group - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- rds_subnet_group - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
- redshift - ``resource_tags`` has been added as an alias for the ``tags`` parameter (https://github.com/ansible-collections/community.aws/pull/1182).
25 changes: 7 additions & 18 deletions plugins/modules/aws_glue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
version_added: 1.0.0
short_description: Manage an AWS Glue job
description:
- Manage an AWS Glue job. See U(https://aws.amazon.com/glue/) for details.
- Manage an AWS Glue job. See U(https://aws.amazon.com/glue/) for details.
author:
- "Rob White (@wimnat)"
- "Vijayanand Sharma (@vijayanandsharma)"
Expand Down Expand Up @@ -77,13 +77,6 @@
- The number of workers of a defined workerType that are allocated when a job runs.
type: int
version_added: 1.5.0
purge_tags:
description:
- If C(true), existing tags will be purged from the resource to match exactly what is defined by I(tags) parameter.
- If the I(tags) parameter is not set then tags will not be modified.
default: true
type: bool
version_added: 2.2.0
role:
description:
- The name or ARN of the IAM role associated with this job.
Expand All @@ -95,12 +88,6 @@
required: true
choices: [ 'present', 'absent' ]
type: str
tags:
description:
- A hash/dictionary of tags to be applied to the job.
- Remove completely or specify an empty dictionary to remove all tags.
type: dict
version_added: 2.2.0
timeout:
description:
- The job timeout in minutes.
Expand All @@ -111,10 +98,12 @@
choices: [ 'Standard', 'G.1X', 'G.2X' ]
type: str
version_added: 1.5.0
notes:
- Support for I(tags) and I(purge_tags) was added in release 2.2.0.
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
'''

EXAMPLES = r'''
Expand Down Expand Up @@ -463,7 +452,7 @@ def main():
purge_tags=dict(type='bool', default=True),
role=dict(type='str'),
state=dict(required=True, choices=['present', 'absent'], type='str'),
tags=dict(type='dict'),
tags=dict(type='dict', aliases=['resource_tags']),
timeout=dict(type='int'),
worker_type=dict(choices=['Standard', 'G.1X', 'G.2X'], type='str'),
)
Expand Down
12 changes: 3 additions & 9 deletions plugins/modules/aws_msk_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DOCUMENTATION = r"""
---
module: aws_msk_cluster
short_description: Manage Amazon MSK clusters.
short_description: Manage Amazon MSK clusters
version_added: "2.0.0"
description:
- Create, delete and modify Amazon MSK (Managed Streaming for Apache Kafka) clusters.
Expand Down Expand Up @@ -198,16 +198,10 @@
description: How many seconds to wait. Cluster creation can take up to 20-30 minutes.
type: int
default: 3600
tags:
description: Tag dictionary to apply to the cluster.
type: dict
purge_tags:
description: Remove tags not listed in I(tags) when tags is specified.
default: true
type: bool
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
notes:
- All operations are time consuming, for example create takes 20-30 minutes,
update kafka version -- more than one hour, update configuration -- 10-15 minutes;
Expand Down Expand Up @@ -769,7 +763,7 @@ def main():
),
wait=dict(type="bool", default=False),
wait_timeout=dict(type="int", default=3600),
tags=dict(type='dict'),
tags=dict(type='dict', aliases=['resource_tags']),
purge_tags=dict(type='bool', default=True),
)

Expand Down
30 changes: 10 additions & 20 deletions plugins/modules/aws_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
---
module: aws_secret
version_added: 1.0.0
short_description: Manage secrets stored in AWS Secrets Manager.
short_description: Manage secrets stored in AWS Secrets Manager
description:
- Create, update, and delete secrets stored in AWS Secrets Manager.
author: "REY Remi (@rrey)"
- Create, update, and delete secrets stored in AWS Secrets Manager.
author:
- "REY Remi (@rrey)"
options:
name:
description:
Expand Down Expand Up @@ -60,19 +61,6 @@
required: false
type: json
version_added: 3.1.0
tags:
description:
- Specifies a dictionary of user-defined tags that are attached to the secret.
- To remove all tags set I(tags={}) and I(purge_tags=true).
type: dict
purge_tags:
description:
- If I(purge_tags=true) and I(tags) is set, existing tags will be purged from the resource
to match exactly what is defined by I(tags) parameter.
type: bool
required: false
default: true
version_added: 4.0.0
rotation_lambda:
description:
- Specifies the ARN of the Lambda function that can rotate the secret.
Expand All @@ -83,9 +71,11 @@
default: 30
type: int
extends_documentation_fragment:
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.tags
notes:
- Support for I(purge_tags) was added in release 4.0.0.
'''

EXAMPLES = r'''
Expand Down Expand Up @@ -432,7 +422,7 @@ def main():
'secret_type': dict(choices=['binary', 'string'], default="string"),
'secret': dict(default="", no_log=True),
'resource_policy': dict(type='json', default=None),
'tags': dict(type='dict', default=None),
'tags': dict(type='dict', default=None, aliases=['resource_tags']),
'purge_tags': dict(type='bool', default=True),
'rotation_lambda': dict(),
'rotation_interval': dict(type='int', default=30),
Expand Down
30 changes: 8 additions & 22 deletions plugins/modules/aws_step_functions_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
---
module: aws_step_functions_state_machine
version_added: 1.0.0
short_description: Manage AWS Step Functions state machines
description:
- Create, update and delete state machines in AWS Step Functions.
- Calling the module in C(state=present) for an existing AWS Step Functions state machine
will attempt to update the state machine definition, IAM Role, or tags with the provided data.
- Create, update and delete state machines in AWS Step Functions.
- Calling the module in C(state=present) for an existing AWS Step Functions state machine
will attempt to update the state machine definition, IAM Role, or tags with the provided data.
options:
name:
Expand All @@ -44,24 +41,13 @@
default: present
choices: [ present, absent ]
type: str
tags:
description:
- A hash/dictionary of tags to add to the new state machine or to add/remove from an existing one.
type: dict
purge_tags:
description:
- If yes, existing tags will be purged from the resource to match exactly what is defined by I(tags) parameter.
If the I(tags) parameter is not set then tags will not be modified.
default: yes
type: bool
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
author:
- Tom De Keyser (@tdekeyser)
- Tom De Keyser (@tdekeyser)
'''

EXAMPLES = '''
Expand Down Expand Up @@ -210,7 +196,7 @@ def main():
definition=dict(type='json'),
role_arn=dict(type='str'),
state=dict(choices=['present', 'absent'], default='present'),
tags=dict(default=None, type='dict'),
tags=dict(default=None, type='dict', aliases=['resource_tags']),
purge_tags=dict(default=True, type='bool'),
)
module = AnsibleAWSModule(
Expand Down
39 changes: 16 additions & 23 deletions plugins/modules/ec2_eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
version_added: 1.0.0
short_description: manages EC2 elastic IP (EIP) addresses.
description:
- This module can allocate or release an EIP.
- This module can associate/disassociate an EIP with instances or network interfaces.
- This module can allocate or release an EIP.
- This module can associate/disassociate an EIP with instances or network interfaces.
options:
device_id:
description:
Expand Down Expand Up @@ -64,16 +64,6 @@
network interface or instance to be re-associated with the specified instance or interface.
default: false
type: bool
tags:
description: A dictionary of tags to apply to the EIP.
type: dict
version_added: 2.1.0
purge_tags:
description: Whether the I(tags) argument should cause tags not in the
dictionary to be removed.
default: True
type: bool
version_added: 2.1.0
tag_name:
description:
- When I(reuse_existing_ip_allowed=true), supplement with this option to only reuse
Expand All @@ -89,18 +79,21 @@
only applies to newly allocated Elastic IPs, isn't validated when I(reuse_existing_ip_allowed=true).
type: str
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
author: "Rick Mendes (@rickmendes) <rmendes@illumina.com>"
author:
- "Rick Mendes (@rickmendes) <rmendes@illumina.com>"
notes:
- There may be a delay between the time the EIP is assigned and when
the cloud instance is reachable via the new address. Use wait_for and
pause to delay further playbook execution until the instance is reachable,
if necessary.
- This module returns multiple changed statuses on disassociation or release.
It returns an overall status based on any changes occurring. It also returns
individual changed statuses for disassociation and release.
- There may be a delay between the time the EIP is assigned and when
the cloud instance is reachable via the new address. Use wait_for and
pause to delay further playbook execution until the instance is reachable,
if necessary.
- This module returns multiple changed statuses on disassociation or release.
It returns an overall status based on any changes occurring. It also returns
individual changed statuses for disassociation and release.
- Support for I(tags) and I(purge_tags) was added in release 2.1.0.
'''

EXAMPLES = '''
Expand Down Expand Up @@ -543,7 +536,7 @@ def main():
release_on_disassociation=dict(required=False, type='bool', default=False),
allow_reassociation=dict(type='bool', default=False),
private_ip_address=dict(),
tags=dict(required=False, type='dict'),
tags=dict(required=False, type='dict', aliases=['resource_tags']),
purge_tags=dict(required=False, type='bool', default=True),
tag_name=dict(),
tag_value=dict(),
Expand Down
22 changes: 4 additions & 18 deletions plugins/modules/ec2_transit_gateway_vpc_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,6 @@
for the life of a flow to send traffic to.
type: bool
required: false
tags:
description:
- A dictionary representing the tags associated with the Transit Gateway
attachment.
- 'For example C({"Example Tag": "some example value"})'
- Unless I(purge_tags=False) all other tags will be removed from the
attachment.
type: dict
required: false
purge_tags:
description:
- If I(purge_tags=true), existing tags will be purged from the resource
to match exactly what is defined by I(tags) parameter.
type: bool
required: false
default: true
wait:
description:
- Whether to wait for the Transit Gateway attachment to reach the
Expand All @@ -111,10 +95,12 @@
- Defaults to 600 seconds.
type: int
required: false
author: "Mark Chappell (@tremble)"
author:
- "Mark Chappell (@tremble)"
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
'''

EXAMPLES = '''
Expand Down Expand Up @@ -246,7 +232,7 @@ def main():
name=dict(type='str', required=False),
subnets=dict(type='list', elements='str', required=False),
purge_subnets=dict(type='bool', required=False, default=True),
tags=dict(type='dict', required=False),
tags=dict(type='dict', required=False, aliases=['resource_tags']),
purge_tags=dict(type='bool', required=False, default=True),
appliance_mode_support=dict(type='bool', required=False),
dns_support=dict(type='bool', required=False),
Expand Down
23 changes: 8 additions & 15 deletions plugins/modules/ec2_vpc_peer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@
- The AWS account number for cross account peering.
required: false
type: str
tags:
description:
- Dictionary of tags to look for and apply when creating a Peering Connection.
required: false
type: dict
purge_tags:
description:
- Remove tags not listed in I(tags).
type: bool
default: true
version_added: 2.0.0
state:
description:
- Create, delete, accept, reject a peering connection.
Expand All @@ -63,10 +52,14 @@
required: false
default: false
type: bool
author: Mike Mochan (@mmochan)
notes:
- Support for I(purge_tags) was added in release 2.0.0.
author:
- Mike Mochan (@mmochan)
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.tags
'''

EXAMPLES = '''
Expand Down Expand Up @@ -547,7 +540,7 @@ def main():
peer_region=dict(),
peering_id=dict(),
peer_owner_id=dict(),
tags=dict(required=False, type='dict'),
tags=dict(required=False, type='dict', aliases=['resource_tags']),
purge_tags=dict(default=True, type='bool'),
state=dict(default='present', choices=['present', 'absent', 'accept', 'reject']),
wait=dict(default=False, type='bool'),
Expand Down
Loading

0 comments on commit b11ffae

Please sign in to comment.