From 2fbf4ca99cdf556be89246a972ba4881659bb560 Mon Sep 17 00:00:00 2001 From: flowerysong Date: Fri, 12 Apr 2019 07:40:25 -0400 Subject: [PATCH] [2.8] Fix ec2_eip parameter logic device_id is required when private_ip_address is set, but the reverse is not true. (cherry picked from commit 6273574eb4fce33cab70c5ab749fa71cc85e3855) Signed-off-by: flowerysong Signed-off-by: Abhijeet Kasurde --- changelogs/fragments/55194-ec2_eip-required_together.yml | 2 ++ lib/ansible/modules/cloud/amazon/ec2_eip.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/55194-ec2_eip-required_together.yml diff --git a/changelogs/fragments/55194-ec2_eip-required_together.yml b/changelogs/fragments/55194-ec2_eip-required_together.yml new file mode 100644 index 00000000000..8b94a0b7826 --- /dev/null +++ b/changelogs/fragments/55194-ec2_eip-required_together.yml @@ -0,0 +1,2 @@ +minor_changes: + - In ec2_eip, device_id is required when private_ip_address is set, but the reverse is not true (https://github.com/ansible/ansible/pull/55194). diff --git a/lib/ansible/modules/cloud/amazon/ec2_eip.py b/lib/ansible/modules/cloud/amazon/ec2_eip.py index f8474d483cc..b1ad5eb0b32 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eip.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eip.py @@ -388,9 +388,9 @@ def main(): module = AnsibleModule( argument_spec=argument_spec, supports_check_mode=True, - required_together=[ - ['device_id', 'private_ip_address'], - ], + required_by={ + 'private_ip_address': ['device_id'], + }, ) if not HAS_BOTO: