From 3f81a65e53201218608143c88221e416584d8b3c Mon Sep 17 00:00:00 2001 From: Rob White Date: Wed, 30 Nov 2016 11:58:58 +1100 Subject: [PATCH] Fail if specifying an ENI as device but in_vpc is not true --- lib/ansible/modules/cloud/amazon/ec2_eip.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/ec2_eip.py b/lib/ansible/modules/cloud/amazon/ec2_eip.py index 04e6e1e1d7..7fa81eb761 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_eip.py +++ b/lib/ansible/modules/cloud/amazon/ec2_eip.py @@ -382,6 +382,8 @@ def main(): if device_id and device_id.startswith('i-'): is_instance = True elif device_id: + if device_id.startswith('eni-') and not in_vpc: + module.fail_json(msg="If you are specifying an ENI, in_vpc must be true") is_instance = False try: