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: