elb_target_group - try to handle target_type default when state is absent (#65201)

* try to handle default when state is absent

* remove default target_type

* Update lib/ansible/modules/cloud/amazon/elb_target_group.py

Co-authored-by: Mark Chappell <mchappel@redhat.com>
pull/67406/head
Markus Bergholz 6 years ago committed by GitHub
parent a2c620819f
commit 69eec1c98f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 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). 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. You can't specify publicly routable IP addresses.
- The default behavior is C(instance).
required: false required: false
default: instance
choices: ['instance', 'ip', 'lambda'] choices: ['instance', 'ip', 'lambda']
version_added: 2.5 version_added: 2.5
type: str type: str
@ -821,7 +821,7 @@ def main():
state=dict(required=True, choices=['present', 'absent']), state=dict(required=True, choices=['present', 'absent']),
successful_response_codes=dict(), successful_response_codes=dict(),
tags=dict(default={}, type='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'), targets=dict(type='list'),
unhealthy_threshold_count=dict(type='int'), unhealthy_threshold_count=dict(type='int'),
vpc_id=dict(), vpc_id=dict(),
@ -829,10 +829,15 @@ def main():
wait=dict(type='bool', default=False) wait=dict(type='bool', default=False)
) )
module = AnsibleAWSModule(argument_spec=argument_spec, required_if=[ module = AnsibleAWSModule(argument_spec=argument_spec,
['target_type', 'instance', ['protocol', 'port', 'vpc_id']], required_if=[
['target_type', 'ip', ['protocol', 'port', 'vpc_id']], ['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') connection = module.client('elbv2')

Loading…
Cancel
Save