diff --git a/lib/ansible/modules/cloud/amazon/elb_target_group.py b/lib/ansible/modules/cloud/amazon/elb_target_group.py index 0ca6b7f8f4a..f45ad152013 100644 --- a/lib/ansible/modules/cloud/amazon/elb_target_group.py +++ b/lib/ansible/modules/cloud/amazon/elb_target_group.py @@ -131,8 +131,8 @@ options: If the target type is ip, specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses. + - The default behavior is C(instance). required: false - default: instance choices: ['instance', 'ip', 'lambda'] version_added: 2.5 type: str @@ -821,7 +821,7 @@ def main(): state=dict(required=True, choices=['present', 'absent']), successful_response_codes=dict(), tags=dict(default={}, type='dict'), - target_type=dict(default='instance', choices=['instance', 'ip', 'lambda']), + target_type=dict(choices=['instance', 'ip', 'lambda']), targets=dict(type='list'), unhealthy_threshold_count=dict(type='int'), vpc_id=dict(), @@ -829,10 +829,15 @@ def main(): wait=dict(type='bool', default=False) ) - module = AnsibleAWSModule(argument_spec=argument_spec, required_if=[ - ['target_type', 'instance', ['protocol', 'port', 'vpc_id']], - ['target_type', 'ip', ['protocol', 'port', 'vpc_id']], - ]) + module = AnsibleAWSModule(argument_spec=argument_spec, + required_if=[ + ['target_type', 'instance', ['protocol', 'port', 'vpc_id']], + ['target_type', 'ip', ['protocol', 'port', 'vpc_id']], + ] + ) + + if module.params.get('target_type') is None: + module.params['target_type'] = 'instance' connection = module.client('elbv2')