Skip to content

Commit

Permalink
ec2_eip - Formally deprecate the 'instance_id' alias. (ansible-collec…
Browse files Browse the repository at this point in the history
…tions#349)

* ec2_eip - Formally deprecate the 'instance_id' alias.

We've been issuing a warning for a while, formally deprecate it so we
can start cleaning up the code.
  • Loading branch information
tremble authored Jan 13, 2021
1 parent ea5dc08 commit 1704205
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ec2_eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
device_id:
description:
- The id of the device for the EIP. Can be an EC2 Instance id or Elastic Network Interface (ENI) id.
- The I(instance_id) alias has been deprecated and will be removed after 2022-12-01.
required: false
aliases: [ instance_id ]
type: str
Expand Down Expand Up @@ -519,7 +520,10 @@ def generate_tag_dict(module, tag_name, tag_value):

def main():
argument_spec = dict(
device_id=dict(required=False, aliases=['instance_id']),
device_id=dict(required=False, aliases=['instance_id'],
deprecated_aliases=[dict(name='instance_id',
date='2022-12-01',
collection_name='community.aws')]),
public_ip=dict(required=False, aliases=['ip']),
state=dict(required=False, default='present',
choices=['present', 'absent']),
Expand Down Expand Up @@ -560,7 +564,6 @@ def main():
public_ipv4_pool = module.params.get('public_ipv4_pool')

if instance_id:
warnings = ["instance_id is no longer used, please use device_id going forward"]
is_instance = True
device_id = instance_id
else:
Expand Down Expand Up @@ -629,8 +632,6 @@ def main():
except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
module.fail_json_aws(str(e))

if instance_id:
result['warnings'] = warnings
module.exit_json(**result)


Expand Down

0 comments on commit 1704205

Please sign in to comment.