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>
This commit is contained in:
Markus Bergholz 2020-02-13 21:49:24 +01:00 committed by GitHub
parent a2c620819f
commit 69eec1c98f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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')