|
|
@ -241,7 +241,6 @@ try:
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
HAS_BOTO = False
|
|
|
|
HAS_BOTO = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_eni_info(interface):
|
|
|
|
def get_eni_info(interface):
|
|
|
|
|
|
|
|
|
|
|
|
# Private addresses
|
|
|
|
# Private addresses
|
|
|
@ -390,7 +389,10 @@ def modify_eni(connection, vpc_id, module, eni):
|
|
|
|
secondary_addresses_to_remove_count = current_secondary_address_count - secondary_private_ip_address_count
|
|
|
|
secondary_addresses_to_remove_count = current_secondary_address_count - secondary_private_ip_address_count
|
|
|
|
connection.unassign_private_ip_addresses(network_interface_id=eni.id, private_ip_addresses=current_secondary_addresses[:secondary_addresses_to_remove_count], dry_run=False)
|
|
|
|
connection.unassign_private_ip_addresses(network_interface_id=eni.id, private_ip_addresses=current_secondary_addresses[:secondary_addresses_to_remove_count], dry_run=False)
|
|
|
|
|
|
|
|
|
|
|
|
if attached == True and instance_id is not None:
|
|
|
|
if attached == True:
|
|
|
|
|
|
|
|
if eni.attachment and eni.attachment.instance_id != instance_id:
|
|
|
|
|
|
|
|
detach_eni(eni, module)
|
|
|
|
|
|
|
|
if eni.attachment is None:
|
|
|
|
eni.attach(instance_id, device_index)
|
|
|
|
eni.attach(instance_id, device_index)
|
|
|
|
wait_for_eni(eni, "attached")
|
|
|
|
wait_for_eni(eni, "attached")
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
@ -451,13 +453,20 @@ def find_eni(connection, module):
|
|
|
|
eni_id = module.params.get("eni_id")
|
|
|
|
eni_id = module.params.get("eni_id")
|
|
|
|
subnet_id = module.params.get('subnet_id')
|
|
|
|
subnet_id = module.params.get('subnet_id')
|
|
|
|
private_ip_address = module.params.get('private_ip_address')
|
|
|
|
private_ip_address = module.params.get('private_ip_address')
|
|
|
|
|
|
|
|
instance_id = module.params.get('instance_id')
|
|
|
|
|
|
|
|
device_index = module.params.get('device_index')
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
filters = {}
|
|
|
|
filters = {}
|
|
|
|
if private_ip_address:
|
|
|
|
|
|
|
|
filters['private-ip-address'] = private_ip_address
|
|
|
|
|
|
|
|
if subnet_id:
|
|
|
|
if subnet_id:
|
|
|
|
filters['subnet-id'] = subnet_id
|
|
|
|
filters['subnet-id'] = subnet_id
|
|
|
|
|
|
|
|
if private_ip_address:
|
|
|
|
|
|
|
|
filters['private-ip-address'] = private_ip_address
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if instance_id:
|
|
|
|
|
|
|
|
filters['attachment.instance-id'] = instance_id
|
|
|
|
|
|
|
|
if device_index:
|
|
|
|
|
|
|
|
filters['attachment.device-index'] = device_index
|
|
|
|
|
|
|
|
|
|
|
|
eni_result = connection.get_all_network_interfaces(eni_id, filters=filters)
|
|
|
|
eni_result = connection.get_all_network_interfaces(eni_id, filters=filters)
|
|
|
|
if len(eni_result) > 0:
|
|
|
|
if len(eni_result) > 0:
|
|
|
|