Skip to content

Commit

Permalink
Cleanup deprecation and set date
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Oct 30, 2023
1 parent a4562d0 commit 6a634c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion changelogs/fragments/1825-ec2_instances.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
minor_changes:
- ec2_instance - add support for additional ``placement`` options and ``license_specifications`` in run instance spec (https://github.com/ansible-collections/amazon.aws/issues/1824).
- ec2_instance - deprecation of ``tenancy`` and ``placement_group`` in favor of ``placement`` attribute (https://github.com/ansible-collections/amazon.aws/pull/1825).
deprecated_features:
- ec2_instance - deprecation of ``tenancy`` and ``placement_group`` in favor of ``placement`` attribute (https://github.com/ansible-collections/amazon.aws/pull/1825).
18 changes: 16 additions & 2 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
tenancy:
description:
- What type of tenancy to allow an instance to use. Default is shared tenancy. Dedicated tenancy will incur additional charges.
- This field is deprecated, use I(placement) instead.
- This field is deprecated and will be removed in a release after 2025-12-01, use I(placement) instead.
choices: ['dedicated', 'default']
type: str
termination_protection:
Expand Down Expand Up @@ -326,7 +326,7 @@
placement_group:
description:
- The placement group that needs to be assigned to the instance.
- This field is deprecated, use I(placement) instead.
- This field is deprecated and will be removed in a release after 2025-12-01, use I(placement) instead.
type: str
placement:
description:
Expand Down Expand Up @@ -2295,6 +2295,20 @@ def main():
if module.params.get("security_groups"):
module.fail_json(msg="Parameter network.interfaces can't be used with security_groups")

if module.params.get("placement_group"):
module.deprecate(
"The placement_group parameter has been deprecated, please use placement.group_name instead.",
date="2025-12-01",
collection_name="amazon.aws",
)

if module.params.get("tenancy"):
module.deprecate(
"The tenancy parameter has been deprecated, please use placement.tenancy instead.",
date="2025-12-01",
collection_name="amazon.aws",
)

state = module.params.get("state")

retry_decorator = AWSRetry.jittered_backoff(
Expand Down

0 comments on commit 6a634c4

Please sign in to comment.