From 0efacbc49ec49d0a4b6e78df83146db293b50185 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Fri, 15 Jul 2022 14:13:22 +0200 Subject: [PATCH] make health_check_protocol required if health_check_path or successful_response_codes is set (#1354) elb_target_group make health_check_protocol required if health_check_path or successful_response_codes is set fixes: #29 SUMMARY health_check_path and successful_response_codes were previously silently dropped on the floor if health_check_protocol wasn't set. ISSUE TYPE Bugfix Pull Request COMPONENT NAME elb_target_group ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- elb_target_group.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/elb_target_group.py b/elb_target_group.py index c0a71c3c0e5..b8110ea0876 100644 --- a/elb_target_group.py +++ b/elb_target_group.py @@ -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'