diff --git a/cloud/ec2 b/cloud/ec2 index 23ec3eabffd..1a75c00b68d 100644 --- a/cloud/ec2 +++ b/cloud/ec2 @@ -184,6 +184,12 @@ options: required: false default: null aliases: [] + source_dest_check: + version_added: "1.5" + description: + - Enable or Disable the Source/Destination checks (for NAT instances and Virtual Routers) + required: false + default: true state: version_added: "1.3" description: @@ -724,6 +730,7 @@ def create_instances(module, ec2, override_count=None): volumes = module.params.get('volumes') exact_count = module.params.get('exact_count') count_tag = module.params.get('count_tag') + source_dest_check = module.boolean(module.params.get('source_dest_check')) # group_id and group_name are exclusive of each other if group_id and group_name: @@ -876,6 +883,11 @@ def create_instances(module, ec2, override_count=None): for inst in this_res.instances: running_instances.append(inst) + # Enabled by default by Amazon + if not source_dest_check: + for inst in res.instances: + inst.modify_attribute('sourceDestCheck', False) + instance_dict_array = [] created_instance_ids = [] for inst in running_instances: @@ -1049,6 +1061,7 @@ def main(): private_ip = dict(), instance_profile_name = dict(), instance_ids = dict(type='list'), + source_dest_check = dict(type='bool', default=True), state = dict(default='present'), exact_count = dict(type='int', default=None), count_tag = dict(),