-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[PR #1631/625777a1 backport][stable-6] route53_health_check - add support for CALCULATED type This is a backport of PR #1631 as merged into main (625777a). SUMMARY Fixes #1442 ISSUE TYPE Feature Pull Request COMPONENT NAME plugins/modules/route53_health_check.py ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis
- Loading branch information
1 parent
87b860a
commit 0ec1534
Showing
4 changed files
with
233 additions
and
15 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelogs/fragments/1631-route53_health_check-added-calculcated.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
minor_changes: | ||
- route53_health_check - add support for another ``type`` choice called ``CALCULATED`` (https://github.com/ansible-collections/amazon.aws/pull/1631). | ||
- route53_health_check - add support for a string list parameter called ``child_health_checks`` to specify health checks that must be healthy for the calculated health check (https://github.com/ansible-collections/amazon.aws/pull/1631). | ||
- route53_health_check - add support for an integer parameter called ``health_threshold`` to specify the minimum number of healthy child health checks that must be healthy for the calculated health check (https://github.com/ansible-collections/amazon.aws/pull/1631). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
156 changes: 156 additions & 0 deletions
156
tests/integration/targets/route53_health_check/tasks/calculate_health_check.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
--- | ||
- block: | ||
# Create Health Check ================================================================= | ||
- name: 'Create Health Check with name' | ||
amazon.aws.route53_health_check: | ||
state: present | ||
name: '{{ tiny_prefix }}-{{ resource_path }}-test-hc-tag-operations' | ||
ip_address: '{{ ip_address }}' | ||
port: '{{ port }}' | ||
type: '{{ type_http }}' | ||
resource_path: '{{ resource_path }}' | ||
use_unique_names: true | ||
fqdn: '{{ fqdn }}' | ||
register: create_result | ||
|
||
# Create and Update =================================================================== | ||
- name: 'Create Invalid Parameter Calculated Health Check' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
ip_address: '{{ ip_address }}' | ||
port: '{{ port }}' | ||
type: CALCULATED | ||
use_unique_names: true | ||
fqdn: '{{ fqdn }}' | ||
health_threshold: 1 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
ignore_errors: true | ||
register: error_create_calculated | ||
|
||
- name: 'Check result - Create Invalid Parameter Calculated Health Check' | ||
ansible.builtin.assert: | ||
that: | ||
- error_create_calculated is failed | ||
- "error_create_calculated.msg == 'parameters are mutually exclusive: child_health_checks|ip_address, child_health_checks|port, child_health_checks|fqdn'" | ||
|
||
- name: 'Create Calculated Health Check - check_mode' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
use_unique_names: true | ||
type: CALCULATED | ||
health_threshold: 1 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
register: check_create_calculated | ||
check_mode: true | ||
|
||
- name: 'Check result - Calculated Health Check' | ||
ansible.builtin.assert: | ||
that: | ||
- check_create_calculated is not failed | ||
- check_create_calculated is changed | ||
|
||
- name: 'Create Calculated Health Check' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
use_unique_names: true | ||
type: CALCULATED | ||
health_threshold: 1 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
register: create_calculated | ||
|
||
- name: 'Check result - Calculated Health Check' | ||
ansible.builtin.assert: | ||
that: | ||
- create_calculated is not failed | ||
- create_calculated is changed | ||
|
||
- name: 'Check result - Create Calculated Health Check - idempotency' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
use_unique_names: true | ||
type: CALCULATED | ||
health_threshold: 1 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
register: create_idem | ||
|
||
- name: 'Check result - Calculated Health Check - idempotency' | ||
ansible.builtin.assert: | ||
that: | ||
- create_idem is not failed | ||
- create_idem is not changed | ||
|
||
- name: 'Update Calculated Health Check' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
use_unique_names: true | ||
type: CALCULATED | ||
health_threshold: 2 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
register: check_updated_calculated | ||
check_mode: true | ||
|
||
- name: 'Check result - Update Calculated Health Check - check_mode' | ||
ansible.builtin.assert: | ||
that: | ||
- check_updated_calculated is not failed | ||
- check_updated_calculated is changed | ||
|
||
- name: 'Update Calculated Health Check' | ||
route53_health_check: | ||
health_check_name: "calculated_health_check" | ||
use_unique_names: true | ||
type: CALCULATED | ||
health_threshold: 2 | ||
child_health_checks: '{{ create_result.health_check.id }}' | ||
register: updated_calculated | ||
|
||
- name: 'Check result - Update Calculated Health Check' | ||
ansible.builtin.assert: | ||
that: | ||
- updated_calculated is not failed | ||
- updated_calculated is changed | ||
|
||
# Deleting Calculated Health Check ====================================================== | ||
- name: 'Delete Calculated Health Check' | ||
amazon.aws.route53_health_check: | ||
state: absent | ||
health_check_id: '{{ create_calculated.health_check.id }}' | ||
register: deleted_calculated | ||
|
||
- name: 'Check if Calculated Health Check can be deleted' | ||
ansible.builtin.assert: | ||
that: | ||
- deleted_calculated is not failed | ||
- deleted_calculated is changed | ||
|
||
- name: 'Delete HTTP health check with use_unique_names' | ||
amazon.aws.route53_health_check: | ||
state: absent | ||
name: '{{ tiny_prefix }}-{{ resource_path }}-test-hc-tag-operations' | ||
ip_address: '{{ ip_address }}' | ||
port: '{{ port }}' | ||
type: '{{ type_http }}' | ||
resource_path: '{{ resource_path }}' | ||
use_unique_names: true | ||
fqdn: '{{ fqdn }}' | ||
register: delete_result | ||
|
||
- name: 'Check if HTTP health check with use_unique_names can be deleted' | ||
ansible.builtin.assert: | ||
that: | ||
- delete_result is changed | ||
- delete_result is not failed | ||
|
||
always: | ||
# Cleanup starts here ================================================================= | ||
- name: 'Delete Calculated Health Check' | ||
amazon.aws.route53_health_check: | ||
state: absent | ||
health_check_id: '{{ create_calculated.health_check.id }}' | ||
ignore_errors: true | ||
|
||
- name: 'Delete HTTP health check with use_unique_names' | ||
amazon.aws.route53_health_check: | ||
state: absent | ||
name: '{{ tiny_prefix }}-{{ resource_path }}-test-hc-tag-operations' | ||
ignore_errors: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters