Skip to content

Commit

Permalink
make health_check_protocol required if health_check_path or successfu…
Browse files Browse the repository at this point in the history
…l_response_codes is set

fixes: #29
  • Loading branch information
tremble committed Jul 14, 2022
1 parent 1f61cfb commit 9d913a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/29-elb_target_group-health_check_protocol.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- elb_target_group - instead of completely ignoring ``health_check_path`` and ``successful_response_codes`` if ``health_check_protocol`` is not supplied, now raises an error (https://github.com/ansible-collections/community.aws/issues/29).
17 changes: 10 additions & 7 deletions plugins/modules/elb_target_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,14 +931,17 @@ def main():
wait_timeout=dict(type='int', default=200),
wait=dict(type='bool', default=False)
)
required_by = dict(
health_check_path=['health_check_protocol'],
successful_response_codes=['health_check_protocol'],
)
required_if = [
['target_type', 'instance', ['protocol', 'port', 'vpc_id']],
['target_type', 'ip', ['protocol', 'port', 'vpc_id']],
['target_type', 'alb', ['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']],
['target_type', 'alb', ['protocol', 'port', 'vpc_id']],
]
)
module = AnsibleAWSModule(argument_spec=argument_spec, required_by=required_by, required_if=required_if)

if module.params.get('target_type') is None:
module.params['target_type'] = 'instance'
Expand Down

0 comments on commit 9d913a4

Please sign in to comment.