diff --git a/changelogs/fragments/1825-ec2_instances.yml b/changelogs/fragments/1825-ec2_instances.yml index 53b7f197343..e77ce53c304 100644 --- a/changelogs/fragments/1825-ec2_instances.yml +++ b/changelogs/fragments/1825-ec2_instances.yml @@ -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). \ No newline at end of file +deprecated_features: + - ec2_instance - deprecation of ``tenancy`` and ``placement_group`` in favor of ``placement`` attribute (https://github.com/ansible-collections/amazon.aws/pull/1825). diff --git a/plugins/modules/ec2_instance.py b/plugins/modules/ec2_instance.py index 28e27454f7c..8858e024c16 100644 --- a/plugins/modules/ec2_instance.py +++ b/plugins/modules/ec2_instance.py @@ -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: @@ -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: @@ -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(