diff --git a/changelogs/fragments/55307-ec2_instance-deprecations.yaml b/changelogs/fragments/55307-ec2_instance-deprecations.yaml new file mode 100644 index 00000000000..d780f648eba --- /dev/null +++ b/changelogs/fragments/55307-ec2_instance-deprecations.yaml @@ -0,0 +1,2 @@ +minor_changes: + - ec2_instance - Remove deprecated ``network.ebs_optimized`` option (https://github.com/ansible/ansible/issues/55307) diff --git a/lib/ansible/modules/cloud/amazon/ec2_instance.py b/lib/ansible/modules/cloud/amazon/ec2_instance.py index 83ba89e1c29..011d1cce18e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_instance.py +++ b/lib/ansible/modules/cloud/amazon/ec2_instance.py @@ -1126,9 +1126,6 @@ def build_top_level_options(params): spec.setdefault('Placement', {'GroupName': str(params.get('placement_group'))}) if params.get('ebs_optimized') is not None: spec['EbsOptimized'] = params.get('ebs_optimized') - elif (params.get('network') or {}).get('ebs_optimized') is not None: - # Backward compatibility for workaround described in https://github.com/ansible/ansible/issues/48159 - spec['EbsOptimized'] = params['network'].get('ebs_optimized') if params.get('instance_initiated_shutdown_behavior'): spec['InstanceInitiatedShutdownBehavior'] = params.get('instance_initiated_shutdown_behavior') if params.get('termination_protection') is not None: @@ -1625,9 +1622,6 @@ def main(): ) if module.params.get('network'): - if 'ebs_optimized' in module.params['network']: - module.deprecate("network.ebs_optimized is deprecated." - "Use the top level ebs_optimized parameter instead", 2.9) if module.params.get('network').get('interfaces'): if module.params.get('security_group'): module.fail_json(msg="Parameter network.interfaces can't be used with security_group")