From 8c2592932078c3188c3c9734e88055bbb436d78d Mon Sep 17 00:00:00 2001 From: mandar242 Date: Thu, 23 Jun 2022 13:11:45 -0700 Subject: [PATCH 01/16] Add health_check_name / name parameter support to naming health checks during creation --- plugins/modules/route53_health_check.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 5b7cce3c147..5615083018e 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -427,6 +427,9 @@ def main(): failure_threshold=dict(type='int', choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), tags=dict(type='dict', aliases=['resource_tags']), purge_tags=dict(type='bool'), + health_check_id=dict(type='str', aliases=['id'], required=False), + health_check_name=dict(type='str', aliases=['name'], required=False), + use_unique_names=dict(type='bool', default='False', required=False), ) args_one_of = [ @@ -498,8 +501,13 @@ def main(): else: changed, action = update_health_check(existing_check) if check_id: + tags = module.params.get('tags') + #add health_check_name to tags if provided + if module.params.get('health_check_name'): + tags['Name'] = module.params.get('health_check_name') + changed |= manage_tags(module, client, 'healthcheck', check_id, - module.params.get('tags'), module.params.get('purge_tags')) + tags, module.params.get('purge_tags')) health_check = describe_health_check(id=check_id) health_check['action'] = action From cdbae7a3720eb0ccf0aae0bb1452ddf0f33e35fe Mon Sep 17 00:00:00 2001 From: mandar242 Date: Thu, 23 Jun 2022 17:16:30 -0700 Subject: [PATCH 02/16] Handle create/update when health_check when name is unique identifier --- plugins/modules/route53_health_check.py | 51 +++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 5615083018e..cf123373c44 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -249,7 +249,6 @@ def find_health_check(ip_addr, fqdn, hc_type, request_interval, port): # Additionally, we can't properly wrap the paginator, so retrying means # starting from scratch with a paginator results = _list_health_checks() - while True: for check in results.get('HealthChecks'): config = check.get('HealthCheckConfig') @@ -268,6 +267,20 @@ def find_health_check(ip_addr, fqdn, hc_type, request_interval, port): return None +def get_existing_checks_with_name(): + results = _list_health_checks() + health_checks_with_name = {} + while True: + for check in results.get('HealthChecks'): + if 'Name' in describe_health_check(check['Id'])['tags']: + check_name = describe_health_check(check['Id'])['tags']['Name'] + health_checks_with_name[check_name] = check + if results.get('IsTruncated', False): + results = _list_health_checks(Marker=results.get('NextMarker')) + else: + return health_checks_with_name + + def delete_health_check(check_id): if not check_id: return False, None @@ -352,7 +365,6 @@ def update_health_check(existing_check): # FullyQualifiedDomainName, however, because we use these in lieu of a # 'Name' to uniquely identify the health check this isn't currently # supported. If we accepted an ID it would be possible to modify them. - changes = dict() existing_config = existing_check.get('HealthCheckConfig') @@ -375,7 +387,6 @@ def update_health_check(existing_check): # No changes... if not changes: return False, None - if module.check_mode: return True, 'update' @@ -467,6 +478,7 @@ def main(): string_match_in = module.params.get('string_match') request_interval_in = module.params.get('request_interval') failure_threshold_in = module.params.get('failure_threshold') + health_check_name = module.params.get('health_check_name') # Default port if port_in is None: @@ -481,6 +493,9 @@ def main(): if len(string_match_in) > 255: module.fail_json(msg="parameter 'string_match' is limited to 255 characters max") + if module.params.get('use_unique_names') and not health_check_name: + module.fail_json(msg="parameter 'health_check_name' or 'name' is required when 'use_unique_names' set to true.") + client = module.client('route53', retry_decorator=AWSRetry.jittered_backoff()) changed = False @@ -492,19 +507,41 @@ def main(): if existing_check: check_id = existing_check.get('Id') + # Delete Health Check if state_in == 'absent': changed, action = delete_health_check(check_id) check_id = None + # Create Health Check elif state_in == 'present': if existing_check is None: changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) + if check_id: + if health_check_name: + name_tag = {} + name_tag['Name'] = health_check_name + changed |= manage_tags(module, client, 'healthcheck', check_id, + name_tag, module.params.get('purge_tags')) + # Update Health Check else: - changed, action = update_health_check(existing_check) + # Update when health_check_name is a unique identifier + if module.params.get('use_unique_names'): + existing_checks_with_name = get_existing_checks_with_name() + if health_check_name in existing_checks_with_name: + changed, action = update_health_check(existing_checks_with_name[health_check_name]) + else: + changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) + # Add tags + if check_id: + tags = module.params.get('tags') + if health_check_name: + tags['Name'] = health_check_name + changed |= manage_tags(module, client, 'healthcheck', check_id, + tags, module.params.get('purge_tags')) + else: + changed, action = update_health_check(existing_check) + if check_id: tags = module.params.get('tags') - #add health_check_name to tags if provided - if module.params.get('health_check_name'): - tags['Name'] = module.params.get('health_check_name') changed |= manage_tags(module, client, 'healthcheck', check_id, tags, module.params.get('purge_tags')) From 0f21134c3379f90f03f392907353b38d34feacbe Mon Sep 17 00:00:00 2001 From: mandar242 Date: Thu, 23 Jun 2022 17:25:59 -0700 Subject: [PATCH 03/16] Sanity fixes --- plugins/modules/route53_health_check.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index cf123373c44..e73e3e55d1e 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -86,6 +86,24 @@ - Will default to C(3) if not specified on creation. choices: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] type: int + health_check_name: + description: + - To be added + type: str + required: False + aliases: ['name'] + use_unique_names: + description: + - To be added + type: bool + required: False + default: False + health_check_id: + description: + - To be added + type: str + required: False + aliases: ['id'] author: - "zimbatm (@zimbatm)" notes: From 022e7a9dca296828235abf5488914fc3832b017d Mon Sep 17 00:00:00 2001 From: mandar242 Date: Mon, 27 Jun 2022 14:16:55 -0700 Subject: [PATCH 04/16] Fix bug: tags not specified but name is specified resulting in python error --- plugins/modules/route53_health_check.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index e73e3e55d1e..78ff9f98757 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -541,18 +541,21 @@ def main(): name_tag, module.params.get('purge_tags')) # Update Health Check else: - # Update when health_check_name is a unique identifier + # If health_check_name is a unique identifier if module.params.get('use_unique_names'): existing_checks_with_name = get_existing_checks_with_name() + # update the health_check if another health check with same name exists if health_check_name in existing_checks_with_name: changed, action = update_health_check(existing_checks_with_name[health_check_name]) else: + # create a new health_check if another health check with same name does not exists changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) - # Add tags + # Add tags to add name to health check if check_id: tags = module.params.get('tags') - if health_check_name: - tags['Name'] = health_check_name + if not tags: + tags = {} + tags['Name'] = health_check_name changed |= manage_tags(module, client, 'healthcheck', check_id, tags, module.params.get('purge_tags')) else: From 851f890efe3976dfa66a21be2a848ee867dd4504 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Mon, 27 Jun 2022 14:50:03 -0700 Subject: [PATCH 05/16] Add integration tests for as unique identifier --- .../route53_health_check/defaults/main.yml | 2 + .../tasks/create_multiple_health_checks.yml | 137 ++++++++++++++++++ .../route53_health_check/tasks/main.yml | 3 + 3 files changed, 142 insertions(+) create mode 100644 tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml diff --git a/tests/integration/targets/route53_health_check/defaults/main.yml b/tests/integration/targets/route53_health_check/defaults/main.yml index 3763717e6d0..d07964d8534 100644 --- a/tests/integration/targets/route53_health_check/defaults/main.yml +++ b/tests/integration/targets/route53_health_check/defaults/main.yml @@ -27,7 +27,9 @@ failure_threshold_updated: 1 # for string_match we need an _STR_MATCH type type_https_match: 'HTTPS_STR_MATCH' type_http_match: 'HTTP_STR_MATCH' +type_http: 'HTTP' resource_path: '/health.php' +resource_path_1: '/new-health.php' resource_path_updated: '/healthz' string_match: 'Hello' string_match_updated: 'Hello World' diff --git a/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml new file mode 100644 index 00000000000..57908775aee --- /dev/null +++ b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml @@ -0,0 +1,137 @@ +--- +- block: + - name: 'Create multiple HTTP health checks with different resource_path - check_mode' + route53_health_check: + state: present + name: '{{ tiny_prefix }}-{{ item }}-test-hc-delete-if-found' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ item }}' + use_unique_names: true + register: create_check + check_mode: true + with_items: + - '{{ resource_path }}' + - '{{ resource_path_1 }}' + + - name: 'Check result - Create a HTTP health check - check_mode' + assert: + that: + - create_check is not failed + - create_check is changed + - '"route53:CreateHealthChecks" not in create_check.results[0].resource_actions' + - '"route53:CreateHealthChecks" not in create_check.results[1].resource_actions' + + - name: 'Create multiple HTTP health checks with different resource_path' + route53_health_check: + state: present + name: '{{ tiny_prefix }}-{{ item }}-test-hc-delete-if-found' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ item }}' + use_unique_names: true + register: create_result + with_items: + - '{{ resource_path }}' + - '{{ resource_path_1 }}' + + - name: Get ID's for health_checks created in above task + set_fact: + health_check_1_id: "{{ create_result.results[0].health_check.id }}" + health_check_2_id: "{{ create_result.results[1].health_check.id }}" + + - name: Get health_check 1 info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_1_id }}" + health_check_method: details + register: health_check_1_info + + - name: Get health_check 2 info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_2_id }}" + health_check_method: details + register: health_check_2_info + + - name: 'Check result - Create multiple HTTP health check' + assert: + that: + - create_result is not failed + - create_result is changed + - '"route53:UpdateHealthCheck" not in create_result.results[0].resource_actions' + - '"route53:UpdateHealthCheck" not in create_result.results[1].resource_actions' + - health_check_1_id != health_check_2_id + - health_check_1_info.HealthCheck.HealthCheckConfig.ResourcePath == '{{ resource_path }}' + - health_check_2_info.HealthCheck.HealthCheckConfig.ResourcePath == '{{ resource_path_1 }}' + + - name: 'Create multiple HTTP health checks with different resource_path - idempotency - check_mode' + route53_health_check: + state: present + name: '{{ tiny_prefix }}-{{ item }}-test-hc-delete-if-found' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ item }}' + use_unique_names: true + register: create_idem_check + check_mode: true + with_items: + - '{{ resource_path }}' + - '{{ resource_path_1 }}' + + - name: 'Check result - Create multiple HTTP health check - idempotency - check_mode' + assert: + that: + - create_idem_check is not failed + - create_idem_check is not changed + - '"route53:CreateHealthCheck" not in create_idem_check.results[0].resource_actions' + - '"route53:CreateHealthCheck" not in create_idem_check.results[1].resource_actions' + - '"route53:UpdateHealthCheck" not in create_idem_check.results[0].resource_actions' + - '"route53:UpdateHealthCheck" not in create_idem_check.results[1].resource_actions' + + - name: 'Create multiple HTTP health checks with different resource_path - idempotency' + route53_health_check: + state: present + name: '{{ tiny_prefix }}-{{ item }}-test-hc-delete-if-found' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ item }}' + use_unique_names: true + register: create_idem + check_mode: true + with_items: + - '{{ resource_path }}' + - '{{ resource_path_1 }}' + + - debug: + var: create_idem + + - name: 'Check result - Create multiple HTTP health check - idempotency - check_mode' + assert: + that: + - create_idem is not failed + - create_idem is not changed + - '"route53:CreateHealthCheck" not in create_idem.results[0].resource_actions' + - '"route53:CreateHealthCheck" not in create_idem.results[1].resource_actions' + - '"route53:UpdateHealthCheck" not in create_idem.results[0].resource_actions' + - '"route53:UpdateHealthCheck" not in create_idem.results[1].resource_actions' + + always: + # Cleanup starts here + - name: 'Delete multiple HTTP health checks with different resource_path' + route53_health_check: + state: absent + name: '{{ tiny_prefix }}-{{ item }}-test-hc-delete-if-found' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ item }}' + use_unique_names: true + register: delete_result + with_items: + - '{{ resource_path }}' + - '{{ resource_path_1 }}' diff --git a/tests/integration/targets/route53_health_check/tasks/main.yml b/tests/integration/targets/route53_health_check/tasks/main.yml index 426a0461703..7a67d1a0b9d 100644 --- a/tests/integration/targets/route53_health_check/tasks/main.yml +++ b/tests/integration/targets/route53_health_check/tasks/main.yml @@ -32,6 +32,9 @@ - set_fact: ip_address: '{{ eip.public_ip }}' + - name: Run tests for creating multiple health checks with name as unique identifier + include_tasks: create_multiple_health_checks.yml + # Minimum possible definition - name: 'Create a TCP health check - check_mode' route53_health_check: From 88713f556ee4c58d3fdaa5f7fcbdac7aeef8f7e8 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Tue, 28 Jun 2022 09:58:08 -0700 Subject: [PATCH 06/16] code cleanup to remove redundant usage of manage_tags --- plugins/modules/route53_health_check.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 78ff9f98757..f05365ddff6 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -497,6 +497,7 @@ def main(): request_interval_in = module.params.get('request_interval') failure_threshold_in = module.params.get('failure_threshold') health_check_name = module.params.get('health_check_name') + tags = module.params.get('tags') # Default port if port_in is None: @@ -529,16 +530,12 @@ def main(): if state_in == 'absent': changed, action = delete_health_check(check_id) check_id = None + # Create Health Check elif state_in == 'present': - if existing_check is None: + if existing_check is None and not module.params.get('use_unique_names'): changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) - if check_id: - if health_check_name: - name_tag = {} - name_tag['Name'] = health_check_name - changed |= manage_tags(module, client, 'healthcheck', check_id, - name_tag, module.params.get('purge_tags')) + # Update Health Check else: # If health_check_name is a unique identifier @@ -550,20 +547,16 @@ def main(): else: # create a new health_check if another health check with same name does not exists changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) - # Add tags to add name to health check + # Add tag to add name to health check if check_id: - tags = module.params.get('tags') if not tags: tags = {} tags['Name'] = health_check_name - changed |= manage_tags(module, client, 'healthcheck', check_id, - tags, module.params.get('purge_tags')) + else: changed, action = update_health_check(existing_check) if check_id: - tags = module.params.get('tags') - changed |= manage_tags(module, client, 'healthcheck', check_id, tags, module.params.get('purge_tags')) From 7d4be9d373d362f3aa5370c41b84b0b7caa223a0 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Tue, 28 Jun 2022 17:11:37 -0700 Subject: [PATCH 07/16] Feat: ability to Update and Delete health checks by ID --- plugins/modules/route53_health_check.py | 69 +++++++++++++++++++++---- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index f05365ddff6..2e237797931 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -142,6 +142,22 @@ community.aws.route53_health_check: state: absent fqdn: host1.example.com + +- name: Update Health check by ID - update ip_address + route53_health_check: + id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx + ip_address: 1.2.3.4 + +- name: Update Health check by ID - update port + route53_health_check: + id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx + ip_address: 8080 + +- name: Delete Health check by ID + route53_health_check: + state: absent + id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx + ''' RETURN = r''' @@ -379,10 +395,15 @@ def create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_ def update_health_check(existing_check): - # In theory it's also possible to update the IPAddress, Port and - # FullyQualifiedDomainName, however, because we use these in lieu of a - # 'Name' to uniquely identify the health check this isn't currently - # supported. If we accepted an ID it would be possible to modify them. + # It's possible to update following parameters + # - ResourcePath + # - SearchString + # - FailureThreshold + # - Disabled + # - IPAddress + # - Port + # - FullyQualifiedDomainName + changes = dict() existing_config = existing_check.get('HealthCheckConfig') @@ -402,6 +423,20 @@ def update_health_check(existing_check): if disabled is not None and disabled != existing_config.get('Disabled'): changes['Disabled'] = module.params.get('disabled') + # If updating based on Health Check ID, we can update + if module.params.get('health_check_id'): + ip_address = module.params.get('ip_address', None) + if ip_address is not None and ip_address != existing_config.get('IPAddress'): + changes['IPAddress'] = module.params.get('ip_address') + + port = module.params.get('port', None) + if port is not None and port != existing_config.get('Port'): + changes['Port'] = module.params.get('port') + + fqdn = module.params.get('fqdn', None) + if fqdn is not None and fqdn != existing_config.get('FullyQualifiedDomainName'): + changes['FullyQualifiedDomainName'] = module.params.get('fqdn') + # No changes... if not changes: return False, None @@ -448,7 +483,7 @@ def main(): disabled=dict(type='bool'), ip_address=dict(), port=dict(type='int'), - type=dict(required=True, choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), + type=dict(choices=['HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP']), resource_path=dict(), fqdn=dict(), string_match=dict(), @@ -462,7 +497,7 @@ def main(): ) args_one_of = [ - ['ip_address', 'fqdn'], + ['ip_address', 'fqdn', 'id'], ] args_if = [ @@ -487,6 +522,9 @@ def main(): version='5.0.0', collection_name='community.aws') module.params['purge_tags'] = False + if not module.params.get('health_check_id') and not module.params.get('type'): + module.fail_json(msg="parameter 'type' is required if not updating or deleting health check by ID.") + state_in = module.params.get('state') ip_addr_in = module.params.get('ip_address') port_in = module.params.get('port') @@ -526,14 +564,24 @@ def main(): if existing_check: check_id = existing_check.get('Id') + # If update or delete Health Check based on ID + update_delete_by_id = False + if module.params.get('health_check_id'): + update_delete_by_id = True + id_to_update_delete = module.params.get('health_check_id') + existing_check = client.get_health_check(HealthCheckId=id_to_update_delete)['HealthCheck'] + # Delete Health Check if state_in == 'absent': - changed, action = delete_health_check(check_id) + if update_delete_by_id: + changed, action = delete_health_check(id_to_update_delete) + else: + changed, action = delete_health_check(check_id) check_id = None # Create Health Check elif state_in == 'present': - if existing_check is None and not module.params.get('use_unique_names'): + if existing_check is None and not module.params.get('use_unique_names') and not update_delete_by_id: changed, action, check_id = create_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) # Update Health Check @@ -554,7 +602,10 @@ def main(): tags['Name'] = health_check_name else: - changed, action = update_health_check(existing_check) + if update_delete_by_id: + changed, action = update_health_check(existing_check) + else: + changed, action = update_health_check(existing_check) if check_id: changed |= manage_tags(module, client, 'healthcheck', check_id, From 5512b4f8a529c7403487963de5ab3410c7c32605 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Wed, 29 Jun 2022 09:37:35 -0700 Subject: [PATCH 08/16] Sanity fixes --- plugins/modules/route53_health_check.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 2e237797931..b31cfee2f57 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -44,7 +44,6 @@ description: - The type of health check that you want to create, which indicates how Amazon Route 53 determines whether an endpoint is healthy. - required: true choices: [ 'HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP' ] type: str resource_path: @@ -497,7 +496,7 @@ def main(): ) args_one_of = [ - ['ip_address', 'fqdn', 'id'], + ['ip_address', 'fqdn', 'health_check_id'], ] args_if = [ From c3a20a5661a6cf7a66d84463434597bfd7b55d24 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 30 Jun 2022 13:42:10 -0700 Subject: [PATCH 09/16] Add integration tests for testing update/delete health check by ID --- plugins/modules/route53_health_check.py | 5 +- .../route53_health_check/defaults/main.yml | 1 + .../tasks/create_multiple_health_checks.yml | 4 +- .../route53_health_check/tasks/main.yml | 3 + .../tasks/update_delete_by_id.yml | 223 ++++++++++++++++++ 5 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index b31cfee2f57..24ff9ab63b3 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -568,7 +568,10 @@ def main(): if module.params.get('health_check_id'): update_delete_by_id = True id_to_update_delete = module.params.get('health_check_id') - existing_check = client.get_health_check(HealthCheckId=id_to_update_delete)['HealthCheck'] + try: + existing_check = client.get_health_check(HealthCheckId=id_to_update_delete)['HealthCheck'] + except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e: + module.exit_json(changed=False, msg='The specified health check with ID: {0} does not exist'.format(id_to_update_delete)) # Delete Health Check if state_in == 'absent': diff --git a/tests/integration/targets/route53_health_check/defaults/main.yml b/tests/integration/targets/route53_health_check/defaults/main.yml index d07964d8534..769e5079d1b 100644 --- a/tests/integration/targets/route53_health_check/defaults/main.yml +++ b/tests/integration/targets/route53_health_check/defaults/main.yml @@ -11,6 +11,7 @@ #ip_address: We allocate an EIP due to route53 restrictions fqdn: '{{ tiny_prefix }}.route53-health.ansible.test' +fqdn_1: '{{ tiny_prefix }}-1.route53-health.ansible.test' port: 8080 type: 'TCP' request_interval: 30 diff --git a/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml index 57908775aee..628d8e8276c 100644 --- a/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml +++ b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml @@ -20,8 +20,8 @@ that: - create_check is not failed - create_check is changed - - '"route53:CreateHealthChecks" not in create_check.results[0].resource_actions' - - '"route53:CreateHealthChecks" not in create_check.results[1].resource_actions' + - '"route53:CreateHealthCheck" not in create_check.results[0].resource_actions' + - '"route53:CreateHealthCheck" not in create_check.results[1].resource_actions' - name: 'Create multiple HTTP health checks with different resource_path' route53_health_check: diff --git a/tests/integration/targets/route53_health_check/tasks/main.yml b/tests/integration/targets/route53_health_check/tasks/main.yml index 7a67d1a0b9d..ff8f41906a0 100644 --- a/tests/integration/targets/route53_health_check/tasks/main.yml +++ b/tests/integration/targets/route53_health_check/tasks/main.yml @@ -35,6 +35,9 @@ - name: Run tests for creating multiple health checks with name as unique identifier include_tasks: create_multiple_health_checks.yml + - name: Run tests for update and delete health check by ID + include_tasks: update_delete_by_id.yml + # Minimum possible definition - name: 'Create a TCP health check - check_mode' route53_health_check: diff --git a/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml new file mode 100644 index 00000000000..eb9595e481e --- /dev/null +++ b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml @@ -0,0 +1,223 @@ +--- +- block: + - name: 'Create HTTP health check for use in this test' + route53_health_check: + state: present + name: '{{ tiny_prefix }}-test-update-delete-by-id' + ip_address: '{{ ip_address }}' + port: '{{ port }}' + type: '{{ type_http }}' + resource_path: '{{ resource_path }}' + use_unique_names: true + register: create_result + + - name: 'Check result - Create HTTP health check' + assert: + that: + - create_result is not failed + - create_result is changed + - '"route53:CreateHealthCheck" in create_result.resource_actions' + + - name: Get ID for health_checks created in above task + set_fact: + health_check_id: "{{ create_result.health_check.id }}" + + - name: Get health_check info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_id }}" + health_check_method: details + register: health_check_info + + # Update Health Check by ID Tests + - name: 'Update Health Check by ID - Update Port - check_mode' + route53_health_check: + id: "{{ health_check_id }}" + port: 8888 + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check Port - check_mode' + assert: + that: + - update_result is not failed + - update_result is changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by ID - Update Port' + route53_health_check: + id: "{{ health_check_id }}" + port: 8888 + register: update_result + + - name: Get health_check info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_id }}" + health_check_method: details + register: health_check_info + + - name: 'Check result - Update Health Check Port' + assert: + that: + - update_result is not failed + - update_result is changed + - health_check_info.HealthCheck.HealthCheckConfig.Port == 8888 + + + - name: 'Update Health Check by ID - Update Port - idempotency - check_mode' + route53_health_check: + id: "{{ health_check_id }}" + port: 8888 + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check Port - idempotency - check_mode' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by ID - Update Port - idempotency' + route53_health_check: + id: "{{ health_check_id }}" + port: 8888 + register: update_result + + - name: 'Check result - Update Health Check Port - idempotency' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + ## + - name: 'Update Health Check by ID - Update IP address and FQDN - check_mode' + route53_health_check: + id: "{{ health_check_id }}" + ip_address: 1.2.3.4 + fqdn: '{{ fqdn_1 }}' + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check IP address and FQDN - check_mode' + assert: + that: + - update_result is not failed + - update_result is changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by ID - Update IP address and FQDN' + route53_health_check: + id: "{{ health_check_id }}" + ip_address: 1.2.3.4 + fqdn: '{{ fqdn_1 }}' + register: update_result + + - name: Get health_check info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_id }}" + health_check_method: details + register: health_check_info + + - name: 'Check result - Update Health Check IP address and FQDN' + assert: + that: + - update_result is not failed + - update_result is changed + - health_check_info.HealthCheck.HealthCheckConfig.IPAddress == '1.2.3.4' + - health_check_info.HealthCheck.HealthCheckConfig.FullyQualifiedDomainName == "{{ fqdn_1 }}" + + + - name: 'Update Health Check by ID - Update IP address and FQDN - idempotency - check_mode' + route53_health_check: + id: "{{ health_check_id }}" + ip_address: 1.2.3.4 + fqdn: '{{ fqdn_1 }}' + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check IP address and FQDN - idempotency - check_mode' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by ID - Update IP address and FQDN - idempotency' + route53_health_check: + id: "{{ health_check_id }}" + ip_address: 1.2.3.4 + fqdn: '{{ fqdn_1 }}' + register: update_result + + - name: 'Check result - Update Health Check IP address and FQDN - idempotency' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + # Delete Health Check by ID Tests + - name: Delete Health check by ID - check_mode + route53_health_check: + state: absent + id: "{{ health_check_id }}" + register: delete_result + check_mode: true + + - name: 'Check result - Delete Health Check by ID -check_mode' + assert: + that: + - delete_result is not failed + - delete_result is changed + - '"route53:DeleteHealthCheck" not in delete_result.resource_actions' + + - name: Delete Health check by ID + route53_health_check: + state: absent + id: "{{ health_check_id }}" + register: delete_result + + - name: 'Check result - Delete Health Check by ID' + assert: + that: + - delete_result is not failed + - delete_result is changed + - '"route53:DeleteHealthCheck" in delete_result.resource_actions' + + - name: Delete Health check by ID - idempotency - check_mode + route53_health_check: + state: absent + id: "{{ health_check_id }}" + register: delete_result + check_mode: true + + - name: 'Check result - Delete Health Check by ID -idempotency -check_mode' + assert: + that: + - delete_result is not failed + - delete_result is not changed + - '"route53:DeleteHealthCheck" not in delete_result.resource_actions' + + - name: Delete Health check by ID - idempotency + route53_health_check: + state: absent + id: "{{ health_check_id }}" + register: delete_result + + - name: 'Check result - Delete Health Check by ID -idempotency' + assert: + that: + - delete_result is not failed + - delete_result is not changed + - '"route53:DeleteHealthCheck" not in delete_result.resource_actions' + + # cleanup + always: + - name: Delete Health check by ID + route53_health_check: + state: absent + id: "{{ health_check_id }}" \ No newline at end of file From afeca55e497224b92807cfc0beb4b57905adb65f Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 30 Jun 2022 14:11:35 -0700 Subject: [PATCH 10/16] Minor fix, improve login to handle find_health_check() call --- plugins/modules/route53_health_check.py | 9 ++++----- .../tasks/create_multiple_health_checks.yml | 3 --- .../route53_health_check/tasks/update_delete_by_id.yml | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 24ff9ab63b3..91ff2ba7d22 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -558,11 +558,6 @@ def main(): action = None check_id = None - existing_check = find_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) - - if existing_check: - check_id = existing_check.get('Id') - # If update or delete Health Check based on ID update_delete_by_id = False if module.params.get('health_check_id'): @@ -572,6 +567,10 @@ def main(): existing_check = client.get_health_check(HealthCheckId=id_to_update_delete)['HealthCheck'] except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e: module.exit_json(changed=False, msg='The specified health check with ID: {0} does not exist'.format(id_to_update_delete)) + else: + existing_check = find_health_check(ip_addr_in, fqdn_in, type_in, request_interval_in, port_in) + if existing_check: + check_id = existing_check.get('Id') # Delete Health Check if state_in == 'absent': diff --git a/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml index 628d8e8276c..41713673d67 100644 --- a/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml +++ b/tests/integration/targets/route53_health_check/tasks/create_multiple_health_checks.yml @@ -107,9 +107,6 @@ - '{{ resource_path }}' - '{{ resource_path_1 }}' - - debug: - var: create_idem - - name: 'Check result - Create multiple HTTP health check - idempotency - check_mode' assert: that: diff --git a/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml index eb9595e481e..7d7ca93d5b7 100644 --- a/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml +++ b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml @@ -220,4 +220,4 @@ - name: Delete Health check by ID route53_health_check: state: absent - id: "{{ health_check_id }}" \ No newline at end of file + id: "{{ health_check_id }}" From 25ef465c4b00e94185379f047cce997c1e558850 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 30 Jun 2022 14:20:38 -0700 Subject: [PATCH 11/16] Use required_together param --- plugins/modules/route53_health_check.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 91ff2ba7d22..1090f6305d1 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -492,7 +492,7 @@ def main(): purge_tags=dict(type='bool'), health_check_id=dict(type='str', aliases=['id'], required=False), health_check_name=dict(type='str', aliases=['name'], required=False), - use_unique_names=dict(type='bool', default='False', required=False), + use_unique_names=dict(type='bool', required=False), ) args_one_of = [ @@ -503,6 +503,10 @@ def main(): ['type', 'TCP', ('port',)], ] + args_required_together = [ + ['use_unique_names', 'health_check_name'], + ] + global module global client @@ -510,6 +514,7 @@ def main(): argument_spec=argument_spec, required_one_of=args_one_of, required_if=args_if, + required_together=args_required_together, supports_check_mode=True, ) @@ -549,9 +554,6 @@ def main(): if len(string_match_in) > 255: module.fail_json(msg="parameter 'string_match' is limited to 255 characters max") - if module.params.get('use_unique_names') and not health_check_name: - module.fail_json(msg="parameter 'health_check_name' or 'name' is required when 'use_unique_names' set to true.") - client = module.client('route53', retry_decorator=AWSRetry.jittered_backoff()) changed = False From 2c0568061b9e50b295be651bb9c167d2ab439da9 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Thu, 30 Jun 2022 14:57:47 -0700 Subject: [PATCH 12/16] Sanity fixes, add documentation --- plugins/modules/route53_health_check.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 1090f6305d1..e76cd1fca05 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -87,19 +87,20 @@ type: int health_check_name: description: - - To be added + - Name of the Health Check. + - Used together with I(use_unique_names) to set/make use of I(health_check_name) as a unique identifier. type: str required: False aliases: ['name'] use_unique_names: description: - - To be added + - Used together with I(health_check_name) to set/make use of I(health_check_name) as a unique identifier. type: bool required: False - default: False health_check_id: description: - - To be added + - ID of the health check to be update or deleted. + - If provided, a health check can be updated or deleted based on the ID as unique identifier. type: str required: False aliases: ['id'] @@ -504,7 +505,7 @@ def main(): ] args_required_together = [ - ['use_unique_names', 'health_check_name'], + ['use_unique_names', 'health_check_name'], ] global module From ad51fc7e019a9bc26d99add17827999e749fd4b1 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 1 Jul 2022 08:53:01 -0700 Subject: [PATCH 13/16] Modified based on feedback --- plugins/modules/route53_health_check.py | 29 ++++++- .../tasks/update_delete_by_id.yml | 80 +++++++++++++++++++ 2 files changed, 107 insertions(+), 2 deletions(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index e76cd1fca05..4495259f566 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -44,6 +44,7 @@ description: - The type of health check that you want to create, which indicates how Amazon Route 53 determines whether an endpoint is healthy. + - Once health_check is created, type can not be changed. choices: [ 'HTTP', 'HTTPS', 'HTTP_STR_MATCH', 'HTTPS_STR_MATCH', 'TCP' ] type: str resource_path: @@ -92,11 +93,13 @@ type: str required: False aliases: ['name'] + version_added: 4.1.0 use_unique_names: description: - Used together with I(health_check_name) to set/make use of I(health_check_name) as a unique identifier. type: bool required: False + version_added: 4.1.0 health_check_id: description: - ID of the health check to be update or deleted. @@ -104,6 +107,7 @@ type: str required: False aliases: ['id'] + version_added:4.1.0 author: - "zimbatm (@zimbatm)" notes: @@ -138,6 +142,15 @@ weight: 100 health_check: "{{ my_health_check.health_check.id }}" +- name: create a simple health check with health_check_name as unique identifier + route53_health_check: + state: present + health_check_name: ansible + fqdn: ansible.com + port: 443 + type: HTTPS + use_unique_names: true + - name: Delete health-check community.aws.route53_health_check: state: absent @@ -423,8 +436,8 @@ def update_health_check(existing_check): if disabled is not None and disabled != existing_config.get('Disabled'): changes['Disabled'] = module.params.get('disabled') - # If updating based on Health Check ID, we can update - if module.params.get('health_check_id'): + # If updating based on Health Check ID or health_check_name, we can update + if module.params.get('health_check_id') or module.params.get('use_unique_names'): ip_address = module.params.get('ip_address', None) if ip_address is not None and ip_address != existing_config.get('IPAddress'): changes['IPAddress'] = module.params.get('ip_address') @@ -508,6 +521,10 @@ def main(): ['use_unique_names', 'health_check_name'], ] + args_mutually_exclusive = [ + ['health_check_id', 'health_check_name'] + ] + global module global client @@ -516,6 +533,7 @@ def main(): required_one_of=args_one_of, required_if=args_if, required_together=args_required_together, + mutually_exclusive=args_mutually_exclusive, supports_check_mode=True, ) @@ -561,6 +579,13 @@ def main(): action = None check_id = None + if module.params.get('use_unique_names') or module.params.get('health_check_id'): + module.deprecate( + 'The health_check_name is currently non required parameter.' + ' This behavior will change and health_check_name ' + ' will change to required=True and use_unique_names will change to default=True in release 6.0.0.', + version='6.0.0', collection_name='community.aws') + # If update or delete Health Check based on ID update_delete_by_id = False if module.params.get('health_check_id'): diff --git a/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml index 7d7ca93d5b7..8bb4fb870f9 100644 --- a/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml +++ b/tests/integration/targets/route53_health_check/tasks/update_delete_by_id.yml @@ -8,6 +8,7 @@ port: '{{ port }}' type: '{{ type_http }}' resource_path: '{{ resource_path }}' + fqdn: '{{ fqdn }}' use_unique_names: true register: create_result @@ -160,6 +161,85 @@ - update_result is not changed - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + # Update Health Check (Port) by name + + - name: 'Update Health Check by name - Update Port - check_mode' + route53_health_check: + state: present + port: 8080 + type: '{{ type_http }}' + fqdn: '{{ fqdn }}' + health_check_name: '{{ tiny_prefix }}-test-update-delete-by-id' + use_unique_names: true + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check Port - check_mode' + assert: + that: + - update_result is not failed + - update_result is changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by name - Update Port' + route53_health_check: + state: present + port: 8080 + type: '{{ type_http }}' + fqdn: '{{ fqdn }}' + health_check_name: '{{ tiny_prefix }}-test-update-delete-by-id' + use_unique_names: true + register: update_result + + - name: Get health_check info + community.aws.route53_info: + query: health_check + health_check_id: "{{ health_check_id }}" + health_check_method: details + register: health_check_info + + - name: 'Check result - Update Health Check Port' + assert: + that: + - update_result is not failed + - update_result is changed + - health_check_info.HealthCheck.HealthCheckConfig.Port == 8080 + + - name: 'Update Health Check by name - Update Port - idempotency - check_mode' + route53_health_check: + state: present + port: 8080 + type: '{{ type_http }}' + fqdn: '{{ fqdn }}' + health_check_name: '{{ tiny_prefix }}-test-update-delete-by-id' + use_unique_names: true + register: update_result + check_mode: true + + - name: 'Check result - Update Health Check Port - idempotency - check_mode' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + + - name: 'Update Health Check by name - Update Port - idempotency' + route53_health_check: + state: present + port: 8080 + type: '{{ type_http }}' + fqdn: '{{ fqdn }}' + health_check_name: '{{ tiny_prefix }}-test-update-delete-by-id' + use_unique_names: true + register: update_result + + - name: 'Check result - Update Health Check Port - idempotency' + assert: + that: + - update_result is not failed + - update_result is not changed + - '"route53:UpdateHealthCheck" not in update_result.resource_actions' + # Delete Health Check by ID Tests - name: Delete Health check by ID - check_mode route53_health_check: From b47618e96759a64fdbbfc46e007f56a4e1af637c Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 1 Jul 2022 09:18:11 -0700 Subject: [PATCH 14/16] Sanity fixes --- plugins/modules/route53_health_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 4495259f566..5eee6716ad6 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -107,7 +107,7 @@ type: str required: False aliases: ['id'] - version_added:4.1.0 + version_added: 4.1.0 author: - "zimbatm (@zimbatm)" notes: From 79e2aa619fcda957189ad23be664d8e06d14d190 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 1 Jul 2022 12:27:48 -0700 Subject: [PATCH 15/16] Added changelogs fragment --- .../1143-route53_health_check-update-delete-by-id-and-name.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml diff --git a/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml b/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml new file mode 100644 index 00000000000..dad8f072067 --- /dev/null +++ b/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml @@ -0,0 +1,3 @@ +minor_changes: + - route53_health_check - Added new parameter `health_check_id` with alias `id` to allow update and delete health check by ID. (https://github.com/ansible-collections/community.aws/pull/1143) + - route53_health_check - Added new parameter `use_unique_names` used with new parameter `health_check_name` with alias `name` to set health check name as unique identifier. (https://github.com/ansible-collections/community.aws/pull/1143) From 9620848deffcdf93184fe3bfe66c71a4d35f662c Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 5 Jul 2022 12:24:21 -0700 Subject: [PATCH 16/16] use fqdn for examples, fix changelog variable names --- ...-route53_health_check-update-delete-by-id-and-name.yml | 4 ++-- plugins/modules/route53_health_check.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml b/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml index dad8f072067..645d6c181ce 100644 --- a/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml +++ b/changelogs/fragments/1143-route53_health_check-update-delete-by-id-and-name.yml @@ -1,3 +1,3 @@ minor_changes: - - route53_health_check - Added new parameter `health_check_id` with alias `id` to allow update and delete health check by ID. (https://github.com/ansible-collections/community.aws/pull/1143) - - route53_health_check - Added new parameter `use_unique_names` used with new parameter `health_check_name` with alias `name` to set health check name as unique identifier. (https://github.com/ansible-collections/community.aws/pull/1143) + - route53_health_check - Added new parameter ``health_check_id`` with alias ``id`` to allow update and delete health check by ID (https://github.com/ansible-collections/community.aws/pull/1143). + - route53_health_check - Added new parameter ``use_unique_names`` used with new parameter ``health_check_name`` with alias ``name`` to set health check name as unique identifier (https://github.com/ansible-collections/community.aws/pull/1143). diff --git a/plugins/modules/route53_health_check.py b/plugins/modules/route53_health_check.py index 5eee6716ad6..83283ecf646 100644 --- a/plugins/modules/route53_health_check.py +++ b/plugins/modules/route53_health_check.py @@ -143,7 +143,7 @@ health_check: "{{ my_health_check.health_check.id }}" - name: create a simple health check with health_check_name as unique identifier - route53_health_check: + community.aws.route53_health_check: state: present health_check_name: ansible fqdn: ansible.com @@ -157,17 +157,17 @@ fqdn: host1.example.com - name: Update Health check by ID - update ip_address - route53_health_check: + community.aws.route53_health_check: id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx ip_address: 1.2.3.4 - name: Update Health check by ID - update port - route53_health_check: + community.aws.route53_health_check: id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx ip_address: 8080 - name: Delete Health check by ID - route53_health_check: + community.aws.route53_health_check: state: absent id: 12345678-abcd-abcd-abcd-0fxxxxxxxxxx