From 20521eecb582cad90396f67e570ec4699d9a1971 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 16 Nov 2023 14:08:18 +0100 Subject: [PATCH 01/77] Update sanity tests - upstream no longer supports ansible 2.9 (#1999) SUMMARY Upstream's dropped support for Ansible 2.9 sanity tests, we don't need to mess about with our own include/exclude list any more. ISSUE TYPE Feature Pull Request COMPONENT NAME .github/workflows/sanity.yml ADDITIONAL INFORMATION See also ansible-collections/amazon.aws#1846 See also pycrypto/pycrypto@65b43bd (pycrypto / pycryptodome) --- * Update sanity tests - upstream no longer supports ansible 2.9 * use defaults for units * pycrypto doesn't work with recent versions - pycryptodome should be (mostly) compatible and uses the same namespace --- .github/workflows/sanity.yml | 63 ------------------------------ .github/workflows/units.yml | 62 ----------------------------- test-requirements.txt | 3 +- tests/integration/requirements.txt | 3 +- 4 files changed, 4 insertions(+), 127 deletions(-) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 55318f2266a..161dabfe25b 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -8,66 +8,3 @@ jobs: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main with: matrix_include: "[]" - matrix_exclude: >- - [ - { - "ansible-version": "stable-2.9" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.9" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" - } - ] - collection_pre_install: '-r source/tests/sanity/requirements.yml' diff --git a/.github/workflows/units.yml b/.github/workflows/units.yml index 4c92b52f91d..7dddcc61050 100644 --- a/.github/workflows/units.yml +++ b/.github/workflows/units.yml @@ -7,66 +7,4 @@ jobs: unit-source: uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main with: - matrix_exclude: >- - [ - { - "python-version": "3.11" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.12", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.13", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.14", - "python-version": "3.8" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.7" - }, - { - "ansible-version": "stable-2.15", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.7" - }, - { - "ansible-version": "milestone", - "python-version": "3.8" - }, - { - "ansible-version": "milestone", - "python-version": "3.9" - }, - { - "ansible-version": "devel", - "python-version": "3.7" - }, - { - "ansible-version": "devel", - "python-version": "3.8" - }, - { - "ansible-version": "devel", - "python-version": "3.9" - } - ] collection_pre_install: '-r source/tests/unit/requirements.yml' diff --git a/test-requirements.txt b/test-requirements.txt index 47896f74134..22b52aac231 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -18,6 +18,7 @@ netaddr # Sometimes needed where we don't have features we need in modules awscli # Used for comparing SSH Public keys to the Amazon fingerprints -pycrypto +# pycrypto is EoL using pycryptodome for now +pycryptodome # Used by ec2_win_password cryptography diff --git a/tests/integration/requirements.txt b/tests/integration/requirements.txt index 352e8b7ff0f..38cdbd8bab4 100644 --- a/tests/integration/requirements.txt +++ b/tests/integration/requirements.txt @@ -8,6 +8,7 @@ virtualenv # Sometimes needed where we don't have features we need in modules awscli # Used for comparing SSH Public keys to the Amazon fingerprints -pycrypto +# pycrypto is EoL using pycryptodome for now +pycryptodome # Used by ec2_asg_scheduled_action python-dateutil From 42c0475d1c6a65c3a9b5180fa3a5df6db863f0ef Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 16 Nov 2023 16:15:20 +0100 Subject: [PATCH 02/77] setup_sshkey: drop a dep on Crypto (#2004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setup_sshkey: drop a dep on Crypto SUMMARY Adjust ec2-fingerprint.py so it use cryptography instead of the deprecated Crypto library. (originally written by Gonéri) ISSUE TYPE Feature Pull Request COMPONENT NAME tests/integration/targets/setup_sshkey/files/ec2-fingerprint.py ADDITIONAL INFORMATION Original PR (amazon.aws) ansible-collections/amazon.aws#799 Reviewed-by: Alina Buzachis --- test-requirements.txt | 5 +---- tests/integration/requirements.txt | 3 +-- .../setup_sshkey/files/ec2-fingerprint.py | 22 +++++++++---------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 22b52aac231..03e59f5965d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -17,8 +17,5 @@ git+https://github.com/ansible-community/pytest-ansible-units.git ; python_versi netaddr # Sometimes needed where we don't have features we need in modules awscli -# Used for comparing SSH Public keys to the Amazon fingerprints -# pycrypto is EoL using pycryptodome for now -pycryptodome -# Used by ec2_win_password +# Used for comparing SSH Public keys to the Amazon fingerprints and ec2_win_password cryptography diff --git a/tests/integration/requirements.txt b/tests/integration/requirements.txt index 38cdbd8bab4..aa71c96813e 100644 --- a/tests/integration/requirements.txt +++ b/tests/integration/requirements.txt @@ -8,7 +8,6 @@ virtualenv # Sometimes needed where we don't have features we need in modules awscli # Used for comparing SSH Public keys to the Amazon fingerprints -# pycrypto is EoL using pycryptodome for now -pycryptodome +cryptography # Used by ec2_asg_scheduled_action python-dateutil diff --git a/tests/integration/targets/setup_sshkey/files/ec2-fingerprint.py b/tests/integration/targets/setup_sshkey/files/ec2-fingerprint.py index f2740554d7a..04d2eb1ea54 100644 --- a/tests/integration/targets/setup_sshkey/files/ec2-fingerprint.py +++ b/tests/integration/targets/setup_sshkey/files/ec2-fingerprint.py @@ -8,28 +8,26 @@ (but without needing the OpenSSL CLI) """ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function - -__metaclass__ = type import hashlib import sys -from Crypto.PublicKey import RSA +from cryptography.hazmat.primitives import serialization if len(sys.argv) == 0: ssh_public_key = "id_rsa.pub" else: ssh_public_key = sys.argv[1] -with open(ssh_public_key, "r") as key_fh: - data = key_fh.read() - -# Convert from SSH format to DER format -public_key = RSA.importKey(data).exportKey("DER") -md5digest = hashlib.md5(public_key).hexdigest() +with open(ssh_public_key, "rb") as key_file: + public_key = serialization.load_ssh_public_key( + key_file.read(), + ) +pub_der = public_key.public_bytes( + encoding=serialization.Encoding.DER, + format=serialization.PublicFormat.SubjectPublicKeyInfo, +) +md5digest = hashlib.md5(pub_der).hexdigest() # Format the md5sum into the normal format pairs = zip(md5digest[::2], md5digest[1::2]) md5string = ":".join(["".join(pair) for pair in pairs]) From 4bdcecda3d37e1ccd4d568ec641b59d0a745bbca Mon Sep 17 00:00:00 2001 From: Markus Bergholz Date: Fri, 1 Dec 2023 13:50:37 +0100 Subject: [PATCH 03/77] fix unsafe asserts (#2013) fix unsafe asserts SUMMARY Closes #2012 ISSUE TYPE Bugfix Pull Request COMPONENT NAME integrationtests Reviewed-by: Mark Chappell Reviewed-by: Alina Buzachis --- .../targets/api_gateway_domain/tasks/main.yml | 6 +- .../tasks/main.yml | 14 ++-- .../targets/autoscaling_policy/tasks/main.yml | 20 +++--- .../tasks/main.yml | 6 +- .../cloudfront_distribution/tasks/main.yml | 2 +- .../task/main.yml | 2 +- .../codecommit_repository/tasks/main.yml | 12 ++-- .../targets/codepipeline/tasks/main.yml | 2 +- .../targets/connection/test_assume.yml | 2 +- .../ec2_placement_group/tasks/main.yml | 30 ++++----- .../ecs_cluster/tasks/20_ecs_service.yml | 8 +-- .../targets/ecs_ecr/tasks/main.yml | 2 +- .../targets/ecs_tag/tasks/main.yml | 14 ++-- tests/integration/targets/efs/tasks/main.yml | 18 ++--- .../targets/elasticache/tasks/main.yml | 4 +- .../elb_classic_lb_info/tasks/main.yml | 24 +++---- .../elb_network_lb/tasks/test_nlb_tags.yml | 4 +- .../targets/elb_target/tasks/ec2_target.yml | 4 +- .../targets/elb_target_info/tasks/main.yml | 18 ++--- ..._inventory_with_hostvars_prefix_suffix.yml | 6 +- .../playbooks/test_populating_inventory.yml | 2 +- .../targets/lightsail/tasks/main.yml | 2 +- .../targets/lightsail_snapshot/tasks/main.yml | 2 +- .../tasks/test_create_auth.yml | 2 +- .../targets/msk_cluster/tasks/test_create.yml | 2 +- .../targets/msk_config/tasks/main.yml | 2 +- .../targets/redshift/tasks/main.yml | 14 ++-- .../targets/s3_sync/tasks/main.yml | 6 +- .../targets/sns_topic/tasks/main.yml | 6 +- .../targets/sqs_queue/tasks/main.yml | 2 +- .../targets/ssm_parameter/tasks/main.yml | 66 +++++++++---------- .../tasks/main.yml | 4 +- .../targets/waf_web_acl/tasks/main.yml | 4 +- 33 files changed, 156 insertions(+), 156 deletions(-) diff --git a/tests/integration/targets/api_gateway_domain/tasks/main.yml b/tests/integration/targets/api_gateway_domain/tasks/main.yml index 24f391df37c..f3c7407937e 100644 --- a/tests/integration/targets/api_gateway_domain/tasks/main.yml +++ b/tests/integration/targets/api_gateway_domain/tasks/main.yml @@ -39,7 +39,7 @@ - assert: that: - create_result.changed == True - - create_result.response.domain.domain_name == "{{ api_gateway_domain_name }}" + - create_result.response.domain.domain_name == api_gateway_domain_name - create_result.response.domain.distribution_domain_name is defined - create_result.response.domain.distribution_hosted_zone_id is defined - create_result.response.path_mappings is defined @@ -59,7 +59,7 @@ that: - repeat_result.changed == False - repeat_result.failed == False - - repeat_result.response.domain_name == "{{ api_gateway_domain_name }}" + - repeat_result.response.domain_name == api_gateway_domain_name - name: Update Test - API gateway custom domain setup, change settings api_gateway_domain: @@ -75,7 +75,7 @@ - assert: that: - update_result.changed == True - - update_result.response.domain.domain_name == "{{ api_gateway_domain_name }}" + - update_result.response.domain.domain_name == api_gateway_domain_name - update_result.response.domain.security_policy == 'TLS_1_2' - update_result.response.domain.endpoint_configuration.types.0 == 'REGIONAL' - update_result.response.path_mappings.0.base_path = '/v1' diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml index f19b7c3c24a..5b754d47d69 100644 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml +++ b/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml @@ -107,7 +107,7 @@ - assert: that: - - "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group {{ resource_prefix }}-asg' in result.msg" + - "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group ' ~ resource_prefix ~ '-asg' in result.msg" - name: test starting a refresh with a valid ASG name - check_mode autoscaling_instance_refresh: @@ -323,7 +323,7 @@ - assert: that: - - "{{ output.instance_refreshes|length }} == 0" + - output.instance_refreshes | length == 0 - name: test using a real refresh ID autoscaling_instance_refresh_info: @@ -334,7 +334,7 @@ - assert: that: - - "{{ output.instance_refreshes |length }} == 1" + - output.instance_refreshes | length == 1 - name: test getting info for an ASG name which doesn't exist autoscaling_instance_refresh_info: @@ -354,7 +354,7 @@ - assert: that: - - "{{ output.instance_refreshes|length }} == 7" + - output.instance_refreshes | length == 7 - name: assert that valid message with fake-token is returned autoscaling_instance_refresh_info: @@ -376,7 +376,7 @@ - assert: that: - - "{{ output.instance_refreshes|length }} < 2" + - output.instance_refreshes | length < 2 - name: assert that valid message with real-token is returned autoscaling_instance_refresh_info: @@ -387,7 +387,7 @@ - assert: that: - - "{{ output.instance_refreshes|length }} == 7" + - output.instance_refreshes | length == 7 - name: test using both real nextToken and max_records=1 autoscaling_instance_refresh_info: @@ -399,7 +399,7 @@ - assert: that: - - "{{ output.instance_refreshes|length }} == 1" + - output.instance_refreshes | length == 1 always: diff --git a/tests/integration/targets/autoscaling_policy/tasks/main.yml b/tests/integration/targets/autoscaling_policy/tasks/main.yml index e3e42041f18..684522d641a 100644 --- a/tests/integration/targets/autoscaling_policy/tasks/main.yml +++ b/tests/integration/targets/autoscaling_policy/tasks/main.yml @@ -46,7 +46,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_simplescaling_policy" + - result.policy_name == resource_prefix ~ '_simplescaling_policy' - result.changed - name: Update Simple Scaling policy using explicit defaults @@ -61,7 +61,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_simplescaling_policy" + - result.policy_name == resource_prefix ~ '_simplescaling_policy' - not result.changed - name: min_adjustment_step is ignored with ChangeInCapacity @@ -77,7 +77,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_simplescaling_policy" + - result.policy_name == resource_prefix ~ '_simplescaling_policy' - not result.changed - result.adjustment_type == "ChangeInCapacity" @@ -94,7 +94,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_simplescaling_policy" + - result.policy_name == resource_prefix ~ '_simplescaling_policy' - result.changed - result.adjustment_type == "PercentChangeInCapacity" @@ -126,7 +126,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_stepscaling_policy" + - result.policy_name == resource_prefix ~ '_stepscaling_policy' - result.changed - name: Add another step @@ -149,7 +149,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_stepscaling_policy" + - result.policy_name == resource_prefix ~ '_stepscaling_policy' - result.changed - result.adjustment_type == "PercentChangeInCapacity" @@ -189,7 +189,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_targettracking_predefined_policy" + - result.policy_name == resource_prefix ~ '_targettracking_predefined_policy' - result.changed - result is successful @@ -206,7 +206,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_targettracking_predefined_policy" + - result.policy_name == resource_prefix ~ '_targettracking_predefined_policy' - result is not changed # # It would be good to also test this but we would need an Target group and an ALB @@ -263,7 +263,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_targettracking_custom_policy" + - result.policy_name == resource_prefix ~ '_targettracking_custom_policy' - result.changed - result is successful @@ -285,7 +285,7 @@ - assert: that: - - result.policy_name == "{{ resource_prefix }}_targettracking_custom_policy" + - result.policy_name == resource_prefix ~ '_targettracking_custom_policy' - result is not changed always: diff --git a/tests/integration/targets/autoscaling_scheduled_action/tasks/main.yml b/tests/integration/targets/autoscaling_scheduled_action/tasks/main.yml index 6de1d2dff7a..4c0e97220af 100644 --- a/tests/integration/targets/autoscaling_scheduled_action/tasks/main.yml +++ b/tests/integration/targets/autoscaling_scheduled_action/tasks/main.yml @@ -101,7 +101,7 @@ that: - scheduled_action is successful - scheduled_action is changed - - scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test" + - scheduled_action.scheduled_action_name == resource_prefix ~ '-test' - scheduled_action.desired_capacity == 2 - name: Create basic scheduled_action - idempotent @@ -155,7 +155,7 @@ that: - scheduled_action is successful - scheduled_action is changed - - scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test" + - scheduled_action.scheduled_action_name == resource_prefix ~ '-test' - scheduled_action.desired_capacity == 3 - scheduled_action.min_size == 3 @@ -217,7 +217,7 @@ that: - advanced_scheduled_action is successful - advanced_scheduled_action is changed - - advanced_scheduled_action.scheduled_action_name == "{{ resource_prefix }}-test1" + - advanced_scheduled_action.scheduled_action_name == resource_prefix ~ '-test1' - advanced_scheduled_action.desired_capacity == 2 - advanced_scheduled_action.min_size == 2 - advanced_scheduled_action.max_size == 5 diff --git a/tests/integration/targets/cloudfront_distribution/tasks/main.yml b/tests/integration/targets/cloudfront_distribution/tasks/main.yml index c61684b7ce1..7a1fa91af81 100644 --- a/tests/integration/targets/cloudfront_distribution/tasks/main.yml +++ b/tests/integration/targets/cloudfront_distribution/tasks/main.yml @@ -168,7 +168,7 @@ that: - update_origin_origin_shield.changed - update_origin_origin_shield.origins['items'][0].origin_shield.enabled - - update_origin_origin_shield.origins['items'][0].origin_shield.origin_shield_region == '{{ aws_region }}' + - update_origin_origin_shield.origins['items'][0].origin_shield.origin_shield_region == aws_region # TODO: fix module idempotency issue # - name: enable origin Origin Shield again to test idempotency diff --git a/tests/integration/targets/cloudfront_reponse_headers_policy/task/main.yml b/tests/integration/targets/cloudfront_reponse_headers_policy/task/main.yml index cf48e89c4ba..5bab44f9fb9 100644 --- a/tests/integration/targets/cloudfront_reponse_headers_policy/task/main.yml +++ b/tests/integration/targets/cloudfront_reponse_headers_policy/task/main.yml @@ -24,7 +24,7 @@ that: - create_result is changed - create_result is not failed - - create_result.response_headers_policy.response_headers_policy_config.name == "{{ resource_prefix }}-my-header-policy" + - create_result.response_headers_policy.response_headers_policy_config.name == resource_prefix ~ '-my-header-policy' - name: Rerun same task to ensure idempotence cloudfront_response_headers_policy: diff --git a/tests/integration/targets/codecommit_repository/tasks/main.yml b/tests/integration/targets/codecommit_repository/tasks/main.yml index 20c09fd8b6d..62dd1653bc9 100644 --- a/tests/integration/targets/codecommit_repository/tasks/main.yml +++ b/tests/integration/targets/codecommit_repository/tasks/main.yml @@ -27,7 +27,7 @@ - assert: that: - output is changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - output.repository_metadata.repository_description == 'original comment' - name: No-op update to repository @@ -39,7 +39,7 @@ - assert: that: - output is not changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - output.repository_metadata.repository_description == 'original comment' - name: Update repository description (CHECK MODE) @@ -52,7 +52,7 @@ - assert: that: - output is changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - output.repository_metadata.repository_description == 'original comment' - name: Update repository description @@ -64,7 +64,7 @@ - assert: that: - output is changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - output.repository_metadata.repository_description == 'new comment' # ============================================================ @@ -104,7 +104,7 @@ - assert: that: - output is changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - name: No-op update to repository without description codecommit_repository: @@ -114,7 +114,7 @@ - assert: that: - output is not changed - - output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' + - output.repository_metadata.repository_name == resource_prefix ~ '_repo' - name: Delete a repository without description codecommit_repository: diff --git a/tests/integration/targets/codepipeline/tasks/main.yml b/tests/integration/targets/codepipeline/tasks/main.yml index 4e6e4368315..57353ed8a58 100644 --- a/tests/integration/targets/codepipeline/tasks/main.yml +++ b/tests/integration/targets/codepipeline/tasks/main.yml @@ -66,7 +66,7 @@ - assert: that: - output.changed == True - - output.pipeline.name == "{{ codepipeline_name }}" + - output.pipeline.name == codepipeline_name - output.pipeline.stages|length > 1 - name: idempotence check rerunning same CodePipeline task diff --git a/tests/integration/targets/connection/test_assume.yml b/tests/integration/targets/connection/test_assume.yml index e8c6aab0a09..f979ef2d432 100644 --- a/tests/integration/targets/connection/test_assume.yml +++ b/tests/integration/targets/connection/test_assume.yml @@ -13,4 +13,4 @@ - assert: that: - - id_cmd.stdout == '{{ user_name }}' + - id_cmd.stdout == user_name diff --git a/tests/integration/targets/ec2_placement_group/tasks/main.yml b/tests/integration/targets/ec2_placement_group/tasks/main.yml index 4f42a9df28d..10695571ebf 100644 --- a/tests/integration/targets/ec2_placement_group/tasks/main.yml +++ b/tests/integration/targets/ec2_placement_group/tasks/main.yml @@ -25,7 +25,7 @@ - assert: that: - pg_1_create_check_mode is changed - - pg_1_create_check_mode.placement_group.name == '{{ resource_prefix }}-pg1' + - pg_1_create_check_mode.placement_group.name == resource_prefix ~ '-pg1' - pg_1_create_check_mode.placement_group.state == "DryRun" - '"ec2:CreatePlacementGroup" in pg_1_create_check_mode.resource_actions' @@ -41,7 +41,7 @@ - assert: that: - pg_1_create is changed - - pg_1_create.placement_group.name == '{{ resource_prefix }}-pg1' + - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' - pg_1_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" in pg_1_create.resource_actions' @@ -54,7 +54,7 @@ - assert: that: - pg_1_info_result is not changed - - pg_1_info_result.placement_groups[0].name == '{{ resource_prefix }}-pg1' + - pg_1_info_result.placement_groups[0].name == resource_prefix ~ '-pg1' - pg_1_info_result.placement_groups[0].state == "available" - pg_1_info_result.placement_groups[0].strategy == "cluster" - '"ec2:DescribePlacementGroups" in pg_1_info_result.resource_actions' @@ -68,7 +68,7 @@ - assert: that: - pg_1_create is not changed - - pg_1_create.placement_group.name == '{{ resource_prefix }}-pg1' + - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' - pg_1_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_1_create.resource_actions' @@ -82,7 +82,7 @@ - assert: that: - pg_1_create_check_mode_idem is not changed - - pg_1_create_check_mode_idem.placement_group.name == '{{ resource_prefix }}-pg1' + - pg_1_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg1' - pg_1_create_check_mode_idem.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_1_create_check_mode_idem.resource_actions' @@ -97,7 +97,7 @@ - assert: that: - pg_2_create_check_mode is changed - - pg_2_create_check_mode.placement_group.name == '{{ resource_prefix }}-pg2' + - pg_2_create_check_mode.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create_check_mode.placement_group.state == "DryRun" - '"ec2:CreatePlacementGroup" in pg_2_create_check_mode.resource_actions' @@ -111,7 +111,7 @@ - assert: that: - pg_2_create is changed - - pg_2_create.placement_group.name == '{{ resource_prefix }}-pg2' + - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" in pg_2_create.resource_actions' @@ -127,7 +127,7 @@ - assert: that: - pg_2_info_result is not changed - - pg_2_info_result.placement_groups[0].name == '{{ resource_prefix }}-pg2' + - pg_2_info_result.placement_groups[0].name == resource_prefix ~ '-pg2' - pg_2_info_result.placement_groups[0].state == "available" - pg_2_info_result.placement_groups[0].strategy == "spread" - '"ec2:DescribePlacementGroups" in pg_2_info_result.resource_actions' @@ -142,7 +142,7 @@ - assert: that: - pg_2_create is not changed - - pg_2_create.placement_group.name == '{{ resource_prefix }}-pg2' + - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_2_create.resource_actions' @@ -157,7 +157,7 @@ - assert: that: - pg_2_create_check_mode_idem is not changed - - pg_2_create_check_mode_idem.placement_group.name == '{{ resource_prefix }}-pg2' + - pg_2_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create_check_mode_idem.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_2_create_check_mode_idem.resource_actions' @@ -173,7 +173,7 @@ - assert: that: - pg_3_create_check_mode is changed - - pg_3_create_check_mode.placement_group.name == '{{ resource_prefix }}-pg3' + - pg_3_create_check_mode.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create_check_mode.placement_group.state == "DryRun" - '"ec2:CreatePlacementGroup" in pg_3_create_check_mode.resource_actions' @@ -188,7 +188,7 @@ - assert: that: - pg_3_create is changed - - pg_3_create.placement_group.name == '{{ resource_prefix }}-pg3' + - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" in pg_3_create.resource_actions' @@ -205,7 +205,7 @@ - assert: that: - pg_3_info_result is not changed - - pg_3_info_result.placement_groups[0].name == '{{ resource_prefix }}-pg3' + - pg_3_info_result.placement_groups[0].name == resource_prefix ~ '-pg3' - pg_3_info_result.placement_groups[0].state == "available" - pg_3_info_result.placement_groups[0].strategy == "partition" - '"ec2:DescribePlacementGroups" in pg_3_info_result.resource_actions' @@ -221,7 +221,7 @@ - assert: that: - pg_3_create is not changed - - pg_3_create.placement_group.name == '{{ resource_prefix }}-pg3' + - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_3_create.resource_actions' @@ -237,7 +237,7 @@ - assert: that: - pg_3_create_check_mode_idem is not changed - - pg_3_create_check_mode_idem.placement_group.name == '{{ resource_prefix }}-pg3' + - pg_3_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create_check_mode_idem.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_3_create_check_mode_idem.resource_actions' diff --git a/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml b/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml index 8d055c0ac22..3c4bbcb28c7 100644 --- a/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml +++ b/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml @@ -348,7 +348,7 @@ assert: that: - ecs_service_creation_hcgp.changed - - "{{ecs_service_creation_hcgp.service.healthCheckGracePeriodSeconds}} == 30" + - ecs_service_creation_hcgp.service.healthCheckGracePeriodSeconds == 30 - name: update ecs_service using health_check_grace_period_seconds ecs_service: @@ -368,7 +368,7 @@ assert: that: - ecs_service_creation_hcgp2.changed - - "{{ecs_service_creation_hcgp2.service.healthCheckGracePeriodSeconds}} == 10" + - ecs_service_creation_hcgp2.service.healthCheckGracePeriodSeconds == 10 - name: update ecs_service using REPLICA scheduling_strategy ecs_service: @@ -453,8 +453,8 @@ assert: that: - ecs_task_definition_constraints is changed - - ecs_task_definition_constraints.taskdefinition.placementConstraints[0].type == "{{ ecs_taskdefinition_placement_constraints[0].type }}" - - ecs_task_definition_constraints.taskdefinition.placementConstraints[0].expression == "{{ ecs_taskdefinition_placement_constraints[0].expression }}" + - ecs_task_definition_constraints.taskdefinition.placementConstraints[0].type == ecs_taskdefinition_placement_constraints[0].type + - ecs_task_definition_constraints.taskdefinition.placementConstraints[0].expression == ecs_taskdefinition_placement_constraints[0].expression - name: Remove ecs task definition with placement constraints ecs_taskdefinition: diff --git a/tests/integration/targets/ecs_ecr/tasks/main.yml b/tests/integration/targets/ecs_ecr/tasks/main.yml index 88a31fbe9ff..68750e06e09 100644 --- a/tests/integration/targets/ecs_ecr/tasks/main.yml +++ b/tests/integration/targets/ecs_ecr/tasks/main.yml @@ -597,7 +597,7 @@ - name: it should use the provided KMS key assert: that: - - result.repository.encryptionConfiguration.kmsKey == '{{ kms_test_key.key_arn }}' + - result.repository.encryptionConfiguration.kmsKey == kms_test_key.key_arn always: diff --git a/tests/integration/targets/ecs_tag/tasks/main.yml b/tests/integration/targets/ecs_tag/tasks/main.yml index 597caaaa202..2c5614eb8bc 100644 --- a/tests/integration/targets/ecs_tag/tasks/main.yml +++ b/tests/integration/targets/ecs_tag/tasks/main.yml @@ -73,7 +73,7 @@ assert: that: - taglist.changed == true - - taglist.added_tags.Name == "{{ resource_prefix }}" + - taglist.added_tags.Name == resource_prefix - taglist.added_tags.another == "foobar" - name: cluster tags - Add tags to cluster again @@ -162,8 +162,8 @@ assert: that: - taglist.changed == true - - taglist.added_tags.Name == "service-{{ resource_prefix }}" - - taglist.tags.Name == "service-{{ resource_prefix }}" + - "taglist.added_tags.Name == 'service-' ~ resource_prefix" + - "taglist.tags.Name == 'service-' ~ resource_prefix" - name: services tags - Add name tag again - see no change ecs_tag: @@ -179,7 +179,7 @@ assert: that: - taglist.changed == false - - taglist.tags.Name == "service-{{ resource_prefix }}" + - "taglist.tags.Name == 'service-' ~ resource_prefix" - name: service tags - remove service tags ecs_tag: @@ -215,8 +215,8 @@ assert: that: - taglist.changed == true - - taglist.added_tags.Name == "task_definition-{{ resource_prefix }}" - - taglist.tags.Name == "task_definition-{{ resource_prefix }}" + - "taglist.added_tags.Name == 'task_definition-' ~ resource_prefix" + - "taglist.tags.Name == 'task_definition-' ~ resource_prefix" - name: task_definition tags - Add name tag again - see no change ecs_tag: @@ -232,7 +232,7 @@ assert: that: - taglist.changed == false - - taglist.tags.Name == "task_definition-{{ resource_prefix }}" + - "taglist.tags.Name == 'task_definition-' ~ resource_prefix" - name: task_definition tags - remove task_definition tags ecs_tag: diff --git a/tests/integration/targets/efs/tasks/main.yml b/tests/integration/targets/efs/tasks/main.yml index 19e0ee7a5a9..bc23f3a1199 100644 --- a/tests/integration/targets/efs/tasks/main.yml +++ b/tests/integration/targets/efs/tasks/main.yml @@ -98,7 +98,7 @@ - efs_result.efs[0].mount_targets[1].security_groups[0] == vpc_default_sg_id - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Get EFS by id @@ -107,7 +107,7 @@ register: efs_result - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Get EFS by tag @@ -117,7 +117,7 @@ register: efs_result - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Get EFS by target (subnet_id) @@ -127,7 +127,7 @@ register: efs_result - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Get EFS by target (security_group_id) @@ -137,7 +137,7 @@ register: efs_result - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Get EFS by tag and target @@ -149,7 +149,7 @@ register: efs_result - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ # Not checking efs_result.efs["throughput_mode"] here as @@ -231,7 +231,7 @@ - efs_result.efs[0].file_system_id == created_efs.efs.file_system_id - assert: - that: "{{efs_result_assertions}}" + that: efs_result_assertions # ============================================================ - name: Efs configure IA transition @@ -366,7 +366,7 @@ - efs_tag_result.tags.Env is defined - efs_tag_result.tags.Env is search("IntegrationTests") - efs_tag_result.tags.Name is defined - - efs_tag_result.tags.Name is search("{{ efs_name }}-test-tag") + - efs_tag_result.tags.Name is search(efs_name ~ '-test-tag') - efs_tag_result.tags["CamelCase"] == 'SimpleCamelCase' - efs_tag_result.tags["Title Case"] == 'Hello Cruel World' - efs_tag_result.tags["lowercase spaced"] == 'hello cruel world' @@ -464,7 +464,7 @@ - efs_tag_result.tags.Env is defined - efs_tag_result.tags.Env is search("IntegrationTests") - efs_tag_result.tags.Name is defined - - efs_tag_result.tags.Name is search("{{ efs_name }}-test-tag") + - efs_tag_result.tags.Name is search(efs_name ~ '-test-tag') - not efs_tag_result.tags["CamelCase"] is defined - not efs_tag_result.tags["Title Case"] is defined - not efs_tag_result.tags["lowercase spaced"] is defined diff --git a/tests/integration/targets/elasticache/tasks/main.yml b/tests/integration/targets/elasticache/tasks/main.yml index 6e567fe687c..9664a70f14e 100644 --- a/tests/integration/targets/elasticache/tasks/main.yml +++ b/tests/integration/targets/elasticache/tasks/main.yml @@ -60,8 +60,8 @@ that: - elasticache_redis is changed - elasticache_redis.elasticache.data is defined - - elasticache_redis.elasticache.name == "{{ elasticache_redis_test_name }}" - - elasticache_redis.elasticache.data.CacheSubnetGroupName == "{{ elasticache_subnet_group_name }}" + - elasticache_redis.elasticache.name == elasticache_redis_test_name + - elasticache_redis.elasticache.data.CacheSubnetGroupName == elasticache_subnet_group_name - name: Add security group for Redis access in Elasticache ec2_security_group: diff --git a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml index dc099388648..b09e8807269 100644 --- a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml +++ b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml @@ -55,8 +55,8 @@ that: - create is changed # We rely on these for the info test, make sure they're what we expect - - '"{{ aws_region }}a" in create.elb.zones' - - '"{{ aws_region }}b" in create.elb.zones' + - aws_region ~ 'a' in create.elb.zones + - aws_region ~ 'b' in create.elb.zones - create.elb.health_check.healthy_threshold == 10 - create.elb.health_check.interval == 30 - create.elb.health_check.target == "HTTP:80/index.html" @@ -74,8 +74,8 @@ that: - info.elbs|length == 1 - elb.availability_zones|length == 2 - - '"{{ aws_region }}a" in elb.availability_zones' - - '"{{ aws_region }}b" in elb.availability_zones' + - aws_region ~ 'a' in elb.availability_zones + - aws_region ~ 'b' in elb.availability_zones - elb.health_check.healthy_threshold == 10 - elb.health_check.interval == 30 - elb.health_check.target == "HTTP:80/index.html" @@ -134,7 +134,7 @@ - assert: that: - update_az is changed - - update_az.elb.zones[0] == "{{ aws_region }}c" + - update_az.elb.zones[0] == aws_region ~ 'c' - name: Get ELB info after changing AZ's elb_classic_lb_info: @@ -144,7 +144,7 @@ - assert: that: - elb.availability_zones|length == 1 - - '"{{ aws_region }}c" in elb.availability_zones[0]' + - aws_region ~ 'c' in elb.availability_zones[0] vars: elb: "{{ info.elbs[0] }}" @@ -170,9 +170,9 @@ - assert: that: - update_az is changed - - '"{{ aws_region }}a" in update_az.elb.zones' - - '"{{ aws_region }}b" in update_az.elb.zones' - - '"{{ aws_region }}c" in update_az.elb.zones' + - aws_region ~ 'a' in update_az.elb.zones + - aws_region ~ 'b' in update_az.elb.zones + - aws_region ~ 'c' in update_az.elb.zones - name: Get ELB info after updating AZ's elb_classic_lb_info: @@ -182,9 +182,9 @@ - assert: that: - elb.availability_zones|length == 3 - - '"{{ aws_region }}a" in elb.availability_zones' - - '"{{ aws_region }}b" in elb.availability_zones' - - '"{{ aws_region }}c" in elb.availability_zones' + - aws_region ~ 'a' in elb.availability_zones + - aws_region ~ 'b' in elb.availability_zones + - aws_region ~ 'c' in elb.availability_zones vars: elb: "{{ info.elbs[0] }}" diff --git a/tests/integration/targets/elb_network_lb/tasks/test_nlb_tags.yml b/tests/integration/targets/elb_network_lb/tasks/test_nlb_tags.yml index b55a0777f79..f1e920de8f7 100644 --- a/tests/integration/targets/elb_network_lb/tasks/test_nlb_tags.yml +++ b/tests/integration/targets/elb_network_lb/tasks/test_nlb_tags.yml @@ -34,7 +34,7 @@ - assert: that: - nlb.changed - - 'nlb.tags.created_by == "NLB test {{ resource_prefix }}"' + - nlb.tags.created_by == 'NLB test ' ~ resource_prefix - name: test tags are not removed if unspecified elb_network_lb: @@ -46,7 +46,7 @@ - assert: that: - not nlb.changed - - 'nlb.tags.created_by == "NLB test {{ resource_prefix }}"' + - nlb.tags.created_by == 'NLB test ' ~ resource_prefix - name: remove tags from NLB elb_network_lb: diff --git a/tests/integration/targets/elb_target/tasks/ec2_target.yml b/tests/integration/targets/elb_target/tasks/ec2_target.yml index af11b655f9e..20931f1d7de 100644 --- a/tests/integration/targets/elb_target/tasks/ec2_target.yml +++ b/tests/integration/targets/elb_target/tasks/ec2_target.yml @@ -147,7 +147,7 @@ - result.health_check_protocol == 'TCP' - '"tags" in result' - '"target_group_arn" in result' - - result.target_group_name == "{{ tg_name }}-nlb" + - result.target_group_name == tg_name ~ '-nlb' - result.target_type == 'instance' - result.deregistration_delay_timeout_seconds == '60' - result.deregistration_delay_connection_termination_enabled @@ -214,7 +214,7 @@ - '"load_balancer_arn" in result' - '"tags" in result' - result.type == 'network' - - result.vpc_id == '{{ vpc.vpc.id }}' + - result.vpc_id == vpc.vpc.id - name: modify up testing target group for NLB (preserve_client_ip_enabled=false) elb_target_group: diff --git a/tests/integration/targets/elb_target_info/tasks/main.yml b/tests/integration/targets/elb_target_info/tasks/main.yml index 031a1c7177c..fadce2135e2 100644 --- a/tests/integration/targets/elb_target_info/tasks/main.yml +++ b/tests/integration/targets/elb_target_info/tasks/main.yml @@ -207,9 +207,9 @@ - assert: that: - - "{{ alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ idle_target_group.target_group_arn not in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" + - "alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "idle_target_group.target_group_arn not in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" - (target_facts.instance_target_groups | length) == 2 msg: "target facts showed the target in the right target groups" @@ -228,9 +228,9 @@ - assert: that: - - "{{ alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ idle_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" + - "alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "idle_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" - (target_facts.instance_target_groups | length) == 3 msg: "target facts reflected the addition of the target to the idle group" @@ -242,9 +242,9 @@ - assert: that: - - "{{ alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" - - "{{ idle_target_group.target_group_arn not in (target_facts.instance_target_groups | map(attribute='target_group_arn')) }}" + - "alb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "nlb_target_group.target_group_arn in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" + - "idle_target_group.target_group_arn not in (target_facts.instance_target_groups | map(attribute='target_group_arn'))" - (target_facts.instance_target_groups | length) == 2 msg: "target_facts.instance_target_groups did not gather unused target groups when variable was set" diff --git a/tests/integration/targets/inventory_aws_mq/playbooks/test_inventory_with_hostvars_prefix_suffix.yml b/tests/integration/targets/inventory_aws_mq/playbooks/test_inventory_with_hostvars_prefix_suffix.yml index b0598b1088c..2db7f76ab15 100644 --- a/tests/integration/targets/inventory_aws_mq/playbooks/test_inventory_with_hostvars_prefix_suffix.yml +++ b/tests/integration/targets/inventory_aws_mq/playbooks/test_inventory_with_hostvars_prefix_suffix.yml @@ -16,9 +16,9 @@ - name: assert the hostvars are defined with prefix and/or suffix assert: that: - - "hostvars[broker_name].{{ vars_prefix }}host_instance_type{{ vars_suffix }} == 'mq.t3.micro'" - - "hostvars[broker_name].{{ vars_prefix }}engine_type{{ vars_suffix }} == '{{ engine }}'" - - "hostvars[broker_name].{{ vars_prefix }}broker_state{{ vars_suffix }} in ('CREATION_IN_PROGRESS', 'RUNNING')" + - "hostvars[broker_name][vars_prefix ~ 'host_instance_type' ~ vars_suffix] == 'mq.t3.micro'" + - "hostvars[broker_name][vars_prefix ~ 'engine_type' ~ vars_suffix] == engine" + - "hostvars[broker_name][vars_prefix ~ 'broker_state' ~ vars_suffix] in ('CREATION_IN_PROGRESS', 'RUNNING')" - "'host_instance_type' not in hostvars[broker_name]" - "'engine_type' not in hostvars[broker_name]" - "'broker_state' not in hostvars[broker_name]" diff --git a/tests/integration/targets/inventory_aws_mq/playbooks/test_populating_inventory.yml b/tests/integration/targets/inventory_aws_mq/playbooks/test_populating_inventory.yml index d138b76ac41..a71043c709c 100644 --- a/tests/integration/targets/inventory_aws_mq/playbooks/test_populating_inventory.yml +++ b/tests/integration/targets/inventory_aws_mq/playbooks/test_populating_inventory.yml @@ -14,4 +14,4 @@ that: - "'aws_mq' in groups" - "groups.aws_mq | length == 1" - - "groups.aws_mq.0 == '{{ broker_name }}'" + - groups.aws_mq.0 == broker_name diff --git a/tests/integration/targets/lightsail/tasks/main.yml b/tests/integration/targets/lightsail/tasks/main.yml index 13c029e554c..18e76756d36 100644 --- a/tests/integration/targets/lightsail/tasks/main.yml +++ b/tests/integration/targets/lightsail/tasks/main.yml @@ -32,7 +32,7 @@ - "'instance' in result and result.instance.name == instance_name" - "result.instance.state.name == 'running'" - "result.instance.networking.ports[0].from_port == 50" - - "{{ result.instance.networking.ports|length }} == 1" + - result.instance.networking.ports|length == 1 - name: Check if it does not delete public ports config when no value is provided lightsail: diff --git a/tests/integration/targets/lightsail_snapshot/tasks/main.yml b/tests/integration/targets/lightsail_snapshot/tasks/main.yml index 4b5eddc17eb..98553d27864 100644 --- a/tests/integration/targets/lightsail_snapshot/tasks/main.yml +++ b/tests/integration/targets/lightsail_snapshot/tasks/main.yml @@ -30,7 +30,7 @@ - assert: that: - result.changed == True - - "'instance_snapshot' in result and result.instance_snapshot.name == '{{ snapshot_name }}'" + - "'instance_snapshot' in result and result.instance_snapshot.name == snapshot_name" - "result.instance_snapshot.state == 'available'" - name: Make sure instance snapshot creation is idempotent diff --git a/tests/integration/targets/msk_cluster-auth/tasks/test_create_auth.yml b/tests/integration/targets/msk_cluster-auth/tasks/test_create_auth.yml index 0ef0f157ccb..9535c235fb9 100644 --- a/tests/integration/targets/msk_cluster-auth/tasks/test_create_auth.yml +++ b/tests/integration/targets/msk_cluster-auth/tasks/test_create_auth.yml @@ -62,7 +62,7 @@ # Not always returned by API # - "msk_cluster.cluster_info.client_authentication.unauthenticated.enabled == false" - "msk_cluster.cluster_info.open_monitoring.prometheus.jmx_exporter.enabled_in_broker == false" - - "msk_cluster.cluster_info.cluster_arn.startswith('arn:aws:kafka:{{ aws_region }}:')" + - "msk_cluster.cluster_info.cluster_arn.startswith('arn:aws:kafka:' ~ aws_region ~ ':')" - name: create a msk cluster with authentication flipped from default (idempotency) msk_cluster: diff --git a/tests/integration/targets/msk_cluster/tasks/test_create.yml b/tests/integration/targets/msk_cluster/tasks/test_create.yml index 5569762bc8e..f6845059fb3 100644 --- a/tests/integration/targets/msk_cluster/tasks/test_create.yml +++ b/tests/integration/targets/msk_cluster/tasks/test_create.yml @@ -50,7 +50,7 @@ - "msk_cluster.cluster_info.broker_node_group_info.instance_type == 'kafka.t3.small'" - "msk_cluster.cluster_info.broker_node_group_info.storage_info.ebs_storage_info.volume_size == 10" - "msk_cluster.cluster_info.open_monitoring.prometheus.jmx_exporter.enabled_in_broker == false" - - "msk_cluster.cluster_info.cluster_arn.startswith('arn:aws:kafka:{{ aws_region }}:')" + - "msk_cluster.cluster_info.cluster_arn.startswith('arn:aws:kafka:' ~ aws_region ~ ':')" - name: create msk cluster (idempotency) msk_cluster: diff --git a/tests/integration/targets/msk_config/tasks/main.yml b/tests/integration/targets/msk_config/tasks/main.yml index 095ec21c2d8..5f7f6c78204 100644 --- a/tests/integration/targets/msk_config/tasks/main.yml +++ b/tests/integration/targets/msk_config/tasks/main.yml @@ -53,7 +53,7 @@ assert: that: - msk_config.revision == 1 - - "msk_config.arn.startswith('arn:aws:kafka:{{ aws_region }}:')" + - "msk_config.arn.startswith('arn:aws:kafka:' ~ aws_region ~ ':')" - "'auto.create.topics.enable=True' in msk_config.server_properties" - "'zookeeper.session.timeout.ms=18000' in msk_config.server_properties" diff --git a/tests/integration/targets/redshift/tasks/main.yml b/tests/integration/targets/redshift/tasks/main.yml index 91ca39f4d78..a50c0372e2a 100644 --- a/tests/integration/targets/redshift/tasks/main.yml +++ b/tests/integration/targets/redshift/tasks/main.yml @@ -120,7 +120,7 @@ assert: that: - 'result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.tags.foo == "bar"' - 'result.cluster.tags.Tizio == "Caio"' @@ -143,7 +143,7 @@ assert: that: - 'not result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.tags.foo == "bar"' - 'result.cluster.tags.Tizio == "Caio"' - 'result.cluster.tags | count() == 2' @@ -166,7 +166,7 @@ assert: that: - 'result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}-modified"' + - result.cluster.identifier == redshift_cluster_name ~ '-modified' - 'result.cluster.enhanced_vpc_routing == True' - 'result.cluster.tags | count() == 1' - 'result.cluster.tags.foo == "bar"' @@ -234,7 +234,7 @@ assert: that: - 'result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.db_name == "integration_test"' # ============================================================ @@ -260,7 +260,7 @@ assert: that: - 'result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.db_name == "integration_test"' - 'result.cluster.tags.foo == "bar"' @@ -289,7 +289,7 @@ assert: that: - 'result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.db_name == "integration_test"' - 'result.cluster.tags.test1 == "value1"' - 'result.cluster.tags.foo == "bar"' @@ -318,7 +318,7 @@ assert: that: - 'not result.changed' - - 'result.cluster.identifier == "{{ redshift_cluster_name }}"' + - result.cluster.identifier == redshift_cluster_name - 'result.cluster.db_name == "integration_test"' - 'result.cluster.tags | count() == 2' diff --git a/tests/integration/targets/s3_sync/tasks/main.yml b/tests/integration/targets/s3_sync/tasks/main.yml index 2263df2bf54..600490706a4 100644 --- a/tests/integration/targets/s3_sync/tasks/main.yml +++ b/tests/integration/targets/s3_sync/tasks/main.yml @@ -23,7 +23,7 @@ - assert: that: - output.changed - - output.name == "{{ test_bucket }}" + - output.name == test_bucket - not output.requester_pays # ============================================================ - name: Prepare fixtures folder @@ -67,7 +67,7 @@ - assert: that: - output.changed - - output.name == "{{ test_bucket_2 }}" + - output.name == test_bucket_2 - not output.requester_pays - name: Sync files with remote bucket using glacier storage class @@ -113,7 +113,7 @@ - assert: that: - output.changed - - output.name == "{{ test_bucket_3 }}" + - output.name == test_bucket_3 - not output.requester_pays - name: Sync individual file with remote bucket diff --git a/tests/integration/targets/sns_topic/tasks/main.yml b/tests/integration/targets/sns_topic/tasks/main.yml index c05ad3b5373..00f3f71d96a 100644 --- a/tests/integration/targets/sns_topic/tasks/main.yml +++ b/tests/integration/targets/sns_topic/tasks/main.yml @@ -62,7 +62,7 @@ that: - sns_topic_info is successful - "'result' in sns_topic_info" - - sns_topic_info.result["sns_arn"] == "{{ sns_arn }}" + - sns_topic_info.result["sns_arn"] == sns_arn - "'sns_topic' in sns_topic_info.result" - "'display_name' in sns_topic_info.result['sns_topic']" - sns_topic_info.result["sns_topic"]["display_name"] == "My topic name" @@ -79,7 +79,7 @@ that: - sns_topic_info is successful - "'result' in sns_topic_info" - - sns_topic_info.result["sns_arn"] == "{{ sns_arn }}" + - sns_topic_info.result["sns_arn"] == sns_arn - "'sns_topic' in sns_topic_info.result" - "'display_name' in sns_topic_info.result['sns_topic']" - sns_topic_info.result["sns_topic"]["display_name"] == "My topic name" @@ -110,7 +110,7 @@ that: - sns_fifo_topic.changed - sns_fifo_topic.sns_topic.topic_type == 'fifo' - - sns_fifo_topic.sns_topic.name == '{{ sns_topic_topic_name }}-fifo' + - sns_fifo_topic.sns_topic.name == sns_topic_topic_name ~ '-fifo' - name: Run create a FIFO topic again for idempotence test (with .fifo) sns_topic: diff --git a/tests/integration/targets/sqs_queue/tasks/main.yml b/tests/integration/targets/sqs_queue/tasks/main.yml index d5a9dd60370..4c16be31340 100644 --- a/tests/integration/targets/sqs_queue/tasks/main.yml +++ b/tests/integration/targets/sqs_queue/tasks/main.yml @@ -19,7 +19,7 @@ assert: that: - create_result.changed - - create_result.region == "{{ aws_region }}" + - create_result.region == aws_region always: - name: Test deleting SQS queue diff --git a/tests/integration/targets/ssm_parameter/tasks/main.yml b/tests/integration/targets/ssm_parameter/tasks/main.yml index efc09bc4b5b..7c0e27fee33 100644 --- a/tests/integration/targets/ssm_parameter/tasks/main.yml +++ b/tests/integration/targets/ssm_parameter/tasks/main.yml @@ -523,7 +523,7 @@ - name: Create parameter with tags case - Ensure tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_orig['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_orig[item.key] loop: "{{ simple_tags_orig | dict2items }}" - name: Create parameter with tags case - Ensure no missing or additional tags @@ -578,7 +578,7 @@ - name: Update description only case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_orig['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_orig[item.key] loop: "{{ simple_tags_orig | dict2items }}" - name: Update description only case - Ensure no missing or additional tags @@ -633,7 +633,7 @@ - name: Add tag to existing parameter case - Ensure tags correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_add_owner['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_add_owner[item.key] loop: "{{ simple_tags_add_owner | dict2items }}" - name: Add tag to existing parameter case - Ensure no missing or additional tags @@ -704,7 +704,7 @@ - name: Change single tag case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_change_environment['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_change_environment[item.key] loop: "{{ simple_tags_change_environment | dict2items }}" - name: Change single tag case - Ensure no missing or additional tags @@ -775,7 +775,7 @@ - name: Delete single tag case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_delete_version['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_delete_version[item.key] loop: "{{ simple_tags_delete_version | dict2items }}" - name: Delete single tag case - Ensure no missing or additional tags @@ -846,7 +846,7 @@ - name: Delete single tag w/ spaces case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_delete_tag_with_space['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_delete_tag_with_space[item.key] loop: "{{ simple_tags_delete_tag_with_space | dict2items }}" - name: Delete single tag w/ spaces case - Ensure no missing or additional tags @@ -917,7 +917,7 @@ - name: Add/delete/change tags case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_add_delete_change['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_add_delete_change[item.key] loop: "{{ simple_tags_add_delete_change | dict2items }}" - name: Add/delete/change tags case - Ensure no missing or additional tags @@ -988,7 +988,7 @@ - name: Delete all tags case - Ensure expected tags is correct assert: that: - - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_delete_all_tags['{{ item.key }}'] + - result.parameter_metadata.tags[item.key] == simple_tags_delete_all_tags[item.key] loop: "{{ simple_tags_delete_all_tags | dict2items }}" - name: Delete all tags case - Ensure no missing or additional tags @@ -1062,8 +1062,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == - (simple_tags_orig | combine(simple_tags_purge_false_add_owner))['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == + (simple_tags_orig | combine(simple_tags_purge_false_add_owner))[item.key] loop: > {{ simple_tags_orig | combine(simple_tags_purge_false_add_owner) | dict2items }} @@ -1071,8 +1071,8 @@ assert: that: - > - result.parameter_metadata.tags | length == {{ simple_tags_orig | - combine(simple_tags_purge_false_add_owner) | dict2items }} | length + result.parameter_metadata.tags | length == simple_tags_orig | + combine(simple_tags_purge_false_add_owner) | dict2items | length - name: Add tag case (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1140,8 +1140,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == - (simple_tags_orig | combine(simple_tags_purge_false_add_multiple))['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == + (simple_tags_orig | combine(simple_tags_purge_false_add_multiple))[item.key] loop: > {{ simple_tags_orig | combine(simple_tags_purge_false_add_multiple) | dict2items }} @@ -1149,8 +1149,8 @@ assert: that: - > - result.parameter_metadata.tags | length == {{ simple_tags_orig | - combine(simple_tags_purge_false_add_multiple) | dict2items }} | length + result.parameter_metadata.tags | length == simple_tags_orig | + combine(simple_tags_purge_false_add_multiple) | dict2items | length - name: Add multiple tags case (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1218,8 +1218,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == - (simple_tags_orig | combine(simple_tags_purge_false_change_environment))['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == + (simple_tags_orig | combine(simple_tags_purge_false_change_environment))[item.key] loop: > {{ simple_tags_orig | combine(simple_tags_purge_false_change_environment) | dict2items }} loop_control: @@ -1230,8 +1230,8 @@ assert: that: - > - result.parameter_metadata.tags | length == {{ simple_tags_orig | - combine(simple_tags_purge_false_change_environment) | dict2items }} | length + result.parameter_metadata.tags | length == simple_tags_orig | + combine(simple_tags_purge_false_change_environment) | dict2items | length - name: Change tag case (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1299,8 +1299,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == - (simple_tags_orig | combine(simple_tags_purge_false_change_multiple))['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == + (simple_tags_orig | combine(simple_tags_purge_false_change_multiple))[item.key] loop: > {{ simple_tags_orig | combine(simple_tags_purge_false_change_multiple) | dict2items }} loop_control: @@ -1311,8 +1311,8 @@ assert: that: - > - result.parameter_metadata.tags | length == {{ simple_tags_orig | - combine(simple_tags_purge_false_change_multiple) | dict2items }} | length + result.parameter_metadata.tags | length == simple_tags_orig | + combine(simple_tags_purge_false_change_multiple) | dict2items | length - name: Change multiple tags (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1380,8 +1380,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == - (simple_tags_orig | combine(simple_tags_purge_false_add_and_change))['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == + (simple_tags_orig | combine(simple_tags_purge_false_add_and_change))[item.key] loop: > {{ simple_tags_orig | combine(simple_tags_purge_false_add_and_change) | dict2items }} loop_control: @@ -1392,8 +1392,8 @@ assert: that: - > - result.parameter_metadata.tags | length == {{ simple_tags_orig | - combine(simple_tags_purge_false_add_and_change) | dict2items }} | length + result.parameter_metadata.tags | length == simple_tags_orig | + combine(simple_tags_purge_false_add_and_change) | dict2items | length - name: Add/Change multiple tags (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1461,7 +1461,7 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] == simple_tags_orig['{{ item.key }}'] + result.parameter_metadata.tags[item.key] == simple_tags_orig[item.key] loop: > {{ simple_tags_orig | dict2items }} loop_control: @@ -1472,7 +1472,7 @@ that: - > result.parameter_metadata.tags | length - == {{ simple_tags_orig | dict2items }} | length + == simple_tags_orig | dict2items | length - name: Empty tags dict (purge_tags=false) - Lookup a tagged parameter set_fact: @@ -1538,8 +1538,8 @@ assert: that: - > - result.parameter_metadata.tags['{{ item.key }}'] - == simple_tags_orig['{{ item.key }}'] + result.parameter_metadata.tags[item.key] + == simple_tags_orig[item.key] loop: > {{ simple_tags_orig | dict2items }} loop_control: @@ -1550,7 +1550,7 @@ that: - > result.parameter_metadata.tags | length - == {{ simple_tags_orig | dict2items }} | length + == simple_tags_orig | dict2items | length - name: No tags parameter (purge_tags=true) - Lookup a tagged parameter set_fact: diff --git a/tests/integration/targets/stepfunctions_state_machine/tasks/main.yml b/tests/integration/targets/stepfunctions_state_machine/tasks/main.yml index a1919f1aedf..061acb2c369 100644 --- a/tests/integration/targets/stepfunctions_state_machine/tasks/main.yml +++ b/tests/integration/targets/stepfunctions_state_machine/tasks/main.yml @@ -112,7 +112,7 @@ - assert: that: - update_check.changed == True - - "update_check.output == 'State machine would be updated: {{ creation_output.state_machine_arn }}'" + - "update_check.output == 'State machine would be updated: ' ~ creation_output.state_machine_arn" - name: Update an existing state machine stepfunctions_state_machine: @@ -265,7 +265,7 @@ - assert: that: - deletion_check.changed == True - - "deletion_check.output == 'State machine would be deleted: {{ creation_output.state_machine_arn }}'" + - "deletion_check.output == 'State machine would be deleted: ' ~ creation_output.state_machine_arn" - name: Remove state machine stepfunctions_state_machine: diff --git a/tests/integration/targets/waf_web_acl/tasks/main.yml b/tests/integration/targets/waf_web_acl/tasks/main.yml index 285ee2b3742..acbf1f29c85 100644 --- a/tests/integration/targets/waf_web_acl/tasks/main.yml +++ b/tests/integration/targets/waf_web_acl/tasks/main.yml @@ -561,7 +561,7 @@ assert: that: - remove_in_use_condition.failed - - "'Condition {{ resource_prefix }}_size_condition is in use' in remove_in_use_condition.msg" + - "'Condition ' ~ resource_prefix ~ '_size_condition is in use' in remove_in_use_condition.msg" - name: create WAF Regional rule waf_rule: @@ -674,7 +674,7 @@ assert: that: - remove_in_use_condition.failed - - "'Condition {{ resource_prefix }}_size_condition is in use' in remove_in_use_condition.msg" + - "'Condition ' ~ resource_prefix ~ '_size_condition is in use' in remove_in_use_condition.msg" ################################################## # aws_waf_web_acl tests From d4eb406d8b39a4983f366b00d47afaa31a10ab83 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:36:14 +0100 Subject: [PATCH 04/77] elb_network_lb - add support for AlpnPolicy for TLS listeners (#2010) elb_network_lb - add support for AlpnPolicy for TLS listeners SUMMARY Depends-On: ansible-collections/amazon.aws#1884 closes #1566 ISSUE TYPE Feature Pull Request COMPONENT NAME elb_network_lb Reviewed-by: Helen Bailey Reviewed-by: Bikouo Aubin --- ...7-elb_network_lb-update-tls-listeners.yaml | 4 + plugins/modules/elb_network_lb.py | 22 +++++ .../tasks/test_modifying_nlb_listeners.yml | 80 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml diff --git a/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml b/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml new file mode 100644 index 00000000000..9f2bdc5c261 --- /dev/null +++ b/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml @@ -0,0 +1,4 @@ +--- +minor_changes: + - elb_network_lb - add the possibly to update ``SslPolicy`` and ``Certificates`` for TLS listeners (). + - elb_network_lb - add support for Application-Layer Protocol Negotiation (ALPN) policy ``AlpnPolicy`` for TLS listeners (https://github.com/ansible-collections/community.aws/issues/1566). diff --git a/plugins/modules/elb_network_lb.py b/plugins/modules/elb_network_lb.py index fa0da3fed24..82ec8700625 100644 --- a/plugins/modules/elb_network_lb.py +++ b/plugins/modules/elb_network_lb.py @@ -69,6 +69,17 @@ description: - The name of the target group. - Mutually exclusive with I(TargetGroupArn). + AlpnPolicy: + description: + - The name of the Application-Layer Protocol Negotiation (ALPN) policy. + type: str + choices: + - HTTP1Only + - HTTP2Only + - HTTP2Optional + - HTTP2Preferred + - None + version_added: 7.1.0 name: description: - The name of the load balancer. This name must be unique within your AWS account, can have a maximum of 32 characters, must contain only alphanumeric @@ -283,6 +294,13 @@ returned: when state is present type: str sample: "" + alpn_policy: + description: The name of the Application-Layer Protocol Negotiation (ALPN) policy. + returned: when state is present + type: list + elements: str + version_added: 7.1.0 + sample: ["HTTP1Only", "HTTP2Only"] load_balancer_arn: description: The Amazon Resource Name (ARN) of the load balancer. returned: when state is present @@ -449,6 +467,10 @@ def main(): SslPolicy=dict(type="str"), Certificates=dict(type="list", elements="dict"), DefaultActions=dict(type="list", required=True, elements="dict"), + AlpnPolicy=dict( + type="str", + choices=["HTTP1Only", "HTTP2Only", "HTTP2Optional", "HTTP2Preferred", "None"], + ), ), ), name=dict(required=True, type="str"), diff --git a/tests/integration/targets/elb_network_lb/tasks/test_modifying_nlb_listeners.yml b/tests/integration/targets/elb_network_lb/tasks/test_modifying_nlb_listeners.yml index 9877e3f1b7c..9189fba28dd 100644 --- a/tests/integration/targets/elb_network_lb/tasks/test_modifying_nlb_listeners.yml +++ b/tests/integration/targets/elb_network_lb/tasks/test_modifying_nlb_listeners.yml @@ -73,3 +73,83 @@ that: - nlb.changed - not nlb.listeners + +# TLS listeners +- name: Add a TLS listener + elb_network_lb: + name: "{{ nlb_name }}" + subnets: "{{ nlb_subnets }}" + state: present + listeners: + - Protocol: TLS + Port: 443 + Certificates: + - CertificateArn: "{{ cert.arn }}" + DefaultActions: + - Type: forward + TargetGroupName: "{{ tg_name }}" + SslPolicy: ELBSecurityPolicy-TLS-1-0-2015-04 + AlpnPolicy: HTTP2Optional + register: _add + +- assert: + that: + - _add.listeners[0].alpn_policy == ["HTTP2Optional"] + - _add.listeners[0].ssl_policy == "ELBSecurityPolicy-TLS-1-0-2015-04" + +- name: Add a TLS listener (idempotency) + elb_network_lb: + name: "{{ nlb_name }}" + subnets: "{{ nlb_subnets }}" + listeners: + - Protocol: TLS + Port: 443 + Certificates: + - CertificateArn: "{{ cert.arn }}" + DefaultActions: + - Type: forward + TargetGroupName: "{{ tg_name }}" + SslPolicy: ELBSecurityPolicy-TLS-1-0-2015-04 + AlpnPolicy: HTTP2Optional + register: _idempotency + +- assert: + that: + - _idempotency is not changed + - _idempotency.listeners[0].alpn_policy == ["HTTP2Optional"] + - _idempotency.listeners[0].ssl_policy == "ELBSecurityPolicy-TLS-1-0-2015-04" + +- name: Update TLS listener of NLB + elb_network_lb: + name: "{{ nlb_name }}" + subnets: "{{ nlb_subnets }}" + listeners: + - Protocol: TLS + Port: 443 + Certificates: + - CertificateArn: "{{ cert.arn }}" + DefaultActions: + - Type: forward + TargetGroupName: "{{ tg_name }}" + SslPolicy: ELBSecurityPolicy-TLS13-1-2-FIPS-2023-04 + AlpnPolicy: HTTP1Only + register: _update + +- assert: + that: + - _update is changed + - _update.listeners[0].alpn_policy == ["HTTP1Only"] + - _update.listeners[0].ssl_policy == "ELBSecurityPolicy-TLS13-1-2-FIPS-2023-04" + +- name: remove listener from NLB + elb_network_lb: + name: "{{ nlb_name }}" + subnets: "{{ nlb_subnets }}" + state: present + listeners: [] + register: nlb + +- assert: + that: + - nlb.changed + - not nlb.listeners From f4b0ba5fb17ed7f2e2d3ac955a0b87cdf423169a Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 11 Dec 2023 09:20:44 +0100 Subject: [PATCH 05/77] Bump main release to 8.0.0-dev0 (#1998) SUMMARY stable-7 has been branched, main now becomes 8.0.0-dev0. ISSUE TYPE Docs Pull Request COMPONENT NAME galaxy.yml plugins/module_utils/common.py ADDITIONAL INFORMATION --- galaxy.yml | 4 ++-- plugins/module_utils/common.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 4ce2e744b11..6c306fa9bb9 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: community name: aws -version: 7.0.0-dev0 +version: 8.0.0-dev0 readme: README.md authors: - Ansible (https://github.com/ansible) @@ -9,7 +9,7 @@ description: A variety of Ansible content to help automate the management of AWS license_file: COPYING tags: [community, aws, cloud, amazon] dependencies: - amazon.aws: '>=7.0.0-dev0' + amazon.aws: '>=8.0.0-dev0' repository: https://github.com/ansible-collections/community.aws documentation: https://ansible-collections.github.io/community.aws/branch/main/collections/community/aws/index.html homepage: https://github.com/ansible-collections/community.aws diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index 153d468830e..4c33a0bb416 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -5,4 +5,4 @@ COMMUNITY_AWS_COLLECTION_NAME = "community.aws" -COMMUNITY_AWS_COLLECTION_VERSION = "7.0.0-dev0" +COMMUNITY_AWS_COLLECTION_VERSION = "8.0.0-dev0" From 5277d06aa86f76015f3a8bd1ca09d9ab5d11bc93 Mon Sep 17 00:00:00 2001 From: abikouo Date: Thu, 21 Dec 2023 17:27:03 +0100 Subject: [PATCH 06/77] Fix broken sanity tests --- .github/workflows/sanity.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 161dabfe25b..1cd6a6ba3b2 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -8,3 +8,4 @@ jobs: uses: ansible-network/github_actions/.github/workflows/sanity.yml@main with: matrix_include: "[]" + collection_pre_install: '-r source/tests/sanity/requirements.yml' From 83cde20a621e9b07d74076c5edc71e862dc5ce08 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 22 Dec 2023 08:10:39 +0100 Subject: [PATCH 07/77] New module dynamodb_table_info (#2021) New module dynamodb_table_info SUMMARY New info module for dynamodb table ISSUE TYPE New Module Pull Request COMPONENT NAME dynamodb_table_info Reviewed-by: GomathiselviS Reviewed-by: Helen Bailey Reviewed-by: Bikouo Aubin --- meta/runtime.yml | 1 + plugins/modules/dynamodb_table_info.py | 292 ++++++++++++++++++ .../targets/dynamodb_table/tasks/main.yml | 21 ++ .../tasks/test_pay_per_request.yml | 52 ++++ 4 files changed, 366 insertions(+) create mode 100644 plugins/modules/dynamodb_table_info.py diff --git a/meta/runtime.yml b/meta/runtime.yml index 5d05436df14..4c6bc72910d 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -89,6 +89,7 @@ action_groups: - dms_endpoint - dms_replication_subnet_group - dynamodb_table + - dynamodb_table_info - dynamodb_ttl - ec2_ami_copy - ec2_asg diff --git a/plugins/modules/dynamodb_table_info.py b/plugins/modules/dynamodb_table_info.py new file mode 100644 index 00000000000..66349e2d74f --- /dev/null +++ b/plugins/modules/dynamodb_table_info.py @@ -0,0 +1,292 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +DOCUMENTATION = r""" +--- +module: dynamodb_table_info +version_added: 7.2.0 +short_description: Returns information about a Dynamo DB table +description: + - Returns information about the Dynamo DB table, including the current status of the table, + when it was created, the primary key schema, and any indexes on the table. +author: + - Aubin Bikouo (@abikouo) +options: + name: + description: + - The name of the table to describe. + required: true + type: str +extends_documentation_fragment: + - amazon.aws.common.modules + - amazon.aws.region.modules + - amazon.aws.boto3 +""" + +EXAMPLES = r""" +- name: Return information about the DynamoDB table named 'my-table' + community.aws.dynamodb_table_info: + name: my-table +""" + +RETURN = r""" +table: + description: The returned table params from the describe API call. + returned: success + type: complex + contains: + table_name: + description: The name of the table. + returned: always + type: str + table_status: + description: The current state of the table. + returned: always + type: str + sample: 'ACTIVE' + creation_date_time: + description: The date and time when the table was created, in UNIX epoch time format. + returned: always + type: str + table_size_bytes: + description: The total size of the specified table, in bytes. + returned: always + type: int + item_count: + description: The number of items in the specified table. + returned: always + type: int + table_arn: + description: The Amazon Resource Name (ARN) that uniquely identifies the table. + returned: always + type: str + table_id: + description: Unique identifier for the table for which the backup was created. + returned: always + type: str + attribute_definitions: + description: A list of attributes for describing the key schema for the table and indexes. + returned: always + type: complex + contains: + attribute_name: + description: A name for the attribute. + type: str + returned: always + attribute_type: + description: The data type for the attribute, S (String), N (Number) and B (Binary). + type: str + returned: always + key_schema: + description: A list of key schemas that specify the attributes that make up the primary key of a table, or the key attributes of an index. + returned: always + type: complex + contains: + attribute_name: + description: The name of a key attribute. + type: str + returned: always + key_type: + description: The role that this key attribute will assume, 'HASH' for partition key, 'RANGE' for sort key + type: str + returned: always + billing_mode: + description: Controls how you are charged for read and write throughput and how you manage capacity. + returned: always + type: str + local_secondary_indexes: + description: Represents one or more local secondary indexes on the table. + returned: if any, on the table + type: list + elements: dict + global_secondary_indexes: + description: The global secondary indexes of table. + returned: if any, on the table + type: list + elements: dict + stream_specification: + description: The current DynamoDB Streams configuration for the table. + returned: if any, on the table + type: complex + contains: + stream_enabled: + description: Indicates whether DynamoDB Streams is enabled (true) or disabled (false) on the table. + type: bool + returned: always + sample: true + stream_view_type: + description: When an item in the table is modified, stream_view_type determines what information is written to the stream for this table. + type: str + returned: always + sample: KEYS_ONLY + latest_stream_label: + description: A timestamp, in ISO 8601 format, for this stream. + type: str + returned: if any on the table + latest_stream_arn: + description: The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this table. + returned: if any on the table + type: str + global_table_version: + description: Represents the version of global tables in use, if the table is replicated across AWS Regions. + type: str + returned: if the table is replicated + replicas: + description: Represents replicas of the table. + type: list + elements: dict + returned: if any on the table + source_backup_arn: + description: The Amazon Resource Name (ARN) of the backup from which the table was restored. + type: str + returned: if any, on the table + source_table_arn: + description: The ARN of the source table of the backup that is being restored. + type: str + returned: if any, on the table + restore_date_time: + description: Point in time or source backup time. + type: str + returned: if any, on table + restore_in_progress: + description: Indicates if a restore is in progress or not. + type: bool + returned: if any, on table + sse_description: + description: The description of the server-side encryption status on the specified table. + type: dict + returned: if any, on table + sample: {} + archival_summary: + description: Contains information about the table archive. + type: complex + returned: if any, on table + contains: + archival_date_time: + description: The date and time when table archival was initiated by DynamoDB, in UNIX epoch time format. + type: str + returned: always + archival_reason: + description: The reason DynamoDB archived the table. + type: str + returned: always + sample: INACCESSIBLE_ENCRYPTION_CREDENTIALS + archival_backup_arn: + description: The Amazon Resource Name (ARN) of the backup the table was archived to, when applicable in the archival reason. + type: str + returned: always + table_class: + description: The table class of the specified table. + type: str + returned: if any on the table + sample: STANDARD_INFREQUENT_ACCESS + deletion_protection_enabled: + description: Indicates whether deletion protection is enabled (true) or disabled (false) on the table. + type: bool + returned: always + sample: true + provisioned_throughput: + description: The provisioned throughput settings for the table. + type: dict + returned: always + sample: '{"number_of_decreases_today": 0, "read_capacity_units": 1, "write_capacity_units": 1}' + tags: + description: A dict of tags associated with the DynamoDB table. + returned: always + type: dict +""" + +try: + import botocore +except ImportError: + pass # Handled by AnsibleAWSModule + +from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict + +from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code +from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict + +from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule + + +# ResourceNotFoundException is expected here if the table doesn't exist +@AWSRetry.jittered_backoff(catch_extra_error_codes=["LimitExceededException", "ResourceInUseException"]) +def _describe_table(client, **params): + return client.describe_table(**params) + + +def describe_dynamodb_table(module): + table_name = module.params.get("name") + retry_decorator = AWSRetry.jittered_backoff( + catch_extra_error_codes=["LimitExceededException", "ResourceInUseException", "ResourceNotFoundException"], + ) + client = module.client("dynamodb", retry_decorator=retry_decorator) + try: + table = _describe_table(client, TableName=table_name) + except is_boto3_error_code("ResourceNotFoundException"): + module.exit_json(table={}) + except ( + botocore.exceptions.ClientError, + botocore.exceptions.BotoCoreError, + ) as e: # pylint: disable=duplicate-except + module.fail_json_aws(e, msg="Failed to describe table") + + table = table["Table"] + try: + tags = client.list_tags_of_resource(aws_retry=True, ResourceArn=table["TableArn"])["Tags"] + except is_boto3_error_code("AccessDeniedException"): + module.warn("Permission denied when listing tags") + tags = [] + except ( + botocore.exceptions.ClientError, + botocore.exceptions.BotoCoreError, + ) as e: # pylint: disable=duplicate-except + module.fail_json_aws(e, msg="Failed to list table tags") + + table = camel_dict_to_snake_dict(table) + table["tags"] = boto3_tag_list_to_ansible_dict(tags) + + if "table_class_summary" in table: + table["table_class"] = table["table_class_summary"]["table_class"] + del table["table_class_summary"] + + # billing_mode_summary doesn't always seem to be set but is always set for PAY_PER_REQUEST + # and when updating the billing_mode + if "billing_mode_summary" in table: + table["billing_mode"] = table["billing_mode_summary"]["billing_mode"] + del table["billing_mode_summary"] + else: + table["billing_mode"] = "PROVISIONED" + + # Restore summary + if "restore_summary" in table: + table["source_backup_arn"] = table["restore_summary"].get("source_backup_arn", "") + table["source_table_arn"] = table["restore_summary"].get("source_table_arn", "") + table["restore_date_time"] = table["restore_summary"].get("restore_date_time", "") + table["restore_in_progress"] = table["restore_summary"].get("restore_in_progress") + del table["restore_summary"] + + module.exit_json(table=table) + + +def main(): + argument_spec = dict( + name=dict( + required=True, + ), + ) + + module = AnsibleAWSModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + describe_dynamodb_table(module) + + +if __name__ == "__main__": + main() diff --git a/tests/integration/targets/dynamodb_table/tasks/main.yml b/tests/integration/targets/dynamodb_table/tasks/main.yml index 268e61baeff..5b3592f3081 100644 --- a/tests/integration/targets/dynamodb_table/tasks/main.yml +++ b/tests/integration/targets/dynamodb_table/tasks/main.yml @@ -30,6 +30,16 @@ that: - create_table is successful - create_table is changed + + - name: Ensure the table was not created + dynamodb_table_info: + name: "{{ table_name }}" + register: table_info + + - name: Assert the table was not created + assert: + that: + - not table_info.table - name: Create table dynamodb_table: @@ -65,6 +75,17 @@ - create_table.table_name == table_name - create_table.write_capacity == 1 + - name: Ensure the table was created + dynamodb_table_info: + name: "{{ table_name }}" + register: table_info + + - name: Assert the table was created + assert: + that: + - table_info.table + - 'table_info.table.attribute_definitions == [{"attribute_name": table_index, "attribute_type": table_index_type[0]}]' + - name: Create table - idempotent - check_mode dynamodb_table: state: present diff --git a/tests/integration/targets/dynamodb_table/tasks/test_pay_per_request.yml b/tests/integration/targets/dynamodb_table/tasks/test_pay_per_request.yml index b469a1b51ca..301d22c06e8 100644 --- a/tests/integration/targets/dynamodb_table/tasks/test_pay_per_request.yml +++ b/tests/integration/targets/dynamodb_table/tasks/test_pay_per_request.yml @@ -15,6 +15,16 @@ - create_table is successful - create_table is changed +- name: Ensure the table was not created + dynamodb_table_info: + name: "{{ table_name_on_demand }}" + register: _table + +- name: Assert the table does not exist + assert: + that: + - not _table.table + - name: Create table - pay-per-request dynamodb_table: state: present @@ -32,6 +42,17 @@ - create_table is changed - create_table.billing_mode == "PAY_PER_REQUEST" +- name: Ensure the table was created + dynamodb_table_info: + name: "{{ table_name_on_demand }}" + register: _table + +- name: Assert the table has been created with the expected billing mode + assert: + that: + - _table.table + - _table.table.billing_mode == 'PAY_PER_REQUEST' + - name: Create table - pay-per-request - check failure dynamodb_table: state: present @@ -71,6 +92,16 @@ - create_complex_table is successful - create_complex_table is changed +- name: Ensure the table was not created + dynamodb_table_info: + name: "{{ table_name_on_demand_complex }}" + register: _complex_table + +- name: Assert the table does not exist + assert: + that: + - not _complex_table.table + - name: Create complex table - check failure on index dynamodb_table: state: present @@ -120,6 +151,17 @@ - create_complex_table.table_name == table_name_on_demand_complex - create_complex_table.tags == tags_default +- name: Ensure the table was created + dynamodb_table_info: + name: "{{ table_name_on_demand_complex }}" + register: _complex_table + +- name: Assert the table has been created + assert: + that: + - _complex_table.table + - _complex_table.table.billing_mode == 'PAY_PER_REQUEST' + - name: Update complex table billing_mode dynamodb_table: state: present @@ -140,3 +182,13 @@ - convert_complex_table is changed - '"billing_mode" in convert_complex_table' - convert_complex_table.billing_mode == "PROVISIONED" + +- name: Read table info + dynamodb_table_info: + name: "{{ table_name_on_demand_complex }}" + register: _complex_table + +- name: Assert the table has been updated + assert: + that: + - _complex_table.table.billing_mode == 'PROVISIONED' From 8c24472851ffc8477b8a6249627e683529cf110b Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 3 Jan 2024 13:23:48 +0100 Subject: [PATCH 08/77] Remove useless tests/sanity/ignore-2.*.txt files lower than 2.14 (#2020) Remove useless tests/sanity/ignore-2.*.txt files lower than 2.14 SUMMARY Remove useless tests/sanity/ignore-2.*.txt files lower than 2.14 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION --- tests/sanity/ignore-2.10.txt | 0 tests/sanity/ignore-2.11.txt | 0 tests/sanity/ignore-2.12.txt | 0 tests/sanity/ignore-2.13.txt | 0 tests/sanity/ignore-2.9.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/sanity/ignore-2.10.txt delete mode 100644 tests/sanity/ignore-2.11.txt delete mode 100644 tests/sanity/ignore-2.12.txt delete mode 100644 tests/sanity/ignore-2.13.txt delete mode 100644 tests/sanity/ignore-2.9.txt diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt deleted file mode 100644 index e69de29bb2d..00000000000 From af18bc61c94003c146a31200c17b0b9cb0651823 Mon Sep 17 00:00:00 2001 From: DJ Lee Date: Wed, 3 Jan 2024 07:36:08 -0500 Subject: [PATCH 09/77] Eliminate escape codes in aws_ssm output from newer versions of Bash (#1839) SUMMARY aws_ssm - prevent escape codes from interfering with output Fixes #1756 ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux). --- changelogs/fragments/1839-disable-bracketed-paste.yml | 2 ++ plugins/connection/aws_ssm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1839-disable-bracketed-paste.yml diff --git a/changelogs/fragments/1839-disable-bracketed-paste.yml b/changelogs/fragments/1839-disable-bracketed-paste.yml new file mode 100644 index 00000000000..1398fc3ec1d --- /dev/null +++ b/changelogs/fragments/1839-disable-bracketed-paste.yml @@ -0,0 +1,2 @@ +bugfixes: + - aws_ssm - disable `enable-bracketed-paste` to fix issue with amazon linux 2023 and other OSes (https://github.com/ansible-collections/community.aws/issues/1756) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 173dd6a084c..263305ab41e 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -627,7 +627,7 @@ def _prepare_terminal(self): disable_prompt_complete = None end_mark = "".join([random.choice(string.ascii_letters) for i in xrange(self.MARK_LENGTH)]) disable_prompt_cmd = to_bytes( - "PS1='' ; printf '\\n%s\\n' '" + end_mark + "'\n", + "PS1='' ; bind 'set enable-bracketed-paste off'; printf '\\n%s\\n' '" + end_mark + "'\n", errors="surrogate_or_strict", ) disable_prompt_reply = re.compile(r"\r\r\n" + re.escape(end_mark) + r"\r\r\n", re.MULTILINE) From e5a41df385cce1e1b660696ed7953002cddd98f7 Mon Sep 17 00:00:00 2001 From: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:37:45 +0100 Subject: [PATCH 10/77] Document the requirement for an S3 bucket for the aws_ssm connection plugin (#1850) SUMMARY Fixes #1775 This explains why an S3 bucket is needed for the aws_ssm plugin, and some considerations relating to that. ISSUE TYPE - Docs Pull Request COMPONENT NAME aws_ssm --- changelogs/fragments/1775-aws_ssm-s3-docs.yaml | 3 +++ plugins/connection/aws_ssm.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 changelogs/fragments/1775-aws_ssm-s3-docs.yaml diff --git a/changelogs/fragments/1775-aws_ssm-s3-docs.yaml b/changelogs/fragments/1775-aws_ssm-s3-docs.yaml new file mode 100644 index 00000000000..fab369337d4 --- /dev/null +++ b/changelogs/fragments/1775-aws_ssm-s3-docs.yaml @@ -0,0 +1,3 @@ +minor_changes: +- aws_ssm - Updated the documentation to explicitly state that an S3 bucket is required, + the behavior of the files in that bucket, and requirements around that. (https://github.com/ansible-collections/community.aws/issues/1775). diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 263305ab41e..d272a0c8b48 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -20,12 +20,26 @@ ``ansible_user`` variables to configure the remote user. The ``become_user`` parameter should be used to configure which user to run commands as. Remote commands will often default to running as the ``ssm-agent`` user, however this will also depend on how SSM has been configured. + - This plugin requires an S3 bucket to send files to/from the remote instance. This is required even for modules + which do not explicitly send files (such as the C(shell) or C(command) modules), because Ansible sends over the C(.py) files of the module itself, via S3. + - Files sent via S3 will be named in S3 with the EC2 host ID (e.g. C(i-123abc/)) as the prefix. + - The files in S3 will be deleted by the end of the playbook run. If the play is terminated ungracefully, the files may remain in the bucket. + If the bucket has versioning enabled, the files will remain in version history. If your tasks involve sending secrets to/from the remote instance + (e.g. within a C(shell) command, or a SQL password in the C(community.postgresql.postgresql_query) module) then those passwords will be included in plaintext in those files in S3 indefinitely, + visible to anyone with access to that bucket. Therefore it is recommended to use a bucket with versioning disabled/suspended. + - The files in S3 will be deleted even if the C(keep_remote_files) setting is C(true). + requirements: - The remote EC2 instance must be running the AWS Systems Manager Agent (SSM Agent). U(https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started.html) - The control machine must have the AWS session manager plugin installed. U(https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html) - The remote EC2 Linux instance must have curl installed. + - The remote EC2 Linux instance and the controller both need network connectivity to S3. + - The remote instance does not require IAM credentials for S3. This module will generate a presigned URL for S3 from the controller, + and then will pass that URL to the target over SSM, telling the target to download/upload from S3 with C(curl). + - The controller requires IAM permissions to upload, download and delete files from the specified S3 bucket. This includes + `s3:GetObject`, `s3:PutObject`, `s3:ListBucket`, `s3:DeleteObject` and `s3:GetBucketLocation`. options: access_key_id: From e5ea29eb34cbf6a9bb08dedb04ac623f6576fe02 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 3 Jan 2024 14:58:27 +0100 Subject: [PATCH 11/77] ssm connection plugin - Replace Fedora tests with CentOS 9 (#1793) ssm connection plugin - Replace Fedora tests with CentOS 9 SUMMARY Applies black to the SSM connection plugin Fedora 34 AMIs aren't available for integration tests any more, move over to CentOS 9 because Fedora Images will keep going away. ISSUE TYPE Bugfix Pull Request COMPONENT NAME aws_ssm ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Markus Bergholz --- changelogs/fragments/ssm-fedora34.yml | 2 ++ plugins/connection/aws_ssm.py | 6 +++--- .../targets/connection_aws_ssm_addressing/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../aws_ssm_integration_test_teardown.yml | 0 .../meta/main.yml | 0 .../runme.sh | 0 .../targets/connection_aws_ssm_cross_region/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/connection_aws_ssm_encrypted_s3/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/connection_aws_ssm_endpoint/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/connection_aws_ssm_profile/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/connection_aws_ssm_ssm_document/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/connection_aws_ssm_vars/aliases | 1 - .../aws_ssm_integration_test_setup.yml | 2 +- .../targets/setup_connection_aws_ssm/defaults/main.yml | 10 +++++++++- 22 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 changelogs/fragments/ssm-fedora34.yml rename tests/integration/targets/{connection_aws_ssm_fedora => connection_aws_ssm_centos}/aliases (81%) rename tests/integration/targets/{connection_aws_ssm_fedora => connection_aws_ssm_centos}/aws_ssm_integration_test_setup.yml (75%) rename tests/integration/targets/{connection_aws_ssm_fedora => connection_aws_ssm_centos}/aws_ssm_integration_test_teardown.yml (100%) rename tests/integration/targets/{connection_aws_ssm_fedora => connection_aws_ssm_centos}/meta/main.yml (100%) rename tests/integration/targets/{connection_aws_ssm_fedora => connection_aws_ssm_centos}/runme.sh (100%) diff --git a/changelogs/fragments/ssm-fedora34.yml b/changelogs/fragments/ssm-fedora34.yml new file mode 100644 index 00000000000..8695fc08129 --- /dev/null +++ b/changelogs/fragments/ssm-fedora34.yml @@ -0,0 +1,2 @@ +trivial: +- ssm - bump test image from Fedora 34 to CentOS 9 diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index d272a0c8b48..68eb2170c29 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -25,8 +25,9 @@ - Files sent via S3 will be named in S3 with the EC2 host ID (e.g. C(i-123abc/)) as the prefix. - The files in S3 will be deleted by the end of the playbook run. If the play is terminated ungracefully, the files may remain in the bucket. If the bucket has versioning enabled, the files will remain in version history. If your tasks involve sending secrets to/from the remote instance - (e.g. within a C(shell) command, or a SQL password in the C(community.postgresql.postgresql_query) module) then those passwords will be included in plaintext in those files in S3 indefinitely, - visible to anyone with access to that bucket. Therefore it is recommended to use a bucket with versioning disabled/suspended. + (e.g. within a C(shell) command, or a SQL password in the C(community.postgresql.postgresql_query) module) then those passwords will be included in + plaintext in those files in S3 indefinitely, visible to anyone with access to that bucket. Therefore it is recommended to use a bucket with versioning + disabled/suspended. - The files in S3 will be deleted even if the C(keep_remote_files) setting is C(true). requirements: @@ -144,7 +145,6 @@ """ EXAMPLES = r""" - # Wait for SSM Agent to be available on the Instance - name: Wait for connection to be available vars: diff --git a/tests/integration/targets/connection_aws_ssm_addressing/aliases b/tests/integration/targets/connection_aws_ssm_addressing/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_addressing/aliases +++ b/tests/integration/targets/connection_aws_ssm_addressing/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_addressing/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_addressing/aws_ssm_integration_test_setup.yml index db519fb631e..9e2f3fd01f2 100644 --- a/tests/integration/targets/connection_aws_ssm_addressing/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_addressing/aws_ssm_integration_test_setup.yml @@ -2,7 +2,7 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos encrypted_bucket: False s3_bucket_region: 'eu-central-1' s3_addressing_style: virtual diff --git a/tests/integration/targets/connection_aws_ssm_fedora/aliases b/tests/integration/targets/connection_aws_ssm_centos/aliases similarity index 81% rename from tests/integration/targets/connection_aws_ssm_fedora/aliases rename to tests/integration/targets/connection_aws_ssm_centos/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_fedora/aliases +++ b/tests/integration/targets/connection_aws_ssm_centos/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_fedora/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_centos/aws_ssm_integration_test_setup.yml similarity index 75% rename from tests/integration/targets/connection_aws_ssm_fedora/aws_ssm_integration_test_setup.yml rename to tests/integration/targets/connection_aws_ssm_centos/aws_ssm_integration_test_setup.yml index 353757e332c..d64cdabb608 100644 --- a/tests/integration/targets/connection_aws_ssm_fedora/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_centos/aws_ssm_integration_test_setup.yml @@ -2,4 +2,4 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos diff --git a/tests/integration/targets/connection_aws_ssm_fedora/aws_ssm_integration_test_teardown.yml b/tests/integration/targets/connection_aws_ssm_centos/aws_ssm_integration_test_teardown.yml similarity index 100% rename from tests/integration/targets/connection_aws_ssm_fedora/aws_ssm_integration_test_teardown.yml rename to tests/integration/targets/connection_aws_ssm_centos/aws_ssm_integration_test_teardown.yml diff --git a/tests/integration/targets/connection_aws_ssm_fedora/meta/main.yml b/tests/integration/targets/connection_aws_ssm_centos/meta/main.yml similarity index 100% rename from tests/integration/targets/connection_aws_ssm_fedora/meta/main.yml rename to tests/integration/targets/connection_aws_ssm_centos/meta/main.yml diff --git a/tests/integration/targets/connection_aws_ssm_fedora/runme.sh b/tests/integration/targets/connection_aws_ssm_centos/runme.sh similarity index 100% rename from tests/integration/targets/connection_aws_ssm_fedora/runme.sh rename to tests/integration/targets/connection_aws_ssm_centos/runme.sh diff --git a/tests/integration/targets/connection_aws_ssm_cross_region/aliases b/tests/integration/targets/connection_aws_ssm_cross_region/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_cross_region/aliases +++ b/tests/integration/targets/connection_aws_ssm_cross_region/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_cross_region/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_cross_region/aws_ssm_integration_test_setup.yml index 1f223757c81..eff5f538699 100644 --- a/tests/integration/targets/connection_aws_ssm_cross_region/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_cross_region/aws_ssm_integration_test_setup.yml @@ -2,7 +2,7 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos s3_bucket_region: 'eu-central-1' # Post 2019 regions behave differently from other regions # they're worth testing but it's not possible in CI today. diff --git a/tests/integration/targets/connection_aws_ssm_encrypted_s3/aliases b/tests/integration/targets/connection_aws_ssm_encrypted_s3/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_encrypted_s3/aliases +++ b/tests/integration/targets/connection_aws_ssm_encrypted_s3/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_encrypted_s3/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_encrypted_s3/aws_ssm_integration_test_setup.yml index bfea0d0dc79..d6e650cd316 100644 --- a/tests/integration/targets/connection_aws_ssm_encrypted_s3/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_encrypted_s3/aws_ssm_integration_test_setup.yml @@ -2,6 +2,6 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos encrypted_bucket: True test_suffix: encrypteds3 diff --git a/tests/integration/targets/connection_aws_ssm_endpoint/aliases b/tests/integration/targets/connection_aws_ssm_endpoint/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_endpoint/aliases +++ b/tests/integration/targets/connection_aws_ssm_endpoint/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_endpoint/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_endpoint/aws_ssm_integration_test_setup.yml index 71c850e9d8f..e0296c7d6e8 100644 --- a/tests/integration/targets/connection_aws_ssm_endpoint/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_endpoint/aws_ssm_integration_test_setup.yml @@ -2,6 +2,6 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos test_suffix: endpoint endpoint_url: 'https://s3.dualstack.{{ aws_region }}.amazonaws.com' diff --git a/tests/integration/targets/connection_aws_ssm_profile/aliases b/tests/integration/targets/connection_aws_ssm_profile/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_profile/aliases +++ b/tests/integration/targets/connection_aws_ssm_profile/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_profile/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_profile/aws_ssm_integration_test_setup.yml index 3f4c2e47db4..b8169d2c61c 100644 --- a/tests/integration/targets/connection_aws_ssm_profile/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_profile/aws_ssm_integration_test_setup.yml @@ -2,5 +2,5 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos profile_name: test_profile diff --git a/tests/integration/targets/connection_aws_ssm_ssm_document/aliases b/tests/integration/targets/connection_aws_ssm_ssm_document/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_ssm_document/aliases +++ b/tests/integration/targets/connection_aws_ssm_ssm_document/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_ssm_document/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_ssm_document/aws_ssm_integration_test_setup.yml index 992426976b8..6ef4dfd47c4 100644 --- a/tests/integration/targets/connection_aws_ssm_ssm_document/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_ssm_document/aws_ssm_integration_test_setup.yml @@ -2,6 +2,6 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos use_ssm_document: True test_suffix: document diff --git a/tests/integration/targets/connection_aws_ssm_vars/aliases b/tests/integration/targets/connection_aws_ssm_vars/aliases index eb6b8d08bcd..eb8e0b8914b 100644 --- a/tests/integration/targets/connection_aws_ssm_vars/aliases +++ b/tests/integration/targets/connection_aws_ssm_vars/aliases @@ -1,5 +1,4 @@ time=10m -disabled cloud/aws connection_aws_ssm diff --git a/tests/integration/targets/connection_aws_ssm_vars/aws_ssm_integration_test_setup.yml b/tests/integration/targets/connection_aws_ssm_vars/aws_ssm_integration_test_setup.yml index ff67bc2c3e5..2b3755b8880 100644 --- a/tests/integration/targets/connection_aws_ssm_vars/aws_ssm_integration_test_setup.yml +++ b/tests/integration/targets/connection_aws_ssm_vars/aws_ssm_integration_test_setup.yml @@ -2,5 +2,5 @@ roles: - role: ../setup_connection_aws_ssm vars: - target_os: fedora + target_os: centos credential_vars: True diff --git a/tests/integration/targets/setup_connection_aws_ssm/defaults/main.yml b/tests/integration/targets/setup_connection_aws_ssm/defaults/main.yml index 5ee1f753507..f7ac20eeefd 100644 --- a/tests/integration/targets/setup_connection_aws_ssm/defaults/main.yml +++ b/tests/integration/targets/setup_connection_aws_ssm/defaults/main.yml @@ -4,7 +4,15 @@ instance_type: t3.micro ami_details: fedora: owner: 125523088429 - name: Fedora-Cloud-Base-34-1.2.x86_64* + name: 'Fedora-Cloud-Base-41-1.2.x86_64*' + user_data: | + #!/bin/sh + sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm + sudo systemctl start amazon-ssm-agent + os_type: linux + centos: + owner: 125523088429 + name: 'CentOS Stream 9 x86_64*' user_data: | #!/bin/sh sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm From bfd1d80b6aae496a97e4e0f7fcee2a8f9438116e Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Fri, 5 Jan 2024 06:51:04 +0900 Subject: [PATCH 12/77] Fix example of eks_nodegroup (#2028) Fix example of eks_nodegroup SUMMARY When using the example as a reference, ansible-playbook command outputs the following errors: fatal: [localhost]: FAILED! => {"changed": false, "msg": "argument 'scaling_config' is of type and we were unable to convert to dict: cannot be converted to a dict"} fatal: [localhost]: FAILED! => {"changed": false, "msg": "argument 'labels' is of type and we were unable to convert to dict: cannot be converted to a dict"} fatal: [localhost]: FAILED! => {"changed": false, "msg": "value of capacity_type must be one of: ON_DEMAND, SPOT, got: on_demand"} This fixes those issues. ISSUE TYPE Docs Pull Request COMPONENT NAME eks_nodegroup ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Mark Chappell --- plugins/modules/eks_nodegroup.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/modules/eks_nodegroup.py b/plugins/modules/eks_nodegroup.py index 51f74c22164..2e13ddb9130 100644 --- a/plugins/modules/eks_nodegroup.py +++ b/plugins/modules/eks_nodegroup.py @@ -184,19 +184,19 @@ - subnet-qwerty123 - subnet-asdfg456 scaling_config: - - min_size: 1 - - max_size: 2 - - desired_size: 1 + min_size: 1 + max_size: 2 + desired_size: 1 disk_size: 20 instance_types: 't3.micro' ami_type: 'AL2_x86_64' labels: - - 'teste': 'test' + 'teste': 'test' taints: - key: 'test' value: 'test' effect: 'NO_SCHEDULE' - capacity_type: 'on_demand' + capacity_type: 'ON_DEMAND' - name: Remove an EKS Nodegrop community.aws.eks_nodegroup: From 6dd4a00b8c18fe3499bad04f90c8ac7832ade8bb Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Fri, 5 Jan 2024 18:42:41 +0100 Subject: [PATCH 13/77] ansible-lint (documentation) cleanup for plugins/ (#2036) ansible-lint (documentation) cleanup for plugins/ SUMMARY Fixes an array of ansible-lint failures in plugins/ Adds ansible-lint plugins/ to tox -m lint ISSUE TYPE Docs Pull Request COMPONENT NAME plugins/ ADDITIONAL INFORMATION docs changes only (no changelog fragment needed) Reviewed-by: Alina Buzachis --- plugins/connection/aws_ssm.py | 55 +++--- plugins/inventory/aws_mq.py | 7 +- plugins/modules/acm_certificate_info.py | 5 +- plugins/modules/api_gateway.py | 5 +- plugins/modules/api_gateway_domain.py | 3 +- plugins/modules/api_gateway_info.py | 4 +- .../modules/autoscaling_instance_refresh.py | 1 - plugins/modules/autoscaling_launch_config.py | 84 +++++---- plugins/modules/batch_job_queue.py | 8 +- plugins/modules/cloudformation_stack_set.py | 7 +- plugins/modules/cloudfront_distribution.py | 18 +- plugins/modules/cloudfront_invalidation.py | 2 - .../cloudfront_origin_access_identity.py | 14 +- plugins/modules/codebuild_project.py | 27 +-- plugins/modules/config_aggregator.py | 6 +- plugins/modules/config_recorder.py | 4 +- plugins/modules/config_rule.py | 9 +- plugins/modules/data_pipeline.py | 30 +-- .../directconnect_virtual_interface.py | 1 - .../modules/dms_replication_subnet_group.py | 2 +- plugins/modules/ec2_ami_copy.py | 4 +- plugins/modules/ec2_carrier_gateway.py | 4 +- plugins/modules/ec2_carrier_gateway_info.py | 2 +- plugins/modules/ec2_placement_group.py | 3 - plugins/modules/ec2_placement_group_info.py | 6 +- plugins/modules/ec2_snapshot_copy.py | 2 +- plugins/modules/ec2_transit_gateway.py | 4 +- .../ec2_transit_gateway_vpc_attachment.py | 22 +-- plugins/modules/ec2_vpc_egress_igw.py | 1 - plugins/modules/ec2_vpc_nacl.py | 20 +- plugins/modules/ec2_vpc_peer.py | 2 +- plugins/modules/ec2_vpc_vgw_info.py | 2 +- plugins/modules/ecs_cluster.py | 4 +- plugins/modules/ecs_service.py | 10 +- plugins/modules/ecs_tag.py | 2 +- plugins/modules/ecs_task.py | 74 ++++---- plugins/modules/ecs_taskdefinition.py | 171 +++++++++--------- plugins/modules/efs.py | 23 ++- plugins/modules/efs_info.py | 7 +- plugins/modules/efs_tag.py | 2 +- plugins/modules/eks_nodegroup.py | 2 +- .../modules/elasticache_parameter_group.py | 6 +- plugins/modules/elasticbeanstalk_app.py | 1 - plugins/modules/elb_classic_lb_info.py | 5 +- plugins/modules/elb_network_lb.py | 1 - plugins/modules/elb_target.py | 2 - plugins/modules/elb_target_group.py | 9 +- plugins/modules/elb_target_group_info.py | 1 - plugins/modules/elb_target_info.py | 171 +++++++++--------- plugins/modules/mq_broker.py | 10 +- plugins/modules/mq_user.py | 4 +- plugins/modules/networkfirewall.py | 12 +- plugins/modules/networkfirewall_rule_group.py | 5 +- .../networkfirewall_rule_group_info.py | 1 - plugins/modules/opensearch.py | 21 +-- plugins/modules/redshift_subnet_group.py | 4 +- plugins/modules/s3_logging.py | 1 - plugins/modules/s3_metrics_configuration.py | 1 - plugins/modules/s3_website.py | 1 - plugins/modules/ses_identity.py | 12 +- plugins/modules/sns_topic.py | 2 +- plugins/modules/sts_session_token.py | 3 +- plugins/modules/waf_condition.py | 121 ++++++------- plugins/modules/waf_rule.py | 36 ++-- plugins/modules/waf_web_acl.py | 30 +-- plugins/modules/wafv2_web_acl.py | 1 - tests/sanity/ignore-2.14.txt | 2 + tests/sanity/ignore-2.15.txt | 2 + tests/sanity/ignore-2.16.txt | 2 + tests/sanity/ignore-2.17.txt | 2 + tox.ini | 8 +- 71 files changed, 575 insertions(+), 561 deletions(-) create mode 100644 tests/sanity/ignore-2.16.txt create mode 100644 tests/sanity/ignore-2.17.txt diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 68eb2170c29..5186179f46d 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -145,6 +145,7 @@ """ EXAMPLES = r""" +--- # Wait for SSM Agent to be available on the Instance - name: Wait for connection to be available vars: @@ -197,17 +198,19 @@ path: C:\Windows\temp state: directory +--- + # Making use of Dynamic Inventory Plugin # ======================================= -# aws_ec2.yml (Dynamic Inventory - Linux) -# This will return the Instance IDs matching the filter -#plugin: aws_ec2 -#regions: -# - us-east-1 -#hostnames: -# - instance-id -#filters: -# tag:SSMTag: ssmlinux +# # aws_ec2.yml (Dynamic Inventory - Linux) +# plugin: aws_ec2 +# regions: +# - us-east-1 +# hostnames: +# - instance-id +# # This will return the Instances with the tag "SSMTag" set to "ssmlinux" +# filters: +# tag:SSMTag: ssmlinux # ----------------------- - name: install aws-cli hosts: all @@ -217,20 +220,23 @@ ansible_aws_ssm_bucket_name: nameofthebucket ansible_aws_ssm_region: us-east-1 tasks: - - name: aws-cli - raw: yum install -y awscli - tags: aws-cli + - name: aws-cli + raw: yum install -y awscli + tags: aws-cli + +--- + # Execution: ansible-playbook linux.yaml -i aws_ec2.yml -# The playbook tasks will get executed on the instance ids returned from the dynamic inventory plugin using ssm connection. # ===================================================== -# aws_ec2.yml (Dynamic Inventory - Windows) -#plugin: aws_ec2 -#regions: -# - us-east-1 -#hostnames: -# - instance-id -#filters: -# tag:SSMTag: ssmwindows +# # aws_ec2.yml (Dynamic Inventory - Windows) +# plugin: aws_ec2 +# regions: +# - us-east-1 +# hostnames: +# - instance-id +# # This will return the Instances with the tag "SSMTag" set to "ssmwindows" +# filters: +# tag:SSMTag: ssmwindows # ----------------------- - name: Create a dir. hosts: all @@ -245,10 +251,13 @@ win_file: path: C:\Temp\SSM_Testing5 state: directory + +--- + # Execution: ansible-playbook win_file.yaml -i aws_ec2.yml # The playbook tasks will get executed on the instance ids returned from the dynamic inventory plugin using ssm connection. -# Install a Nginx Package on Linux Instance; with specific SSE for file transfer +# Install a Nginx Package on Linux Instance; with specific SSE CMK used for the file transfer - name: Install a Nginx Package vars: ansible_connection: aws_ssm @@ -262,7 +271,7 @@ name: nginx state: present -# Install a Nginx Package on Linux Instance; with dedicated SSM document +# Install a Nginx Package on Linux Instance; using the specified SSM document - name: Install a Nginx Package vars: ansible_connection: aws_ssm diff --git a/plugins/inventory/aws_mq.py b/plugins/inventory/aws_mq.py index 96beaceb254..3ca1a6a97c8 100644 --- a/plugins/inventory/aws_mq.py +++ b/plugins/inventory/aws_mq.py @@ -52,21 +52,26 @@ """ EXAMPLES = r""" +--- # Minimal example using AWS credentials from environment vars or instance role credentials # Get all brokers in us-east-1 region plugin: community.aws.aws_mq regions: - ca-central-1 +--- + # Example multiple regions, ignoring permission errors, and only brokers with state RUNNING plugin: community.aws.aws_mq regions: - us-east-1 - us-east-2 -strict_permissions: False +strict_permissions: false statuses: - RUNNING +--- + # Example group by engine, hostvars custom prefix-suffix, and compose variable from tags plugin: community.aws.aws_mq regions: diff --git a/plugins/modules/acm_certificate_info.py b/plugins/modules/acm_certificate_info.py index 26d00e7e319..73da208f18a 100644 --- a/plugins/modules/acm_certificate_info.py +++ b/plugins/modules/acm_certificate_info.py @@ -57,7 +57,7 @@ - name: obtain all certificates pending validation community.aws.acm_certificate_info: statuses: - - PENDING_VALIDATION + - PENDING_VALIDATION - name: obtain all certificates with tag Name=foo and myTag=bar community.aws.acm_certificate_info: @@ -69,8 +69,7 @@ # The output is still a list of certificates, just one item long. - name: obtain information about a certificate with a particular ARN community.aws.acm_certificate_info: - certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12" - + certificate_arn: "arn:aws:acm:ap-southeast-2:123456789012:certificate/abcdeabc-abcd-1234-4321-abcdeabcde12" """ RETURN = r""" diff --git a/plugins/modules/api_gateway.py b/plugins/modules/api_gateway.py index 1936f8b5ad7..af443238738 100644 --- a/plugins/modules/api_gateway.py +++ b/plugins/modules/api_gateway.py @@ -152,7 +152,10 @@ swagger_file: my_api.yml cache_enabled: true cache_size: '6.1' - canary_settings: { percentTraffic: 50.0, deploymentId: '123', useStageCache: True } + canary_settings: + percentTraffic: 50.0 + deploymentId: '123' + useStageCache: true state: present - name: Delete API gateway diff --git a/plugins/modules/api_gateway_domain.py b/plugins/modules/api_gateway_domain.py index 10a1ca1f2f7..8ffbdaf20ed 100644 --- a/plugins/modules/api_gateway_domain.py +++ b/plugins/modules/api_gateway_domain.py @@ -73,7 +73,8 @@ security_policy: TLS_1_2 endpoint_type: EDGE domain_mappings: - - { rest_api_id: abc123, stage: production } + - rest_api_id: abc123 + stage: production state: present register: api_gw_domain_result diff --git a/plugins/modules/api_gateway_info.py b/plugins/modules/api_gateway_info.py index a6d0854b7ed..fd38d795ab7 100644 --- a/plugins/modules/api_gateway_info.py +++ b/plugins/modules/api_gateway_info.py @@ -35,8 +35,8 @@ - name: List all for a specific function community.aws.api_gateway_info: ids: - - 012345678a - - abcdefghij + - 012345678a + - abcdefghij """ RETURN = r""" diff --git a/plugins/modules/autoscaling_instance_refresh.py b/plugins/modules/autoscaling_instance_refresh.py index 86546fac21e..b301fea9439 100644 --- a/plugins/modules/autoscaling_instance_refresh.py +++ b/plugins/modules/autoscaling_instance_refresh.py @@ -84,7 +84,6 @@ preferences: min_healthy_percentage: 91 instance_warmup: 60 - """ RETURN = r""" diff --git a/plugins/modules/autoscaling_launch_config.py b/plugins/modules/autoscaling_launch_config.py index a3cd600fa70..78b7ee23352 100644 --- a/plugins/modules/autoscaling_launch_config.py +++ b/plugins/modules/autoscaling_launch_config.py @@ -192,65 +192,71 @@ name: special image_id: ami-XXX key_name: default - security_groups: ['group', 'group2' ] + security_groups: + - 'group' + - 'group2' instance_type: t1.micro volumes: - - device_name: /dev/sda1 - volume_size: 100 - volume_type: io1 - iops: 3000 - delete_on_termination: true - encrypted: true - - device_name: /dev/sdb - ephemeral: ephemeral0 + - device_name: /dev/sda1 + volume_size: 100 + volume_type: io1 + iops: 3000 + delete_on_termination: true + encrypted: true + - device_name: /dev/sdb + ephemeral: ephemeral0 - name: create a launch configuration using a running instance id as a basis community.aws.autoscaling_launch_config: name: special instance_id: i-00a48b207ec59e948 key_name: default - security_groups: ['launch-wizard-2' ] + security_groups: + - 'launch-wizard-2' volumes: - - device_name: /dev/sda1 - volume_size: 120 - volume_type: io1 - iops: 3000 - delete_on_termination: true + - device_name: /dev/sda1 + volume_size: 120 + volume_type: io1 + iops: 3000 + delete_on_termination: true - name: create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image community.aws.autoscaling_launch_config: name: special image_id: ami-XXX key_name: default - security_groups: ['group', 'group2' ] + security_groups: + - 'group' + - 'group2' instance_type: t1.micro volumes: - - device_name: /dev/sdf - no_device: true + - device_name: /dev/sdf + no_device: true - name: Use EBS snapshot ID for volume block: - - name: Set Volume Facts - ansible.builtin.set_fact: - volumes: - - device_name: /dev/sda1 - volume_size: 20 - ebs: - snapshot: snap-XXXX - volume_type: gp2 - delete_on_termination: true - encrypted: false - - - name: Create launch configuration - community.aws.autoscaling_launch_config: - name: lc1 - image_id: ami-xxxx - assign_public_ip: true - instance_type: t2.medium - key_name: my-key - security_groups: "['sg-xxxx']" - volumes: "{{ volumes }}" - register: lc_info + - name: Set Volume Facts + ansible.builtin.set_fact: + volumes: + - device_name: /dev/sda1 + volume_size: 20 + ebs: + snapshot: snap-XXXX + volume_type: gp2 + delete_on_termination: true + encrypted: false + + - name: Create launch configuration + community.aws.autoscaling_launch_config: + name: lc1 + image_id: ami-xxxx + assign_public_ip: true + instance_type: t2.medium + key_name: my-key + security_groups: + - 'sg-xxxx' + volumes: "{{ volumes }}" + register: lc_info """ RETURN = r""" diff --git a/plugins/modules/batch_job_queue.py b/plugins/modules/batch_job_queue.py index c9e253d0652..4be42cbc56b 100644 --- a/plugins/modules/batch_job_queue.py +++ b/plugins/modules/batch_job_queue.py @@ -75,10 +75,10 @@ job_queue_state: ENABLED priority: 1 compute_environment_order: - - order: 1 - compute_environment: my_compute_env1 - - order: 2 - compute_environment: my_compute_env2 + - order: 1 + compute_environment: my_compute_env1 + - order: 2 + compute_environment: my_compute_env2 register: batch_job_queue_action - name: show results diff --git a/plugins/modules/cloudformation_stack_set.py b/plugins/modules/cloudformation_stack_set.py index 17e888b4f1b..ebb9403e8c5 100644 --- a/plugins/modules/cloudformation_stack_set.py +++ b/plugins/modules/cloudformation_stack_set.py @@ -201,7 +201,7 @@ - 123456789012 - 234567890123 regions: - - us-east-1 + - us-east-1 - name: The same type of update, but wait for the update to complete in all stacks community.aws.cloudformation_stack_set: @@ -217,7 +217,7 @@ - 123456789012 - 234567890123 regions: - - us-east-1 + - us-east-1 - name: Register new accounts (create new stack instances) with an existing stack set. community.aws.cloudformation_stack_set: @@ -234,7 +234,7 @@ - 234567890123 - 345678901234 regions: - - us-east-1 + - us-east-1 """ RETURN = r""" @@ -315,7 +315,6 @@ other: Type: "AWS::SNS::Topic" Properties: {} - """ import datetime diff --git a/plugins/modules/cloudfront_distribution.py b/plugins/modules/cloudfront_distribution.py index 52e7440f366..33299623e09 100644 --- a/plugins/modules/cloudfront_distribution.py +++ b/plugins/modules/cloudfront_distribution.py @@ -625,7 +625,9 @@ state: present distribution_id: E1RP5A2MJ8073O comment: modified by cloudfront.py again - aliases: [ 'www.my-distribution-source.com', 'zzz.aaa.io' ] + aliases: + - 'www.my-distribution-source.com' + - 'zzz.aaa.io' - name: update a distribution's aliases and comment using an alias as a reference community.aws.cloudfront_distribution: @@ -652,12 +654,12 @@ state: present caller_reference: unique test distribution ID origins: - - id: 'my test origin-000111' - domain_name: www.example.com - origin_path: /production - custom_headers: - - header_name: MyCustomHeaderName - header_value: MyCustomHeaderValue + - id: 'my test origin-000111' + domain_name: www.example.com + origin_path: /production + custom_headers: + - header_name: MyCustomHeaderName + header_value: MyCustomHeaderValue default_cache_behavior: target_origin_id: 'my test origin-000111' forwarded_values: @@ -665,7 +667,7 @@ cookies: forward: all headers: - - '*' + - '*' viewer_protocol_policy: allow-all smooth_streaming: true compress: true diff --git a/plugins/modules/cloudfront_invalidation.py b/plugins/modules/cloudfront_invalidation.py index b98b56be2d2..732d135e1e5 100644 --- a/plugins/modules/cloudfront_invalidation.py +++ b/plugins/modules/cloudfront_invalidation.py @@ -52,7 +52,6 @@ """ EXAMPLES = r""" - - name: create a batch of invalidations using a distribution_id for a reference community.aws.cloudfront_invalidation: distribution_id: E15BU8SDCGSG57 @@ -70,7 +69,6 @@ - /testpathone/test4.css - /testpathtwo/test5.js - /testpaththree/* - """ RETURN = r""" diff --git a/plugins/modules/cloudfront_origin_access_identity.py b/plugins/modules/cloudfront_origin_access_identity.py index 3c9340df611..bb5e3a01703 100644 --- a/plugins/modules/cloudfront_origin_access_identity.py +++ b/plugins/modules/cloudfront_origin_access_identity.py @@ -63,16 +63,15 @@ - name: update an existing origin access identity using caller_reference as an identifier community.aws.cloudfront_origin_access_identity: - origin_access_identity_id: E17DRN9XUOAHZX - caller_reference: this is an example reference - comment: this is a new comment + origin_access_identity_id: E17DRN9XUOAHZX + caller_reference: this is an example reference + comment: this is a new comment - name: delete an existing origin access identity using caller_reference as an identifier community.aws.cloudfront_origin_access_identity: - state: absent - caller_reference: this is an example reference - comment: this is a new comment - + state: absent + caller_reference: this is an example reference + comment: this is a new comment """ RETURN = r""" @@ -110,7 +109,6 @@ description: The fully qualified URI of the new origin access identity just created. returned: when initially created type: str - """ import datetime diff --git a/plugins/modules/codebuild_project.py b/plugins/modules/codebuild_project.py index 69fd2e463b5..1f4630f73ca 100644 --- a/plugins/modules/codebuild_project.py +++ b/plugins/modules/codebuild_project.py @@ -161,21 +161,22 @@ description: My nice little project service_role: "arn:aws:iam::123123:role/service-role/code-build-service-role" source: - # Possible values: BITBUCKET, CODECOMMIT, CODEPIPELINE, GITHUB, S3 - type: CODEPIPELINE - buildspec: '' + # Possible values: BITBUCKET, CODECOMMIT, CODEPIPELINE, GITHUB, S3 + type: CODEPIPELINE + buildspec: '' artifacts: - namespaceType: NONE - packaging: NONE - type: CODEPIPELINE - name: my_project + namespaceType: NONE + packaging: NONE + type: CODEPIPELINE + name: my_project environment: - computeType: BUILD_GENERAL1_SMALL - privilegedMode: "true" - image: "aws/codebuild/docker:17.09.0" - type: LINUX_CONTAINER - environmentVariables: - - { name: 'PROFILE', value: 'staging' } + computeType: BUILD_GENERAL1_SMALL + privilegedMode: "true" + image: "aws/codebuild/docker:17.09.0" + type: LINUX_CONTAINER + environmentVariables: + - name: 'PROFILE' + value: 'staging' encryption_key: "arn:aws:kms:us-east-1:123123:alias/aws/s3" region: us-east-1 state: present diff --git a/plugins/modules/config_aggregator.py b/plugins/modules/config_aggregator.py index 58866159028..48771080b45 100644 --- a/plugins/modules/config_aggregator.py +++ b/plugins/modules/config_aggregator.py @@ -80,9 +80,9 @@ state: present account_sources: account_ids: - - 1234567890 - - 0123456789 - - 9012345678 + - 1234567890 + - 0123456789 + - 9012345678 all_aws_regions: true """ diff --git a/plugins/modules/config_recorder.py b/plugins/modules/config_recorder.py index 2672664a5fe..510bbaa2307 100644 --- a/plugins/modules/config_recorder.py +++ b/plugins/modules/config_recorder.py @@ -71,8 +71,8 @@ state: present role_arn: 'arn:aws:iam::123456789012:role/AwsConfigRecorder' recording_group: - all_supported: true - include_global_types: true + all_supported: true + include_global_types: true """ RETURN = r"""#""" diff --git a/plugins/modules/config_rule.py b/plugins/modules/config_rule.py index 3b49c17465e..b86a528dd55 100644 --- a/plugins/modules/config_rule.py +++ b/plugins/modules/config_rule.py @@ -95,12 +95,11 @@ state: present description: 'This AWS Config rule checks for public write access on S3 buckets' scope: - compliance_types: - - 'AWS::S3::Bucket' + compliance_types: + - 'AWS::S3::Bucket' source: - owner: AWS - identifier: 'S3_BUCKET_PUBLIC_WRITE_PROHIBITED' - + owner: AWS + identifier: 'S3_BUCKET_PUBLIC_WRITE_PROHIBITED' """ RETURN = r"""#""" diff --git a/plugins/modules/data_pipeline.py b/plugins/modules/data_pipeline.py index 5a62784c6e9..85849324f33 100644 --- a/plugins/modules/data_pipeline.py +++ b/plugins/modules/data_pipeline.py @@ -144,23 +144,30 @@ - community.aws.data_pipeline: name: test-dp objects: - - "id": "DefaultSchedule" - "name": "Every 1 day" - "fields": + - id: "DefaultSchedule" + name: "Every 1 day" + fields: - "key": "period" "stringValue": "1 days" - "key": "type" "stringValue": "Schedule" - "key": "startAt" "stringValue": "FIRST_ACTIVATION_DATE_TIME" - - "id": "Default" - "name": "Default" - "fields": [ { "key": "resourceRole", "stringValue": "my_resource_role" }, - { "key": "role", "stringValue": "DataPipelineDefaultRole" }, - { "key": "pipelineLogUri", "stringValue": "s3://my_s3_log.txt" }, - { "key": "scheduleType", "stringValue": "cron" }, - { "key": "schedule", "refValue": "DefaultSchedule" }, - { "key": "failureAndRerunMode", "stringValue": "CASCADE" } ] + - id: "Default" + name: "Default" + fields: + - "key": "resourceRole" + "stringValue": "my_resource_role" + - "key": "role" + "stringValue": "DataPipelineDefaultRole" + - "key": "pipelineLogUri" + "stringValue": "s3://my_s3_log.txt" + - "key": "scheduleType" + "stringValue": "cron" + - "key": "schedule" + "refValue": "DefaultSchedule" + - "key": "failureAndRerunMode" + "stringValue": "CASCADE" state: active # Activate pipeline @@ -174,7 +181,6 @@ name: test-dp region: us-west-2 state: absent - """ RETURN = r""" diff --git a/plugins/modules/directconnect_virtual_interface.py b/plugins/modules/directconnect_virtual_interface.py index ec0c87099a4..da76d57372d 100644 --- a/plugins/modules/directconnect_virtual_interface.py +++ b/plugins/modules/directconnect_virtual_interface.py @@ -242,7 +242,6 @@ state: absent connection_id: dxcon-XXXXXXXX virtual_interface_id: dxv-XXXXXXXX - """ import traceback diff --git a/plugins/modules/dms_replication_subnet_group.py b/plugins/modules/dms_replication_subnet_group.py index 6f847d8e35f..772a54aa1fd 100644 --- a/plugins/modules/dms_replication_subnet_group.py +++ b/plugins/modules/dms_replication_subnet_group.py @@ -51,7 +51,7 @@ state: present identifier: "dev-sngroup" description: "Development Subnet Group asdasdas" - subnet_ids: ['subnet-id1','subnet-id2'] + subnet_ids: ['subnet-id1', 'subnet-id2'] """ RETURN = r""" # """ diff --git a/plugins/modules/ec2_ami_copy.py b/plugins/modules/ec2_ami_copy.py index 170a564e15d..bb5a30ea117 100644 --- a/plugins/modules/ec2_ami_copy.py +++ b/plugins/modules/ec2_ami_copy.py @@ -104,8 +104,8 @@ region: eu-west-1 source_image_id: ami-xxxxxxx tags: - Name: My-Super-AMI - Patch: 1.2.3 + Name: My-Super-AMI + Patch: 1.2.3 tag_equality: true - name: Encrypted AMI copy diff --git a/plugins/modules/ec2_carrier_gateway.py b/plugins/modules/ec2_carrier_gateway.py index e02b1a7ded5..97d62b5fc42 100644 --- a/plugins/modules/ec2_carrier_gateway.py +++ b/plugins/modules/ec2_carrier_gateway.py @@ -53,8 +53,8 @@ vpc_id: vpc-abcdefgh state: present tags: - Tag1: tag1 - Tag2: tag2 + Tag1: tag1 + Tag2: tag2 register: cagw - name: Delete Carrier gateway diff --git a/plugins/modules/ec2_carrier_gateway_info.py b/plugins/modules/ec2_carrier_gateway_info.py index 43d77d59aa6..67ee30e55e5 100644 --- a/plugins/modules/ec2_carrier_gateway_info.py +++ b/plugins/modules/ec2_carrier_gateway_info.py @@ -45,7 +45,7 @@ community.aws.ec2_carrier_gateway_info: region: ap-southeast-2 filters: - "tag:Name": "cagw-123" + "tag:Name": "cagw-123" register: cagw_info - name: Gather information about a specific carrier gateway by CarrierGatewayId diff --git a/plugins/modules/ec2_placement_group.py b/plugins/modules/ec2_placement_group.py index ccdd7d54785..3cdb5be219e 100644 --- a/plugins/modules/ec2_placement_group.py +++ b/plugins/modules/ec2_placement_group.py @@ -75,10 +75,8 @@ community.aws.ec2_placement_group: name: my-cluster state: absent - """ - RETURN = r""" placement_group: description: Placement group attributes @@ -97,7 +95,6 @@ description: PG strategy type: str sample: "cluster" - """ try: diff --git a/plugins/modules/ec2_placement_group_info.py b/plugins/modules/ec2_placement_group_info.py index 75cbc72585c..05b37488cfe 100644 --- a/plugins/modules/ec2_placement_group_info.py +++ b/plugins/modules/ec2_placement_group_info.py @@ -39,14 +39,13 @@ - name: List two placement groups. community.aws.ec2_placement_group_info: names: - - my-cluster - - my-other-cluster + - my-cluster + - my-other-cluster register: specific_ec2_placement_groups - ansible.builtin.debug: msg: > {{ specific_ec2_placement_groups | json_query("[?name=='my-cluster']") }} - """ @@ -68,7 +67,6 @@ description: PG strategy type: str sample: "cluster" - """ try: diff --git a/plugins/modules/ec2_snapshot_copy.py b/plugins/modules/ec2_snapshot_copy.py index ce73191cb79..2cf994caaba 100644 --- a/plugins/modules/ec2_snapshot_copy.py +++ b/plugins/modules/ec2_snapshot_copy.py @@ -81,7 +81,7 @@ region: eu-west-1 source_snapshot_id: snap-xxxxxxx tags: - Name: Snapshot-Name + Name: Snapshot-Name - name: Encrypted Snapshot copy community.aws.ec2_snapshot_copy: diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py index 9b50cb21b9c..19876984dba 100644 --- a/plugins/modules/ec2_transit_gateway.py +++ b/plugins/modules/ec2_transit_gateway.py @@ -91,9 +91,9 @@ asn: 64514 auto_associate: false auto_propagate: false - dns_support: True + dns_support: true description: "nonprod transit gateway" - purge_tags: False + purge_tags: false state: present region: us-east-1 tags: diff --git a/plugins/modules/ec2_transit_gateway_vpc_attachment.py b/plugins/modules/ec2_transit_gateway_vpc_attachment.py index 301fefb0513..cfb6809a803 100644 --- a/plugins/modules/ec2_transit_gateway_vpc_attachment.py +++ b/plugins/modules/ec2_transit_gateway_vpc_attachment.py @@ -109,13 +109,13 @@ transit_gateway: 'tgw-123456789abcdef01' name: AnsibleTest-1 subnets: - - subnet-00000000000000000 - - subnet-11111111111111111 - - subnet-22222222222222222 - ipv6_support: True - purge_subnets: True - dns_support: True - appliance_mode_support: True + - subnet-00000000000000000 + - subnet-11111111111111111 + - subnet-22222222222222222 + ipv6_support: true + purge_subnets: true + dns_support: true + appliance_mode_support: true tags: TestTag: changed data in Test Tag @@ -124,10 +124,10 @@ state: present id: 'tgw-attach-0c0c5fd0b0f01d1c9' name: AnsibleTest-1 - ipv6_support: True - purge_subnets: False - dns_support: False - appliance_mode_support: True + ipv6_support: true + purge_subnets: false + dns_support: false + appliance_mode_support: true # Delete the transit gateway - community.aws.ec2_transit_gateway_vpc_attachment: diff --git a/plugins/modules/ec2_vpc_egress_igw.py b/plugins/modules/ec2_vpc_egress_igw.py index 0a309b4863c..1bd65f501c8 100644 --- a/plugins/modules/ec2_vpc_egress_igw.py +++ b/plugins/modules/ec2_vpc_egress_igw.py @@ -40,7 +40,6 @@ vpc_id: vpc-abcdefgh state: present register: eigw - """ RETURN = r""" diff --git a/plugins/modules/ec2_vpc_nacl.py b/plugins/modules/ec2_vpc_nacl.py index 46f7086bc85..cf109de1c8b 100644 --- a/plugins/modules/ec2_vpc_nacl.py +++ b/plugins/modules/ec2_vpc_nacl.py @@ -83,7 +83,6 @@ """ EXAMPLES = r""" - # Complete example to create and delete a network ACL # that allows SSH, HTTP and ICMP in, and all traffic out. - name: "Create and associate production DMZ network ACL with DMZ subnets" @@ -97,16 +96,16 @@ Project: phoenix Description: production DMZ ingress: - # rule no, protocol, allow/deny, cidr, icmp_type, icmp_code, - # port from, port to - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [205, 'tcp', 'allow', '::/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - - [305, 'ipv6-icmp', 'allow', '::/0', 0, 8] + # rule no, protocol, allow/deny, cidr, icmp_type, icmp_code, + # port from, port to + - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] + - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] + - [205, 'tcp', 'allow', '::/0', null, null, 80, 80] + - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] + - [305, 'ipv6-icmp', 'allow', '::/0', 0, 8] egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - - [105, 'all', 'allow', '::/0', null, null, null, null] + - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] + - [105, 'all', 'allow', '::/0', null, null, null, null] state: 'present' - name: "Remove the ingress and egress rules - defaults to deny all" @@ -141,6 +140,7 @@ nacl_id: acl-33b4ee5b state: absent """ + RETURN = r""" task: description: The result of the create, or delete action. diff --git a/plugins/modules/ec2_vpc_peer.py b/plugins/modules/ec2_vpc_peer.py index 465c9c852eb..2a731bf23e4 100644 --- a/plugins/modules/ec2_vpc_peer.py +++ b/plugins/modules/ec2_vpc_peer.py @@ -209,8 +209,8 @@ peering_id: "{{ vpc_peer.peering_id }}" profile: bot03_profile_for_cross_account state: reject - """ + RETURN = r""" peering_id: description: The id of the VPC peering connection created/deleted. diff --git a/plugins/modules/ec2_vpc_vgw_info.py b/plugins/modules/ec2_vpc_vgw_info.py index d8bfcc78ecb..6ab311c038f 100644 --- a/plugins/modules/ec2_vpc_vgw_info.py +++ b/plugins/modules/ec2_vpc_vgw_info.py @@ -45,7 +45,7 @@ region: ap-southeast-2 profile: production filters: - "tag:Name": "main-virt-gateway" + "tag:Name": "main-virt-gateway" register: vgw_info - name: Gather information about a specific virtual gateway by VpnGatewayIds diff --git a/plugins/modules/ecs_cluster.py b/plugins/modules/ecs_cluster.py index c354724c9c6..7d427a58d57 100644 --- a/plugins/modules/ecs_cluster.py +++ b/plugins/modules/ecs_cluster.py @@ -103,7 +103,7 @@ weight: 1 - capacity_provider: FARGATE_SPOT weight: 100 - purge_capacity_providers: True + purge_capacity_providers: true - name: Cluster deletion community.aws.ecs_cluster: @@ -117,8 +117,8 @@ delay: 10 repeat: 10 register: task_output - """ + RETURN = r""" activeServicesCount: description: how many services are active in this cluster diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index 3230e2e4a5b..e832fa3b5d5 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -320,10 +320,10 @@ desired_count: 0 network_configuration: subnets: - - subnet-abcd1234 + - subnet-abcd1234 security_groups: - - sg-aaaa1111 - - my_security_group + - sg-aaaa1111 + - my_security_group # Simple example to delete - community.aws.ecs_service: @@ -357,8 +357,8 @@ desired_count: 3 deployment_configuration: deployment_circuit_breaker: - enable: True - rollback: True + enable: true + rollback: true # With capacity_provider_strategy (added in version 4.0) - community.aws.ecs_service: diff --git a/plugins/modules/ecs_tag.py b/plugins/modules/ecs_tag.py index 109b974eea6..dd09096ea4c 100644 --- a/plugins/modules/ecs_tag.py +++ b/plugins/modules/ecs_tag.py @@ -86,7 +86,7 @@ cluster_name: mycluster resource_type: cluster tags: - Name: foo + Name: foo state: absent purge_tags: true """ diff --git a/plugins/modules/ecs_task.py b/plugins/modules/ecs_task.py index dfd7d9a7902..169ff4c7b0b 100644 --- a/plugins/modules/ecs_task.py +++ b/plugins/modules/ecs_task.py @@ -117,63 +117,63 @@ - name: Start a task community.aws.ecs_task: - operation: start - cluster: console-sample-app-static-cluster - task_definition: console-sample-app-static-taskdef - task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" - tags: - resourceName: a_task_for_ansible_to_run - type: long_running_task - network: internal - version: 1.4 - container_instances: + operation: start + cluster: console-sample-app-static-cluster + task_definition: console-sample-app-static-taskdef + task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" + tags: + resourceName: a_task_for_ansible_to_run + type: long_running_task + network: internal + version: 1.4 + container_instances: - arn:aws:ecs:us-west-2:123456789012:container-instance/79c23f22-876c-438a-bddf-55c98a3538a8 - started_by: ansible_user - network_configuration: - subnets: + started_by: ansible_user + network_configuration: + subnets: - subnet-abcd1234 - security_groups: + security_groups: - sg-aaaa1111 - my_security_group register: task_output - name: RUN a task on Fargate community.aws.ecs_task: - operation: run - cluster: console-sample-app-static-cluster - task_definition: console-sample-app-static-taskdef - task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" - started_by: ansible_user - launch_type: FARGATE - network_configuration: - subnets: + operation: run + cluster: console-sample-app-static-cluster + task_definition: console-sample-app-static-taskdef + task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" + started_by: ansible_user + launch_type: FARGATE + network_configuration: + subnets: - subnet-abcd1234 - security_groups: + security_groups: - sg-aaaa1111 - my_security_group register: task_output - name: RUN a task on Fargate with public ip assigned community.aws.ecs_task: - operation: run - count: 2 - cluster: console-sample-app-static-cluster - task_definition: console-sample-app-static-taskdef - task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" - started_by: ansible_user - launch_type: FARGATE - network_configuration: - assign_public_ip: true - subnets: + operation: run + count: 2 + cluster: console-sample-app-static-cluster + task_definition: console-sample-app-static-taskdef + task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" + started_by: ansible_user + launch_type: FARGATE + network_configuration: + assign_public_ip: true + subnets: - subnet-abcd1234 register: task_output - name: Stop a task community.aws.ecs_task: - operation: stop - cluster: console-sample-app-static-cluster - task_definition: console-sample-app-static-taskdef - task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" + operation: stop + cluster: console-sample-app-static-cluster + task_definition: console-sample-app-static-taskdef + task: "arn:aws:ecs:us-west-2:123456789012:task/3f8353d1-29a8-4689-bbf6-ad79937ffe8a" """ RETURN = r""" diff --git a/plugins/modules/ecs_taskdefinition.py b/plugins/modules/ecs_taskdefinition.py index 4c4aefc2032..25a786e4f4c 100644 --- a/plugins/modules/ecs_taskdefinition.py +++ b/plugins/modules/ecs_taskdefinition.py @@ -658,40 +658,41 @@ - name: Create task definition community.aws.ecs_taskdefinition: containers: - - name: simple-app - cpu: 10 - essential: true - image: "httpd:2.4" - memory: 300 - mountPoints: - - containerPath: /usr/local/apache2/htdocs - sourceVolume: my-vol - portMappings: - - containerPort: 80 - hostPort: 80 - logConfiguration: - logDriver: awslogs - options: - awslogs-group: /ecs/test-cluster-taskdef - awslogs-region: us-west-2 - awslogs-stream-prefix: ecs - - name: busybox - command: - - > - /bin/sh -c "while true; do echo 'Amazon ECS Sample App

Amazon ECS Sample App

Congratulations! -

Your application is now running on a container in Amazon ECS.

' > top; /bin/date > date ; echo '
' > bottom; - cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done" - cpu: 10 - entryPoint: - - sh - - "-c" - essential: false - image: busybox - memory: 200 - volumesFrom: - - sourceContainer: simple-app + - name: simple-app + cpu: 10 + essential: true + image: "httpd:2.4" + memory: 300 + mountPoints: + - containerPath: /usr/local/apache2/htdocs + sourceVolume: my-vol + portMappings: + - containerPort: 80 + hostPort: 80 + logConfiguration: + logDriver: awslogs + options: + awslogs-group: /ecs/test-cluster-taskdef + awslogs-region: us-west-2 + awslogs-stream-prefix: ecs + - name: busybox + command: + - > + /bin/sh -c "while true; do echo 'Amazon ECS Sample App

Amazon ECS Sample App

+

Congratulations!

+

Your application is now running on a container in Amazon ECS.

' > top; /bin/date > date ; echo '
' > bottom; + cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done" + cpu: 10 + entryPoint: + - sh + - "-c" + essential: false + image: busybox + memory: 200 + volumesFrom: + - sourceContainer: simple-app volumes: - - name: my-vol + - name: my-vol family: test-cluster-taskdef state: present register: task_output @@ -700,26 +701,26 @@ community.aws.ecs_taskdefinition: family: nginx containers: - - name: nginx - essential: true - image: "nginx" - portMappings: - - containerPort: 8080 - hostPort: 8080 - cpu: 512 - memory: 1024 + - name: nginx + essential: true + image: "nginx" + portMappings: + - containerPort: 8080 + hostPort: 8080 + cpu: 512 + memory: 1024 state: present - name: Create task definition community.aws.ecs_taskdefinition: family: nginx containers: - - name: nginx - essential: true - image: "nginx" - portMappings: - - containerPort: 8080 - hostPort: 8080 + - name: nginx + essential: true + image: "nginx" + portMappings: + - containerPort: 8080 + hostPort: 8080 launch_type: FARGATE cpu: 512 memory: 1024 @@ -730,36 +731,36 @@ community.aws.ecs_taskdefinition: family: nginx containers: - - name: nginx - essential: true - image: "nginx" - portMappings: - - containerPort: 8080 - hostPort: 8080 - cpu: 512 - memory: 1024 - dependsOn: - - containerName: "simple-app" - condition: "start" + - name: nginx + essential: true + image: "nginx" + portMappings: + - containerPort: 8080 + hostPort: 8080 + cpu: 512 + memory: 1024 + dependsOn: + - containerName: "simple-app" + condition: "start" # Create Task Definition with Environment Variables and Secrets - name: Create task definition community.aws.ecs_taskdefinition: family: nginx containers: - - name: nginx - essential: true - image: "nginx" - environment: - - name: "PORT" - value: "8080" - secrets: - # For variables stored in Secrets Manager - - name: "NGINX_HOST" - valueFrom: "arn:aws:secretsmanager:us-west-2:123456789012:secret:nginx/NGINX_HOST" - # For variables stored in Parameter Store - - name: "API_KEY" - valueFrom: "arn:aws:ssm:us-west-2:123456789012:parameter/nginx/API_KEY" + - name: nginx + essential: true + image: "nginx" + environment: + - name: "PORT" + value: "8080" + secrets: + # For variables stored in Secrets Manager + - name: "NGINX_HOST" + valueFrom: "arn:aws:secretsmanager:us-west-2:123456789012:secret:nginx/NGINX_HOST" + # For variables stored in Parameter Store + - name: "API_KEY" + valueFrom: "arn:aws:ssm:us-west-2:123456789012:parameter/nginx/API_KEY" launch_type: FARGATE cpu: 512 memory: 1GB @@ -771,22 +772,22 @@ community.aws.ecs_taskdefinition: family: nginx containers: - - name: nginx - essential: true - image: "nginx" - portMappings: - - containerPort: 8080 - hostPort: 8080 - cpu: 512 - memory: 1024 - healthCheck: - command: + - name: nginx + essential: true + image: "nginx" + portMappings: + - containerPort: 8080 + hostPort: 8080 + cpu: 512 + memory: 1024 + healthCheck: + command: - CMD-SHELL - /app/healthcheck.py - interval: 60 - retries: 3 - startPeriod: 15 - timeout: 15 + interval: 60 + retries: 3 + startPeriod: 15 + timeout: 15 state: present """ diff --git a/plugins/modules/efs.py b/plugins/modules/efs.py index df79babc92c..6b9390f2b4d 100644 --- a/plugins/modules/efs.py +++ b/plugins/modules/efs.py @@ -112,21 +112,21 @@ state: present name: myTestEFS tags: - Name: myTestNameTag - purpose: file-storage + Name: myTestNameTag + purpose: file-storage targets: - - subnet_id: subnet-748c5d03 - security_groups: [ "sg-1a2b3c4d" ] + - subnet_id: subnet-748c5d03 + security_groups: ["sg-1a2b3c4d"] - name: Modifying EFS data community.aws.efs: state: present name: myTestEFS tags: - name: myAnotherTestTag + name: myAnotherTestTag targets: - - subnet_id: subnet-7654fdca - security_groups: [ "sg-4c5d6f7a" ] + - subnet_id: subnet-7654fdca + security_groups: ["sg-4c5d6f7a"] - name: Set a lifecycle policy community.aws.efs: @@ -134,8 +134,8 @@ name: myTestEFS transition_to_ia: 7 targets: - - subnet_id: subnet-7654fdca - security_groups: [ "sg-4c5d6f7a" ] + - subnet_id: subnet-7654fdca + security_groups: ["sg-4c5d6f7a"] - name: Remove a lifecycle policy community.aws.efs: @@ -143,8 +143,8 @@ name: myTestEFS transition_to_ia: None targets: - - subnet_id: subnet-7654fdca - security_groups: [ "sg-4c5d6f7a" ] + - subnet_id: subnet-7654fdca + security_groups: ["sg-4c5d6f7a"] - name: Deleting EFS community.aws.efs: @@ -241,7 +241,6 @@ "name": "my-efs", "key": "Value" } - """ from time import sleep diff --git a/plugins/modules/efs_info.py b/plugins/modules/efs_info.py index 76952337b97..3a170a3915b 100644 --- a/plugins/modules/efs_info.py +++ b/plugins/modules/efs_info.py @@ -55,10 +55,10 @@ - name: Searching all EFS instances with tag Name = 'myTestNameTag', in subnet 'subnet-1a2b3c4d' and with security group 'sg-4d3c2b1a' community.aws.efs_info: tags: - Name: myTestNameTag + Name: myTestNameTag targets: - - subnet-1a2b3c4d - - sg-4d3c2b1a + - subnet-1a2b3c4d + - sg-4d3c2b1a register: result - ansible.builtin.debug: @@ -164,7 +164,6 @@ "name": "my-efs", "key": "Value" } - """ diff --git a/plugins/modules/efs_tag.py b/plugins/modules/efs_tag.py index c8e5a1f1667..0f51434716b 100644 --- a/plugins/modules/efs_tag.py +++ b/plugins/modules/efs_tag.py @@ -66,7 +66,7 @@ resource: fsap-78945ff state: absent tags: - Name: foo + Name: foo purge_tags: true - name: Remove all tags diff --git a/plugins/modules/eks_nodegroup.py b/plugins/modules/eks_nodegroup.py index 2e13ddb9130..f9bbb785762 100644 --- a/plugins/modules/eks_nodegroup.py +++ b/plugins/modules/eks_nodegroup.py @@ -202,7 +202,7 @@ community.aws.eks_nodegroup: name: test_nodegroup cluster_name: test_cluster - wait: yes + wait: true state: absent """ diff --git a/plugins/modules/elasticache_parameter_group.py b/plugins/modules/elasticache_parameter_group.py index 00f2af19a08..fa7f87a2f78 100644 --- a/plugins/modules/elasticache_parameter_group.py +++ b/plugins/modules/elasticache_parameter_group.py @@ -51,8 +51,8 @@ EXAMPLES = r""" # Note: These examples do not set authentication details, see the AWS Guide for details. - -- hosts: localhost +- name: Create, modify and delete a parameter group + hosts: localhost connection: local tasks: - name: 'Create a test parameter group' @@ -65,7 +65,7 @@ community.aws.elasticache_parameter_group: name: 'test-param-group' values: - activerehashing: yes + activerehashing: true client-output-buffer-limit-normal-hard-limit: 4 state: 'present' - name: 'Reset all modifiable parameters for the test parameter group' diff --git a/plugins/modules/elasticbeanstalk_app.py b/plugins/modules/elasticbeanstalk_app.py index bf11afbb2bf..1aaa4c4d8fe 100644 --- a/plugins/modules/elasticbeanstalk_app.py +++ b/plugins/modules/elasticbeanstalk_app.py @@ -57,7 +57,6 @@ - community.aws.elasticbeanstalk_app: app_name: Sample_App state: absent - """ RETURN = r""" diff --git a/plugins/modules/elb_classic_lb_info.py b/plugins/modules/elb_classic_lb_info.py index 8ac3b1f1c6a..5329e5b81db 100644 --- a/plugins/modules/elb_classic_lb_info.py +++ b/plugins/modules/elb_classic_lb_info.py @@ -50,14 +50,13 @@ # Gather information about a set of ELBs - community.aws.elb_classic_lb_info: names: - - frontend-prod-elb - - backend-prod-elb + - frontend-prod-elb + - backend-prod-elb register: elb_info - ansible.builtin.debug: msg: "{{ item.dns_name }}" loop: "{{ elb_info.elbs }}" - """ RETURN = r""" diff --git a/plugins/modules/elb_network_lb.py b/plugins/modules/elb_network_lb.py index 82ec8700625..22e419328d9 100644 --- a/plugins/modules/elb_network_lb.py +++ b/plugins/modules/elb_network_lb.py @@ -194,7 +194,6 @@ community.aws.elb_network_lb: name: myelb state: absent - """ RETURN = r""" diff --git a/plugins/modules/elb_target.py b/plugins/modules/elb_target.py index d7dfaf824cb..22074d496de 100644 --- a/plugins/modules/elb_target.py +++ b/plugins/modules/elb_target.py @@ -105,11 +105,9 @@ target_id: i-1234567 target_port: 8080 state: present - """ RETURN = r""" - """ from time import sleep diff --git a/plugins/modules/elb_target_group.py b/plugins/modules/elb_target_group.py index 4eb38f4c2d4..71a859ead28 100644 --- a/plugins/modules/elb_target_group.py +++ b/plugins/modules/elb_target_group.py @@ -270,7 +270,7 @@ Port: 80 state: present wait_timeout: 200 - wait: True + wait: true - name: Create a target group with IP address targets community.aws.elb_target_group: @@ -290,7 +290,7 @@ Port: 80 state: present wait_timeout: 200 - wait: True + wait: true # Using lambda as targets require that the target group # itself is allow to invoke the lambda function. @@ -303,7 +303,7 @@ name: my-lambda-targetgroup target_type: lambda state: present - modify_targets: False + modify_targets: false register: out - name: second, allow invoke of the lambda @@ -321,8 +321,7 @@ target_type: lambda state: present targets: - - Id: arn:aws:lambda:eu-central-1:123456789012:function:my-lambda-function - + - Id: arn:aws:lambda:eu-central-1:123456789012:function:my-lambda-function """ RETURN = r""" diff --git a/plugins/modules/elb_target_group_info.py b/plugins/modules/elb_target_group_info.py index bf02db21f15..d0b013bfd09 100644 --- a/plugins/modules/elb_target_group_info.py +++ b/plugins/modules/elb_target_group_info.py @@ -59,7 +59,6 @@ names: - tg1 - tg2 - """ RETURN = r""" diff --git a/plugins/modules/elb_target_info.py b/plugins/modules/elb_target_info.py index add122416d9..ad0b3c74b30 100644 --- a/plugins/modules/elb_target_info.py +++ b/plugins/modules/elb_target_info.py @@ -35,96 +35,95 @@ EXAMPLES = r""" # practical use case - dynamically de-registering and re-registering nodes - - name: Get EC2 Metadata - amazon.aws.ec2_metadata_facts: - - - name: Get initial list of target groups - delegate_to: localhost - community.aws.elb_target_info: - instance_id: "{{ ansible_ec2_instance_id }}" - region: "{{ ansible_ec2_placement_region }}" - register: target_info - - - name: save fact for later - ansible.builtin.set_fact: - original_tgs: "{{ target_info.instance_target_groups }}" - - - name: Deregister instance from all target groups - delegate_to: localhost - community.aws.elb_target: - target_group_arn: "{{ item.0.target_group_arn }}" - target_port: "{{ item.1.target_port }}" - target_az: "{{ item.1.target_az }}" - target_id: "{{ item.1.target_id }}" - state: absent - target_status: "draining" - region: "{{ ansible_ec2_placement_region }}" - with_subelements: - - "{{ original_tgs }}" - - "targets" - - # This avoids having to wait for 'elb_target' to serially deregister each - # target group. An alternative would be to run all of the 'elb_target' - # tasks async and wait for them to finish. - - - name: wait for all targets to deregister simultaneously - delegate_to: localhost - community.aws.elb_target_info: - get_unused_target_groups: false - instance_id: "{{ ansible_ec2_instance_id }}" - region: "{{ ansible_ec2_placement_region }}" - register: target_info - until: (target_info.instance_target_groups | length) == 0 - retries: 60 - delay: 10 - - - name: reregister in elbv2s - community.aws.elb_target: - region: "{{ ansible_ec2_placement_region }}" - target_group_arn: "{{ item.0.target_group_arn }}" - target_port: "{{ item.1.target_port }}" - target_az: "{{ item.1.target_az }}" - target_id: "{{ item.1.target_id }}" - state: present - target_status: "initial" - with_subelements: - - "{{ original_tgs }}" - - "targets" - - # wait until all groups associated with this instance are 'healthy' or - # 'unused' - - name: wait for registration - community.aws.elb_target_info: - get_unused_target_groups: false - instance_id: "{{ ansible_ec2_instance_id }}" - region: "{{ ansible_ec2_placement_region }}" - register: target_info - until: (target_info.instance_target_groups | - map(attribute='targets') | - flatten | - map(attribute='target_health') | - rejectattr('state', 'equalto', 'healthy') | - rejectattr('state', 'equalto', 'unused') | - list | - length) == 0 - retries: 61 - delay: 10 +- name: Get EC2 Metadata + amazon.aws.ec2_metadata_facts: + +- name: Get initial list of target groups + delegate_to: localhost + community.aws.elb_target_info: + instance_id: "{{ ansible_ec2_instance_id }}" + region: "{{ ansible_ec2_placement_region }}" + register: target_info + +- name: save fact for later + ansible.builtin.set_fact: + original_tgs: "{{ target_info.instance_target_groups }}" + +- name: Deregister instance from all target groups + delegate_to: localhost + community.aws.elb_target: + target_group_arn: "{{ item.0.target_group_arn }}" + target_port: "{{ item.1.target_port }}" + target_az: "{{ item.1.target_az }}" + target_id: "{{ item.1.target_id }}" + state: absent + target_status: "draining" + region: "{{ ansible_ec2_placement_region }}" + with_subelements: + - "{{ original_tgs }}" + - "targets" + + # This avoids having to wait for 'elb_target' to serially deregister each + # target group. An alternative would be to run all of the 'elb_target' + # tasks async and wait for them to finish. + +- name: wait for all targets to deregister simultaneously + delegate_to: localhost + community.aws.elb_target_info: + get_unused_target_groups: false + instance_id: "{{ ansible_ec2_instance_id }}" + region: "{{ ansible_ec2_placement_region }}" + register: target_info + until: (target_info.instance_target_groups | length) == 0 + retries: 60 + delay: 10 + +- name: reregister in elbv2s + community.aws.elb_target: + region: "{{ ansible_ec2_placement_region }}" + target_group_arn: "{{ item.0.target_group_arn }}" + target_port: "{{ item.1.target_port }}" + target_az: "{{ item.1.target_az }}" + target_id: "{{ item.1.target_id }}" + state: present + target_status: "initial" + with_subelements: + - "{{ original_tgs }}" + - "targets" + +# wait until all groups associated with this instance are 'healthy' or +# 'unused' +- name: wait for registration + community.aws.elb_target_info: + get_unused_target_groups: false + instance_id: "{{ ansible_ec2_instance_id }}" + region: "{{ ansible_ec2_placement_region }}" + register: target_info + until: (target_info.instance_target_groups | + map(attribute='targets') | + flatten | + map(attribute='target_health') | + rejectattr('state', 'equalto', 'healthy') | + rejectattr('state', 'equalto', 'unused') | + list | + length) == 0 + retries: 61 + delay: 10 # using the target groups to generate AWS CLI commands to reregister the # instance - useful in case the playbook fails mid-run and manual # rollback is required - - name: "reregistration commands: ELBv2s" - ansible.builtin.debug: - msg: > - aws --region {{ansible_ec2_placement_region}} elbv2 - register-targets --target-group-arn {{item.target_group_arn}} - --targets{%for target in item.targets%} - Id={{target.target_id}}, - Port={{target.target_port}}{%if target.target_az%},AvailabilityZone={{target.target_az}} - {%endif%} - {%endfor%} - loop: "{{target_info.instance_target_groups}}" - +- name: "reregistration commands: ELBv2s" + ansible.builtin.debug: + msg: > + aws --region {{ansible_ec2_placement_region}} elbv2 + register-targets --target-group-arn {{item.target_group_arn}} + --targets{%for target in item.targets%} + Id={{target.target_id}}, + Port={{target.target_port}}{%if target.target_az%},AvailabilityZone={{target.target_az}} + {%endif%} + {%endfor%} + loop: "{{target_info.instance_target_groups}}" """ RETURN = r""" diff --git a/plugins/modules/mq_broker.py b/plugins/modules/mq_broker.py index 25377407c2c..79ed8118d52 100644 --- a/plugins/modules/mq_broker.py +++ b/plugins/modules/mq_broker.py @@ -152,7 +152,7 @@ register: result until: "result.broker['BrokerState'] == 'RUNNING'" retries: 15 - delay: 60 + delay: 60 - name: create or update broker with almost all parameter set including credentials community.aws.mq_broker: @@ -174,11 +174,11 @@ - subnet_xxx - subnet_yyy users: - - Username: 'initial-user' - Password': 'plain-text-password' - ConsoleAccess: true + - Username: 'initial-user' + Password': 'plain-text-password' + ConsoleAccess: true tags: - - env: Test + env: Test creator: ansible authentication_strategy: 'SIMPLE' auto_minor_version_upgrade: true diff --git a/plugins/modules/mq_user.py b/plugins/modules/mq_user.py index 0daf4e5b6e6..68e1fd62912 100644 --- a/plugins/modules/mq_user.py +++ b/plugins/modules/mq_user.py @@ -67,7 +67,7 @@ broker_id: "aws-mq-broker-id" username: "sample_user1" console_access: false - groups: [ "g1", "g2" ] + groups: ["g1", "g2"] password: "plain-text-password" - name: allow console access and update group list - relying on default state @@ -76,7 +76,7 @@ username: "sample_user1" region: "{{ aws_region }}" console_access: true - groups: [ "g1", "g2", "g3" ] + groups: ["g1", "g2", "g3"] - name: remove user - setting all credentials explicitly community.aws.mq_user: diff --git a/plugins/modules/networkfirewall.py b/plugins/modules/networkfirewall.py index 2cab7e26dfc..f7fe63f3307 100644 --- a/plugins/modules/networkfirewall.py +++ b/plugins/modules/networkfirewall.py @@ -115,21 +115,21 @@ state: present policy: 'ExamplePolicy' subnets: - - 'subnet-123456789abcdef01' + - 'subnet-123456789abcdef01' # Create an AWS Network Firewall with various options, don't wait for creation # to finish. - community.aws.networkfirewall: name: 'ExampleFirewall' state: present - delete_protection: True + delete_protection: true description: "An example Description" policy: 'ExamplePolicy' - policy_change_protection: True + policy_change_protection: true subnets: - - 'subnet-123456789abcdef01' - - 'subnet-abcdef0123456789a' - subnet_change_protection: True + - 'subnet-123456789abcdef01' + - 'subnet-abcdef0123456789a' + subnet_change_protection: true tags: ExampleTag: Example Value another_tag: another_example diff --git a/plugins/modules/networkfirewall_rule_group.py b/plugins/modules/networkfirewall_rule_group.py index da67247aa96..9300036c5c7 100644 --- a/plugins/modules/networkfirewall_rule_group.py +++ b/plugins/modules/networkfirewall_rule_group.py @@ -365,8 +365,8 @@ domain_names: - 'example.com' - '.example.net' - filter_https: True - filter_http: True + filter_https: true + filter_http: true action: allow source_ips: '192.0.2.0/24' @@ -392,7 +392,6 @@ name: 'MinimalGroup' type: 'stateful' state: absent - """ RETURN = r""" diff --git a/plugins/modules/networkfirewall_rule_group_info.py b/plugins/modules/networkfirewall_rule_group_info.py index 3cf03e58baa..8b3c9d2305f 100644 --- a/plugins/modules/networkfirewall_rule_group_info.py +++ b/plugins/modules/networkfirewall_rule_group_info.py @@ -66,7 +66,6 @@ - community.aws.networkfirewall_rule_group_info: name: ExampleRuleGroup type: stateful - """ RETURN = r""" diff --git a/plugins/modules/opensearch.py b/plugins/modules/opensearch.py index 1c8f0deb582..d89e173bba2 100644 --- a/plugins/modules/opensearch.py +++ b/plugins/modules/opensearch.py @@ -450,16 +450,16 @@ auto_tune_options: enabled: true maintenance_schedules: - - start_at: "2025-01-12" - duration: - value: 1 - unit: "HOURS" - cron_expression_for_recurrence: "cron(0 12 * * ? *)" - - start_at: "2032-01-12" - duration: - value: 2 - unit: "HOURS" - cron_expression_for_recurrence: "cron(0 12 * * ? *)" + - start_at: "2025-01-12" + duration: + value: 1 + unit: "HOURS" + cron_expression_for_recurrence: "cron(0 12 * * ? *)" + - start_at: "2032-01-12" + duration: + value: 2 + unit: "HOURS" + cron_expression_for_recurrence: "cron(0 12 * * ? *)" tags: Environment: Development Application: Search @@ -478,7 +478,6 @@ cluster_config: instance_count: 40 wait: true - """ import datetime diff --git a/plugins/modules/redshift_subnet_group.py b/plugins/modules/redshift_subnet_group.py index 3d693cc23ac..2ae3a24059e 100644 --- a/plugins/modules/redshift_subnet_group.py +++ b/plugins/modules/redshift_subnet_group.py @@ -51,8 +51,8 @@ group_name: redshift-subnet group_description: Redshift subnet group_subnets: - - 'subnet-aaaaa' - - 'subnet-bbbbb' + - 'subnet-aaaaa' + - 'subnet-bbbbb' - name: Remove subnet group community.aws.redshift_subnet_group: diff --git a/plugins/modules/s3_logging.py b/plugins/modules/s3_logging.py index 193455a4be2..3a78749945f 100644 --- a/plugins/modules/s3_logging.py +++ b/plugins/modules/s3_logging.py @@ -56,7 +56,6 @@ community.aws.s3_logging: name: mywebsite.com state: absent - """ try: diff --git a/plugins/modules/s3_metrics_configuration.py b/plugins/modules/s3_metrics_configuration.py index d90e7d0e603..4e62b7bf8e4 100644 --- a/plugins/modules/s3_metrics_configuration.py +++ b/plugins/modules/s3_metrics_configuration.py @@ -93,7 +93,6 @@ bucket_name: my-bucket id: EntireBucket state: absent - """ try: diff --git a/plugins/modules/s3_website.py b/plugins/modules/s3_website.py index 38c411b1fe2..1c212d11789 100644 --- a/plugins/modules/s3_website.py +++ b/plugins/modules/s3_website.py @@ -68,7 +68,6 @@ suffix: home.htm error_key: errors/404.htm state: present - """ RETURN = r""" diff --git a/plugins/modules/ses_identity.py b/plugins/modules/ses_identity.py index e324a7e12f7..785519bd3ba 100644 --- a/plugins/modules/ses_identity.py +++ b/plugins/modules/ses_identity.py @@ -84,7 +84,7 @@ - Whether or not to enable feedback forwarding. - This can only be false if both I(bounce_notifications) and I(complaint_notifications) specify SNS topics. type: 'bool' - default: True + default: true extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -115,7 +115,7 @@ community.aws.sns_topic: name: "complaints-topic" state: present - purge_subscriptions: False + purge_subscriptions: false register: topic_info - name: Deliver feedback to topic instead of owner email @@ -124,11 +124,11 @@ state: present complaint_notifications: topic: "{{ topic_info.sns_arn }}" - include_headers: True + include_headers: true bounce_notifications: topic: "{{ topic_info.sns_arn }}" - include_headers: False - feedback_forwarding: False + include_headers: false + feedback_forwarding: false # Create an SNS topic for delivery notifications and leave complaints # Being forwarded to the identity owner email @@ -136,7 +136,7 @@ community.aws.sns_topic: name: "delivery-notifications-topic" state: present - purge_subscriptions: False + purge_subscriptions: false register: topic_info - name: Delivery notifications to topic diff --git a/plugins/modules/sns_topic.py b/plugins/modules/sns_topic.py index 03e69d8c40f..0fe7fbe3390 100644 --- a/plugins/modules/sns_topic.py +++ b/plugins/modules/sns_topic.py @@ -179,7 +179,7 @@ numMinDelayRetries: 2 numNoDelayRetries: 2 backoffFunction: "linear" - disableSubscriptionOverrides: True + disableSubscriptionOverrides: true defaultThrottlePolicy: maxReceivesPerSecond: 10 subscriptions: diff --git a/plugins/modules/sts_session_token.py b/plugins/modules/sts_session_token.py index 044a6367b58..cb9f99fd3a9 100644 --- a/plugins/modules/sts_session_token.py +++ b/plugins/modules/sts_session_token.py @@ -73,8 +73,7 @@ resource: i-xyzxyz01 state: present tags: - MyNewTag: value - + MyNewTag: value """ try: diff --git a/plugins/modules/waf_condition.py b/plugins/modules/waf_condition.py index aed48130d3c..5b08cb6de86 100644 --- a/plugins/modules/waf_condition.py +++ b/plugins/modules/waf_condition.py @@ -139,71 +139,70 @@ """ EXAMPLES = r""" - - name: create WAF byte condition - community.aws.waf_condition: - name: my_byte_condition - filters: +- name: create WAF byte condition + community.aws.waf_condition: + name: my_byte_condition + filters: - field_to_match: header position: STARTS_WITH target_string: Hello header: Content-type - type: byte - - - name: create WAF geo condition - community.aws.waf_condition: - name: my_geo_condition - filters: - - country: US - - country: AU - - country: AT - type: geo - - - name: create IP address condition - community.aws.waf_condition: - name: "{{ resource_prefix }}_ip_condition" - filters: - - ip_address: "10.0.0.0/8" - - ip_address: "192.168.0.0/24" - type: ip - - - name: create WAF regex condition - community.aws.waf_condition: - name: my_regex_condition - filters: - - field_to_match: query_string - regex_pattern: - name: greetings - regex_strings: - - '[hH]ello' - - '^Hi there' - - '.*Good Day to You' - type: regex - - - name: create WAF size condition - community.aws.waf_condition: - name: my_size_condition - filters: - - field_to_match: query_string - size: 300 - comparison: GT - type: size - - - name: create WAF sql injection condition - community.aws.waf_condition: - name: my_sql_condition - filters: - - field_to_match: query_string - transformation: url_decode - type: sql - - - name: create WAF xss condition - community.aws.waf_condition: - name: my_xss_condition - filters: - - field_to_match: query_string - transformation: url_decode - type: xss - + type: byte + +- name: create WAF geo condition + community.aws.waf_condition: + name: my_geo_condition + filters: + - country: US + - country: AU + - country: AT + type: geo + +- name: create IP address condition + community.aws.waf_condition: + name: "{{ resource_prefix }}_ip_condition" + filters: + - ip_address: "10.0.0.0/8" + - ip_address: "192.168.0.0/24" + type: ip + +- name: create WAF regex condition + community.aws.waf_condition: + name: my_regex_condition + filters: + - field_to_match: query_string + regex_pattern: + name: greetings + regex_strings: + - '[hH]ello' + - '^Hi there' + - '.*Good Day to You' + type: regex + +- name: create WAF size condition + community.aws.waf_condition: + name: my_size_condition + filters: + - field_to_match: query_string + size: 300 + comparison: GT + type: size + +- name: create WAF sql injection condition + community.aws.waf_condition: + name: my_sql_condition + filters: + - field_to_match: query_string + transformation: url_decode + type: sql + +- name: create WAF xss condition + community.aws.waf_condition: + name: my_xss_condition + filters: + - field_to_match: query_string + transformation: url_decode + type: xss """ RETURN = r""" diff --git a/plugins/modules/waf_rule.py b/plugins/modules/waf_rule.py index a744d8747d8..87a02bbbdda 100644 --- a/plugins/modules/waf_rule.py +++ b/plugins/modules/waf_rule.py @@ -73,24 +73,24 @@ """ EXAMPLES = r""" - - name: create WAF rule - community.aws.waf_rule: - name: my_waf_rule - conditions: - - name: my_regex_condition - type: regex - negated: false - - name: my_geo_condition - type: geo - negated: false - - name: my_byte_condition - type: byte - negated: true - - - name: remove WAF rule - community.aws.waf_rule: - name: "my_waf_rule" - state: absent +- name: create WAF rule + community.aws.waf_rule: + name: my_waf_rule + conditions: + - name: my_regex_condition + type: regex + negated: false + - name: my_geo_condition + type: geo + negated: false + - name: my_byte_condition + type: byte + negated: true + +- name: remove WAF rule + community.aws.waf_rule: + name: "my_waf_rule" + state: absent """ RETURN = r""" diff --git a/plugins/modules/waf_web_acl.py b/plugins/modules/waf_web_acl.py index b8e4d9e6290..021ca568d80 100644 --- a/plugins/modules/waf_web_acl.py +++ b/plugins/modules/waf_web_acl.py @@ -87,21 +87,21 @@ """ EXAMPLES = r""" - - name: create web ACL - community.aws.waf_web_acl: - name: my_web_acl - rules: - - name: my_rule - priority: 1 - action: block - default_action: block - purge_rules: true - state: present - - - name: delete the web acl - community.aws.waf_web_acl: - name: my_web_acl - state: absent +- name: create web ACL + community.aws.waf_web_acl: + name: my_web_acl + rules: + - name: my_rule + priority: 1 + action: block + default_action: block + purge_rules: true + state: present + +- name: delete the web acl + community.aws.waf_web_acl: + name: my_web_acl + state: absent """ RETURN = r""" diff --git a/plugins/modules/wafv2_web_acl.py b/plugins/modules/wafv2_web_acl.py index acc5345be34..054c093c532 100644 --- a/plugins/modules/wafv2_web_acl.py +++ b/plugins/modules/wafv2_web_acl.py @@ -246,7 +246,6 @@ content: '{ message: "Your request has been blocked due to too many HTTP requests coming from your IP" }' region: us-east-1 state: present - """ RETURN = r""" diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index e69de29bb2d..67d3693df63 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -0,0 +1,2 @@ +plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index e69de29bb2d..67d3693df63 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -0,0 +1,2 @@ +plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt new file mode 100644 index 00000000000..67d3693df63 --- /dev/null +++ b/tests/sanity/ignore-2.16.txt @@ -0,0 +1,2 @@ +plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt new file mode 100644 index 00000000000..67d3693df63 --- /dev/null +++ b/tests/sanity/ignore-2.17.txt @@ -0,0 +1,2 @@ +plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 diff --git a/tox.ini b/tox.ini index e425f3a6494..179ed761c7c 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_const # Tox4 supports labels which allow us to group the environments rather than dumping all commands into a single environment labels = format = flynt, black, isort - lint = complexity-report, black-lint, isort-lint, flake8-lint, flynt-lint + lint = complexity-report, ansible-lint, black-lint, isort-lint, flake8-lint, flynt-lint units = ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints} [common] @@ -36,6 +36,12 @@ deps = flake8-html commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins +[testenv:ansible-lint] +deps = + ansible-lint +commands = + ansible-lint {toxinidir}/plugins + [testenv:black] depends = flynt, isort From 7da2ed5c0ed7b7db349f25d41b7e557a78a73ab5 Mon Sep 17 00:00:00 2001 From: Zac Lovoy Date: Tue, 9 Jan 2024 03:05:03 -0800 Subject: [PATCH 14/77] cloudfront_distribution: Add support for cache_policy_id and origin_request_policy_id for behaviors (#1589) cloudfront_distribution: Add support for cache_policy_id and origin_request_policy_id for behaviors SUMMARY As described by issue #290, the current cloudfront_distribution module does not support cache_policy_id and origin_request_policy_id in a behavior. In particular, attempting to use cache_policy_id will add default values that are incompatible with it (mainly default_ttl, max_ttl, min_ttl, and compress). So this change allows you to use the policies instead of using a forwarded_values for a given behavior. Fixed #290 ISSUE TYPE Feature Pull Request COMPONENT NAME cloudfront_distribution Reviewed-by: Markus Bergholz Reviewed-by: Zac Lovoy Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis --- ...9-cloudfront_distribution-add-policies.yml | 2 + plugins/modules/cloudfront_distribution.py | 76 +++++++++++++++---- .../cloudfront_distribution/tasks/main.yml | 16 ++++ 3 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 changelogs/fragments/1589-cloudfront_distribution-add-policies.yml diff --git a/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml b/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml new file mode 100644 index 00000000000..c0b9bbdd5c7 --- /dev/null +++ b/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml @@ -0,0 +1,2 @@ +minor_changes: + - cloudfront_distribution - added support for ``cache_policy_id`` and ``origin_request_policy_id`` for behaviors (https://github.com/ansible-collections/community.aws/pull/1589) \ No newline at end of file diff --git a/plugins/modules/cloudfront_distribution.py b/plugins/modules/cloudfront_distribution.py index 33299623e09..13718cfb896 100644 --- a/plugins/modules/cloudfront_distribution.py +++ b/plugins/modules/cloudfront_distribution.py @@ -205,9 +205,25 @@ description: - The ID of the header policy that CloudFront adds to responses that it sends to viewers. type: str + cache_policy_id: + version_added: 7.1.0 + description: + - The ID of the cache policy for CloudFront to use for the default cache behavior. + - A behavior should use either a C(cache_policy_id) or a C(forwarded_values) option. + - For more information see the CloudFront documentation + at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html) + type: str + origin_request_policy_id: + version_added: 7.1.0 + description: + - The ID of the origin request policy for CloudFront to use for the default cache behavior. + - For more information see the CloudFront documentation + at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html) + type: str forwarded_values: description: - A dict that specifies how CloudFront handles query strings and cookies. + - A behavior should use either a C(cache_policy_id) or a C(forwarded_values) option. type: dict suboptions: query_string: @@ -326,9 +342,25 @@ description: - The ID of the header policy that CloudFront adds to responses that it sends to viewers. type: str + cache_policy_id: + version_added: 7.1.0 + description: + - The ID of the cache policy for CloudFront to use for the cache behavior. + - A behavior should use either a C(cache_policy_id) or a C(forwarded_values) option. + - For more information see the CloudFront documentation + at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html) + type: str + origin_request_policy_id: + version_added: 7.1.0 + description: + - The ID of the origin request policy for CloudFront to use for the cache behavior. + - For more information see the CloudFront documentation + at U(https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html) + type: str forwarded_values: description: - A dict that specifies how CloudFront handles query strings and cookies. + - A behavior should use either a C(cache_policy_id) or a C(forwarded_values) option. type: dict suboptions: query_string: @@ -1914,7 +1946,10 @@ def validate_cache_behavior(self, config, cache_behavior, valid_origins, is_defa cache_behavior = self.validate_cache_behavior_first_level_keys( config, cache_behavior, valid_origins, is_default_cache ) - cache_behavior = self.validate_forwarded_values(config, cache_behavior.get("forwarded_values"), cache_behavior) + if cache_behavior.get("cache_policy_id") is None: + cache_behavior = self.validate_forwarded_values( + config, cache_behavior.get("forwarded_values"), cache_behavior + ) cache_behavior = self.validate_allowed_methods(config, cache_behavior.get("allowed_methods"), cache_behavior) cache_behavior = self.validate_lambda_function_associations( config, cache_behavior.get("lambda_function_associations"), cache_behavior @@ -1926,19 +1961,34 @@ def validate_cache_behavior(self, config, cache_behavior, valid_origins, is_defa return cache_behavior def validate_cache_behavior_first_level_keys(self, config, cache_behavior, valid_origins, is_default_cache): - try: - cache_behavior = self.add_key_else_change_dict_key( - cache_behavior, "min_ttl", "min_t_t_l", config.get("min_t_t_l", self.__default_cache_behavior_min_ttl) - ) - cache_behavior = self.add_key_else_change_dict_key( - cache_behavior, "max_ttl", "max_t_t_l", config.get("max_t_t_l", self.__default_cache_behavior_max_ttl) - ) - cache_behavior = self.add_key_else_change_dict_key( - cache_behavior, - "default_ttl", - "default_t_t_l", - config.get("default_t_t_l", self.__default_cache_behavior_default_ttl), + if cache_behavior.get("cache_policy_id") is not None and cache_behavior.get("forwarded_values") is not None: + if is_default_cache: + cache_behavior_name = "Default cache behavior" + else: + cache_behavior_name = f"Cache behavior for path {cache_behavior['path_pattern']}" + self.module.fail_json( + msg=f"{cache_behavior_name} cannot have both a cache_policy_id and a forwarded_values option." ) + try: + if cache_behavior.get("cache_policy_id") is None: + cache_behavior = self.add_key_else_change_dict_key( + cache_behavior, + "min_ttl", + "min_t_t_l", + config.get("min_t_t_l", self.__default_cache_behavior_min_ttl), + ) + cache_behavior = self.add_key_else_change_dict_key( + cache_behavior, + "max_ttl", + "max_t_t_l", + config.get("max_t_t_l", self.__default_cache_behavior_max_ttl), + ) + cache_behavior = self.add_key_else_change_dict_key( + cache_behavior, + "default_ttl", + "default_t_t_l", + config.get("default_t_t_l", self.__default_cache_behavior_default_ttl), + ) cache_behavior = self.add_missing_key( cache_behavior, "compress", config.get("compress", self.__default_cache_behavior_compress) ) diff --git a/tests/integration/targets/cloudfront_distribution/tasks/main.yml b/tests/integration/targets/cloudfront_distribution/tasks/main.yml index 7a1fa91af81..281097db1d1 100644 --- a/tests/integration/targets/cloudfront_distribution/tasks/main.yml +++ b/tests/integration/targets/cloudfront_distribution/tasks/main.yml @@ -632,6 +632,22 @@ - result.origins['quantity'] > 0 - result.origins['items'] | selectattr('s3_origin_config', 'defined') | map(attribute='s3_origin_config') | selectattr('origin_access_identity', 'eq', origin_access_identity) | list | length == 1 + - name: update distribution to use cache_policy_id and origin_request_policy_id + cloudfront_distribution: + distribution_id: "{{ distribution_id }}" + default_cache_behavior: + cache_policy_id: "658327ea-f89d-4fab-a63d-7e88639e58f6" + origin_request_policy_id: "88a5eaf4-2fd4-4709-b370-b4c650ea3fcf" + state: present + register: update_distribution_with_cache_policies + + - name: ensure that the cache_policy_id and origin_request_policy_id was set + assert: + that: + - update_distribution_with_cache_policies.changed + - update_distribution_with_cache_policies.default_cache_behavior.cache_policy_id == '658327ea-f89d-4fab-a63d-7e88639e58f6' + - update_distribution_with_cache_policies.default_cache_behavior.origin_request_policy_id == '88a5eaf4-2fd4-4709-b370-b4c650ea3fcf' + always: # TEARDOWN STARTS HERE - name: delete the s3 bucket From f65eb5a1589657c2e5273f88e834cb4663835fff Mon Sep 17 00:00:00 2001 From: alialkhalidi <75764610+alialkhalidi@users.noreply.github.com> Date: Tue, 9 Jan 2024 06:05:07 -0500 Subject: [PATCH 15/77] feat: add wait and wait_timeout to mq_broker; closes #1879 (#1888) feat: add wait and wait_timeout to mq_broker; closes #1879 SUMMARY add wait and wait_timeout to wait for broker desired state. This will be used instead of polling for broker desired state though a separate module, broker_info. ISSUE TYPE Feature Pull Request COMPONENT NAME mq_broker ADDITIONAL INFORMATION wait: description: - Specifies whether the module waits for the desired C(state). type: bool wait_timeout: description: - How long to wait (in seconds) for the broker to reach the desired state. default: 900 type: int Reviewed-by: Alina Buzachis --- .../fragments/1879-mq_broker-add-wait.yml | 2 + plugins/modules/mq_broker.py | 84 ++++++++++++++++++- .../targets/mq/tasks/broker_tests.yml | 13 +-- 3 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 changelogs/fragments/1879-mq_broker-add-wait.yml diff --git a/changelogs/fragments/1879-mq_broker-add-wait.yml b/changelogs/fragments/1879-mq_broker-add-wait.yml new file mode 100644 index 00000000000..388b5523aac --- /dev/null +++ b/changelogs/fragments/1879-mq_broker-add-wait.yml @@ -0,0 +1,2 @@ +minor_changes: + - mq_broker - add support to wait for broker state via ``wait`` and ``wait_timeout`` parameter values (https://github.com/ansible-collections/community.aws/pull/1879). diff --git a/plugins/modules/mq_broker.py b/plugins/modules/mq_broker.py index 79ed8118d52..5a97fda9264 100644 --- a/plugins/modules/mq_broker.py +++ b/plugins/modules/mq_broker.py @@ -124,6 +124,19 @@ - At least one must be provided during creation. type: list elements: str + wait: + description: + - Specifies whether the module waits for the desired C(state). + - The time to wait can be controlled by setting I(wait_timeout). + type: bool + default: false + version_added: 7.1.0 + wait_timeout: + description: + - How long to wait (in seconds) for the broker to reach the desired state if I(wait=true). + default: 900 + type: int + version_added: 7.1.0 extends_documentation_fragment: - amazon.aws.boto3 @@ -215,6 +228,9 @@ # handled by AnsibleAWSModule pass +from time import sleep +from time import time + from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule @@ -384,22 +400,77 @@ def get_broker_info(conn, module, broker_id): module.fail_json_aws(e, msg="Couldn't get broker details.") +def wait_for_status(conn, module): + interval_secs = 5 + timeout = module.params.get("wait_timeout", 900) + broker_name = module.params.get("broker_name") + desired_state = module.params.get("state") + done = False + + paginator = conn.get_paginator("list_brokers") + page_iterator = paginator.paginate(PaginationConfig={"MaxItems": 100, "PageSize": 100, "StartingToken": ""}) + wait_timeout = time() + timeout + + while wait_timeout > time(): + try: + filtered_iterator = page_iterator.search(f"BrokerSummaries[?BrokerName == `{broker_name}`][]") + broker_list = list(filtered_iterator) + + if module.check_mode: + return + + if len(broker_list) < 1 and desired_state == "absent": + done = True + break + + if desired_state in ["present", "rebooted"] and broker_list[0]["BrokerState"] == "RUNNING": + done = True + break + + if broker_list[0]["BrokerState"] == "CREATION_FAILED": + break + + sleep(interval_secs) + + except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: + module.fail_json_aws(e, msg="Couldn't paginate brokers.") + + if not done: + module.fail_json(msg="desired state not reached") + + def reboot_broker(conn, module, broker_id): + wait = module.params.get("wait") + try: - return conn.reboot_broker(BrokerId=broker_id) + response = conn.reboot_broker(BrokerId=broker_id) except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't reboot broker.") + if wait: + wait_for_status(conn, module) + + return response + def delete_broker(conn, module, broker_id): + wait = module.params.get("wait") + try: - return conn.delete_broker(BrokerId=broker_id) + response = conn.delete_broker(BrokerId=broker_id) except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't delete broker.") + if wait: + wait_for_status(conn, module) + + return response + def create_broker(conn, module): kwargs = _fill_kwargs(module) + wait = module.params.get("wait") + if "EngineVersion" in kwargs and kwargs["EngineVersion"] == "latest": kwargs["EngineVersion"] = get_latest_engine_version(conn, module, kwargs["EngineType"]) if kwargs["AuthenticationStrategy"] == "LDAP": @@ -416,11 +487,15 @@ def create_broker(conn, module): changed = True result = conn.create_broker(**kwargs) # + if wait: + wait_for_status(conn, module) + return {"broker": camel_dict_to_snake_dict(result, ignore_list=["Tags"]), "changed": changed} def update_broker(conn, module, broker_id): kwargs = _fill_kwargs(module, apply_defaults=False, ignore_create_params=True) + wait = module.params.get("wait") # replace name with id broker_name = kwargs["BrokerName"] del kwargs["BrokerName"] @@ -443,6 +518,9 @@ def update_broker(conn, module, broker_id): api_result = conn.update_broker(**kwargs) # # + if wait: + wait_for_status(conn, module) + return {"broker": result, "changed": changed} @@ -484,6 +562,8 @@ def main(): argument_spec = dict( broker_name=dict(required=True, type="str"), state=dict(default="present", choices=["present", "absent", "restarted"]), + wait=dict(default=False, type="bool"), + wait_timeout=dict(default=900, type="int"), # parameters only allowed on create deployment_mode=dict(choices=["SINGLE_INSTANCE", "ACTIVE_STANDBY_MULTI_AZ", "CLUSTER_MULTI_AZ"]), use_aws_owned_key=dict(type="bool"), diff --git a/tests/integration/targets/mq/tasks/broker_tests.yml b/tests/integration/targets/mq/tasks/broker_tests.yml index d4d399da7c1..515306abfa1 100644 --- a/tests/integration/targets/mq/tasks/broker_tests.yml +++ b/tests/integration/targets/mq/tasks/broker_tests.yml @@ -4,6 +4,7 @@ security_groups: "{{ broker_sg_ids.split(',') }}" subnet_ids: "{{ broker_subnet_ids.split(',') }}" tags: "{{ tags }}" + wait: true register: result - set_fact: broker_id: "{{ result.broker['broker_id'] }}" @@ -19,20 +20,10 @@ - ( result.changed | bool ) - result_c1.broker['broker_id'] == broker_id - result_c1.broker['broker_name'] == broker_name - - result_c1.broker['broker_state'] == 'CREATION_IN_PROGRESS' + - result_c1.broker['broker_state'] == 'RUNNING' - ( result_c1.broker['storage_type'] | upper ) == 'EFS' - result_c1.broker['tags'] == tags when: not ansible_check_mode -- debug: - msg: "Wait until broker {{ broker_name }} ({{ broker_id }}) enters running state. This may take several minutes" -- name: wait for startup - mq_broker_info: - broker_id: "{{ broker_id }}" - register: result - until: result.broker['broker_state'] == 'RUNNING' - retries: 15 - delay: 60 - when: not ansible_check_mode - name: repeat creation mq_broker: broker_name: "{{ broker_name }}" From 5224601b7cef6510eb12f735ef25d805a605bf15 Mon Sep 17 00:00:00 2001 From: Hokwang Lee Date: Thu, 11 Jan 2024 17:54:01 +0900 Subject: [PATCH 16/77] fix(connection): get bucket_region in aws_ssm (#1908) fix(connection): get bucket_region in aws_ssm SUMMARY when bucket is in us-east-1, bucket_location["LocationConstraint"] is null ISSUE TYPE Bugfix Pull Request COMPONENT NAME connection ADDITIONAL INFORMATION add condition for bucket_region Reviewed-by: Mark Chappell --- .../fragments/1908-fix_find_out_bucket_region_logic.yml | 2 ++ plugins/connection/aws_ssm.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml diff --git a/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml b/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml new file mode 100644 index 00000000000..eea7d2a6025 --- /dev/null +++ b/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml @@ -0,0 +1,2 @@ +minor_changes: + - ssm(connection) - fix bucket region logic when region is ``us-east-1`` (https://github.com/ansible-collections/community.aws/pull/1908) diff --git a/plugins/connection/aws_ssm.py b/plugins/connection/aws_ssm.py index 5186179f46d..5c2d6d57788 100644 --- a/plugins/connection/aws_ssm.py +++ b/plugins/connection/aws_ssm.py @@ -430,7 +430,10 @@ def _get_bucket_endpoint(self): bucket_location = tmp_s3_client.get_bucket_location( Bucket=(self.get_option("bucket_name")), ) - bucket_region = bucket_location["LocationConstraint"] + if bucket_location["LocationConstraint"]: + bucket_region = bucket_location["LocationConstraint"] + else: + bucket_region = "us-east-1" if self.get_option("bucket_endpoint_url"): return self.get_option("bucket_endpoint_url"), bucket_region From 4c5cb406e191e773216893cad3f86a4e46acbaa3 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 11 Jan 2024 12:37:21 +0100 Subject: [PATCH 17/77] Pull 7.1.0 and 7.0.0 changelogs into main branch (#2042) Pull 7.1.0 and 7.0.0 changelogs into main branch SUMMARY Pull 7.1.0 and 7.0.0 changelogs into main branch ISSUE TYPE Docs Pull Request COMPONENT NAME CHANGELOG.rst changelogs/changelog.yaml ADDITIONAL INFORMATION #2040 Reviewed-by: Alina Buzachis --- CHANGELOG.rst | 61 +++++++++ changelogs/changelog.yaml | 120 ++++++++++++++++++ ...9-cloudfront_distribution-add-policies.yml | 2 - .../fragments/1775-aws_ssm-s3-docs.yaml | 3 - .../1839-disable-bracketed-paste.yml | 2 - .../fragments/1879-mq_broker-add-wait.yml | 2 - changelogs/fragments/ssm-fedora34.yml | 2 - 7 files changed, 181 insertions(+), 11 deletions(-) delete mode 100644 changelogs/fragments/1589-cloudfront_distribution-add-policies.yml delete mode 100644 changelogs/fragments/1775-aws_ssm-s3-docs.yaml delete mode 100644 changelogs/fragments/1839-disable-bracketed-paste.yml delete mode 100644 changelogs/fragments/1879-mq_broker-add-wait.yml delete mode 100644 changelogs/fragments/ssm-fedora34.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 76c7dc0cbd7..d2ed998bf35 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,67 @@ community.aws Release Notes .. contents:: Topics +v7.1.0 +====== + +Release Summary +--------------- + +This release includes new features for the ``cloudfront_distribution`` and ``mq_broker`` modules, as well as a bugfix for the ``aws_ssm`` connection plugin needed when connecting to hosts with Bash 5.1.0 and later. + +Minor Changes +------------- + +- aws_ssm - Updated the documentation to explicitly state that an S3 bucket is required, the behavior of the files in that bucket, and requirements around that. (https://github.com/ansible-collections/community.aws/issues/1775). +- cloudfront_distribution - added support for ``cache_policy_id`` and ``origin_request_policy_id`` for behaviors (https://github.com/ansible-collections/community.aws/pull/1589) +- mq_broker - add support to wait for broker state via ``wait`` and ``wait_timeout`` parameter values (https://github.com/ansible-collections/community.aws/pull/1879). + +Bugfixes +-------- + +- aws_ssm - disable ``enable-bracketed-paste`` to fix issue with amazon linux 2023 and other OSes (https://github.com/ansible-collections/community.aws/issues/1756) + +v7.0.0 +====== + +Release Summary +--------------- + +This release includes some new features, bugfixes and breaking changes. Several modules have been migrated to amazon.aws and the Fully Qualified Collection Name for these modules needs to be updated. The community.aws collection has dropped support for ``botocore<1.29.0`` and ``boto3<1.26.0``. Due to the AWS SDKs announcing the end of support for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/), support for Python less than 3.7 by this collection was deprecated in release 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). + +Minor Changes +------------- + +- api_gateway - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). +- api_gateway_info - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). +- community.aws collection - apply isort code formatting to ensure consistent formatting of code (https://github.com/ansible-collections/community.aws/pull/1962) +- ecs_taskdefinition - Add parameter ``runtime_platform`` (https://github.com/ansible-collections/community.aws/issues/1891). +- eks_nodegroup - ensure wait also waits for deletion to complete when ``wait==True`` (https://github.com/ansible-collections/community.aws/pull/1994). + +Breaking Changes / Porting Guide +-------------------------------- + +- The community.aws collection has dropped support for ``botocore<1.29.0`` and ``boto3<1.26.0``. Most modules will continue to work with older versions of the AWS SDK, however compatability with older versions of the SDK is not guaranteed and will not be tested. When using older versions of the SDK a warning will be emitted by Ansible (https://github.com/ansible-collections/amazon.aws/pull/1763). +- aws_region_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.aws_region_info``. +- aws_s3_bucket_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.aws_s3_bucket_info``. +- community.aws collection - due to the AWS SDKs announcing the end of support for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) support for Python less than 3.7 by this collection wss been deprecated in release 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). +- iam_access_key - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_access_key``. +- iam_access_key_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_access_key_info``. +- iam_group - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_group`` (https://github.com/ansible-collections/community.aws/pull/1945). +- iam_managed_policy - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_managed_policy`` (https://github.com/ansible-collections/community.aws/pull/1954). +- iam_mfa_device_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_mfa_device_info`` (https://github.com/ansible-collections/community.aws/pull/1953). +- iam_password_policy - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_password_policy``. +- iam_role - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_role`` (https://github.com/ansible-collections/community.aws/pull/1948). +- iam_role_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_role_info`` (https://github.com/ansible-collections/community.aws/pull/1948). +- s3_bucket_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.s3_bucket_info``. +- sts_assume_role - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.sts_assume_role``. + +Bugfixes +-------- + +- mq_broker - ensure broker is created with ``tags`` when passed (https://github.com/ansible-collections/community.aws/issues/1832). +- opensearch - Don't try to read a non existing key from the domain config (https://github.com/ansible-collections/community.aws/pull/1910). + v6.2.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 25fcad5fdef..37a7d7341d1 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -3614,3 +3614,123 @@ releases: - release_summary.yml - transit_gateway_to_vpn.yaml release_date: '2023-08-04' + 7.0.0: + changes: + breaking_changes: + - The community.aws collection has dropped support for ``botocore<1.29.0`` and + ``boto3<1.26.0``. Most modules will continue to work with older versions of + the AWS SDK, however compatability with older versions of the SDK is not guaranteed + and will not be tested. When using older versions of the SDK a warning will + be emitted by Ansible (https://github.com/ansible-collections/amazon.aws/pull/1763). + - aws_region_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.aws_region_info``. + - aws_s3_bucket_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.aws_s3_bucket_info``. + - community.aws collection - due to the AWS SDKs announcing the end of support + for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) + support for Python less than 3.7 by this collection wss been deprecated in + release 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). + - iam_access_key - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_access_key``. + - iam_access_key_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_access_key_info``. + - iam_group - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_group`` (https://github.com/ansible-collections/community.aws/pull/1945). + - iam_managed_policy - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_managed_policy`` (https://github.com/ansible-collections/community.aws/pull/1954). + - iam_mfa_device_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_mfa_device_info`` (https://github.com/ansible-collections/community.aws/pull/1953). + - iam_password_policy - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_password_policy``. + - iam_role - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_role`` (https://github.com/ansible-collections/community.aws/pull/1948). + - iam_role_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_role_info`` (https://github.com/ansible-collections/community.aws/pull/1948). + - s3_bucket_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.s3_bucket_info``. + - sts_assume_role - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.sts_assume_role``. + bugfixes: + - mq_broker - ensure broker is created with ``tags`` when passed (https://github.com/ansible-collections/community.aws/issues/1832). + - opensearch - Don't try to read a non existing key from the domain config (https://github.com/ansible-collections/community.aws/pull/1910). + minor_changes: + - api_gateway - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). + - api_gateway_info - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). + - community.aws collection - apply isort code formatting to ensure consistent + formatting of code (https://github.com/ansible-collections/community.aws/pull/1962) + - ecs_taskdefinition - Add parameter ``runtime_platform`` (https://github.com/ansible-collections/community.aws/issues/1891). + - eks_nodegroup - ensure wait also waits for deletion to complete when ``wait==True`` + (https://github.com/ansible-collections/community.aws/pull/1994). + release_summary: This release includes some new features, bugfixes and breaking + changes. Several modules have been migrated to amazon.aws and the Fully Qualified + Collection Name for these modules needs to be updated. The community.aws collection + has dropped support for ``botocore<1.29.0`` and ``boto3<1.26.0``. Due to the + AWS SDKs announcing the end of support for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/), + support for Python less than 3.7 by this collection was deprecated in release + 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). + fragments: + - 1832-mq_broker_tags.yml + - 1891_ecs-task-definition-add-runtime-platform.yml + - 1904-route53_wait.yml + - 1962-isort.yml + - 20230623-black-cloudfront.yml + - 20230702-isort.yml + - 20230801-fix-linters.yml + - 20230906-galaxy.yml + - 20230906-route53_wait.yml + - 20230908-alias-cleanup.yml + - 20230915_migrate_iam_role_and_iam_role_info.yml + - 7.0.0-dev0.yml + - botocore.yml + - botocore_params-cleanup.yml + - eks_nodegroup-integration-wait-delete.yml + - galaxy_importer.yml + - migrate_aws_region_info.yml + - migrate_iam_access_key.yml + - migrate_iam_group.yml + - migrate_iam_managed_policy.yml + - migrate_iam_mfa_device_info.yml + - migrate_iam_password_policy.yml + - migrate_s3_bucket_info.yml + - migrate_sts_assume_role.yml + - opensearch_domainconfig_no_options.yaml + - python37.yml + - release_summary.yml + - workflow-requirements.yml + release_date: '2023-11-06' + 7.1.0: + changes: + bugfixes: + - aws_ssm - disable ``enable-bracketed-paste`` to fix issue with amazon linux + 2023 and other OSes (https://github.com/ansible-collections/community.aws/issues/1756) + minor_changes: + - aws_ssm - Updated the documentation to explicitly state that an S3 bucket + is required, the behavior of the files in that bucket, and requirements around + that. (https://github.com/ansible-collections/community.aws/issues/1775). + - cloudfront_distribution - added support for ``cache_policy_id`` and ``origin_request_policy_id`` + for behaviors (https://github.com/ansible-collections/community.aws/pull/1589) + - mq_broker - add support to wait for broker state via ``wait`` and ``wait_timeout`` + parameter values (https://github.com/ansible-collections/community.aws/pull/1879). + release_summary: This release includes new features for the ``cloudfront_distribution`` + and ``mq_broker`` modules, as well as a bugfix for the ``aws_ssm`` connection + plugin needed when connecting to hosts with Bash 5.1.0 and later. + fragments: + - 1589-cloudfront_distribution-add-policies.yml + - 1775-aws_ssm-s3-docs.yaml + - 1839-disable-bracketed-paste.yml + - 1879-mq_broker-add-wait.yml + - release.yml + - ssm-fedora34.yml + release_date: '2024-01-10' diff --git a/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml b/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml deleted file mode 100644 index c0b9bbdd5c7..00000000000 --- a/changelogs/fragments/1589-cloudfront_distribution-add-policies.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - cloudfront_distribution - added support for ``cache_policy_id`` and ``origin_request_policy_id`` for behaviors (https://github.com/ansible-collections/community.aws/pull/1589) \ No newline at end of file diff --git a/changelogs/fragments/1775-aws_ssm-s3-docs.yaml b/changelogs/fragments/1775-aws_ssm-s3-docs.yaml deleted file mode 100644 index fab369337d4..00000000000 --- a/changelogs/fragments/1775-aws_ssm-s3-docs.yaml +++ /dev/null @@ -1,3 +0,0 @@ -minor_changes: -- aws_ssm - Updated the documentation to explicitly state that an S3 bucket is required, - the behavior of the files in that bucket, and requirements around that. (https://github.com/ansible-collections/community.aws/issues/1775). diff --git a/changelogs/fragments/1839-disable-bracketed-paste.yml b/changelogs/fragments/1839-disable-bracketed-paste.yml deleted file mode 100644 index 1398fc3ec1d..00000000000 --- a/changelogs/fragments/1839-disable-bracketed-paste.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - aws_ssm - disable `enable-bracketed-paste` to fix issue with amazon linux 2023 and other OSes (https://github.com/ansible-collections/community.aws/issues/1756) diff --git a/changelogs/fragments/1879-mq_broker-add-wait.yml b/changelogs/fragments/1879-mq_broker-add-wait.yml deleted file mode 100644 index 388b5523aac..00000000000 --- a/changelogs/fragments/1879-mq_broker-add-wait.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - mq_broker - add support to wait for broker state via ``wait`` and ``wait_timeout`` parameter values (https://github.com/ansible-collections/community.aws/pull/1879). diff --git a/changelogs/fragments/ssm-fedora34.yml b/changelogs/fragments/ssm-fedora34.yml deleted file mode 100644 index 8695fc08129..00000000000 --- a/changelogs/fragments/ssm-fedora34.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- ssm - bump test image from Fedora 34 to CentOS 9 From 2b5d71d8ad9d5711318cb58bfb7ead148782a059 Mon Sep 17 00:00:00 2001 From: JIHUN KIM Date: Thu, 11 Jan 2024 23:21:01 +0900 Subject: [PATCH 18/77] feat: add larger instance types for MSK cluster (#1947) feat: add larger instance types for MSK cluster This commit adds support for larger instance types (kafka.m5.8xlarge, kafka.m5.12xlarge, kafka.m5.16xlarge, kafka.m5.24xlarge) to the MSK cluster module. Now users can choose from a wider range of instance sizes when creating an MSK cluster. If the provisioning MSK supports m6 and m7 in the future, may want to consider removing the choice syntax. (Provisioning M5 types are not expected to be added anymore, The m5 has a maximum of 24 xlarge types. SUMMARY Fixes #1946 ISSUE TYPE Feature Pull Request COMPONENT NAME msk_cluster ADDITIONAL INFORMATION Link to MSK Provisioning Instance Types documentation https://docs.aws.amazon.com/msk/latest/developerguide/msk-create-cluster.html#broker-instance-types Reviewed-by: Alina Buzachis Reviewed-by: JIHUN KIM Reviewed-by: Mark Chappell --- .../1947-add_support_msk_addtinal_type.yml | 2 ++ plugins/modules/msk_cluster.py | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 changelogs/fragments/1947-add_support_msk_addtinal_type.yml diff --git a/changelogs/fragments/1947-add_support_msk_addtinal_type.yml b/changelogs/fragments/1947-add_support_msk_addtinal_type.yml new file mode 100644 index 00000000000..4c55f7b78f6 --- /dev/null +++ b/changelogs/fragments/1947-add_support_msk_addtinal_type.yml @@ -0,0 +1,2 @@ +minor_changes: +- msk_cluster - Support for additional ``m5`` and ``m7g`` types of MSK clusters (https://github.com/ansible-collections/community.aws/pull/1947). \ No newline at end of file diff --git a/plugins/modules/msk_cluster.py b/plugins/modules/msk_cluster.py index aa0383294b2..9ecf053f87f 100644 --- a/plugins/modules/msk_cluster.py +++ b/plugins/modules/msk_cluster.py @@ -54,6 +54,17 @@ - kafka.m5.xlarge - kafka.m5.2xlarge - kafka.m5.4xlarge + - kafka.m5.8xlarge + - kafka.m5.12xlarge + - kafka.m5.16xlarge + - kafka.m5.24xlarge + - kafka.m7g.large + - kafka.m7g.xlarge + - kafka.m7g.2xlarge + - kafka.m7g.4xlarge + - kafka.m7g.8xlarge + - kafka.m7g.12xlarge + - kafka.m7g.16xlarge default: kafka.t3.small type: str ebs_volume_size: @@ -662,6 +673,17 @@ def main(): "kafka.m5.xlarge", "kafka.m5.2xlarge", "kafka.m5.4xlarge", + "kafka.m5.8xlarge", + "kafka.m5.12xlarge", + "kafka.m5.16xlarge", + "kafka.m5.24xlarge", + "kafka.m7g.large", + "kafka.m7g.xlarge", + "kafka.m7g.2xlarge", + "kafka.m7g.4xlarge", + "kafka.m7g.8xlarge", + "kafka.m7g.12xlarge", + "kafka.m7g.16xlarge", ], default="kafka.t3.small", ), From a397c4c324c7c705648a9a056a1e60f5de6c93f4 Mon Sep 17 00:00:00 2001 From: Tone Date: Mon, 25 Mar 2024 15:49:18 +0700 Subject: [PATCH 19/77] add support for G.4X and G.8X in glue_job.py (#2048) add support for G.4X and G.8X in glue_job.py SUMMARY according to https://aws.amazon.com/about-aws/whats-new/2023/05/aws-glue-large-instance-types-generally-available/ I added support for these 2 new instance types ISSUE TYPE Feature Pull Request COMPONENT NAME glue_job Reviewed-by: Mark Chappell Reviewed-by: Alina Buzachis --- .../fragments/2048-add-new-instance-types-in-gluejob.yaml | 2 ++ plugins/modules/glue_job.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml diff --git a/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml b/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml new file mode 100644 index 00000000000..49119a5da37 --- /dev/null +++ b/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml @@ -0,0 +1,2 @@ +minor_changes: + - glue_job - add support for 2 new instance types which are G.4X and G.8X (https://github.com/ansible-collections/community.aws/pull/2048). diff --git a/plugins/modules/glue_job.py b/plugins/modules/glue_job.py index 2567799757e..10ad102e340 100644 --- a/plugins/modules/glue_job.py +++ b/plugins/modules/glue_job.py @@ -95,7 +95,8 @@ worker_type: description: - The type of predefined worker that is allocated when a job runs. - choices: [ 'Standard', 'G.1X', 'G.2X' ] + - Support for instance types C(G.4X( and C(G.8X) was added in community.aws release 7.2.0. + choices: [ 'Standard', 'G.1X', 'G.2X', 'G.4X', 'G.8X' ] type: str version_added: 1.5.0 notes: @@ -465,7 +466,7 @@ def main(): state=dict(required=True, choices=["present", "absent"], type="str"), tags=dict(type="dict", aliases=["resource_tags"]), timeout=dict(type="int"), - worker_type=dict(choices=["Standard", "G.1X", "G.2X"], type="str"), + worker_type=dict(choices=["Standard", "G.1X", "G.2X", "G.4X", "G.8X"], type="str"), ) module = AnsibleAWSModule( From b2fedfc7ad6d4bcbdd11ea39e5a29160e6bb3b9e Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 25 Mar 2024 10:18:59 +0100 Subject: [PATCH 20/77] Remove unparsible sanity error (#2059) Remove unparsible sanity error SUMMARY ansible/ansible#82355 has been merged and is now part of milestone, we can remove the ignore ISSUE TYPE Bugfix Pull Request COMPONENT NAME tests/sanity/ignore-2.17.txt ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- tests/sanity/ignore-2.17.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index 67d3693df63..e69de29bb2d 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -1,2 +0,0 @@ -plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 -plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 From 915cb0d57c9efe466747ab32de82cb00630472f2 Mon Sep 17 00:00:00 2001 From: Helen Bailey Date: Thu, 4 Apr 2024 10:54:55 -0400 Subject: [PATCH 21/77] Update lambda python runtime version in integration tests (#2065) Update lambda python runtime version in integration tests SUMMARY The elb_target and s3_bucket_notification integration test targets were failing due to the python3.7 runtime no longer being supported. I have updated this to python3.12. While at it I went ahead and updated the secretsmanager_secret and sns_topic target runtimes from python3.9 to python3.12 too. ISSUE TYPE Bugfix Pull Request Reviewed-by: Mike Graves Reviewed-by: Helen Bailey Reviewed-by: Alina Buzachis --- changelogs/fragments/20240402-lambda-test-runtime.yml | 2 ++ tests/integration/targets/elb_target/tasks/lambda_target.yml | 2 +- .../tasks/test_lambda_notifications.yml | 2 +- .../targets/secretsmanager_secret/tasks/rotation.yml | 4 ++-- tests/integration/targets/sns_topic/tasks/main.yml | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/20240402-lambda-test-runtime.yml diff --git a/changelogs/fragments/20240402-lambda-test-runtime.yml b/changelogs/fragments/20240402-lambda-test-runtime.yml new file mode 100644 index 00000000000..ef86b61a42e --- /dev/null +++ b/changelogs/fragments/20240402-lambda-test-runtime.yml @@ -0,0 +1,2 @@ +trivial: + - integration tests - update lambda ``runtime`` parameter to python3.12 (https://github.com/ansible-collections/community.aws/pull/2065). diff --git a/tests/integration/targets/elb_target/tasks/lambda_target.yml b/tests/integration/targets/elb_target/tasks/lambda_target.yml index abc4cc5d084..c4271cdd655 100644 --- a/tests/integration/targets/elb_target/tasks/lambda_target.yml +++ b/tests/integration/targets/elb_target/tasks/lambda_target.yml @@ -23,7 +23,7 @@ name: "{{ lambda_name }}" state: present zip_file: /tmp/lambda.zip - runtime: python3.7 + runtime: python3.12 role: "{{ ROLE_ARN.arn }}" handler: ansible_lambda_target.lambda_handler timeout: 30 diff --git a/tests/integration/targets/s3_bucket_notification/tasks/test_lambda_notifications.yml b/tests/integration/targets/s3_bucket_notification/tasks/test_lambda_notifications.yml index 23ed32e3215..b4cc8a6e037 100644 --- a/tests/integration/targets/s3_bucket_notification/tasks/test_lambda_notifications.yml +++ b/tests/integration/targets/s3_bucket_notification/tasks/test_lambda_notifications.yml @@ -41,7 +41,7 @@ name: '{{ lambda_name }}' state: present role: "{{ lambda_role_name }}" - runtime: python3.7 + runtime: python3.12 zip_file: '{{function_res.dest}}' handler: lambda_function.lambda_handler memory_size: '128' diff --git a/tests/integration/targets/secretsmanager_secret/tasks/rotation.yml b/tests/integration/targets/secretsmanager_secret/tasks/rotation.yml index 697c5ecc279..77151227dc8 100644 --- a/tests/integration/targets/secretsmanager_secret/tasks/rotation.yml +++ b/tests/integration/targets/secretsmanager_secret/tasks/rotation.yml @@ -55,7 +55,7 @@ name: "{{ lambda_name }}" state: present zip_file: "{{ tmp.path }}/hello_world.zip" - runtime: 'python3.9' + runtime: 'python3.12' role: "{{ iam_role_output.arn }}" handler: 'hello_world.lambda_handler' register: lambda_output @@ -169,7 +169,7 @@ name: "{{ lambda_name }}" state: absent zip_file: "{{ tmp.path }}/hello_world.zip" - runtime: 'python3.9' + runtime: 'python3.12' role: "{{ secret_manager_role }}" handler: 'hello_world.lambda_handler' ignore_errors: yes diff --git a/tests/integration/targets/sns_topic/tasks/main.yml b/tests/integration/targets/sns_topic/tasks/main.yml index 00f3f71d96a..25f6368320a 100644 --- a/tests/integration/targets/sns_topic/tasks/main.yml +++ b/tests/integration/targets/sns_topic/tasks/main.yml @@ -309,7 +309,7 @@ name: '{{ sns_topic_lambda_name }}' state: present zip_file: '{{ tempdir.path }}/{{ sns_topic_lambda_function }}.zip' - runtime: python3.9 + runtime: python3.12 role: '{{ sns_topic_lambda_role }}' handler: '{{ sns_topic_lambda_function }}.handler' register: lambda_result From 5cb20f74789dc96e49117672becb2d9751ade6bd Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 8 Apr 2024 13:07:45 +0200 Subject: [PATCH 22/77] amazon.aws 8.0.0 deprecation tests cleanup (#2070) amazon.aws 8.0.0 deprecations - test cleanup SUMMARY iam_role moved all of the return values under .iam_role, rather than returning a tangled mess at the top level ISSUE TYPE Feature Pull Request COMPONENT NAME tests/integration/targets/config/tasks/main.yaml tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml tests/integration/targets/eks_cluster/tasks/full_test.yml tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml tests/integration/targets/eks_fargate_profile/tasks/full_test.yml tests/integration/targets/eks_nodegroup/tasks/dependecies.yml tests/integration/targets/eks_nodegroup/tasks/full_test.yml ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- .../targets/config/tasks/main.yaml | 14 ++-- .../tasks/iam_instance_role.yml | 20 +++--- .../ecs_cluster/tasks/20_ecs_service.yml | 16 ++--- .../targets/eks_cluster/tasks/full_test.yml | 10 +-- .../tasks/create_eks_cluster.yml | 2 +- .../eks_fargate_profile/tasks/full_test.yml | 38 +++++----- .../eks_nodegroup/tasks/dependecies.yml | 2 +- .../targets/eks_nodegroup/tasks/full_test.yml | 70 +++++++++---------- 8 files changed, 86 insertions(+), 86 deletions(-) diff --git a/tests/integration/targets/config/tasks/main.yaml b/tests/integration/targets/config/tasks/main.yaml index 244c4b29b7b..54037080398 100644 --- a/tests/integration/targets/config/tasks/main.yaml +++ b/tests/integration/targets/config/tasks/main.yaml @@ -173,7 +173,7 @@ config_recorder: name: '{{ resource_prefix }}-recorder' state: present - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" recording_group: all_supported: true include_global_types: true @@ -236,7 +236,7 @@ account_sources: [] organization_source: all_aws_regions: true - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" register: output - name: assert success @@ -251,7 +251,7 @@ account_sources: [] organization_source: all_aws_regions: true - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" register: output - name: assert not changed @@ -266,7 +266,7 @@ config_recorder: name: '{{ resource_prefix }}-recorder' state: present - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" recording_group: all_supported: false include_global_types: false @@ -348,7 +348,7 @@ all_aws_regions: false aws_regions: - '{{ aws_region }}' - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" register: output - name: assert success @@ -365,7 +365,7 @@ all_aws_regions: false aws_regions: - '{{ aws_region }}' - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" register: output - name: assert success @@ -380,7 +380,7 @@ config_recorder: name: '{{ resource_prefix }}-recorder' state: present - role_arn: "{{ config_iam_role.arn }}" + role_arn: "{{ config_iam_role.iam_role.arn }}" recording_group: all_supported: false include_global_types: false diff --git a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml b/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml index c26b96d69c0..ad797fabb79 100644 --- a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml +++ b/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml @@ -29,7 +29,7 @@ - assert: that: - - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - name: Create template again, with no change to instance_role ec2_launch_template: @@ -41,7 +41,7 @@ - assert: that: - - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role is not changed' - name: Update instance with new instance_role @@ -54,8 +54,8 @@ - assert: that: - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - 'template_with_updated_role is changed' - 'template_with_updated_role is not failed' @@ -71,7 +71,7 @@ - assert: that: - 'template_with_updated_role is not changed' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - name: Update instance with original instance_role (pass profile ARN) ec2_launch_template: @@ -79,13 +79,13 @@ image_id: "{{ ec2_ami_id }}" instance_type: t2.micro # By default an instance profile will be created with the same name as the role - iam_instance_profile: '{{ iam_role.arn.replace(":role/", ":instance-profile/") }}' + iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' register: template_with_updated_role - assert: that: - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - 'template_with_updated_role is changed' - 'template_with_updated_role is not failed' @@ -95,13 +95,13 @@ name: "{{ resource_prefix }}-test-instance-role" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro - iam_instance_profile: '{{ iam_role.arn.replace(":role/", ":instance-profile/") }}' + iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' register: template_with_updated_role - assert: that: - 'template_with_updated_role is not changed' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.arn.replace(":role/", ":instance-profile/")' + - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' always: - name: delete launch template diff --git a/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml b/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml index 3c4bbcb28c7..e04cfe6acd5 100644 --- a/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml +++ b/tests/integration/targets/ecs_cluster/tasks/20_ecs_service.yml @@ -547,7 +547,7 @@ >> "rolloutStateReason": "ECS deployment ecs-svc/5156684577543126023 in progress.", constraints and placement strategies are only changeable if the rollout state is "COMPLETED" - + a) ecs_service has currently no waiter function. so this is a DIY waiter b) the state reached never "COMPLETED" because something if wrong with the ECS EC2 Instances or the network setup. The EC2 instance never arrived as an active instance in the cluster. @@ -555,9 +555,9 @@ >> no container instance met all of its requirements. Reason: No Container Instances were found in your cluster. >> For more information, see the Troubleshooting section of the Amazon ECS Developer Guide. >> ec2_instance networking does not work correctly, no instance available for the cluster - + Because all of this, all following tasks, that test the change of a constraint or placement stragegy are - using `force_new_deployment: true`. That ignores a) and b). + using `force_new_deployment: true`. That ignores a) and b). ignore_errors: true ecs_service_info: name: "{{ ecs_service_name }}-constraint" @@ -736,7 +736,7 @@ launch_type: FARGATE cpu: 512 memory: 1024 - execution_role_arn: "{{ iam_execution_role.arn }}" + execution_role_arn: "{{ iam_execution_role.iam_role.arn }}" state: present vars: ecs_task_host_port: 8080 @@ -750,7 +750,7 @@ launch_type: EC2 cpu: 512 memory: 1024 - execution_role_arn: "{{ iam_execution_role.arn }}" + execution_role_arn: "{{ iam_execution_role.iam_role.arn }}" state: present vars: ecs_task_host_port: 8080 @@ -916,7 +916,7 @@ launch_type: FARGATE cpu: 512 memory: 1024 - execution_role_arn: "{{ iam_execution_role.arn }}" + execution_role_arn: "{{ iam_execution_role.iam_role.arn }}" state: present runtime_platform: cpuArchitecture: "ARM64" @@ -938,7 +938,7 @@ launch_type: FARGATE cpu: 512 memory: 1024 - execution_role_arn: "{{ iam_execution_role.arn }}" + execution_role_arn: "{{ iam_execution_role.iam_role.arn }}" state: present runtime_platform: cpuArchitecture: "ARM64" @@ -960,7 +960,7 @@ launch_type: FARGATE cpu: 512 memory: 1024 - execution_role_arn: "{{ iam_execution_role.arn }}" + execution_role_arn: "{{ iam_execution_role.iam_role.arn }}" state: present runtime_platform: cpuArchitecture: "ARM64" diff --git a/tests/integration/targets/eks_cluster/tasks/full_test.yml b/tests/integration/targets/eks_cluster/tasks/full_test.yml index 71cc1fc87e5..d3f7dfbe6fd 100644 --- a/tests/integration/targets/eks_cluster/tasks/full_test.yml +++ b/tests/integration/targets/eks_cluster/tasks/full_test.yml @@ -79,7 +79,7 @@ name: "{{ eks_cluster_name }}" security_groups: "{{ eks_security_groups | map(attribute='name') }}" subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}" - role_arn: "{{ iam_role.arn }}" + role_arn: "{{ iam_role.iam_role.arn }}" tags: Name: "{{ resource_prefix }}" another: foobar @@ -97,7 +97,7 @@ name: "{{ eks_cluster_name }}" security_groups: "{{ eks_security_groups | map(attribute='name') }}" subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}" - role_arn: "{{ iam_role.arn }}" + role_arn: "{{ iam_role.iam_role.arn }}" wait: yes register: eks_create @@ -117,7 +117,7 @@ name: "{{ eks_cluster_name }}" security_groups: "{{ setup_security_groups.results | map(attribute='group_id') }}" subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}" - role_arn: "{{ iam_role.arn }}" + role_arn: "{{ iam_role.iam_role.arn }}" register: eks_create - name: check that EKS cluster did not change @@ -143,7 +143,7 @@ name: "{{ eks_cluster_name }}" security_groups: "{{ eks_security_groups | map(attribute='name') }}" subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}" - role_arn: "{{ iam_role.arn }}" + role_arn: "{{ iam_role.iam_role.arn }}" wait: yes register: eks_create @@ -169,7 +169,7 @@ name: "{{ eks_cluster_short_name }}" security_groups: "{{ eks_security_groups | map(attribute='name') }}" subnets: "{{ setup_subnets.results | map(attribute='subnet.id') }}" - role_arn: "{{ iam_role.arn }}" + role_arn: "{{ iam_role.iam_role.arn }}" register: eks_create - name: check that EKS cluster was created with short name diff --git a/tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml b/tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml index 48fbbef8017..1402ad0a137 100644 --- a/tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml +++ b/tests/integration/targets/eks_fargate_profile/tasks/create_eks_cluster.yml @@ -87,7 +87,7 @@ name: '{{ eks_cluster_name }}' security_groups: '{{ eks_security_groups | map(attribute=''name'') }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' - role_arn: '{{ iam_role.arn }}' + role_arn: '{{ iam_role.iam_role.arn }}' wait: true register: eks_create diff --git a/tests/integration/targets/eks_fargate_profile/tasks/full_test.yml b/tests/integration/targets/eks_fargate_profile/tasks/full_test.yml index b992125b334..6b513b9b59b 100644 --- a/tests/integration/targets/eks_fargate_profile/tasks/full_test.yml +++ b/tests/integration/targets/eks_fargate_profile/tasks/full_test.yml @@ -1,5 +1,5 @@ # Creating dependencies -- name: create IAM instance role +- name: create IAM instance role iam_role: name: 'ansible-test-aws_eks_fargate_profile' assume_role_policy_document: '{{ lookup(''file'',''eks-fargate-profile-trust-policy.json'') }}' @@ -19,7 +19,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: fake_cluster - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -38,7 +38,7 @@ name: fake_profile cluster_name: '{{ eks_cluster_name }}' state: absent - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -57,7 +57,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'public') | map(attribute='subnet.id') }} @@ -72,13 +72,13 @@ - not eks_fargate_profile_create.changed - eks_fargate_profile_create.msg.endswith("provided in Fargate Profile is not a private subnet") -# Create Fargate_profile with wait +# Create Fargate_profile with wait - name: create Fargate Profile with wait (check mode) eks_fargate_profile: name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -99,7 +99,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -120,7 +120,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -141,7 +141,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -162,7 +162,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -185,7 +185,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -207,7 +207,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -230,7 +230,7 @@ name: '{{ eks_fargate_profile_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -253,7 +253,7 @@ name: '{{ eks_fargate_profile_name_b }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -272,7 +272,7 @@ name: '{{ eks_fargate_profile_name_b }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -291,7 +291,7 @@ name: '{{ eks_fargate_profile_name_b }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -310,7 +310,7 @@ name: '{{ eks_fargate_profile_name_b }}' state: present cluster_name: '{{ eks_cluster_name }}' - role_arn: '{{ iam_role_fargate.arn }}' + role_arn: '{{ iam_role_fargate.iam_role.arn }}' subnets: >- {{setup_subnets.results|selectattr('subnet.tags.Name', 'contains', 'private') | map(attribute='subnet.id') }} @@ -389,7 +389,7 @@ that: - eks_fargate_profile_b_delete.changed -- name: delete a fargate profile b +- name: delete a fargate profile b eks_fargate_profile: name: '{{ eks_fargate_profile_name_b }}' cluster_name: '{{ eks_cluster_name }}' @@ -426,4 +426,4 @@ - name: check that eks_fargate_profile did nothing (idempotency) assert: that: - - not eks_fargate_profile_b_delete.changed \ No newline at end of file + - not eks_fargate_profile_b_delete.changed diff --git a/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml b/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml index 882d45dd7af..cd37239c4a7 100644 --- a/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml +++ b/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml @@ -67,7 +67,7 @@ name: '{{ eks_cluster_name }}' security_groups: '{{ eks_security_groups | map(attribute=''name'') }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' - role_arn: '{{ iam_role.arn }}' + role_arn: '{{ iam_role.iam_role.arn }}' wait: true register: eks_create diff --git a/tests/integration/targets/eks_nodegroup/tasks/full_test.yml b/tests/integration/targets/eks_nodegroup/tasks/full_test.yml index 9accc8e8f29..cb1d27340df 100644 --- a/tests/integration/targets/eks_nodegroup/tasks/full_test.yml +++ b/tests/integration/targets/eks_nodegroup/tasks/full_test.yml @@ -4,7 +4,7 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: fake_cluster - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 @@ -38,10 +38,10 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' wait: True - launch_template: + launch_template: id: 'lt-0824c69cafa69ac81' disk_size: 30 register: eks_nodegroup_result @@ -60,18 +60,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 3 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'test' taints: - key: 'env' @@ -98,18 +98,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 3 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'test' taints: - key: 'env' @@ -135,18 +135,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 3 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'test' taints: - key: 'env' @@ -173,18 +173,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 3 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'test' taints: - key: 'env' @@ -214,7 +214,7 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' wait: True disk_size: 40 @@ -231,7 +231,7 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' wait: True instance_types: ['t3.small'] @@ -251,18 +251,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 4 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'changeit' taints: - key: 'env' @@ -289,18 +289,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 4 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'changeit' taints: - key: 'env' @@ -326,18 +326,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 4 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'changeit' taints: - key: 'env' @@ -364,18 +364,18 @@ name: '{{ eks_nodegroup_name_a }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' scaling_config: min_size: 1 max_size: 4 desired_size: 2 - disk_size: 30 + disk_size: 30 instance_types: ['t3.small'] ami_type: 'AL2_x86_64' update_config: max_unavailable_percentage: 50 - labels: + labels: 'env': 'changeit' taints: - key: 'env' @@ -405,7 +405,7 @@ name: '{{ eks_nodegroup_name_a }}' state: absent cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' register: eks_nodegroup_result check_mode: True @@ -459,7 +459,7 @@ name: '{{ eks_nodegroup_name_lt }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' launch_template: name: '{{ lt.template.launch_template_name }}' @@ -477,7 +477,7 @@ name: '{{ eks_nodegroup_name_lt }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' launch_template: name: '{{ lt.template.launch_template_name }}' @@ -494,7 +494,7 @@ name: '{{ eks_nodegroup_name_lt }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' launch_template: name: '{{ lt.template.launch_template_name }}' @@ -512,7 +512,7 @@ name: '{{ eks_nodegroup_name_lt }}' state: present cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' launch_template: name: '{{ lt.template.launch_template_name }}' @@ -533,7 +533,7 @@ name: '{{ eks_nodegroup_name_lt }}' state: absent cluster_name: '{{ eks_cluster_name }}' - node_role: '{{ iam_role_eks_nodegroup.arn }}' + node_role: '{{ iam_role_eks_nodegroup.iam_role.arn }}' wait: True register: eks_nodegroup_result check_mode: True From ceffd08c485300458dd70176d844079a53368a15 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 8 Apr 2024 14:24:55 +0200 Subject: [PATCH 23/77] fix docs workflow (#2066) --- .github/workflows/docs-pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml index 35b58df243f..e1f6ac1f69b 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yml @@ -5,7 +5,6 @@ concurrency: on: pull_request_target: types: [opened, synchronize, reopened, closed] - env: GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} @@ -22,6 +21,8 @@ jobs: intersphinx-links: | amazon_aws:https://ansible-collections.github.io/amazon.aws/branch/main/ ansible_devel:https://docs.ansible.com/ansible-core/devel/ + artifact-name: ${{ github.event.repository.name }}_validate_docs_${{ github.event.pull_request.head.sha }} + build-docs: permissions: From cffd1483b0269f684ced6aecbadcad365c700660 Mon Sep 17 00:00:00 2001 From: Helen Bailey Date: Mon, 8 Apr 2024 11:26:13 -0400 Subject: [PATCH 24/77] Prep community.aws 7.2.0 (#2064) (#2069) Changelog update after 7.2.0 release SUMMARY Changelog update after 7.2.0 release ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell --- CHANGELOG.rst | 29 +++++++++++++++---- changelogs/changelog.yaml | 21 ++++++++++++++ .../1908-fix_find_out_bucket_region_logic.yml | 2 -- .../1947-add_support_msk_addtinal_type.yml | 2 -- .../20240402-lambda-test-runtime.yml | 2 -- ...048-add-new-instance-types-in-gluejob.yaml | 2 -- 6 files changed, 44 insertions(+), 14 deletions(-) delete mode 100644 changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml delete mode 100644 changelogs/fragments/1947-add_support_msk_addtinal_type.yml delete mode 100644 changelogs/fragments/20240402-lambda-test-runtime.yml delete mode 100644 changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d2ed998bf35..b47d79fe4a2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,29 @@ community.aws Release Notes .. contents:: Topics +v7.2.0 +====== + +Release Summary +--------------- + +This release includes a new module ``dynamodb_table_info``, new features for the ``glue_job`` and ``msk_cluster`` modules, and a bugfix for the ``aws_ssm`` connection plugin. + +Minor Changes +------------- + +- glue_job - add support for 2 new instance types which are G.4X and G.8X (https://github.com/ansible-collections/community.aws/pull/2048). +- msk_cluster - Support for additional ``m5`` and ``m7g`` types of MSK clusters (https://github.com/ansible-collections/community.aws/pull/1947). + +Bugfixes +-------- + +- ssm(connection) - fix bucket region logic when region is ``us-east-1`` (https://github.com/ansible-collections/community.aws/pull/1908). + +New Modules +----------- + +- dynamodb_table_info - Returns information about a Dynamo DB table v7.1.0 ====== @@ -134,7 +157,6 @@ This release brings some new plugins and features. Several bugfixes, breaking ch The community.aws collection has dropped support for ``botocore<1.25.0`` and ``boto3<1.22.0``. Support for Python 3.6 has also been dropped. - Minor Changes ------------- @@ -207,7 +229,6 @@ Release Summary This release contains a number of bugfixes for various modules, as well as new features for the ``ec2_launch_template`` and ``msk_cluster`` modules. This is the last planned minor release prior to the release of version 6.0.0. - Minor Changes ------------- @@ -303,7 +324,6 @@ modules. As well as improvements to the ``ecs_cluster``, ``ec2_ecr``, ``ecs_service``, ``iam_role`` and ``ssm_parameter`` plugins. - Minor Changes ------------- @@ -369,7 +389,6 @@ Support for ``ansible-core<2.11`` has also been dropped. This release also brings some new features, bugfixes, breaking changes and deprecated features. - Minor Changes ------------- @@ -531,7 +550,6 @@ Release Summary This release contains a minor bugfix for the ``sns_topic`` module as well as corrections to the documentation for various modules. This is the last planned release of the 4.x series. - Bugfixes -------- @@ -889,7 +907,6 @@ Release Summary Following the release of community.aws 5.0.0, 3.6.0 is a bugfix release and the final planned release for the 3.x series. - Minor Changes ------------- diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 37a7d7341d1..b4e65e9ab1b 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -3734,3 +3734,24 @@ releases: - release.yml - ssm-fedora34.yml release_date: '2024-01-10' + 7.2.0: + changes: + bugfixes: + - ssm(connection) - fix bucket region logic when region is ``us-east-1`` (https://github.com/ansible-collections/community.aws/pull/1908). + minor_changes: + - glue_job - add support for 2 new instance types which are G.4X and G.8X (https://github.com/ansible-collections/community.aws/pull/2048). + - msk_cluster - Support for additional ``m5`` and ``m7g`` types of MSK clusters + (https://github.com/ansible-collections/community.aws/pull/1947). + release_summary: This release includes a new module ``dynamodb_table_info``, + new features for the ``glue_job`` and ``msk_cluster`` modules, and a bugfix + for the ``aws_ssm`` connection plugin. + fragments: + - 1908-fix_find_out_bucket_region_logic.yml + - 1947-add_support_msk_addtinal_type.yml + - 20240402-lambda-test-runtime.yml + - 2048-add-new-instance-types-in-gluejob.yaml + modules: + - description: Returns information about a Dynamo DB table + name: dynamodb_table_info + namespace: '' + release_date: '2024-04-05' diff --git a/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml b/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml deleted file mode 100644 index eea7d2a6025..00000000000 --- a/changelogs/fragments/1908-fix_find_out_bucket_region_logic.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ssm(connection) - fix bucket region logic when region is ``us-east-1`` (https://github.com/ansible-collections/community.aws/pull/1908) diff --git a/changelogs/fragments/1947-add_support_msk_addtinal_type.yml b/changelogs/fragments/1947-add_support_msk_addtinal_type.yml deleted file mode 100644 index 4c55f7b78f6..00000000000 --- a/changelogs/fragments/1947-add_support_msk_addtinal_type.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: -- msk_cluster - Support for additional ``m5`` and ``m7g`` types of MSK clusters (https://github.com/ansible-collections/community.aws/pull/1947). \ No newline at end of file diff --git a/changelogs/fragments/20240402-lambda-test-runtime.yml b/changelogs/fragments/20240402-lambda-test-runtime.yml deleted file mode 100644 index ef86b61a42e..00000000000 --- a/changelogs/fragments/20240402-lambda-test-runtime.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - integration tests - update lambda ``runtime`` parameter to python3.12 (https://github.com/ansible-collections/community.aws/pull/2065). diff --git a/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml b/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml deleted file mode 100644 index 49119a5da37..00000000000 --- a/changelogs/fragments/2048-add-new-instance-types-in-gluejob.yaml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - glue_job - add support for 2 new instance types which are G.4X and G.8X (https://github.com/ansible-collections/community.aws/pull/2048). From a15e50fcc6fc80cad777054a40f50ce74f5c23f7 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Mon, 8 Apr 2024 17:26:16 +0200 Subject: [PATCH 25/77] efs - Use yield from in order to fix sanity errors. (#2071) efs - Use `yield from` in order to fix sanity errors SUMMARY efs - Use yield from in order to fix sanity errors ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME efs ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- changelogs/fragments/20240408-efs-sanity_fix.yml | 2 ++ plugins/modules/efs.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/20240408-efs-sanity_fix.yml diff --git a/changelogs/fragments/20240408-efs-sanity_fix.yml b/changelogs/fragments/20240408-efs-sanity_fix.yml new file mode 100644 index 00000000000..f8be70f183b --- /dev/null +++ b/changelogs/fragments/20240408-efs-sanity_fix.yml @@ -0,0 +1,2 @@ +trivial: + - efs - Use ``yield from`` in ordr to fix sanity errors. diff --git a/plugins/modules/efs.py b/plugins/modules/efs.py index 6b9390f2b4d..32992c4a3c2 100644 --- a/plugins/modules/efs.py +++ b/plugins/modules/efs.py @@ -653,8 +653,7 @@ def iterate_all(attr, map_method, **kwargs): while True: try: data = map_method(**args) - for elm in data[attr]: - yield elm + yield from data[attr] if "NextMarker" in data: args["Marker"] = data["Nextmarker"] continue From 6316d6c3049d2211f2fcfb0eb65309fabc715e77 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 9 Apr 2024 09:53:38 +0200 Subject: [PATCH 26/77] Drop support for ansible-core < 2.14 (#2074) Drop support for ansible-core < 2.14 SUMMARY Drop support for ansible-core < 2.14 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- README.md | 2 +- changelogs/fragments/8.0.0-increase-ansible-core-version.yml | 2 ++ meta/runtime.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/8.0.0-increase-ansible-core-version.yml diff --git a/README.md b/README.md index bcabfb701e2..8d6a693621f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ AWS related modules and plugins supported by the Ansible Cloud team are in the [ ## Ansible version compatibility -Tested with the Ansible Core >= 2.12.0 versions, and the current development version of Ansible. Ansible Core versions before 2.12.0 are not supported. +Tested with the Ansible Core >= 2.14.0 versions, and the current development version of Ansible. Ansible Core versions before 2.14.0 are not supported. Use community.aws 4.x.y if you are using Ansible 2.9 or Ansible Core 2.10. diff --git a/changelogs/fragments/8.0.0-increase-ansible-core-version.yml b/changelogs/fragments/8.0.0-increase-ansible-core-version.yml new file mode 100644 index 00000000000..e3653bb7590 --- /dev/null +++ b/changelogs/fragments/8.0.0-increase-ansible-core-version.yml @@ -0,0 +1,2 @@ +breaking_changes: + - community.aws collection - Support for ansible-core < 2.14 has been dropped (https://github.com/ansible-collections/community.aws/pull/2074). diff --git a/meta/runtime.yml b/meta/runtime.yml index 4c6bc72910d..71d258aae9d 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.12.0' +requires_ansible: '>=2.14.0' action_groups: aws: - accessanalyzer_validate_policy_info From b5d4ea703d861b5becaaead98256535d603bbd96 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Tue, 9 Apr 2024 15:03:14 +0200 Subject: [PATCH 27/77] Remove use of ignored boto3 parameter (#2075) Remove use of ignored boto3 parameter SUMMARY get_ec2_security_group_ids_from_names() has ignored the boto3 parameter since release 4.0.0, drop the use. ISSUE TYPE Feature Pull Request COMPONENT NAME plugins/modules/glue_connection.py plugins/modules/autoscaling_launch_config.py ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- changelogs/fragments/boto3_equals.yml | 3 +++ plugins/modules/autoscaling_launch_config.py | 2 +- plugins/modules/glue_connection.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/boto3_equals.yml diff --git a/changelogs/fragments/boto3_equals.yml b/changelogs/fragments/boto3_equals.yml new file mode 100644 index 00000000000..4566bc77b04 --- /dev/null +++ b/changelogs/fragments/boto3_equals.yml @@ -0,0 +1,3 @@ +trivial: +- glue_connection - stop passing ``boto3`` into ``get_ec2_security_group_ids_from_names()`` it is no longer used. +- autoscaling_launch_config - stop passing ``boto3`` into ``get_ec2_security_group_ids_from_names()`` it is no longer used. diff --git a/plugins/modules/autoscaling_launch_config.py b/plugins/modules/autoscaling_launch_config.py index 78b7ee23352..cd411e57606 100644 --- a/plugins/modules/autoscaling_launch_config.py +++ b/plugins/modules/autoscaling_launch_config.py @@ -533,7 +533,7 @@ def create_launch_config(connection, module): module.fail_json_aws(e, msg="Failed to connect to AWS") try: security_groups = get_ec2_security_group_ids_from_names( - module.params.get("security_groups"), ec2_connection, vpc_id=vpc_id, boto3=True + module.params.get("security_groups"), ec2_connection, vpc_id=vpc_id ) except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Failed to get Security Group IDs") diff --git a/plugins/modules/glue_connection.py b/plugins/modules/glue_connection.py index 18039a8616d..f8667116237 100644 --- a/plugins/modules/glue_connection.py +++ b/plugins/modules/glue_connection.py @@ -299,7 +299,7 @@ def create_or_update_glue_connection(connection, connection_ec2, module, glue_co if module.params.get("security_groups") is not None: # Get security group IDs from names security_group_ids = get_ec2_security_group_ids_from_names( - module.params.get("security_groups"), connection_ec2, boto3=True + module.params.get("security_groups"), connection_ec2 ) params["ConnectionInput"]["PhysicalConnectionRequirements"]["SecurityGroupIdList"] = security_group_ids if module.params.get("subnet_id") is not None: From 2e8289f00a2e62f52da3b44464cea3c627ee7720 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Sun, 14 Apr 2024 17:36:15 +0200 Subject: [PATCH 28/77] Fix ELB target integration test (#2078) Fix ELB target integration test SUMMARY follow up to ansible-collections/amazon.aws#2040 ISSUE TYPE Bugfix Pull Request COMPONENT NAME elb_target ADDITIONAL INFORMATION --- plugins/modules/glue_connection.py | 4 +--- tests/integration/targets/elb_target/tasks/lambda_target.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/modules/glue_connection.py b/plugins/modules/glue_connection.py index f8667116237..ecfbd1a90dd 100644 --- a/plugins/modules/glue_connection.py +++ b/plugins/modules/glue_connection.py @@ -298,9 +298,7 @@ def create_or_update_glue_connection(connection, connection_ec2, module, glue_co params["ConnectionInput"]["PhysicalConnectionRequirements"] = dict() if module.params.get("security_groups") is not None: # Get security group IDs from names - security_group_ids = get_ec2_security_group_ids_from_names( - module.params.get("security_groups"), connection_ec2 - ) + security_group_ids = get_ec2_security_group_ids_from_names(module.params.get("security_groups"), connection_ec2) params["ConnectionInput"]["PhysicalConnectionRequirements"]["SecurityGroupIdList"] = security_group_ids if module.params.get("subnet_id") is not None: params["ConnectionInput"]["PhysicalConnectionRequirements"]["SubnetId"] = module.params.get("subnet_id") diff --git a/tests/integration/targets/elb_target/tasks/lambda_target.yml b/tests/integration/targets/elb_target/tasks/lambda_target.yml index c4271cdd655..7e6b54cef5d 100644 --- a/tests/integration/targets/elb_target/tasks/lambda_target.yml +++ b/tests/integration/targets/elb_target/tasks/lambda_target.yml @@ -24,7 +24,7 @@ state: present zip_file: /tmp/lambda.zip runtime: python3.12 - role: "{{ ROLE_ARN.arn }}" + role: "{{ ROLE_ARN.iam_role.arn }}" handler: ansible_lambda_target.lambda_handler timeout: 30 register: lambda_function From c065fd322ae7cb659d9524f21cd13896eeb5a43d Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 6 May 2024 12:59:36 +0200 Subject: [PATCH 29/77] Bump 2024 deprecations from dates to release versions (#2082) Bump 2024 deprecations from dates to release versions SUMMARY Bump 2024 deprecations from dates to release versions ISSUE TYPE Docs Pull Request COMPONENT NAME plugins/modules/ecs_cluster.py plugins/modules/ecs_service.py plugins/modules/glue_connection.py ADDITIONAL INFORMATION See also: #518 #1640 #1716 Reviewed-by: Alina Buzachis --- changelogs/fragments/9-date-deprecations.yml | 9 +++++++++ plugins/modules/ecs_cluster.py | 6 +++--- plugins/modules/ecs_service.py | 4 ++-- plugins/modules/glue_connection.py | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/9-date-deprecations.yml diff --git a/changelogs/fragments/9-date-deprecations.yml b/changelogs/fragments/9-date-deprecations.yml new file mode 100644 index 00000000000..7827048bdce --- /dev/null +++ b/changelogs/fragments/9-date-deprecations.yml @@ -0,0 +1,9 @@ +deprecated_features: +- aws_glue_connection - updated the deprecation for removal of the ``connection_parameters`` return key from ``after 2024-06-01`` to release version ``9.0.0``, + it is being replaced by the ``raw_connection_parameters`` key (https://github.com/ansible-collections/community.aws/pull/518). +- ecs_cluster - updated the deprecation for updated default of ``purge_capacity_providers``, the current default of ``False`` will be changed to ``True`` + in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_capacity_providers=False`` (https://github.com/ansible-collections/community.aws/pull/1640). +- ecs_service - updated the deprecation for updated default of ``purge_placement_constraints``, the current default of ``False`` will be changed to ``True`` + in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_constraints=False`` (https://github.com/ansible-collections/community.aws/pull/1716). +- ecs_service - updated the deprecation for updated default of ``purge_placement_strategy``, the current default of ``False`` will be changed to ``True`` + in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_strategy=False`` (https://github.com/ansible-collections/community.aws/pull/1716). diff --git a/plugins/modules/ecs_cluster.py b/plugins/modules/ecs_cluster.py index 7d427a58d57..5a0470eea8e 100644 --- a/plugins/modules/ecs_cluster.py +++ b/plugins/modules/ecs_cluster.py @@ -72,7 +72,7 @@ version_added: 5.2.0 description: - Toggle overwriting of existing capacity providers or strategy. This is needed for backwards compatibility. - - By default I(purge_capacity_providers=false). In a release after 2024-06-01 this will be changed to I(purge_capacity_providers=true). + - By default I(purge_capacity_providers=false). In release 9.0.0 this default will be changed to I(purge_capacity_providers=true). required: false type: bool default: false @@ -292,9 +292,9 @@ def main(): # Unless purge_capacity_providers is true, we will not be updating the providers or strategy. if not purge_capacity_providers: module.deprecate( - "After 2024-06-01 the default value of purge_capacity_providers will change from false to true." + "In release 9.0.0 the default value of purge_capacity_providers will change from false to true." " To maintain the existing behaviour explicitly set purge_capacity_providers=true", - date="2024-06-01", + version="9.0.0", collection_name="community.aws", ) cps_update_needed = False diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index e832fa3b5d5..e6ecf736b5c 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -158,7 +158,7 @@ version_added: 5.3.0 description: - Toggle overwriting of existing placement constraints. This is needed for backwards compatibility. - - By default I(purge_placement_constraints=false). In a release after 2024-06-01 this will be changed to I(purge_placement_constraints=true). + - By default I(purge_placement_constraints=false). In release 9.0.0 this will be changed to I(purge_placement_constraints=true). required: false type: bool default: false @@ -180,7 +180,7 @@ version_added: 5.3.0 description: - Toggle overwriting of existing placement strategy. This is needed for backwards compatibility. - - By default I(purge_placement_strategy=false). In a release after 2024-06-01 this will be changed to I(purge_placement_strategy=true). + - By default I(purge_placement_strategy=false). In release 9.0.0 this will be changed to I(purge_placement_strategy=true). required: false type: bool default: false diff --git a/plugins/modules/glue_connection.py b/plugins/modules/glue_connection.py index ecfbd1a90dd..f44ca8bbf76 100644 --- a/plugins/modules/glue_connection.py +++ b/plugins/modules/glue_connection.py @@ -110,7 +110,7 @@ connection_properties: description: - (deprecated) A dict of key-value pairs (converted to lowercase) used as parameters for this connection. - - This return key has been deprecated, and will be removed in a release after 2024-06-01. + - This return key has been deprecated, and will be removed in release 9.0.0. returned: when state is present type: dict sample: {'jdbc_connection_url':'jdbc:mysql://mydb:3306/databasename','username':'x','password':'y'} @@ -337,7 +337,7 @@ def create_or_update_glue_connection(connection, connection_ec2, module, glue_co "The 'connection_properties' return key is deprecated and will be replaced" " by 'raw_connection_properties'. Both values are returned for now." ), - date="2024-06-01", + version="9.0.0", collection_name="community.aws", ) glue_connection["RawConnectionProperties"] = glue_connection["ConnectionProperties"] From 72ea8e464d5d034f33e446fe65fdb16084792fb1 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 17 May 2024 14:39:08 +0200 Subject: [PATCH 30/77] Support for ansible-core < 2.15 has been dropped (#2093) Support for ansible-core < 2.15 has been dropped SUMMARY Support for ansible-core < 2.15 has been dropped ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- README.md | 2 +- changelogs/fragments/8.0.0-increase-ansible-core-version.yml | 2 +- meta/runtime.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8d6a693621f..1cc7ff4ba7c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ AWS related modules and plugins supported by the Ansible Cloud team are in the [ ## Ansible version compatibility -Tested with the Ansible Core >= 2.14.0 versions, and the current development version of Ansible. Ansible Core versions before 2.14.0 are not supported. +Tested with the Ansible Core >= 2.15.0 versions, and the current development version of Ansible. Ansible Core versions before 2.15.0 are not supported. Use community.aws 4.x.y if you are using Ansible 2.9 or Ansible Core 2.10. diff --git a/changelogs/fragments/8.0.0-increase-ansible-core-version.yml b/changelogs/fragments/8.0.0-increase-ansible-core-version.yml index e3653bb7590..a83a9473bd7 100644 --- a/changelogs/fragments/8.0.0-increase-ansible-core-version.yml +++ b/changelogs/fragments/8.0.0-increase-ansible-core-version.yml @@ -1,2 +1,2 @@ breaking_changes: - - community.aws collection - Support for ansible-core < 2.14 has been dropped (https://github.com/ansible-collections/community.aws/pull/2074). + - community.aws collection - Support for ansible-core < 2.15 has been dropped (https://github.com/ansible-collections/community.aws/pull/2074). diff --git a/meta/runtime.yml b/meta/runtime.yml index 71d258aae9d..ea50b016258 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.14.0' +requires_ansible: '>=2.15.0' action_groups: aws: - accessanalyzer_validate_policy_info From bb2cb3b02cb1e7474d338fdc8ff85ae2b42af349 Mon Sep 17 00:00:00 2001 From: Helen Bailey Date: Tue, 21 May 2024 04:58:27 -0400 Subject: [PATCH 31/77] Changelog updates after 8.0.0 release (#2098) Changelog updates after 8.0.0 release SUMMARY Update changelog and remove changelog fragments after 8.0.0 release. ISSUE TYPE Docs Pull Request Reviewed-by: Mark Chappell --- CHANGELOG.rst | 52 +++++++ changelogs/changelog.yaml | 128 +++++++++++++++++- changelogs/fragments/1832-mq_broker_tags.yml | 2 - ...s-task-definition-add-runtime-platform.yml | 2 - changelogs/fragments/1904-route53_wait.yml | 2 - changelogs/fragments/1962-isort.yml | 4 - .../fragments/20230623-black-cloudfront.yml | 2 - changelogs/fragments/20230702-isort.yml | 2 - changelogs/fragments/20230801-fix-linters.yml | 3 - changelogs/fragments/20230906-galaxy.yml | 2 - .../fragments/20230906-route53_wait.yml | 2 - .../fragments/20230908-alias-cleanup.yml | 2 - ...915_migrate_iam_role_and_iam_role_info.yml | 7 - ...7-elb_network_lb-update-tls-listeners.yaml | 4 - .../fragments/20240408-efs-sanity_fix.yml | 2 - changelogs/fragments/7.0.0-dev0.yml | 2 - .../8.0.0-increase-ansible-core-version.yml | 2 - changelogs/fragments/9-date-deprecations.yml | 9 -- changelogs/fragments/boto3_equals.yml | 3 - changelogs/fragments/botocore.yml | 6 - .../fragments/botocore_params-cleanup.yml | 2 - .../eks_nodegroup-integration-wait-delete.yml | 4 - changelogs/fragments/galaxy_importer.yml | 2 - .../fragments/migrate_aws_region_info.yml | 5 - .../fragments/migrate_iam_access_key.yml | 7 - changelogs/fragments/migrate_iam_group.yml | 4 - .../fragments/migrate_iam_managed_policy.yml | 4 - .../fragments/migrate_iam_mfa_device_info.yml | 4 - .../fragments/migrate_iam_password_policy.yml | 4 - .../fragments/migrate_s3_bucket_info.yml | 8 -- .../fragments/migrate_sts_assume_role.yml | 4 - .../opensearch_domainconfig_no_options.yaml | 3 - changelogs/fragments/python37.yml | 10 -- .../fragments/workflow-requirements.yml | 2 - 34 files changed, 176 insertions(+), 125 deletions(-) delete mode 100644 changelogs/fragments/1832-mq_broker_tags.yml delete mode 100644 changelogs/fragments/1891_ecs-task-definition-add-runtime-platform.yml delete mode 100644 changelogs/fragments/1904-route53_wait.yml delete mode 100644 changelogs/fragments/1962-isort.yml delete mode 100644 changelogs/fragments/20230623-black-cloudfront.yml delete mode 100644 changelogs/fragments/20230702-isort.yml delete mode 100644 changelogs/fragments/20230801-fix-linters.yml delete mode 100644 changelogs/fragments/20230906-galaxy.yml delete mode 100644 changelogs/fragments/20230906-route53_wait.yml delete mode 100644 changelogs/fragments/20230908-alias-cleanup.yml delete mode 100644 changelogs/fragments/20230915_migrate_iam_role_and_iam_role_info.yml delete mode 100644 changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml delete mode 100644 changelogs/fragments/20240408-efs-sanity_fix.yml delete mode 100644 changelogs/fragments/7.0.0-dev0.yml delete mode 100644 changelogs/fragments/8.0.0-increase-ansible-core-version.yml delete mode 100644 changelogs/fragments/9-date-deprecations.yml delete mode 100644 changelogs/fragments/boto3_equals.yml delete mode 100644 changelogs/fragments/botocore.yml delete mode 100644 changelogs/fragments/botocore_params-cleanup.yml delete mode 100644 changelogs/fragments/eks_nodegroup-integration-wait-delete.yml delete mode 100644 changelogs/fragments/galaxy_importer.yml delete mode 100644 changelogs/fragments/migrate_aws_region_info.yml delete mode 100644 changelogs/fragments/migrate_iam_access_key.yml delete mode 100644 changelogs/fragments/migrate_iam_group.yml delete mode 100644 changelogs/fragments/migrate_iam_managed_policy.yml delete mode 100644 changelogs/fragments/migrate_iam_mfa_device_info.yml delete mode 100644 changelogs/fragments/migrate_iam_password_policy.yml delete mode 100644 changelogs/fragments/migrate_s3_bucket_info.yml delete mode 100644 changelogs/fragments/migrate_sts_assume_role.yml delete mode 100644 changelogs/fragments/opensearch_domainconfig_no_options.yaml delete mode 100644 changelogs/fragments/python37.yml delete mode 100644 changelogs/fragments/workflow-requirements.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b47d79fe4a2..5e7208f47ed 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,58 @@ community.aws Release Notes .. contents:: Topics +v8.0.0 +====== + +Release Summary +--------------- + +This major release brings several new features, bug fixes, and deprecated features. It also includes the removal of several modules that have been migrated to the ``amazon.aws`` collection. We have also removed support for ``ansible-core<2.15``. + +Minor Changes +------------- + +- api_gateway - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). +- api_gateway_info - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). +- community.aws collection - apply isort code formatting to ensure consistent formatting of code (https://github.com/ansible-collections/community.aws/pull/1962) +- ecs_taskdefinition - Add parameter ``runtime_platform`` (https://github.com/ansible-collections/community.aws/issues/1891). +- eks_nodegroup - ensure wait also waits for deletion to complete when ``wait==True`` (https://github.com/ansible-collections/community.aws/pull/1994). +- elb_network_lb - add support for Application-Layer Protocol Negotiation (ALPN) policy ``AlpnPolicy`` for TLS listeners (https://github.com/ansible-collections/community.aws/issues/1566). +- elb_network_lb - add the possibly to update ``SslPolicy`` and ``Certificates`` for TLS listeners (). + +Breaking Changes / Porting Guide +-------------------------------- + +- The community.aws collection has dropped support for ``botocore<1.29.0`` and ``boto3<1.26.0``. Most modules will continue to work with older versions of the AWS SDK, however compatability with older versions of the SDK is not guaranteed and will not be tested. When using older versions of the SDK a warning will be emitted by Ansible (https://github.com/ansible-collections/amazon.aws/pull/1763). +- aws_region_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.aws_region_info``. +- aws_s3_bucket_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.aws_s3_bucket_info``. +- community.aws collection - Support for ansible-core < 2.15 has been dropped (https://github.com/ansible-collections/community.aws/pull/2074). +- community.aws collection - due to the AWS SDKs announcing the end of support for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) support for Python less than 3.7 by this collection wss been deprecated in release 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). +- iam_access_key - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_access_key``. +- iam_access_key_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_access_key_info``. +- iam_group - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_group`` (https://github.com/ansible-collections/community.aws/pull/1945). +- iam_managed_policy - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_managed_policy`` (https://github.com/ansible-collections/community.aws/pull/1954). +- iam_mfa_device_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_mfa_device_info`` (https://github.com/ansible-collections/community.aws/pull/1953). +- iam_password_policy - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_password_policy``. +- iam_role - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_role`` (https://github.com/ansible-collections/community.aws/pull/1948). +- iam_role_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.iam_role_info`` (https://github.com/ansible-collections/community.aws/pull/1948). +- s3_bucket_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.s3_bucket_info``. +- sts_assume_role - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.sts_assume_role``. + +Deprecated Features +------------------- + +- aws_glue_connection - updated the deprecation for removal of the ``connection_parameters`` return key from ``after 2024-06-01`` to release version ``9.0.0``, it is being replaced by the ``raw_connection_parameters`` key (https://github.com/ansible-collections/community.aws/pull/518). +- ecs_cluster - updated the deprecation for updated default of ``purge_capacity_providers``, the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_capacity_providers=False`` (https://github.com/ansible-collections/community.aws/pull/1640). +- ecs_service - updated the deprecation for updated default of ``purge_placement_constraints``, the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_constraints=False`` (https://github.com/ansible-collections/community.aws/pull/1716). +- ecs_service - updated the deprecation for updated default of ``purge_placement_strategy``, the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_strategy=False`` (https://github.com/ansible-collections/community.aws/pull/1716). + +Bugfixes +-------- + +- mq_broker - ensure broker is created with ``tags`` when passed (https://github.com/ansible-collections/community.aws/issues/1832). +- opensearch - Don't try to read a non existing key from the domain config (https://github.com/ansible-collections/community.aws/pull/1910). + v7.2.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index b4e65e9ab1b..beb6b030ceb 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1643,9 +1643,8 @@ releases: release_date: '2022-06-22' 2.6.1: changes: - release_summary: - Bump collection from 2.6.0 to 2.6.1 due to a publishing error with 2.6.0. This - release supersedes 2.6.0 entirely, users should skip 2.6.0. + release_summary: Bump collection from 2.6.0 to 2.6.1 due to a publishing error + with 2.6.0. This release supersedes 2.6.0 entirely, users should skip 2.6.0. fragments: - 261_increase.yml release_date: '2022-06-22' @@ -3470,7 +3469,8 @@ releases: - cloudfront_distribution - add ``http3`` support via parameter value ``http2and3`` for parameter ``http_version`` (https://github.com/ansible-collections/community.aws/pull/1753). - cloudfront_distribution - add ``origin_shield`` options (https://github.com/ansible-collections/community.aws/pull/1557). - - cloudfront_distribution - documented ``connection_attempts`` and ``connection_timeout`` the module was already capable of using them + - cloudfront_distribution - documented ``connection_attempts`` and ``connection_timeout`` + the module was already capable of using them - community.aws - updated document fragments based on changes in amazon.aws (https://github.com/ansible-collections/community.aws/pull/1738). - community.aws - updated imports based on changes in amazon.aws (https://github.com/ansible-collections/community.aws/pull/1738). @@ -3755,3 +3755,123 @@ releases: name: dynamodb_table_info namespace: '' release_date: '2024-04-05' + 8.0.0: + changes: + breaking_changes: + - The community.aws collection has dropped support for ``botocore<1.29.0`` and + ``boto3<1.26.0``. Most modules will continue to work with older versions of + the AWS SDK, however compatability with older versions of the SDK is not guaranteed + and will not be tested. When using older versions of the SDK a warning will + be emitted by Ansible (https://github.com/ansible-collections/amazon.aws/pull/1763). + - aws_region_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.aws_region_info``. + - aws_s3_bucket_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.aws_s3_bucket_info``. + - community.aws collection - Support for ansible-core < 2.15 has been dropped + (https://github.com/ansible-collections/community.aws/pull/2074). + - community.aws collection - due to the AWS SDKs announcing the end of support + for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) + support for Python less than 3.7 by this collection wss been deprecated in + release 6.0.0 and removed in release 7.0.0. (https://github.com/ansible-collections/amazon.aws/pull/1763). + - iam_access_key - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_access_key``. + - iam_access_key_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_access_key_info``. + - iam_group - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_group`` (https://github.com/ansible-collections/community.aws/pull/1945). + - iam_managed_policy - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_managed_policy`` (https://github.com/ansible-collections/community.aws/pull/1954). + - iam_mfa_device_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_mfa_device_info`` (https://github.com/ansible-collections/community.aws/pull/1953). + - iam_password_policy - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.iam_password_policy``. + - iam_role - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_role`` (https://github.com/ansible-collections/community.aws/pull/1948). + - iam_role_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.iam_role_info`` (https://github.com/ansible-collections/community.aws/pull/1948). + - s3_bucket_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.s3_bucket_info``. + - sts_assume_role - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.sts_assume_role``. + bugfixes: + - mq_broker - ensure broker is created with ``tags`` when passed (https://github.com/ansible-collections/community.aws/issues/1832). + - opensearch - Don't try to read a non existing key from the domain config (https://github.com/ansible-collections/community.aws/pull/1910). + deprecated_features: + - aws_glue_connection - updated the deprecation for removal of the ``connection_parameters`` + return key from ``after 2024-06-01`` to release version ``9.0.0``, it is being + replaced by the ``raw_connection_parameters`` key (https://github.com/ansible-collections/community.aws/pull/518). + - ecs_cluster - updated the deprecation for updated default of ``purge_capacity_providers``, + the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To + maintain the current behaviour explicitly set ``purge_capacity_providers=False`` + (https://github.com/ansible-collections/community.aws/pull/1640). + - ecs_service - updated the deprecation for updated default of ``purge_placement_constraints``, + the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To + maintain the current behaviour explicitly set ``purge_placement_constraints=False`` + (https://github.com/ansible-collections/community.aws/pull/1716). + - ecs_service - updated the deprecation for updated default of ``purge_placement_strategy``, + the current default of ``False`` will be changed to ``True`` in release ``9.0.0``. To + maintain the current behaviour explicitly set ``purge_placement_strategy=False`` + (https://github.com/ansible-collections/community.aws/pull/1716). + minor_changes: + - api_gateway - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). + - api_gateway_info - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). + - community.aws collection - apply isort code formatting to ensure consistent + formatting of code (https://github.com/ansible-collections/community.aws/pull/1962) + - ecs_taskdefinition - Add parameter ``runtime_platform`` (https://github.com/ansible-collections/community.aws/issues/1891). + - eks_nodegroup - ensure wait also waits for deletion to complete when ``wait==True`` + (https://github.com/ansible-collections/community.aws/pull/1994). + - elb_network_lb - add support for Application-Layer Protocol Negotiation (ALPN) + policy ``AlpnPolicy`` for TLS listeners (https://github.com/ansible-collections/community.aws/issues/1566). + - elb_network_lb - add the possibly to update ``SslPolicy`` and ``Certificates`` + for TLS listeners (). + release_summary: This major release brings several new features, bug fixes, + and deprecated features. It also includes the removal of several modules that + have been migrated to the ``amazon.aws`` collection. We have also removed + support for ``ansible-core<2.15``. + fragments: + - 1832-mq_broker_tags.yml + - 1891_ecs-task-definition-add-runtime-platform.yml + - 1904-route53_wait.yml + - 1962-isort.yml + - 20230623-black-cloudfront.yml + - 20230702-isort.yml + - 20230801-fix-linters.yml + - 20230906-galaxy.yml + - 20230906-route53_wait.yml + - 20230908-alias-cleanup.yml + - 20230915_migrate_iam_role_and_iam_role_info.yml + - 20231127-elb_network_lb-update-tls-listeners.yaml + - 20240408-efs-sanity_fix.yml + - 7.0.0-dev0.yml + - 8.0.0-increase-ansible-core-version.yml + - 8.0.0-release.yml + - 9-date-deprecations.yml + - boto3_equals.yml + - botocore.yml + - botocore_params-cleanup.yml + - eks_nodegroup-integration-wait-delete.yml + - galaxy_importer.yml + - migrate_aws_region_info.yml + - migrate_iam_access_key.yml + - migrate_iam_group.yml + - migrate_iam_managed_policy.yml + - migrate_iam_mfa_device_info.yml + - migrate_iam_password_policy.yml + - migrate_s3_bucket_info.yml + - migrate_sts_assume_role.yml + - opensearch_domainconfig_no_options.yaml + - python37.yml + - workflow-requirements.yml + release_date: '2024-05-20' diff --git a/changelogs/fragments/1832-mq_broker_tags.yml b/changelogs/fragments/1832-mq_broker_tags.yml deleted file mode 100644 index b2320dd3c71..00000000000 --- a/changelogs/fragments/1832-mq_broker_tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - mq_broker - ensure broker is created with ``tags`` when passed (https://github.com/ansible-collections/community.aws/issues/1832). \ No newline at end of file diff --git a/changelogs/fragments/1891_ecs-task-definition-add-runtime-platform.yml b/changelogs/fragments/1891_ecs-task-definition-add-runtime-platform.yml deleted file mode 100644 index ae800635281..00000000000 --- a/changelogs/fragments/1891_ecs-task-definition-add-runtime-platform.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ecs_taskdefinition - Add parameter ``runtime_platform`` (https://github.com/ansible-collections/community.aws/issues/1891). diff --git a/changelogs/fragments/1904-route53_wait.yml b/changelogs/fragments/1904-route53_wait.yml deleted file mode 100644 index f8f4568b43e..00000000000 --- a/changelogs/fragments/1904-route53_wait.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Add route53_wait module to community.aws.aws action group (https://github.com/ansible-collections/community.aws/pull/1904)." diff --git a/changelogs/fragments/1962-isort.yml b/changelogs/fragments/1962-isort.yml deleted file mode 100644 index 65eb9792250..00000000000 --- a/changelogs/fragments/1962-isort.yml +++ /dev/null @@ -1,4 +0,0 @@ -minor_changes: -- community.aws collection - apply isort code formatting to ensure consistent formatting of code (https://github.com/ansible-collections/community.aws/pull/1962) -- api_gateway - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). -- api_gateway_info - use fstrings where appropriate (https://github.com/ansible-collections/amazon.aws/pull/1962). diff --git a/changelogs/fragments/20230623-black-cloudfront.yml b/changelogs/fragments/20230623-black-cloudfront.yml deleted file mode 100644 index 4630a814612..00000000000 --- a/changelogs/fragments/20230623-black-cloudfront.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- cloudfront_distribution - apply black formatting diff --git a/changelogs/fragments/20230702-isort.yml b/changelogs/fragments/20230702-isort.yml deleted file mode 100644 index 5ceaa201c0e..00000000000 --- a/changelogs/fragments/20230702-isort.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- added isort configs to pyproject.toml diff --git a/changelogs/fragments/20230801-fix-linters.yml b/changelogs/fragments/20230801-fix-linters.yml deleted file mode 100644 index d0a3c957d70..00000000000 --- a/changelogs/fragments/20230801-fix-linters.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - Replace use of ``type`` by ``isinstance`` to test variable type. diff --git a/changelogs/fragments/20230906-galaxy.yml b/changelogs/fragments/20230906-galaxy.yml deleted file mode 100644 index a7ff7b5a43f..00000000000 --- a/changelogs/fragments/20230906-galaxy.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- galaxy.yml - add collection description. diff --git a/changelogs/fragments/20230906-route53_wait.yml b/changelogs/fragments/20230906-route53_wait.yml deleted file mode 100644 index 34f5fc1d245..00000000000 --- a/changelogs/fragments/20230906-route53_wait.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- route53_wait - fix version_added. diff --git a/changelogs/fragments/20230908-alias-cleanup.yml b/changelogs/fragments/20230908-alias-cleanup.yml deleted file mode 100644 index b54cc42242e..00000000000 --- a/changelogs/fragments/20230908-alias-cleanup.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- Update integration tests to reflect renamed plugins diff --git a/changelogs/fragments/20230915_migrate_iam_role_and_iam_role_info.yml b/changelogs/fragments/20230915_migrate_iam_role_and_iam_role_info.yml deleted file mode 100644 index f984a66337f..00000000000 --- a/changelogs/fragments/20230915_migrate_iam_role_and_iam_role_info.yml +++ /dev/null @@ -1,7 +0,0 @@ -breaking_changes: -- iam_role - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_role`` (https://github.com/ansible-collections/community.aws/pull/1948). -- iam_role_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_role_info`` (https://github.com/ansible-collections/community.aws/pull/1948). diff --git a/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml b/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml deleted file mode 100644 index 9f2bdc5c261..00000000000 --- a/changelogs/fragments/20231127-elb_network_lb-update-tls-listeners.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - elb_network_lb - add the possibly to update ``SslPolicy`` and ``Certificates`` for TLS listeners (). - - elb_network_lb - add support for Application-Layer Protocol Negotiation (ALPN) policy ``AlpnPolicy`` for TLS listeners (https://github.com/ansible-collections/community.aws/issues/1566). diff --git a/changelogs/fragments/20240408-efs-sanity_fix.yml b/changelogs/fragments/20240408-efs-sanity_fix.yml deleted file mode 100644 index f8be70f183b..00000000000 --- a/changelogs/fragments/20240408-efs-sanity_fix.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - efs - Use ``yield from`` in ordr to fix sanity errors. diff --git a/changelogs/fragments/7.0.0-dev0.yml b/changelogs/fragments/7.0.0-dev0.yml deleted file mode 100644 index c49331daa50..00000000000 --- a/changelogs/fragments/7.0.0-dev0.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- bump galaxy.yml to release 7.0.0-dev0 diff --git a/changelogs/fragments/8.0.0-increase-ansible-core-version.yml b/changelogs/fragments/8.0.0-increase-ansible-core-version.yml deleted file mode 100644 index a83a9473bd7..00000000000 --- a/changelogs/fragments/8.0.0-increase-ansible-core-version.yml +++ /dev/null @@ -1,2 +0,0 @@ -breaking_changes: - - community.aws collection - Support for ansible-core < 2.15 has been dropped (https://github.com/ansible-collections/community.aws/pull/2074). diff --git a/changelogs/fragments/9-date-deprecations.yml b/changelogs/fragments/9-date-deprecations.yml deleted file mode 100644 index 7827048bdce..00000000000 --- a/changelogs/fragments/9-date-deprecations.yml +++ /dev/null @@ -1,9 +0,0 @@ -deprecated_features: -- aws_glue_connection - updated the deprecation for removal of the ``connection_parameters`` return key from ``after 2024-06-01`` to release version ``9.0.0``, - it is being replaced by the ``raw_connection_parameters`` key (https://github.com/ansible-collections/community.aws/pull/518). -- ecs_cluster - updated the deprecation for updated default of ``purge_capacity_providers``, the current default of ``False`` will be changed to ``True`` - in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_capacity_providers=False`` (https://github.com/ansible-collections/community.aws/pull/1640). -- ecs_service - updated the deprecation for updated default of ``purge_placement_constraints``, the current default of ``False`` will be changed to ``True`` - in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_constraints=False`` (https://github.com/ansible-collections/community.aws/pull/1716). -- ecs_service - updated the deprecation for updated default of ``purge_placement_strategy``, the current default of ``False`` will be changed to ``True`` - in release ``9.0.0``. To maintain the current behaviour explicitly set ``purge_placement_strategy=False`` (https://github.com/ansible-collections/community.aws/pull/1716). diff --git a/changelogs/fragments/boto3_equals.yml b/changelogs/fragments/boto3_equals.yml deleted file mode 100644 index 4566bc77b04..00000000000 --- a/changelogs/fragments/boto3_equals.yml +++ /dev/null @@ -1,3 +0,0 @@ -trivial: -- glue_connection - stop passing ``boto3`` into ``get_ec2_security_group_ids_from_names()`` it is no longer used. -- autoscaling_launch_config - stop passing ``boto3`` into ``get_ec2_security_group_ids_from_names()`` it is no longer used. diff --git a/changelogs/fragments/botocore.yml b/changelogs/fragments/botocore.yml deleted file mode 100644 index 901bcdabcbe..00000000000 --- a/changelogs/fragments/botocore.yml +++ /dev/null @@ -1,6 +0,0 @@ -breaking_changes: -- The community.aws collection has dropped support for ``botocore<1.29.0`` and - ``boto3<1.26.0``. Most modules will continue to work with older versions of the AWS SDK, however - compatability with older versions of the SDK is not guaranteed and will not be tested. When using - older versions of the SDK a warning will be emitted by Ansible - (https://github.com/ansible-collections/amazon.aws/pull/1763). diff --git a/changelogs/fragments/botocore_params-cleanup.yml b/changelogs/fragments/botocore_params-cleanup.yml deleted file mode 100644 index b92b6606e75..00000000000 --- a/changelogs/fragments/botocore_params-cleanup.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- update docs and tests to use canonical parameter names for credentials. diff --git a/changelogs/fragments/eks_nodegroup-integration-wait-delete.yml b/changelogs/fragments/eks_nodegroup-integration-wait-delete.yml deleted file mode 100644 index a88c08d73ef..00000000000 --- a/changelogs/fragments/eks_nodegroup-integration-wait-delete.yml +++ /dev/null @@ -1,4 +0,0 @@ -trivial: -- eks_nodegroup - update integration test to wait for both nodegroups to be deleted. -minor_changes: -- eks_nodegroup - ensure wait also waits for deletion to complete when ``wait==True`` (https://github.com/ansible-collections/community.aws/pull/1994). diff --git a/changelogs/fragments/galaxy_importer.yml b/changelogs/fragments/galaxy_importer.yml deleted file mode 100644 index db2a75b6388..00000000000 --- a/changelogs/fragments/galaxy_importer.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- "Add Galaxy importer GitHub action." diff --git a/changelogs/fragments/migrate_aws_region_info.yml b/changelogs/fragments/migrate_aws_region_info.yml deleted file mode 100644 index ba6b319168f..00000000000 --- a/changelogs/fragments/migrate_aws_region_info.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - aws_region_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.aws_region_info``. diff --git a/changelogs/fragments/migrate_iam_access_key.yml b/changelogs/fragments/migrate_iam_access_key.yml deleted file mode 100644 index 8485c6a1849..00000000000 --- a/changelogs/fragments/migrate_iam_access_key.yml +++ /dev/null @@ -1,7 +0,0 @@ -breaking_changes: -- iam_access_key - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_access_key``. -- iam_access_key_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_access_key_info``. diff --git a/changelogs/fragments/migrate_iam_group.yml b/changelogs/fragments/migrate_iam_group.yml deleted file mode 100644 index 23aa0386250..00000000000 --- a/changelogs/fragments/migrate_iam_group.yml +++ /dev/null @@ -1,4 +0,0 @@ -breaking_changes: -- iam_group - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_group`` (https://github.com/ansible-collections/community.aws/pull/1945). diff --git a/changelogs/fragments/migrate_iam_managed_policy.yml b/changelogs/fragments/migrate_iam_managed_policy.yml deleted file mode 100644 index 284a0e927ee..00000000000 --- a/changelogs/fragments/migrate_iam_managed_policy.yml +++ /dev/null @@ -1,4 +0,0 @@ -breaking_changes: -- iam_managed_policy - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_managed_policy`` (https://github.com/ansible-collections/community.aws/pull/1954). diff --git a/changelogs/fragments/migrate_iam_mfa_device_info.yml b/changelogs/fragments/migrate_iam_mfa_device_info.yml deleted file mode 100644 index 85ef2ec60af..00000000000 --- a/changelogs/fragments/migrate_iam_mfa_device_info.yml +++ /dev/null @@ -1,4 +0,0 @@ -breaking_changes: -- iam_mfa_device_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_mfa_device_info`` (https://github.com/ansible-collections/community.aws/pull/1953). diff --git a/changelogs/fragments/migrate_iam_password_policy.yml b/changelogs/fragments/migrate_iam_password_policy.yml deleted file mode 100644 index fb9dbda7439..00000000000 --- a/changelogs/fragments/migrate_iam_password_policy.yml +++ /dev/null @@ -1,4 +0,0 @@ -breaking_changes: -- iam_password_policy - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.iam_password_policy``. diff --git a/changelogs/fragments/migrate_s3_bucket_info.yml b/changelogs/fragments/migrate_s3_bucket_info.yml deleted file mode 100644 index 8be309e4d82..00000000000 --- a/changelogs/fragments/migrate_s3_bucket_info.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - aws_s3_bucket_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.aws_s3_bucket_info``. - - s3_bucket_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.s3_bucket_info``. diff --git a/changelogs/fragments/migrate_sts_assume_role.yml b/changelogs/fragments/migrate_sts_assume_role.yml deleted file mode 100644 index 49bb113ab2d..00000000000 --- a/changelogs/fragments/migrate_sts_assume_role.yml +++ /dev/null @@ -1,4 +0,0 @@ -breaking_changes: -- sts_assume_role - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be updated - to use ``amazon.aws.sts_assume_role``. diff --git a/changelogs/fragments/opensearch_domainconfig_no_options.yaml b/changelogs/fragments/opensearch_domainconfig_no_options.yaml deleted file mode 100644 index d86d379f55d..00000000000 --- a/changelogs/fragments/opensearch_domainconfig_no_options.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: -- "opensearch - Don't try to read a non existing key from the domain config (https://github.com/ansible-collections/community.aws/pull/1910)." diff --git a/changelogs/fragments/python37.yml b/changelogs/fragments/python37.yml deleted file mode 100644 index 8bd6d148bd0..00000000000 --- a/changelogs/fragments/python37.yml +++ /dev/null @@ -1,10 +0,0 @@ -breaking_changes: -- community.aws collection - due to the AWS SDKs announcing the end of support - for Python less than 3.7 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) - support for Python less than 3.7 by this collection wss been deprecated in release 6.0.0 and removed in release 7.0.0. - (https://github.com/ansible-collections/amazon.aws/pull/1763). - -# We've already announced the deprecation for <3.8 (with 6.0.0), dropping support for <3.9 on ours side will happen -# after April 2026. This is about 2 years + 5 months away assuming a November 7.0.0 release, we could announce -# the deprecation now, but assuming we release 8.0.0 in about 6 months a just short of 2 year -# deprecation feels fine given it's predictable. diff --git a/changelogs/fragments/workflow-requirements.yml b/changelogs/fragments/workflow-requirements.yml deleted file mode 100644 index c43821ae60e..00000000000 --- a/changelogs/fragments/workflow-requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: -- Update test workflows to use relevant requirements files. From d0bcaf04485d1a3448f287d74ddeeb57584bb2c4 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 23 May 2024 21:17:25 +0200 Subject: [PATCH 32/77] msk_cluster - disable integration tests (#2101) msk_cluster - disable integration tests SUMMARY msk_cluster - disable integration tests ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- changelogs/fragments/20240423-msk_cluster-disable-tests.yml | 2 ++ tests/integration/targets/msk_cluster/aliases | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/20240423-msk_cluster-disable-tests.yml diff --git a/changelogs/fragments/20240423-msk_cluster-disable-tests.yml b/changelogs/fragments/20240423-msk_cluster-disable-tests.yml new file mode 100644 index 00000000000..28be7b8378d --- /dev/null +++ b/changelogs/fragments/20240423-msk_cluster-disable-tests.yml @@ -0,0 +1,2 @@ +trivial: + - msk_cluster - Disable integration tests because they are too slow. diff --git a/tests/integration/targets/msk_cluster/aliases b/tests/integration/targets/msk_cluster/aliases index c9cac54c218..d0a8d6e9449 100644 --- a/tests/integration/targets/msk_cluster/aliases +++ b/tests/integration/targets/msk_cluster/aliases @@ -1,2 +1,5 @@ +# reason: integration tests are too slow +disabled + cloud/aws time=46m From 9c66d1e4b3883e5847ff0c376e165714a64857fb Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 7 Jun 2024 23:56:16 +0200 Subject: [PATCH 33/77] Bump release for main branch to 9.0.0-dev0 (#2091) Bump release for main branch to 9.0.0-dev0 SUMMARY Bump release for main branch to 9.0.0-dev0 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell Reviewed-by: Mandar Kulkarni --- changelogs/fragments/20250515-main-9.0.0.yml | 2 ++ galaxy.yml | 2 +- plugins/module_utils/common.py | 2 +- tests/sanity/ignore-2.15.txt | 2 ++ tests/sanity/ignore-2.16.txt | 2 ++ tests/sanity/ignore-2.17.txt | 2 ++ tests/sanity/ignore-2.18.txt | 2 ++ 7 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/20250515-main-9.0.0.yml create mode 100644 tests/sanity/ignore-2.18.txt diff --git a/changelogs/fragments/20250515-main-9.0.0.yml b/changelogs/fragments/20250515-main-9.0.0.yml new file mode 100644 index 00000000000..7d31e9997a9 --- /dev/null +++ b/changelogs/fragments/20250515-main-9.0.0.yml @@ -0,0 +1,2 @@ +trivial: + - galaxy.yml - bump ``release`` for main branch to ``9.0.0-dev0``. diff --git a/galaxy.yml b/galaxy.yml index 6c306fa9bb9..72c91f51b01 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: community name: aws -version: 8.0.0-dev0 +version: 9.0.0-dev0 readme: README.md authors: - Ansible (https://github.com/ansible) diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index 4c33a0bb416..b21074bc278 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -5,4 +5,4 @@ COMMUNITY_AWS_COLLECTION_NAME = "community.aws" -COMMUNITY_AWS_COLLECTION_VERSION = "8.0.0-dev0" +COMMUNITY_AWS_COLLECTION_VERSION = "9.0.0-dev0" diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index 67d3693df63..e846a866640 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -1,2 +1,4 @@ plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/modules/ecs_cluster.py pylint:collection-deprecated-version +plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index 67d3693df63..e846a866640 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -1,2 +1,4 @@ plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 +plugins/modules/ecs_cluster.py pylint:collection-deprecated-version +plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index e69de29bb2d..e925c5a05f2 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -0,0 +1,2 @@ +plugins/modules/ecs_cluster.py pylint:collection-deprecated-version +plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt new file mode 100644 index 00000000000..e925c5a05f2 --- /dev/null +++ b/tests/sanity/ignore-2.18.txt @@ -0,0 +1,2 @@ +plugins/modules/ecs_cluster.py pylint:collection-deprecated-version +plugins/modules/glue_connection.py pylint:collection-deprecated-version From 02b230f9d903f0cecf3c159f87a99adea1be0378 Mon Sep 17 00:00:00 2001 From: Alice Kaerast <77268763+alicekaerast@users.noreply.github.com> Date: Fri, 28 Jun 2024 14:25:19 +0100 Subject: [PATCH 34/77] Document IAM actions required (#2087) SUMMARY This change documents the IAM actions required in order to use the community.aws.acm_certificate_info module ISSUE TYPE Docs Pull Request COMPONENT NAME community.aws.acm_certificate_info ADDITIONAL INFORMATION I've not done much with documentation in the past, is this the best place to add this? Reviewed-by: Markus Bergholz Reviewed-by: Alina Buzachis --- plugins/modules/acm_certificate_info.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/acm_certificate_info.py b/plugins/modules/acm_certificate_info.py index 73da208f18a..2e61d2a8ccd 100644 --- a/plugins/modules/acm_certificate_info.py +++ b/plugins/modules/acm_certificate_info.py @@ -13,6 +13,7 @@ - Note that this will not return information about uploaded keys of size 4096 bits, due to a limitation of the ACM API. - Prior to release 5.0.0 this module was called C(community.aws.aws_acm_info). The usage did not change. + - Requires the IAM permissions 'acm:ListCertificates', 'acm:DescribeCertificate', 'acm:GetCertificate', 'acm:ListTagsForCertificate' options: certificate_arn: description: From 3054d9443891c5fe2a01fa1ec4e7613d6e9bd764 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 2 Jul 2024 08:57:10 +0200 Subject: [PATCH 35/77] Adjust docs publish workflow. (#2112) --- .github/workflows/docs-push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 69c8fe7d689..79168f97dc0 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -31,10 +31,13 @@ jobs: if: github.repository == 'ansible-collections/community.aws' permissions: contents: write + pages: write + id-token: write needs: [build-docs] name: Publish Ansible Docs uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main with: artifact-name: ${{ needs.build-docs.outputs.artifact-name }} + publish-gh-pages-branch: true secrets: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4752c05c56076e1b904d7ee4dfd6c350601da0af Mon Sep 17 00:00:00 2001 From: Carlos Schimidt <40364204+cschimid@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:33:10 -0300 Subject: [PATCH 36/77] Add support to enable multicast on transit gateway (#2063) SUMMARY Need to enable multicast while creating transit gateway ISSUE TYPE Feature Pull Request COMPONENT NAME transit_gateway ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin Reviewed-by: Carlos Schimidt Reviewed-by: Mark Chappell --- .../fragments/2063-add-multicast-support.yml | 2 ++ plugins/module_utils/transitgateway.py | 3 ++ plugins/modules/ec2_transit_gateway.py | 14 ++++++++ plugins/modules/ec2_transit_gateway_info.py | 7 ++++ .../ec2_transit_gateway/tasks/main.yml | 34 +++++++++++++++++-- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/2063-add-multicast-support.yml diff --git a/changelogs/fragments/2063-add-multicast-support.yml b/changelogs/fragments/2063-add-multicast-support.yml new file mode 100644 index 00000000000..ed6ec1e9eb3 --- /dev/null +++ b/changelogs/fragments/2063-add-multicast-support.yml @@ -0,0 +1,2 @@ +minor_changes: + - ec2_transit_gateway - Support for enable multicast on Transit Gateway (https://github.com/ansible-collections/community.aws/pull/2063). diff --git a/plugins/module_utils/transitgateway.py b/plugins/module_utils/transitgateway.py index 5f0e934d1f2..8a82a839ff1 100644 --- a/plugins/module_utils/transitgateway.py +++ b/plugins/module_utils/transitgateway.py @@ -192,6 +192,9 @@ def _set_option(self, name, value): def set_dns_support(self, value): return self._set_option("DnsSupport", value) + def set_multicast_support(self, value): + return self._set_option("MulticastSupport", value) + def set_ipv6_support(self, value): return self._set_option("Ipv6Support", value) diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py index 19876984dba..c3a1079e5c9 100644 --- a/plugins/modules/ec2_transit_gateway.py +++ b/plugins/modules/ec2_transit_gateway.py @@ -42,6 +42,11 @@ - Whether to enable AWS DNS support. default: true type: bool + multicast_support: + description: + - Whether to enable AWS Multicast support. Valid only at the time of creation of the Transit Gateway. + type: bool + version_added: 8.1.0 state: description: - C(present) to ensure resource is created. @@ -91,6 +96,7 @@ asn: 64514 auto_associate: false auto_propagate: false + multicast_support: true dns_support: true description: "nonprod transit gateway" purge_tags: false @@ -181,6 +187,12 @@ returned: always type: str sample: enable + multicast_support: + description: Indicates whether Multicast support is enabled. + returned: always + type: str + sample: enable + version_added: 7.3.0 owner_id: description: The account that owns the transit gateway. returned: always @@ -362,6 +374,7 @@ def create_tgw(self, description): options["DefaultRouteTablePropagation"] = self.enable_option_flag(self._module.params.get("auto_propagate")) options["VpnEcmpSupport"] = self.enable_option_flag(self._module.params.get("vpn_ecmp_support")) options["DnsSupport"] = self.enable_option_flag(self._module.params.get("dns_support")) + options["MulticastSupport"] = self.enable_option_flag(self._module.params.get("multicast_support")) try: response = self._connection.create_transit_gateway(Description=description, Options=options) @@ -482,6 +495,7 @@ def setup_module_object(): auto_attach=dict(type="bool", default=False), auto_propagate=dict(type="bool", default=True), description=dict(type="str"), + multicast_support=dict(type="bool"), dns_support=dict(type="bool", default=True), purge_tags=dict(type="bool", default=True), state=dict(default="present", choices=["present", "absent"]), diff --git a/plugins/modules/ec2_transit_gateway_info.py b/plugins/modules/ec2_transit_gateway_info.py index b25346b84b8..014c875b6a0 100644 --- a/plugins/modules/ec2_transit_gateway_info.py +++ b/plugins/modules/ec2_transit_gateway_info.py @@ -119,6 +119,13 @@ returned: always type: str sample: "enable" + multicast_support: + description: + - Indicates whether Multicast support is enabled. + returned: always + type: str + sample: "enable" + version_added: 7.3.0 propagation_default_route_table_id: description: - The ID of the default propagation route table. diff --git a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml index c7353cfc0a6..241c9c2c324 100644 --- a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml +++ b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml @@ -22,7 +22,7 @@ assert: that: - create_result.changed == True - + - name: test update transit gateway with tags by description ec2_transit_gateway: description: "{{ tgw_description }}" @@ -75,6 +75,32 @@ assert: that: - result.changed == False + + - name: generate unique value for testing + set_fact: + tgw_description_multicast: "{{ resource_prefix }}-tgw-multicast" + + - name: test create transit gateway with multicast enabled + ec2_transit_gateway: + description: "{{ tgw_description_multicast }}" + multicast_support: true + register: create_result + + - name: assert changed is True + assert: + that: + - create_result.changed == True + + - name: test success with filter + ec2_transit_gateway_info: + filters: + options.multicast-support: enable + register: result + + - name: assert success with multicast-support filter + assert: + that: + - 'result.transit_gateways != []' # ==== Combine ec2_transit_gateway_info ====================== - name: test success with no parameters @@ -129,10 +155,14 @@ that: - 'result.changed == false' - 'result.transit_gateways != []' + always: ###### TEARDOWN STARTS HERE ###### - name: delete transit gateway ec2_transit_gateway: - description: "{{ tgw_description }}" + description: "{{ item }}" state: absent ignore_errors: yes + loop: + - "{{ tgw_description }}" + - "{{ tgw_description_multicast }}" From 78d94b5f3e2a3c246e253e8d9d24fc0d8efe6baa Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 15 Jul 2024 17:21:19 +0200 Subject: [PATCH 37/77] Update eks_nodegroup test to use t3a.micro (#2122) SUMMARY t3.micro's been having capacity issues, bump the eks_nodegroup integration tests over to t3a.micro which seems to be doing better. ISSUE TYPE Bugfix Pull Request COMPONENT NAME eks_nodegroup ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- tests/integration/targets/eks_nodegroup/aliases | 3 ++- .../targets/eks_nodegroup/tasks/dependecies.yml | 8 +------- .../integration/targets/eks_nodegroup/tasks/full_test.yml | 5 +++-- tests/integration/targets/eks_nodegroup/tasks/main.yml | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/eks_nodegroup/aliases b/tests/integration/targets/eks_nodegroup/aliases index 0b84301d76c..2a23e632d67 100644 --- a/tests/integration/targets/eks_nodegroup/aliases +++ b/tests/integration/targets/eks_nodegroup/aliases @@ -1 +1,2 @@ -cloud/aws \ No newline at end of file +cloud/aws +time=55m diff --git a/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml b/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml index cd37239c4a7..f2e591a139a 100644 --- a/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml +++ b/tests/integration/targets/eks_nodegroup/tasks/dependecies.yml @@ -95,16 +95,10 @@ # Dependecies to test eks nodegroup with launch_template - name: create instance template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" - instance_type: t3.nano - register: lt_default - -- name: update simple instance template ec2_launch_template: name: "{{ resource_prefix }}-simple" default_version: 1 - instance_type: t3.micro + instance_type: t3a.micro register: lt - name: Create securitygroup for node access diff --git a/tests/integration/targets/eks_nodegroup/tasks/full_test.yml b/tests/integration/targets/eks_nodegroup/tasks/full_test.yml index cb1d27340df..30eb5266f6d 100644 --- a/tests/integration/targets/eks_nodegroup/tasks/full_test.yml +++ b/tests/integration/targets/eks_nodegroup/tasks/full_test.yml @@ -84,7 +84,7 @@ ec2_ssh_key: "{{ ec2_key_eks_nodegroup.key.name }}" source_sg: - "{{ securitygroup_eks_nodegroup.group_id }}" - wait: True + wait: False register: eks_nodegroup_result check_mode: True @@ -123,6 +123,7 @@ source_sg: - "{{ securitygroup_eks_nodegroup.group_id }}" wait: True + wait_timeout: 1500 register: eks_nodegroup_result - name: check that eks_nodegroup is created @@ -463,7 +464,7 @@ subnets: '{{ setup_subnets.results | map(attribute=''subnet.id'') }}' launch_template: name: '{{ lt.template.launch_template_name }}' - wait: True + wait: False register: eks_nodegroup_result check_mode: True diff --git a/tests/integration/targets/eks_nodegroup/tasks/main.yml b/tests/integration/targets/eks_nodegroup/tasks/main.yml index 5c1a76f5764..2ccf8dfe4fb 100644 --- a/tests/integration/targets/eks_nodegroup/tasks/main.yml +++ b/tests/integration/targets/eks_nodegroup/tasks/main.yml @@ -2,7 +2,7 @@ - name: 'eks_nodegroup integration tests' collections: - amazon.aws - - amozon.community + - amazon.community module_defaults: group/aws: access_key: '{{ aws_access_key }}' @@ -13,4 +13,4 @@ - include_tasks: dependecies.yml - include_tasks: full_test.yml always: - - include_tasks: cleanup.yml \ No newline at end of file + - include_tasks: cleanup.yml From 97131eca035974f41ad17357ef9bef8a0a61f675 Mon Sep 17 00:00:00 2001 From: Eli Acherkan <69798096+eacherkan-aternity@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:08:52 +0300 Subject: [PATCH 38/77] ecs_taskdefinition: use `aws_retry` to avoid throttling exception (#2124) SUMMARY Fixes #2123 by adding aws_retry=True to the API calls. ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ADDITIONAL INFORMATION We observed that ecs_taskdefinition intermittently causes a ThrottlingException when running on a task definition with a large number of revisions. Looking at the code, it appears that describe_task_definitions loops over the revisions without using the retry mechanism. This PR attempts to solve the problem by adding aws_retry=True to the API calls. Due to the nature of the problem (intermittent throttling by AWS), I couldn't devise automated tests that validate the fix. Reviewed-by: Alina Buzachis Reviewed-by: Mark Chappell Reviewed-by: Eli Acherkan --- .../fragments/2124-add-retry-to-ecs_taskdefinition.yml | 2 ++ plugins/modules/ecs_taskdefinition.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml diff --git a/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml b/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml new file mode 100644 index 00000000000..cd03aab2d41 --- /dev/null +++ b/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml @@ -0,0 +1,2 @@ +bugfixes: + - ecs_taskdefinition - avoid throttling exceptions on task definitions with a large number of revisions by using the retry mechanism (https://github.com/ansible-collections/community.aws/issues/2123). diff --git a/plugins/modules/ecs_taskdefinition.py b/plugins/modules/ecs_taskdefinition.py index 25a786e4f4c..9f8871def49 100644 --- a/plugins/modules/ecs_taskdefinition.py +++ b/plugins/modules/ecs_taskdefinition.py @@ -916,7 +916,7 @@ def fetch(): if data["nextToken"]: params["nextToken"] = data["nextToken"] - result = self.ecs.list_task_definitions(**params) + result = self.ecs.list_task_definitions(aws_retry=True, **params) data["taskDefinitionArns"] += result["taskDefinitionArns"] data["nextToken"] = result.get("nextToken", None) return data["nextToken"] is not None @@ -929,7 +929,7 @@ def fetch(): return list( sorted( [ - self.ecs.describe_task_definition(taskDefinition=arn)["taskDefinition"] + self.ecs.describe_task_definition(aws_retry=True, taskDefinition=arn)["taskDefinition"] for arn in data["taskDefinitionArns"] ], key=lambda td: td["revision"], @@ -937,7 +937,7 @@ def fetch(): ) def deregister_task(self, taskArn): - response = self.ecs.deregister_task_definition(taskDefinition=taskArn) + response = self.ecs.deregister_task_definition(aws_retry=True, taskDefinition=taskArn) return response["taskDefinition"] From c235bd33fd7676aabf71ff928fb3d59d96c9f157 Mon Sep 17 00:00:00 2001 From: Haris Okanovic Date: Thu, 1 Aug 2024 01:45:17 -0500 Subject: [PATCH 39/77] Add tag support to ec2_placement_group (#2081) SUMMARY Allows users to optionally create EC2 placement groups with tags. Extend integration suite with additional test cases. ISSUE TYPE Feature Pull Request Reviewed-by: Markus Bergholz Reviewed-by: Mark Chappell Reviewed-by: Haris Okanovic Reviewed-by: Alina Buzachis --- .../20240613_ec2_placement_group_tags.yml | 2 + plugins/modules/ec2_placement_group.py | 22 +++ plugins/modules/ec2_placement_group_info.py | 11 ++ .../ec2_placement_group/tasks/main.yml | 149 ++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 changelogs/fragments/20240613_ec2_placement_group_tags.yml diff --git a/changelogs/fragments/20240613_ec2_placement_group_tags.yml b/changelogs/fragments/20240613_ec2_placement_group_tags.yml new file mode 100644 index 00000000000..16e197cb254 --- /dev/null +++ b/changelogs/fragments/20240613_ec2_placement_group_tags.yml @@ -0,0 +1,2 @@ +minor_changes: + - ec2_placement_group - Added support for creating with ``tags`` (https://github.com/ansible-collections/community.aws/pull/2081). diff --git a/plugins/modules/ec2_placement_group.py b/plugins/modules/ec2_placement_group.py index 3cdb5be219e..b045ea34b25 100644 --- a/plugins/modules/ec2_placement_group.py +++ b/plugins/modules/ec2_placement_group.py @@ -43,6 +43,11 @@ default: cluster choices: [ 'cluster', 'spread', 'partition' ] type: str + tags: + description: + - A dict of key value pairs to associate with the placement group + type: dict + version_added: 8.1.0 extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -95,6 +100,14 @@ description: PG strategy type: str sample: "cluster" + tags: + description: Tags associated with the placement group + type: dict + version_added: 8.1.0 + sample: + tags: + some: value1 + other: value2 """ try: @@ -104,6 +117,8 @@ from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule @@ -127,6 +142,7 @@ def search_placement_group(connection, module): "name": placement_group["GroupName"], "state": placement_group["State"], "strategy": placement_group["Strategy"], + "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), } @@ -141,6 +157,7 @@ def get_placement_group_information(connection, name): "name": placement_group["GroupName"], "state": placement_group["State"], "strategy": placement_group["Strategy"], + "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), } @@ -148,6 +165,7 @@ def get_placement_group_information(connection, name): def create_placement_group(connection, module): name = module.params.get("name") strategy = module.params.get("strategy") + tags = module.params.get("tags") partition_count = module.params.get("partition_count") if strategy != "partition" and partition_count: @@ -156,6 +174,8 @@ def create_placement_group(connection, module): params = {} params["GroupName"] = name params["Strategy"] = strategy + if tags: + params["TagSpecifications"] = boto3_tag_specifications(tags, types=["placement-group"]) if partition_count: params["PartitionCount"] = partition_count params["DryRun"] = module.check_mode @@ -169,6 +189,7 @@ def create_placement_group(connection, module): "name": name, "state": "DryRun", "strategy": strategy, + "tags": tags, }, ) except ( @@ -198,6 +219,7 @@ def main(): partition_count=dict(type="int"), state=dict(default="present", choices=["present", "absent"]), strategy=dict(default="cluster", choices=["cluster", "spread", "partition"]), + tags=dict(type="dict"), ) module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/ec2_placement_group_info.py b/plugins/modules/ec2_placement_group_info.py index 05b37488cfe..74b32558246 100644 --- a/plugins/modules/ec2_placement_group_info.py +++ b/plugins/modules/ec2_placement_group_info.py @@ -67,6 +67,14 @@ description: PG strategy type: str sample: "cluster" + tags: + description: Tags associated with the placement group + type: dict + version_added: 8.1.0 + sample: + tags: + some: value1 + other: value2 """ try: @@ -75,6 +83,8 @@ except ImportError: pass # caught by AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict + from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule @@ -102,6 +112,7 @@ def get_placement_groups_details(connection, module): "name": placement_group["GroupName"], "state": placement_group["State"], "strategy": placement_group["Strategy"], + "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), } ) return results diff --git a/tests/integration/targets/ec2_placement_group/tasks/main.yml b/tests/integration/targets/ec2_placement_group/tasks/main.yml index 10695571ebf..eec1b168ef0 100644 --- a/tests/integration/targets/ec2_placement_group/tasks/main.yml +++ b/tests/integration/targets/ec2_placement_group/tasks/main.yml @@ -241,6 +241,105 @@ - pg_3_create_check_mode_idem.placement_group.state == "available" - '"ec2:CreatePlacementGroup" not in pg_3_create_check_mode_idem.resource_actions' + - name: Create a placement group 4 with tags - check_mode + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: present + strategy: cluster + tags: + foo: test1 + bar: test2 + check_mode: true + register: pg_4_create_check_mode + + - assert: + that: + - pg_4_create_check_mode is changed + - pg_4_create_check_mode.placement_group.name == resource_prefix ~ '-pg4' + - pg_4_create_check_mode.placement_group.state == "DryRun" + - pg_4_create_check_mode.placement_group.tags.foo == "test1" + - pg_4_create_check_mode.placement_group.tags.bar == "test2" + - '"ec2:CreatePlacementGroup" in pg_4_create_check_mode.resource_actions' + + - name: Create a placement group 4 with tags + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: present + strategy: cluster + tags: + foo: test1 + bar: test2 + register: pg_4_create + + - assert: + that: + - pg_4_create is changed + - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' + - pg_4_create.placement_group.state == "available" + - pg_4_create.placement_group.tags.foo == "test1" + - pg_4_create.placement_group.tags.bar == "test2" + - '"ec2:CreatePlacementGroup" in pg_4_create.resource_actions' + + - set_fact: + placement_group_names: "{{ placement_group_names + [pg_4_create.placement_group.name] }}" + + - name: Gather information about placement group 4 + community.aws.ec2_placement_group_info: + names: + - '{{ resource_prefix }}-pg4' + register: pg_4_info_result + + - assert: + that: + - pg_4_info_result is not changed + - pg_4_info_result.placement_groups[0].name == resource_prefix ~ '-pg4' + - pg_4_info_result.placement_groups[0].state == "available" + - pg_4_info_result.placement_groups[0].strategy == "cluster" + - pg_4_info_result.placement_groups[0].tags.foo == "test1" + - pg_4_info_result.placement_groups[0].tags.bar == "test2" + - '"ec2:DescribePlacementGroups" in pg_4_info_result.resource_actions' + + - name: Create a placement group 4 with tags - Idempotency + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: present + strategy: cluster + tags: + foo: test1 + bar: test2 + register: pg_4_create + + - assert: + that: + - pg_4_create is not changed + - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' + - pg_4_create.placement_group.state == "available" + - pg_4_create.placement_group.strategy == "cluster" + - pg_4_create.placement_group.tags.foo == "test1" + - pg_4_create.placement_group.tags.bar == "test2" + - '"ec2:CreatePlacementGroup" not in pg_4_create.resource_actions' + + - name: Create a placement group 4 with tags - check_mode Idempotency + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: present + strategy: cluster + tags: + foo: test1 + bar: test2 + check_mode: true + register: pg_4_create_check_mode_idem + + - assert: + that: + - pg_4_create_check_mode_idem is not changed + - pg_4_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg4' + - pg_4_create_check_mode_idem.placement_group.state == "available" + - pg_4_create_check_mode_idem.placement_group.strategy == "cluster" + - pg_4_create_check_mode_idem.placement_group.tags.foo == "test1" + - pg_4_create_check_mode_idem.placement_group.tags.bar == "test2" + - '"ec2:CreatePlacementGroup" not in pg_4_create_check_mode_idem.resource_actions' + - name: List all placement groups. community.aws.ec2_placement_group_info: register: all_ec2_placement_groups @@ -397,6 +496,56 @@ - pg_3_delete_check_mode_idem is not changed - '"ec2:DeletePlacementGroup" not in pg_3_delete_check_mode_idem.resource_actions' + - name: Delete a placement group 4 - check_mode + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: absent + check_mode: true + register: pg_4_delete_check_mode + ignore_errors: true + + - assert: + that: + - pg_4_delete_check_mode is not changed + - pg_4_delete_check_mode.error.code == 'DryRunOperation' + - '"ec2:DeletePlacementGroup" in pg_4_delete_check_mode.resource_actions' + + + - name: Delete a placement group 4 + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: absent + register: pg_4_delete + + - assert: + that: + - pg_4_delete is changed + - '"ec2:DeletePlacementGroup" in pg_4_delete.resource_actions' + + - name: Delete a placement group 4 - Idempotency + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: absent + register: pg_4_delete + + - assert: + that: + - pg_4_delete is not changed + - '"ec2:DeletePlacementGroup" not in pg_4_delete.resource_actions' + + - name: Delete a placement group 4 - check_mode Idempotency + community.aws.ec2_placement_group: + name: '{{ resource_prefix }}-pg4' + state: absent + check_mode: true + register: pg_4_delete_check_mode_idem + ignore_errors: true + + - assert: + that: + - pg_4_delete_check_mode_idem is not changed + - '"ec2:DeletePlacementGroup" not in pg_4_delete_check_mode_idem.resource_actions' + always: - name: Make sure placement groups created during test are deleted From 7862e9edd2da30c905ee8b2cd52f2fe015f11a19 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Mon, 19 Aug 2024 11:01:23 +0200 Subject: [PATCH 40/77] README: Add Communication section with Forum information (#2134) SUMMARY Dear maintainers, As a part of the Consolidating Ansible discussion platforms initiative, this PR adds the communication section template defined by the community to the README. Similar PRs are being raised across all included collections under the ansible-collection org for now. If you have your forum group and/or tags related to the collection, please update corresponding lines by suggesting changes to the PR. If the collection is not present on the Ansible forum yet, please check out the existing tags and groups - use what suits your collection. If there is no appropritate tag and group yet, please request one. Then update corresponding lines by suggesting changes to the PR. Presence in the forum will soon likely become a part of the Collection inclusion requirements. ISSUE TYPE Docs Pull Request COMPONENT NAME README.md Reviewed-by: Mark Chappell Reviewed-by: Alina Buzachis --- README.md | 13 +++++++++++++ changelogs/fragments/0-readme.yml | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 changelogs/fragments/0-readme.yml diff --git a/README.md b/README.md index 1cc7ff4ba7c..efe4d130812 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,19 @@ The Ansible Community AWS collection includes a variety of Ansible content to he AWS related modules and plugins supported by the Ansible Cloud team are in the [amazon.aws](https://github.com/ansible-collections/amazon.aws) collection. +## Communication + +* Join the Ansible forum: + * [Get Help](https://forum.ansible.com/c/help/6): get help or help others. + * [Posts tagged with 'aws'](https://forum.ansible.com/tag/aws): subscribe to participate in collection-related conversations. + * [AWS Working Group](https://forum.ansible.com/g/AWS): by joining the team you will automatically get subscribed to the posts tagged with [aws](https://forum.ansible.com/tags). + * [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts. + * [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events. + +* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes. + +For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html). + ## Ansible version compatibility Tested with the Ansible Core >= 2.15.0 versions, and the current development version of Ansible. Ansible Core versions before 2.15.0 are not supported. diff --git a/changelogs/fragments/0-readme.yml b/changelogs/fragments/0-readme.yml new file mode 100644 index 00000000000..6ae0307d203 --- /dev/null +++ b/changelogs/fragments/0-readme.yml @@ -0,0 +1,3 @@ +--- +trivial: + - README.md - Add Communication section with Forum information. From 728b9100e22c39e3327772ea0aae691995c50563 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Tue, 3 Sep 2024 08:55:32 +0200 Subject: [PATCH 41/77] CONTRIBUTING.md: remove IRC --- CONTRIBUTING.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb41c927453..4aad92bd23e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,9 +114,6 @@ For general information on running the integration tests see Ignore the part about `source hacking/env-setup`. That's only applicable for working on `ansible-core`. You should be able to use the `ansible-test` that's installed with Ansible generally. Look at [the section on configuration for cloud tests](https://docs.ansible.com/ansible/devel/dev_guide/testing_integration.html#other-configuration-for-cloud-tests). -For questions about writing tests the Ansible AWS community can -be found on Libera.Chat IRC as detailed below. - - [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) - Details on contributing to Ansible - [Contributing to Collections](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#contributing-to-collections) - How to check out collection git repositories correctly @@ -129,10 +126,3 @@ be found on Libera.Chat IRC as detailed below. The `community.aws` collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). Please read and familiarize yourself with this document. - -### IRC -Our IRC channels may require you to register your nickname. If you receive an error when you connect, see -[Libera.Chat's Nickname Registration guide](https://libera.chat/guides/registration) for instructions. - -The `#ansible-aws` channel on [irc.libera.chat](https://libera.chat/) is the main and official place to discuss use and development -of the `community.aws` collection. From 87e2152254b35949343df70c8fc68af3825573a6 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:41:54 +0200 Subject: [PATCH 42/77] ec2_vpc_vgw - fix call to parent static method in class VGWRetry (#2140) SUMMARY When trying to create a VPN virtual gateway with a non-existent VPC id, module fails incorrectly with the following error \\"/tmp/ansible_community.aws.ec2_vpc_vgw_payload_t4kolii1/ansible_community.aws.ec2_vpc_vgw_payload.zip/ansible_collections/community/aws/plugins/modules/ec2_vpc_vgw.py\\", line 173, in found\\nTypeError: super(type, obj): obj must be an instance or subtype of type The fix consists in adding argument to super() ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_vpc_vgw Reviewed-by: Mark Chappell --- .../fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml | 3 +++ plugins/modules/ec2_vpc_vgw.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml diff --git a/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml b/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml new file mode 100644 index 00000000000..671c7f8f565 --- /dev/null +++ b/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: + - ec2_vpc_vgw - Fix call to parent static method in class ``VGWRetry`` (https://github.com/ansible-collections/community.aws/pull/2140). \ No newline at end of file diff --git a/plugins/modules/ec2_vpc_vgw.py b/plugins/modules/ec2_vpc_vgw.py index 135658f7639..1b2af15a5ab 100644 --- a/plugins/modules/ec2_vpc_vgw.py +++ b/plugins/modules/ec2_vpc_vgw.py @@ -170,7 +170,7 @@ def found(response_code, catch_extra_error_codes=None): response_code = (response_code,) for code in response_code: - if super().found(response_code, catch_extra_error_codes): + if super(VGWRetry, VGWRetry).found(response_code, catch_extra_error_codes): return True return False From f2f62847c6fd3209847b63ae753405d64e612522 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Tue, 10 Sep 2024 02:13:32 -0700 Subject: [PATCH 43/77] elb_network_lb: Update tests to use valid cert (#2142) SUMMARY The tests for network load balancers use an invalid cert: community.aws/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml Line 7 in d79e817 size: 4096 . As per AWS documentation Network load balancers only support RSA certs with up to 3072 bit keys. ISSUE TYPE Bugfix Pull Request COMPONENT NAME elb_network_lb ADDITIONAL INFORMATION https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#tls-listener-certificates Supported key algorithms RSA 1024-bit RSA 2048-bit RSA 3072-bit ECDSA 256-bit ECDSA 384-bit ECDSA 521-bit related to mattclay/aws-terminator#309 Reviewed-by: Mark Chappell --- .../2142-elb_network_lb-update-tests-to-use-valid-cert.yml | 2 ++ .../integration/targets/elb_network_lb/tasks/generate-certs.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml diff --git a/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml b/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml new file mode 100644 index 00000000000..9fb16b1e437 --- /dev/null +++ b/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml @@ -0,0 +1,2 @@ +trivial: + - elb_network_lb - Update tests to use valid cert RSA 3072-bit instead of 4096 (https://github.com/ansible-collections/community.aws/pull/2142). diff --git a/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml b/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml index a79289a958d..dccfa6df65b 100644 --- a/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml +++ b/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml @@ -4,7 +4,7 @@ - name: 'Generate SSL Keys' community.crypto.openssl_privatekey: path: '{{ remote_tmp_dir }}/{{ item }}-key.pem' - size: 4096 + size: 3072 loop: - 'ca' - 'cert1' From f1812b31a973f54c1e523765e4b3bf7663f335a6 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Mon, 16 Sep 2024 09:30:17 +0200 Subject: [PATCH 44/77] Docs: remove IRC/ML remnants --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- README.md | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f90bd1ad861..94645b576fa 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -17,10 +17,10 @@ contact_links: url: https://docs.ansible.com/ansible/latest/community/code_of_conduct.html?utm_medium=github&utm_source=issue_template_chooser_ansible_collections about: Be nice to other members of the community. - name: Talks to the community - url: https://docs.ansible.com/ansible/latest/community/communication.html?utm_medium=github&utm_source=issue_template_chooser#mailing-list-information + url: https://docs.ansible.com/ansible/devel/community/communication.html about: Please ask and answer usage questions here - name: Working groups - url: https://github.com/ansible/community/wiki + url: https://forum.ansible.com/g about: Interested in improving a specific area? Become a part of a working group! - name: For Enterprise url: https://www.ansible.com/products/engine?utm_medium=github&utm_source=issue_template_chooser_ansible_collections diff --git a/README.md b/README.md index efe4d130812..d63c845a58e 100644 --- a/README.md +++ b/README.md @@ -126,10 +126,6 @@ You can either call modules by their Fully Qualified Collection Name (FQCN), suc We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Community AWS collection repository](https://github.com/ansible-collections/community.aws). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for more details. -You can also join us on: - -- Libera.Chat IRC - the ``#ansible-aws`` [irc.libera.chat](https://libera.chat/) channel - ### More information about contributing - [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) - Details on contributing to Ansible From 008b515022ef0dbc19f964e174f803e48de9871f Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 20 Sep 2024 11:16:50 +0200 Subject: [PATCH 45/77] Fix sanity errors happening with the ansible devel branch (#2146) SUMMARY Fix sanity errors happening with the ansible devel branch ERROR: Found 5 pylint issue(s) which need to be resolved: ERROR: plugins/modules/ec2_vpc_vgw.py:504:13: used-before-assignment: Using variable 'deleted_vgw' before assignment ERROR: plugins/modules/ecs_cluster.py:342:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_cluster.py:364:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_service.py:1251:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_service.py:1266:12: unreachable: Unreachable code ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin --- changelogs/fragments/20240919-fix_sanity.yml | 2 ++ plugins/modules/ec2_vpc_vgw.py | 1 + plugins/modules/ecs_cluster.py | 3 +-- plugins/modules/ecs_service.py | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/20240919-fix_sanity.yml diff --git a/changelogs/fragments/20240919-fix_sanity.yml b/changelogs/fragments/20240919-fix_sanity.yml new file mode 100644 index 00000000000..ae45638f926 --- /dev/null +++ b/changelogs/fragments/20240919-fix_sanity.yml @@ -0,0 +1,2 @@ +trivial: + - "Fix sanity errors happening with the ansible devel branch (e.g., unreachable code, using variable before assignment)." diff --git a/plugins/modules/ec2_vpc_vgw.py b/plugins/modules/ec2_vpc_vgw.py index 1b2af15a5ab..b6f91e5dfc1 100644 --- a/plugins/modules/ec2_vpc_vgw.py +++ b/plugins/modules/ec2_vpc_vgw.py @@ -420,6 +420,7 @@ def ensure_vgw_absent(client, module): changed = False params = dict() result = dict() + deleted_vgw = None params["Name"] = module.params.get("name") params["VpcId"] = module.params.get("vpc_id") params["Type"] = module.params.get("type") diff --git a/plugins/modules/ecs_cluster.py b/plugins/modules/ecs_cluster.py index 5a0470eea8e..0500a27ffdb 100644 --- a/plugins/modules/ecs_cluster.py +++ b/plugins/modules/ecs_cluster.py @@ -339,7 +339,7 @@ def main(): elif module.params["state"] == "has_instances": if not existing: module.fail_json(msg="Cluster '" + module.params["name"] + " not found.") - return + # it exists, so we should delete it and mark changed. # return info about the cluster deleted delay = module.params["delay"] @@ -361,7 +361,6 @@ def main(): + str(delay) + " seconds each." ) - return module.exit_json(**results) diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index e6ecf736b5c..be2735cf6da 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -1248,7 +1248,7 @@ def main(): elif module.params["state"] == "deleting": if not existing: module.fail_json(msg="Service '" + module.params["name"] + " not found.") - return + # it exists, so we should delete it and mark changed. # return info about the cluster deleted delay = module.params["delay"] @@ -1263,7 +1263,6 @@ def main(): time.sleep(delay) if i is repeat - 1: module.fail_json(msg=f"Service still not deleted after {repeat} tries of {delay} seconds each.") - return module.exit_json(**results) From f54383b0f34628a27c0325ebda8120cdfd484f63 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 24 Sep 2024 16:55:18 +0200 Subject: [PATCH 46/77] Create tests/sanity/ignore-2.19.txt (#2155) SUMMARY Create tests/sanity/ignore-2.19.txt ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- changelogs/fragments/20240924-create-ignore-2.19.yml | 2 ++ tests/sanity/ignore-2.19.txt | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/20240924-create-ignore-2.19.yml create mode 100644 tests/sanity/ignore-2.19.txt diff --git a/changelogs/fragments/20240924-create-ignore-2.19.yml b/changelogs/fragments/20240924-create-ignore-2.19.yml new file mode 100644 index 00000000000..cbb265dc813 --- /dev/null +++ b/changelogs/fragments/20240924-create-ignore-2.19.yml @@ -0,0 +1,2 @@ +trivial: + - "Add tests/sanity/ignore-2.19.txt file." diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-2.19.txt new file mode 100644 index 00000000000..e925c5a05f2 --- /dev/null +++ b/tests/sanity/ignore-2.19.txt @@ -0,0 +1,2 @@ +plugins/modules/ecs_cluster.py pylint:collection-deprecated-version +plugins/modules/glue_connection.py pylint:collection-deprecated-version From d59fa93cf463cbb194cd10ab1bb0e59763a5b3f0 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Wed, 25 Sep 2024 18:00:10 +0200 Subject: [PATCH 47/77] autoscaling_instance_refresh - prepare modules for promotion (#2150) SUMMARY Closes #2120 Closes #2019 Closes #2016 Prepare modules autoscaling_instance_refresh and autoscaling_instance_refresh_info for promotion: Refactor modules to use common code from ansible_collections.amazon.aws.plugins.module_utils.autoscaling Add type hinting Update integration tests ISSUE TYPE Feature Pull Request Reviewed-by: GomathiselviS Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis --- ...r-autoscaling_instance_refresh-modules.yml | 7 + .../modules/autoscaling_instance_refresh.py | 238 +++++++----- .../autoscaling_instance_refresh_info.py | 230 ++++++------ .../tasks/instance_refresh_info.yml | 99 +++++ .../tasks/main.yml | 351 ++---------------- .../tasks/refresh_and_cancel_three_times.yml | 19 +- .../tasks/start_cancel_instance_refresh.yml | 206 ++++++++++ .../vars/main.yml | 0 .../test_autoscaling_instance_refresh.py | 28 ++ 9 files changed, 625 insertions(+), 553 deletions(-) create mode 100644 changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml create mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml create mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/vars/main.yml create mode 100644 tests/unit/plugins/modules/test_autoscaling_instance_refresh.py diff --git a/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml b/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml new file mode 100644 index 00000000000..0d3f2efa2f4 --- /dev/null +++ b/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml @@ -0,0 +1,7 @@ +--- +bugfixes: + - autoscaling_instance_refresh - Fix typo in module ``exit_json`` (https://github.com/ansible-collections/community.aws/issues/2019). +minor_changes: + - autoscaling_instance_refresh - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). + - autoscaling_instance_refresh - Add support for ``skip_matching`` and ``max_healthy_percentage`` in ``preference`` (https://github.com/ansible-collections/community.aws/pull/2150). + - autoscaling_instance_refresh_info - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). \ No newline at end of file diff --git a/plugins/modules/autoscaling_instance_refresh.py b/plugins/modules/autoscaling_instance_refresh.py index b301fea9439..b337b5b1f52 100644 --- a/plugins/modules/autoscaling_instance_refresh.py +++ b/plugins/modules/autoscaling_instance_refresh.py @@ -12,7 +12,7 @@ description: - Start or cancel an EC2 Auto Scaling Group instance refresh in AWS. - Can be used with M(community.aws.autoscaling_instance_refresh_info) to track the subsequent progress. - - Prior to release 5.0.0 this module was called C(community.aws.ec2_asg_instance_refresh). + - Prior to release 5.0.0 this module was called M(community.aws.ec2_asg_instance_refresh). The usage did not change. author: - "Dan Khersonsky (@danquixote)" @@ -30,7 +30,7 @@ required: true strategy: description: - - The strategy to use for the instance refresh. The only valid value is C(Rolling). + - The strategy to use for the instance refresh. The only valid value is V(Rolling). - A rolling update is an update that is applied to all instances in an Auto Scaling group until all instances have been updated. - A rolling update can fail due to failed health checks or if instances are on standby or are protected from scale in. - If the rolling update process fails, any instances that were already replaced are not rolled back to their previous configuration. @@ -40,15 +40,16 @@ description: - Set of preferences associated with the instance refresh request. - If not provided, the default values are used. - - For I(min_healthy_percentage), the default value is C(90). - - For I(instance_warmup), the default is to use the value specified for the health check grace period for the Auto Scaling group. - - Can not be specified when I(state) is set to 'cancelled'. + - For O(preferences.min_healthy_percentage), the default value is V(90). + - For O(preferences.instance_warmup), the default is to use the value specified for the health check grace period for the Auto Scaling group. + - Can not be specified when O(state=cancelled). required: false suboptions: min_healthy_percentage: description: - Total percent of capacity in ASG that must remain healthy during instance refresh to allow operation to continue. - It is rounded up to the nearest integer. + - Value range is V(0) to V(100). type: int default: 90 instance_warmup: @@ -57,6 +58,21 @@ - During this time, Amazon EC2 Auto Scaling does not immediately move on to the next replacement. - The default is to use the value for the health check grace period defined for the group. type: int + skip_matching: + description: + - Indicates whether skip matching is enabled. + - If enabled V(true), then Amazon EC2 Auto Scaling skips replacing instances that match the desired configuration. + type: bool + version_added: 9.0.0 + max_healthy_percentage: + description: + - Specifies the maximum percentage of the group that can be in service and healthy, or pending, + to support your workload when replacing instances. + - The value is expressed as a percentage of the desired capacity of the Auto Scaling group. + - Value range is V(100) to V(200). + - When specified, you must also specify O(preferences.min_healthy_percentage), and the difference between them cannot be greater than V(100). + type: int + version_added: 9.0.0 type: dict extends_documentation_fragment: - amazon.aws.common.modules @@ -84,98 +100,117 @@ preferences: min_healthy_percentage: 91 instance_warmup: 60 + skip_matching: true """ RETURN = r""" ---- -instance_refresh_id: - description: instance refresh id - returned: success - type: str - sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" -auto_scaling_group_name: - description: Name of autoscaling group - returned: success - type: str - sample: "public-webapp-production-1" -status: - description: - - The current state of the group when DeleteAutoScalingGroup is in progress. - - The following are the possible statuses - - Pending -- The request was created, but the operation has not started. - - InProgress -- The operation is in progress. - - Successful -- The operation completed successfully. - - Failed -- The operation failed to complete. You can troubleshoot using the status reason and the scaling activities. - - Cancelling -- - - An ongoing operation is being cancelled. - - Cancellation does not roll back any replacements that have already been completed, - - but it prevents new replacements from being started. - - Cancelled -- The operation is cancelled. - returned: success - type: str - sample: "Pending" -start_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" -end_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" -percentage_complete: - description: the % of completeness - returned: success - type: int - sample: 100 -instances_to_update: - description: num. of instance to update - returned: success - type: int - sample: 5 +instance_refreshes: + description: Details of the instance refreshes for the Auto Scaling group. + returned: always + type: complex + contains: + instance_refresh_id: + description: Instance refresh id. + returned: success + type: str + sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" + auto_scaling_group_name: + description: Name of autoscaling group. + returned: success + type: str + sample: "public-webapp-production-1" + status: + description: + - The current state of the group when DeleteAutoScalingGroup is in progress. + - The following are the possible statuses + - Pending - The request was created, but the operation has not started. + - InProgress - The operation is in progress. + - Successful - The operation completed successfully. + - Failed - The operation failed to complete. + You can troubleshoot using the status reason and the scaling activities. + - Cancelling - An ongoing operation is being cancelled. + Cancellation does not roll back any replacements that have already been + completed, but it prevents new replacements from being started. + - Cancelled - The operation is cancelled. + returned: success + type: str + sample: "Pending" + preferences: + description: The preferences for an instance refresh. + returned: always + type: dict + sample: { + 'AlarmSpecification': { + 'Alarms': [ + 'my-alarm', + ], + }, + 'AutoRollback': True, + 'InstanceWarmup': 200, + 'MinHealthyPercentage': 90, + 'ScaleInProtectedInstances': 'Ignore', + 'SkipMatching': False, + 'StandbyInstances': 'Ignore', + } + start_time: + description: The date and time this ASG was created, in ISO 8601 format. + returned: success + type: str + sample: "2015-11-25T00:05:36.309Z" + end_time: + description: The date and time this ASG was created, in ISO 8601 format. + returned: success + type: str + sample: "2015-11-25T00:05:36.309Z" + percentage_complete: + description: the % of completeness. + returned: success + type: int + sample: 100 + instances_to_update: + description: number of instances to update. + returned: success + type: int + sample: 5 """ -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Dict +from typing import Optional +from typing import Union from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import AnsibleAutoScalingError +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import cancel_instance_refresh +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import describe_instance_refreshes +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import start_instance_refresh from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def start_or_cancel_instance_refresh(conn, module): +def validate_healthy_percentage(preferences: Dict[str, Union[bool, int]]) -> Optional[str]: + min_healthy_percentage = preferences.get("min_healthy_percentage") + max_healthy_percentage = preferences.get("max_healthy_percentage") + + if min_healthy_percentage is not None and (min_healthy_percentage < 0 or min_healthy_percentage > 100): + return "The value range for the min_healthy_percentage is 0 to 100." + if max_healthy_percentage is not None: + if max_healthy_percentage < 100 or max_healthy_percentage > 200: + return "The value range for the max_healthy_percentage is 100 to 200." + if min_healthy_percentage is None: + return "You must also specify min_healthy_percentage when max_healthy_percentage is specified." + if (max_healthy_percentage - min_healthy_percentage) > 100: + return "The difference between the max_healthy_percentage and min_healthy_percentage cannot be greater than 100." + return None + + +def start_or_cancel_instance_refresh(conn, module: AnsibleAWSModule) -> None: """ Args: conn (boto3.AutoScaling.Client): Valid Boto3 ASG client. module: AnsibleAWSModule object - - Returns: - { - "instance_refreshes": [ - { - 'auto_scaling_group_name': 'ansible-test-hermes-63642726-asg', - 'instance_refresh_id': '6507a3e5-4950-4503-8978-e9f2636efc09', - 'instances_to_update': 1, - 'percentage_complete': 0, - "preferences": { - "instance_warmup": 60, - "min_healthy_percentage": 90, - "skip_matching": false - }, - 'start_time': '2021-02-04T03:39:40+00:00', - 'status': 'Cancelling', - 'status_reason': 'Replacing instances before cancelling.', - } - ] - } """ asg_state = module.params.get("state") @@ -183,24 +218,25 @@ def start_or_cancel_instance_refresh(conn, module): preferences = module.params.get("preferences") args = {} - args["AutoScalingGroupName"] = asg_name if asg_state == "started": args["Strategy"] = module.params.get("strategy") if preferences: if asg_state == "cancelled": module.fail_json(msg="can not pass preferences dict when canceling a refresh") - _prefs = scrub_none_parameters(preferences) - args["Preferences"] = snake_dict_to_camel_dict(_prefs, capitalize_first=True) + error = validate_healthy_percentage(preferences) + if error: + module.fail_json(msg=error) + args["Preferences"] = snake_dict_to_camel_dict(scrub_none_parameters(preferences), capitalize_first=True) cmd_invocations = { - "cancelled": conn.cancel_instance_refresh, - "started": conn.start_instance_refresh, + "cancelled": cancel_instance_refresh, + "started": start_instance_refresh, } try: if module.check_mode: + ongoing_refresh = describe_instance_refreshes(conn, auto_scaling_group_name=asg_name).get( + "InstanceRefreshes", [] + ) if asg_state == "started": - ongoing_refresh = conn.describe_instance_refreshes(AutoScalingGroupName=asg_name).get( - "InstanceRefreshes", "[]" - ) if ongoing_refresh: module.exit_json( changed=False, @@ -209,26 +245,23 @@ def start_or_cancel_instance_refresh(conn, module): else: module.exit_json(changed=True, msg="Would have started instance refresh if not in check mode.") elif asg_state == "cancelled": - ongoing_refresh = conn.describe_instance_refreshes(AutoScalingGroupName=asg_name).get( - "InstanceRefreshes", "[]" - )[0] - if ongoing_refresh.get("Status", "") in ["Cancelling", "Cancelled"]: + if ongoing_refresh and ongoing_refresh[0].get("Status", "") in ["Cancelling", "Cancelled"]: module.exit_json( changed=False, msg="In check_mode - Instance Refresh already cancelled or is pending cancellation.", ) elif not ongoing_refresh: - module.exit_json(chaned=False, msg="In check_mode - No active referesh found, nothing to cancel.") + module.exit_json(changed=False, msg="In check_mode - No active referesh found, nothing to cancel.") else: module.exit_json(changed=True, msg="Would have cancelled instance refresh if not in check mode.") - result = cmd_invocations[asg_state](aws_retry=True, **args) - instance_refreshes = conn.describe_instance_refreshes( - AutoScalingGroupName=asg_name, InstanceRefreshIds=[result["InstanceRefreshId"]] + instance_refresh_id = cmd_invocations[asg_state](conn, auto_scaling_group_name=asg_name, **args) + response = describe_instance_refreshes( + conn, auto_scaling_group_name=asg_name, instance_refresh_ids=[instance_refresh_id] ) - result = dict(instance_refreshes=camel_dict_to_snake_dict(instance_refreshes["InstanceRefreshes"][0])) - return module.exit_json(**result) - except (BotoCoreError, ClientError) as e: - module.fail_json_aws(e, msg=f"Failed to {asg_state.replace('ed', '')} InstanceRefresh") + result = dict(instance_refreshes=camel_dict_to_snake_dict(response["InstanceRefreshes"][0])) + module.exit_json(**result) + except AnsibleAutoScalingError as e: + module.fail_json_aws(e, msg=f"Failed to {asg_state.replace('ed', '')} InstanceRefresh: {e}") def main(): @@ -246,6 +279,8 @@ def main(): options=dict( min_healthy_percentage=dict(type="int", default=90), instance_warmup=dict(type="int"), + skip_matching=dict(type="bool"), + max_healthy_percentage=dict(type="int"), ), ), ) @@ -254,10 +289,7 @@ def main(): argument_spec=argument_spec, supports_check_mode=True, ) - autoscaling = module.client( - "autoscaling", - retry_decorator=AWSRetry.jittered_backoff(retries=10, catch_extra_error_codes=["InstanceRefreshInProgress"]), - ) + autoscaling = module.client("autoscaling") start_or_cancel_instance_refresh(autoscaling, module) diff --git a/plugins/modules/autoscaling_instance_refresh_info.py b/plugins/modules/autoscaling_instance_refresh_info.py index 639940b1b77..1d3bf8fe90c 100644 --- a/plugins/modules/autoscaling_instance_refresh_info.py +++ b/plugins/modules/autoscaling_instance_refresh_info.py @@ -11,8 +11,8 @@ short_description: Gather information about EC2 Auto Scaling Group (ASG) Instance Refreshes in AWS description: - Describes one or more instance refreshes. - - You can determine the status of a request by looking at the I(status) parameter. - - Prior to release 5.0.0 this module was called C(community.aws.ec2_asg_instance_refresh_info). + - You can determine the status of a request by looking at the RV(instance_refreshes.status) return value. + - Prior to release 5.0.0 this module was called M(community.aws.ec2_asg_instance_refresh_info). The usage did not change. author: - "Dan Khersonsky (@danquixote)" @@ -34,7 +34,7 @@ type: str max_records: description: - - The maximum number of items to return with this call. The default value is 50 and the maximum value is 100. + - The maximum number of items to return with this call. The default value is V(50) and the maximum value is V(100). type: int required: false extends_documentation_fragment: @@ -70,131 +70,137 @@ """ RETURN = r""" ---- -instance_refresh_id: - description: instance refresh id - returned: success - type: str - sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" -auto_scaling_group_name: - description: Name of autoscaling group - returned: success - type: str - sample: "public-webapp-production-1" -status: - description: - - The current state of the group when DeleteAutoScalingGroup is in progress. - - The following are the possible statuses - - C(Pending) - The request was created, but the operation has not started. - - C(InProgress) - The operation is in progress. - - C(Successful) - The operation completed successfully. - - C(Failed) - The operation failed to complete. - You can troubleshoot using the status reason and the scaling activities. - - C(Cancelling) - An ongoing operation is being cancelled. - Cancellation does not roll back any replacements that have already been - completed, but it prevents new replacements from being started. - - C(Cancelled) - The operation is cancelled.' - returned: success - type: str - sample: "Pending" -start_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" -end_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" -percentage_complete: - description: the % of completeness - returned: success - type: int - sample: 100 -instances_to_update: - description: num. of instance to update - returned: success - type: int - sample: 5 +next_token: + description: A string that indicates that the response contains more items than can be returned in a single response. + returned: always + type: str +instance_refreshes: + description: A list of instance refreshes. + returned: always + type: complex + contains: + instance_refresh_id: + description: instance refresh id. + returned: success + type: str + sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" + auto_scaling_group_name: + description: Name of autoscaling group. + returned: success + type: str + sample: "public-webapp-production-1" + status: + description: + - The current state of the group when DeleteAutoScalingGroup is in progress. + - The following are the possible statuses + - Pending - The request was created, but the operation has not started. + - InProgress - The operation is in progress. + - Successful - The operation completed successfully. + - Failed - The operation failed to complete. + You can troubleshoot using the status reason and the scaling activities. + - Cancelling - An ongoing operation is being cancelled. + Cancellation does not roll back any replacements that have already been + completed, but it prevents new replacements from being started. + - Cancelled - The operation is cancelled. + returned: success + type: str + sample: "Pending" + preferences: + description: The preferences for an instance refresh. + returned: always + type: dict + sample: { + 'AlarmSpecification': { + 'Alarms': [ + 'my-alarm', + ], + }, + 'AutoRollback': True, + 'InstanceWarmup': 200, + 'MinHealthyPercentage': 90, + 'ScaleInProtectedInstances': 'Ignore', + 'SkipMatching': False, + 'StandbyInstances': 'Ignore', + } + start_time: + description: The date and time this ASG was created, in ISO 8601 format. + returned: success + type: str + sample: "2015-11-25T00:05:36.309Z" + end_time: + description: The date and time this ASG was created, in ISO 8601 format. + returned: success + type: str + sample: "2015-11-25T00:05:36.309Z" + percentage_complete: + description: the % of completeness + returned: success + type: int + sample: 100 + instances_to_update: + description: number of instances to update. + returned: success + type: int + sample: 5 """ -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import AnsibleAutoScalingError +from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import describe_instance_refreshes from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def find_asg_instance_refreshes(conn, module): +def format_response(response: Dict[str, Any]) -> Dict[str, Any]: + result = {} + if "InstanceRefreshes" in response: + instance_refreshes_dict = { + "instance_refreshes": response["InstanceRefreshes"], + "next_token": response.get("NextToken", ""), + } + result = camel_dict_to_snake_dict(instance_refreshes_dict) + return result + + +def find_asg_instance_refreshes(client, module: AnsibleAWSModule) -> None: """ Args: - conn (boto3.AutoScaling.Client): Valid Boto3 ASG client. + client (boto3.AutoScaling.Client): Valid Boto3 ASG client. module: AnsibleAWSModule object - - Returns: - { - "instance_refreshes": [ - { - 'auto_scaling_group_name': 'ansible-test-hermes-63642726-asg', - 'instance_refresh_id': '6507a3e5-4950-4503-8978-e9f2636efc09', - 'instances_to_update': 1, - 'percentage_complete': 0, - "preferences": { - "instance_warmup": 60, - "min_healthy_percentage": 90, - "skip_matching": false - }, - 'start_time': '2021-02-04T03:39:40+00:00', - 'status': 'Cancelled', - 'status_reason': 'Cancelled due to user request.', - } - ], - 'next_token': 'string' - } """ - asg_name = module.params.get("name") - asg_ids = module.params.get("ids") - asg_next_token = module.params.get("next_token") - asg_max_records = module.params.get("max_records") - - args = {} - args["AutoScalingGroupName"] = asg_name - if asg_ids: - args["InstanceRefreshIds"] = asg_ids - if asg_next_token: - args["NextToken"] = asg_next_token - if asg_max_records: - args["MaxRecords"] = asg_max_records - try: - instance_refreshes_result = {} - response = conn.describe_instance_refreshes(**args) - if "InstanceRefreshes" in response: - instance_refreshes_dict = dict( - instance_refreshes=response["InstanceRefreshes"], next_token=response.get("next_token", "") - ) - instance_refreshes_result = camel_dict_to_snake_dict(instance_refreshes_dict) - - while "NextToken" in response: - args["NextToken"] = response["NextToken"] - response = conn.describe_instance_refreshes(**args) - if "InstanceRefreshes" in response: - instance_refreshes_dict = camel_dict_to_snake_dict( - dict(instance_refreshes=response["InstanceRefreshes"], next_token=response.get("next_token", "")) + max_records = module.params.get("max_records") + response = describe_instance_refreshes( + client, + auto_scaling_group_name=module.params.get("name"), + instance_refresh_ids=module.params.get("ids"), + next_token=module.params.get("next_token"), + max_records=max_records, + ) + instance_refreshes_result = format_response(response) + + if max_records is None: + while "NextToken" in response: + response = describe_instance_refreshes( + client, + auto_scaling_group_name=module.params.get("name"), + instance_refresh_ids=module.params.get("ids"), + next_token=response["NextToken"], + max_records=max_records, ) - instance_refreshes_result.update(instance_refreshes_dict) + f_response = format_response(response) + if "instance_refreshes" in f_response: + instance_refreshes_result["instance_refreshes"].extend(f_response["instance_refreshes"]) + instance_refreshes_result["next_token"] = f_response["next_token"] - return module.exit_json(**instance_refreshes_result) - except (BotoCoreError, ClientError) as e: - module.fail_json_aws(e, msg="Failed to describe InstanceRefreshes") + module.exit_json(changed=False, **instance_refreshes_result) + except AnsibleAutoScalingError as e: + module.fail_json_aws(e, msg=f"Failed to describe InstanceRefreshes: {e}") def main(): @@ -210,7 +216,7 @@ def main(): supports_check_mode=True, ) - autoscaling = module.client("autoscaling", retry_decorator=AWSRetry.jittered_backoff(retries=10)) + autoscaling = module.client("autoscaling") find_asg_instance_refreshes(autoscaling, module) diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml new file mode 100644 index 00000000000..bf95b1668db --- /dev/null +++ b/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml @@ -0,0 +1,99 @@ +--- +- name: Test getting info for an ASG name + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + register: output + +- name: Assert that the correct number of records are returned + assert: + that: + - output.instance_refreshes | map(attribute='instance_refresh_id') | unique | length == 7 + +- name: Test using fake refresh ID + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + ids: ['0e367f58-blabla-bla-bla-ca870dc5dbfe'] + register: output + +- name: Assert that no record is returned + assert: + that: + - output.instance_refreshes | length == 0 + +- name: Test using a real refresh ID + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + ids: [ '{{ refreshout.instance_refreshes.instance_refresh_id }}' ] + register: output + +- name: Assert that the correct record is returned + assert: + that: + - output.instance_refreshes | length == 1 + +- name: Test getting info for an ASG name which doesn't exist + autoscaling_instance_refresh_info: + name: n0n3x1stentname27b + ignore_errors: true + register: output + +- name: Assert that module failed to return record + assert: + that: + - "'Failed to describe InstanceRefreshes: An error occurred (ValidationError) when calling the DescribeInstanceRefreshes operation: AutoScalingGroup name not found - AutoScalingGroup n0n3x1stentname27b not found' in output.msg" + +- name: Retrieve instance refresh info + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + register: output + +- name: Assert that the correct number of records are returned + assert: + that: + - output.instance_refreshes | length == 7 + +- name: Retrieve instance refresh info using next_token + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + next_token: "fake-token-123" + ignore_errors: true + register: output + +- name: Assert that valid message with fake-token is returned + assert: + that: + - '"Failed to describe InstanceRefreshes: An error occurred (InvalidNextToken) when calling the DescribeInstanceRefreshes operation: The token ''********'' is invalid." in output.msg' + +- name: Retrieve instance refresh info using max_records + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + max_records: 1 + register: output_with_token + +- name: Assert that max records=1 returns no more than one record + assert: + that: + - output_with_token.instance_refreshes | length == 1 + +- name: Retrieve instance refresh using valid token + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + next_token: "{{ output_with_token.next_token }}" + register: output + +- name: Assert that valid message with real-token is returned + assert: + that: + - output.instance_refreshes | length == 6 + +- name: Test using both real nextToken and max_records=1 + autoscaling_instance_refresh_info: + name: "{{ asg_name }}" + max_records: 1 + next_token: "{{ output_with_token.next_token }}" + register: output + +- name: Assert that only one instance refresh is returned + assert: + that: + - output.instance_refreshes | length == 1 diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml index 5b754d47d69..cdfa2e00106 100644 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml +++ b/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml @@ -35,7 +35,7 @@ Name: "{{ subnet_name }}" register: testing_subnet - - name: create routing rules + - name: Create routing rules ec2_vpc_route_table: vpc_id: "{{ testing_vpc.vpc.id }}" tags: @@ -46,7 +46,7 @@ subnets: - "{{ testing_subnet.subnet.id }}" - - name: create a security group with the vpc created in the ec2_setup + - name: Create a security group with the vpc created in the ec2_setup ec2_security_group: name: "{{ sg_name }}" description: a security group for ansible tests @@ -62,7 +62,7 @@ cidr_ip: 0.0.0.0/0 register: sg - - name: ensure launch configs exist + - name: Ensure launch configs exist autoscaling_launch_config: name: "{{ item }}" assign_public_ip: true @@ -80,7 +80,7 @@ - "{{ lc_name_1 }}" - "{{ lc_name_2 }}" - - name: launch asg and do not wait for instances to be deemed healthy (no ELB) + - name: Launch asg and do not wait for instances to be deemed healthy (no ELB) autoscaling_group: name: "{{ asg_name }}" launch_config_name: "{{ lc_name_1 }}" @@ -92,335 +92,44 @@ state: present register: output - - assert: + - name: Assert that there is no viable instance + assert: that: - "output.viable_instances == 0" # ============================================================ - - - name: test invalid cancelation - V1 - (pre-refresh) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - ignore_errors: yes - register: result - - - assert: - that: - - "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group ' ~ resource_prefix ~ '-asg' in result.msg" - - - name: test starting a refresh with a valid ASG name - check_mode - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - check_mode: true - register: output - - - assert: - that: - - output is not failed - - output is changed - - '"autoscaling:StartInstanceRefresh" not in output.resource_actions' - - - name: test starting a refresh with a valid ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - register: output - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: test starting a refresh with a valid ASG name - Idempotent - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - ignore_errors: true - register: output - - - assert: - that: - - output is not changed - - '"Failed to start InstanceRefresh: An error occurred (InstanceRefreshInProgress) when calling the StartInstanceRefresh operation: An Instance Refresh is already in progress and blocks the execution of this Instance Refresh." in output.msg' - - - name: test starting a refresh with a valid ASG name - Idempotent (check_mode) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - ignore_errors: true - check_mode: true - register: output - - - assert: - that: - - output is not changed - - output is not failed - - '"In check_mode - Instance Refresh is already in progress, can not start new instance refresh." in output.msg' - - - name: test starting a refresh with a nonexistent ASG name - autoscaling_instance_refresh: - name: "nonexistentname-asg" - state: "started" - ignore_errors: yes - register: result - - - assert: - that: - - "'Failed to start InstanceRefresh: An error occurred (ValidationError) when calling the StartInstanceRefresh operation: AutoScalingGroup name not found' in result.msg" - - - name: test canceling a refresh with an ASG name - check_mode - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - check_mode: true - register: output - - - assert: - that: - - output is not failed - - output is changed - - '"autoscaling:CancelInstanceRefresh" not in output.resource_actions' - - - name: test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: test canceling a refresh with a ASG name - Idempotent - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - ignore_errors: yes - register: output - - - assert: - that: - - output is not changed - - - name: test cancelling a refresh with a valid ASG name - Idempotent (check_mode) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - ignore_errors: true - check_mode: true - register: output - - - assert: - that: - - output is not changed - - output is not failed - - - name: test starting a refresh with an ASG name and preferences dict - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - min_healthy_percentage: 10 - instance_warmup: 10 - retries: 5 - register: output - until: output is not failed - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: re-test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: test valid start - V1 - (with preferences missing instance_warmup) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - min_healthy_percentage: 10 - ignore_errors: yes - retries: 5 - register: output - until: output is not failed - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: re-test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: test valid start - V2 - (with preferences missing min_healthy_percentage) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - instance_warmup: 10 - retries: 5 - register: output - until: output is not failed - ignore_errors: yes - - - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - - - name: test invalid cancelation - V2 - (with preferences) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - preferences: - min_healthy_percentage: 10 - instance_warmup: 10 - ignore_errors: yes - register: result - - - assert: - that: - - "'can not pass preferences dict when canceling a refresh' in result.msg" - + - name: Run test with start_cancel_instance_refresh.yml + include_tasks: start_cancel_instance_refresh.yml + # ============================================================ - - name: run setup with refresh_and_cancel_three_times.yml + - name: Run test with refresh_and_cancel_three_times.yml include_tasks: refresh_and_cancel_three_times.yml loop: "{{ query('sequence', 'start=1 end=3') }}" - - name: test getting info for an ASG name - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - region: "{{ aws_region }}" - ignore_errors: yes - register: output - - - assert: - that: - - output | community.general.json_query(inst_refresh_id_json_query) | unique | length == 7 - vars: - inst_refresh_id_json_query: instance_refreshes[].instance_refresh_id - - - name: test using fake refresh ID - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - ids: ['0e367f58-blabla-bla-bla-ca870dc5dbfe'] - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length == 0 - - - name: test using a real refresh ID - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - ids: [ '{{ refreshout.instance_refreshes.instance_refresh_id }}' ] - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length == 1 - - - name: test getting info for an ASG name which doesn't exist - autoscaling_instance_refresh_info: - name: n0n3x1stentname27b - ignore_errors: yes - register: output - - - assert: - that: - - "'Failed to describe InstanceRefreshes: An error occurred (ValidationError) when calling the DescribeInstanceRefreshes operation: AutoScalingGroup name not found - AutoScalingGroup n0n3x1stentname27b not found' == output.msg" - - - name: assert that the correct number of records are returned - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length == 7 - - - name: assert that valid message with fake-token is returned - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - next_token: "fake-token-123" - ignore_errors: yes - register: output - - - assert: - that: - - '"Failed to describe InstanceRefreshes: An error occurred (InvalidNextToken) when calling the DescribeInstanceRefreshes operation: The token ''********'' is invalid." == output.msg' - - - name: assert that max records=1 returns no more than one record - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - max_records: 1 - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length < 2 - - - name: assert that valid message with real-token is returned - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - next_token: "{{ output.next_token }}" - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length == 7 - - - name: test using both real nextToken and max_records=1 - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - max_records: 1 - next_token: "{{ output.next_token }}" - ignore_errors: yes - register: output - - - assert: - that: - - output.instance_refreshes | length == 1 + - name: Run test with instance_refresh_info.yml + include_tasks: instance_refresh_info.yml always: - - name: kill asg + - name: Kill asg autoscaling_group: name: "{{ asg_name }}" state: absent register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 # Remove the testing dependencies - - name: remove the load balancer + - name: Remove the load balancer elb_classic_lb: name: "{{ load_balancer_name }}" state: absent security_group_ids: - "{{ sg.group_id }}" subnets: "{{ testing_subnet.subnet.id }}" - wait: yes + wait: true connection_draining_timeout: 60 listeners: - protocol: http @@ -436,22 +145,22 @@ healthy_threshold: 2 register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 - - name: remove launch configs + - name: Remove launch configs autoscaling_launch_config: name: "{{ item }}" state: absent register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 loop: - "{{ lc_name_1 }}" - "{{ lc_name_2 }}" - - name: delete launch template + - name: Delete launch template ec2_launch_template: name: "{{ resource_prefix }}-lt" state: absent @@ -460,7 +169,7 @@ until: del_lt is not failed ignore_errors: true - - name: remove the security group + - name: Remove the security group ec2_security_group: name: "{{ sg_name }}" description: a security group for ansible tests @@ -468,10 +177,10 @@ state: absent register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 - - name: remove routing rules + - name: Remove routing rules ec2_vpc_route_table: state: absent vpc_id: "{{ testing_vpc.vpc.id }}" @@ -484,34 +193,34 @@ - "{{ testing_subnet.subnet.id }}" register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 - - name: remove internet gateway + - name: Remove internet gateway ec2_vpc_igw: vpc_id: "{{ testing_vpc.vpc.id }}" state: absent register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 - - name: remove the subnet + - name: Remove the subnet ec2_vpc_subnet: state: absent vpc_id: "{{ testing_vpc.vpc.id }}" cidr: '{{ subnet_a_cidr }}' register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 - - name: remove the VPC + - name: Remove the VPC ec2_vpc_net: name: "{{ vpc_name }}" cidr_block: '{{ subnet_a_cidr }}' state: absent register: removed until: removed is not failed - ignore_errors: yes + ignore_errors: true retries: 10 diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml index 9b051a054e0..e2cebe924a9 100644 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml +++ b/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml @@ -1,29 +1,14 @@ --- - -- name: try to cancel pre-loop - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - ignore_errors: yes - -- name: test starting a refresh with an ASG name +- name: Test starting a refresh with an ASG name autoscaling_instance_refresh: name: "{{ asg_name }}" state: "started" - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - region: "{{ aws_region }}" - ignore_errors: no retries: 10 delay: 5 register: refreshout until: refreshout is not failed -- name: test cancelling a refresh with an ASG name +- name: Test cancelling a refresh with an ASG name autoscaling_instance_refresh: name: "{{ asg_name }}" state: "cancelled" - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - region: "{{ aws_region }}" - ignore_errors: yes diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml new file mode 100644 index 00000000000..a15e71cc3d3 --- /dev/null +++ b/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml @@ -0,0 +1,206 @@ +--- +- name: test invalid cancelation - V1 - (pre-refresh) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + ignore_errors: true + register: result + +- name: Assert that module failed with proper message + assert: + that: + - "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group ' ~ resource_prefix ~ '-asg' in result.msg" + +- name: Test starting a refresh with a valid ASG name - check_mode + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + check_mode: true + register: output + +- name: Validate starting in check_mode + assert: + that: + - output is changed + - '"autoscaling:StartInstanceRefresh" not in output.resource_actions' + +- name: Test starting a refresh with a valid ASG name + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + register: output + +- name: Validate start + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Test starting a refresh with a valid ASG name - Idempotent + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + ignore_errors: true + register: output + +- name: Validate starting Idempotency + assert: + that: + - output is not changed + - '"Failed to start InstanceRefresh: An error occurred (InstanceRefreshInProgress) when calling the StartInstanceRefresh operation: An Instance Refresh is already in progress and blocks the execution of this Instance Refresh." in output.msg' + +- name: Test starting a refresh with a valid ASG name - Idempotent (check_mode) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + check_mode: true + register: output + +- name: Validate starting Idempotency in check_mode + assert: + that: + - output is not changed + - '"In check_mode - Instance Refresh is already in progress, can not start new instance refresh." in output.msg' + +- name: Test starting a refresh with a nonexistent ASG name + autoscaling_instance_refresh: + name: "nonexistentname-asg" + state: "started" + ignore_errors: true + register: result + +- name: Assert that module failed with proper message + assert: + that: + - "'Failed to start InstanceRefresh: An error occurred (ValidationError) when calling the StartInstanceRefresh operation: AutoScalingGroup name not found' in result.msg" + +- name: Test canceling a refresh with an ASG name - check_mode + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + check_mode: true + register: output + +- name: Validate cancelation + assert: + that: + - output is not failed + - output is changed + - '"autoscaling:CancelInstanceRefresh" not in output.resource_actions' + +- name: Test canceling a refresh with an ASG name + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + register: output + +- name: Validate cancelation + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Test canceling a refresh with a ASG name - Idempotent + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + register: output + ignore_errors: true + +- name: Validate cancelling Idempotency + assert: + that: + - output is not changed + +- name: Test cancelling a refresh with a valid ASG name - Idempotent (check_mode) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + check_mode: true + register: output + +- name: Validate cancelling Idempotency in check_mode + assert: + that: + - output is not changed + +- name: Test starting a refresh with an ASG name and preferences dict + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + preferences: + min_healthy_percentage: 10 + instance_warmup: 10 + retries: 5 + register: output + until: output is not failed + +- name: Assert that module succeed with preferences + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Re-test canceling a refresh with an ASG name + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + register: output + +- name: Assert that module returned instance refresh id + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Test valid start - V1 - (with preferences missing instance_warmup) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + preferences: + min_healthy_percentage: 10 + retries: 5 + register: output + until: output is not failed + +- name: Validate start with preferences missing instance warmup + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Re-test canceling a refresh with an ASG name + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + register: output + +- name: Validate canceling Idempotency + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Test valid start - V2 - (with preferences missing min_healthy_percentage) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "started" + preferences: + instance_warmup: 10 + retries: 5 + register: output + until: output is not failed + +- name: Assert that module did not returned and instance refresh id + assert: + that: + - "'instance_refresh_id' in output.instance_refreshes" + +- name: Test invalid cancelation - V2 - (with preferences) + autoscaling_instance_refresh: + name: "{{ asg_name }}" + state: "cancelled" + preferences: + min_healthy_percentage: 10 + instance_warmup: 10 + ignore_errors: true + register: result + +- name: Assert that module failed with proper message + assert: + that: + - "'can not pass preferences dict when canceling a refresh' in result.msg" diff --git a/tests/integration/targets/autoscaling_instance_refresh/vars/main.yml b/tests/integration/targets/autoscaling_instance_refresh/vars/main.yml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py b/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py new file mode 100644 index 00000000000..590074367a2 --- /dev/null +++ b/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py @@ -0,0 +1,28 @@ +# (c) 2024 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +import pytest + +from ansible_collections.community.aws.plugins.modules.autoscaling_instance_refresh import validate_healthy_percentage + + +@pytest.mark.parametrize( + "min_healthy, max_healthy, expected_error", + [ + (90, None, None), + (-1, None, "The value range for the min_healthy_percentage is 0 to 100."), + (101, None, "The value range for the min_healthy_percentage is 0 to 100."), + (None, 90, "The value range for the max_healthy_percentage is 100 to 200."), + (None, 201, "The value range for the max_healthy_percentage is 100 to 200."), + (None, 100, "You must also specify min_healthy_percentage when max_healthy_percentage is specified."), + (10, 100, None), + ( + 10, + 150, + "The difference between the max_healthy_percentage and min_healthy_percentage cannot be greater than 100.", + ), + ], +) +def test_validate_healthy_percentage(min_healthy, max_healthy, expected_error): + preferences = dict(min_healthy_percentage=min_healthy, max_healthy_percentage=max_healthy) + assert expected_error == validate_healthy_percentage(preferences) From 2ad8a8ff5b620b6bd2dc57fa9d695c7622e09c11 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 25 Sep 2024 18:42:42 -0700 Subject: [PATCH 48/77] elb_classic_lb_info: Refactor elb_classic_lb_info module (#2139) SUMMARY Added type hints and function descriptions. Updated return block of the module. ISSUE TYPE Docs Pull Request COMPONENT NAME elb_classic_lb_info ADDITIONAL INFORMATION Reviewed-by: Markus Bergholz Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni Reviewed-by: Mark Chappell Reviewed-by: GomathiselviS --- ...39-elb_classic_lb_info-refactor-module.yml | 2 + plugins/modules/elb_classic_lb_info.py | 443 ++++++++++++++---- 2 files changed, 363 insertions(+), 82 deletions(-) create mode 100644 changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml diff --git a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml new file mode 100644 index 00000000000..e2ee0cb7a91 --- /dev/null +++ b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml @@ -0,0 +1,2 @@ +minor_changes: +- elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). diff --git a/plugins/modules/elb_classic_lb_info.py b/plugins/modules/elb_classic_lb_info.py index 5329e5b81db..2115ca70f1e 100644 --- a/plugins/modules/elb_classic_lb_info.py +++ b/plugins/modules/elb_classic_lb_info.py @@ -8,9 +8,9 @@ --- module: elb_classic_lb_info version_added: 1.0.0 -short_description: Gather information about EC2 Elastic Load Balancers in AWS +short_description: Gather information about EC2 Classic Elastic Load Balancers in AWS description: - - Gather information about EC2 Elastic Load Balancers in AWS + - Gather information about EC2 Classic Elastic Load Balancers in AWS. author: - "Michael Schultz (@mjschultz)" - "Fernando Jose Pando (@nand0p)" @@ -29,26 +29,26 @@ EXAMPLES = r""" # Note: These examples do not set authentication details, see the AWS Guide for details. -# Output format tries to match amazon.aws.ec2_elb_lb module input parameters +# Output format tries to match amazon.aws.elb_classic_lb module input parameters -# Gather information about all ELBs -- community.aws.elb_classic_lb_info: +- name: Gather information about all ELBs + community.aws.elb_classic_lb_info: register: elb_info - ansible.builtin.debug: msg: "{{ item.dns_name }}" loop: "{{ elb_info.elbs }}" -# Gather information about a particular ELB -- community.aws.elb_classic_lb_info: +- name: Gather information about a particular ELB + community.aws.elb_classic_lb_info: names: frontend-prod-elb register: elb_info - ansible.builtin.debug: msg: "{{ elb_info.elbs.0.dns_name }}" -# Gather information about a set of ELBs -- community.aws.elb_classic_lb_info: +- name: Gather information about a set of ELBs + community.aws.elb_classic_lb_info: names: - frontend-prod-elb - backend-prod-elb @@ -61,70 +61,282 @@ RETURN = r""" elbs: - description: a list of load balancers + description: A list of load balancers. returned: always type: list - sample: - elbs: - - attributes: - access_log: - enabled: false - connection_draining: - enabled: true - timeout: 300 - connection_settings: - idle_timeout: 60 - cross_zone_load_balancing: - enabled: true - availability_zones: - - "us-east-1a" - - "us-east-1b" - - "us-east-1c" - - "us-east-1d" - - "us-east-1e" - backend_server_description: [] - canonical_hosted_zone_name: test-lb-XXXXXXXXXXXX.us-east-1.elb.amazonaws.com - canonical_hosted_zone_name_id: XXXXXXXXXXXXXX - created_time: '2017-08-23T18:25:03.280000+00:00' - dns_name: test-lb-XXXXXXXXXXXX.us-east-1.elb.amazonaws.com - health_check: - healthy_threshold: 10 - interval: 30 - target: HTTP:80/index.html - timeout: 5 - unhealthy_threshold: 2 - instances: [] - instances_inservice: [] - instances_inservice_count: 0 - instances_outofservice: [] - instances_outofservice_count: 0 - instances_unknownservice: [] - instances_unknownservice_count: 0 - listener_descriptions: - - listener: - instance_port: 80 - instance_protocol: HTTP - load_balancer_port: 80 - protocol: HTTP - policy_names: [] - load_balancer_name: test-lb - policies: - app_cookie_stickiness_policies: [] - lb_cookie_stickiness_policies: [] - other_policies: [] - scheme: internet-facing - security_groups: - - sg-29d13055 - source_security_group: - group_name: default - owner_alias: XXXXXXXXXXXX - subnets: - - subnet-XXXXXXXX - - subnet-XXXXXXXX - tags: {} - vpc_id: vpc-c248fda4 + elements: dict + contains: + attributes: + description: Information about the load balancer attributes. + returned: always + type: dict + contains: + access_log: + description: Information on whether access logs are enabled or not. + type: dict + sample: { + "enabled": false + } + additional_attributes: + description: Information about additional load balancer attributes. + type: list + elements: dict + sample: [ + { + "key": "elb.http.desyncmitigationmode", + "value": "defensive" + } + ] + connection_draining: + description: + - Information on connection draining configuration of elastic load balancer. + type: dict + sample: { + "enabled": true, + "timeout": 300 + } + contains: + enabled: + description: Whether connection draining is enabled. + type: bool + returned: always + timeout: + description: The maximum time, in seconds, to keep the existing connections open before deregistering the instances. + type: int + returned: always + connection_settings: + description: Information on connection settings. + type: dict + sample: { + "idle_timeout": 60 + } + cross_zone_load_balancing: + description: Information on whether cross zone load balancing is enabled or not. + type: dict + sample: { + "enabled": true + } + availability_zones: + description: The Availability Zones for the load balancer. + type: list + elements: str + returned: always + sample: [ + "us-west-2a" + ] + backend_server_descriptions: + description: Information about your EC2 instances. + type: list + elements: dict + returned: always + sample: [ + { + instance_port: 8085, + policy_names: [ + 'MyPolicy1', + ] + }, + ] + canonical_hosted_zone_name: + description: The DNS name of the load balancer. + type: str + returned: always + sample: "test-123456789.us-west-2.elb.amazonaws.com" + canonical_hosted_zone_name_id: + description: The ID of the Amazon Route 53 hosted zone for the load balancer. + type: str + returned: always + sample: "Z1Z1ZZ5HABSF5" + created_time: + description: The date and time the load balancer was created. + type: str + returned: always + sample: "2024-09-04T17:52:22.270000+00:00" + dns_name: + description: The DNS name of the load balancer. + type: str + returned: "always" + sample: "test-123456789.us-west-2.elb.amazonaws.com" + health_check: + description: Information about the health checks conducted on the load balancer. + type: dict + returned: always + sample: { + "healthy_threshold": 10, + "interval": 5, + "target": "HTTP:80/index.html", + "timeout": 2, + "unhealthy_threshold": 2 + } + contains: + healthy_threshold: + description: The number of consecutive health checks successes required before moving the instance to the Healthy state. + type: int + returned: always + interval: + description: The approximate interval, in seconds, between health checks of an individual instance. + type: int + returned: always + target: + description: The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. + type: str + returned: always + timeout: + description: The amount of time, in seconds, during which no response means a failed health check. + type: int + returned: always + unhealthy_threshold: + description: The number of consecutive health checks successes required before moving the instance to the Unhealthy state. + type: int + returned: always + instances: + description: The IDs of the instances for the load balancer. + type: list + elements: dict + returned: always + sample: [ + { + "instance_id": "i-11d1f111ea111111b" + } + ] + instances_inservice: + description: Information about instances for load balancer in state "InService". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_inservice_count: + description: Total number of instances for load balancer with state "InService". + type: int + returned: always + sample: 1 + instances_outofservice: + description: Information about instances for load balancer in state "OutOfService". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_outofservice_count: + description: Total number of instances for load balancer with state "OutOfService". + type: int + returned: always + sample: 0 + instances_unknownservice: + description: Information about instances for load balancer in state "Unknown". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_unknownservice_count: + description: Total number of instances for load balancer with state "Unknown". + type: int + returned: always + sample: 1 + listener_descriptions: + description: Information about the listeners for the load balancer. + type: list + elements: dict + returned: always + sample: [ + { + "listener": { + "instance_port": 80, + "instance_protocol": "HTTP", + "load_balancer_port": 80, + "protocol": "HTTP" + }, + "policy_names": [] + } + ] + load_balancer_name: + description: The name of the elastic load balancer. + type: str + returned: always + sample: "MyLoadBalancer" + policies: + description: Information about the policies defined for the load balancer. + type: dict + returned: always + sample: { + "app_cookie_stickiness_policies": [], + "lb_cookie_stickiness_policies": [], + "other_policies": [] + } + contains: + app_cookie_stickiness_policies: + description: The stickiness policies created using CreateAppCookieStickinessPolicy. + type: list + returned: always + lb_cookie_stickiness_policies: + description: The stickiness policies created using CreateLBCookieStickinessPolicy. + type: list + returned: always + other_policies: + description: The policies other than the stickiness policies. + type: list + returned: always + scheme: + description: The type of load balancer. + type: str + returned: always + sample: "internet-facing" + security_groups: + description: The security groups for the load balancer. + type: list + returned: always + sample: [ + "sg-111111af1111cb111" + ] + source_security_group: + description: + - The security group for the load balancer, + which are used as part of inbound rules for registered instances. + type: dict + returned: always + sample: { + "group_name": "default", + "owner_alias": "721111111111" + } + contains: + group_name: + description: The name of the security group. + type: str + returned: always + owner_alias: + description: The owner of the security group. + type: str + returned: always + subnets: + description: The IDs of the subnets for the load balancer. + type: list + returned: always + sample: [ + "subnet-111111af1111cb111" + ] + tags: + description: The tags associated with a load balancer. + type: dict + returned: always + sample: { + "Env": "Dev", + "Owner": "Dev001" + } + vpc_id: + description: The ID of the VPC for the load balancer. + type: str + returned: always + sample: "vpc-0cc28c9e20d111111" """ +from typing import Any +from typing import Dict +from typing import List +from typing import Tuple +from typing import Union + try: import botocore except ImportError: @@ -133,16 +345,22 @@ from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code +from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -MAX_AWS_RETRIES = 5 -MAX_AWS_DELAY = 5 +def list_elbs(connection: Any, load_balancer_names: List[str]) -> List[Dict]: + """ + List Elastic Load Balancers (ELBs) and their detailed information. + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_names (List[str]): List of ELB names to gather information about. -def list_elbs(connection, load_balancer_names): + Returns: + A list of dictionaries where each dictionary contains informtion about one ELB. + """ results = [] if not load_balancer_names: @@ -157,7 +375,17 @@ def list_elbs(connection, load_balancer_names): return results -def describe_elb(connection, lb): +def describe_elb(connection: Any, lb: Dict[str, Any]) -> Dict[str, Any]: + """ + Describes an Elastic Load Balancer (ELB). + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + lb (Dict): Dictionary containing ELB . + + Returns: + A dictionary with detailed information of the ELB. + """ description = camel_dict_to_snake_dict(lb) name = lb["LoadBalancerName"] instances = lb.get("Instances", []) @@ -176,12 +404,31 @@ def describe_elb(connection, lb): @AWSRetry.jittered_backoff() -def get_all_lb(connection): +def get_all_lb(connection: Any) -> List: + """ + Get paginated result for information of all Elastic Load Balancers. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + + Returns: + A list of dictionaries containing descriptions of all ELBs. + """ paginator = connection.get_paginator("describe_load_balancers") return paginator.paginate().build_full_result()["LoadBalancerDescriptions"] -def get_lb(connection, load_balancer_name): +def get_lb(connection: Any, load_balancer_name: str) -> Union[Dict[str, Any], List]: + """ + Describes a specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary with detailed information of the specified ELB. + """ try: return connection.describe_load_balancers(aws_retry=True, LoadBalancerNames=[load_balancer_name])[ "LoadBalancerDescriptions" @@ -190,21 +437,55 @@ def get_lb(connection, load_balancer_name): return [] -def get_lb_attributes(connection, load_balancer_name): +def get_lb_attributes(connection: Any, load_balancer_name: str) -> Dict[str, Any]: + """ + Retrieves attributes of specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary with detailed information of the attributes of specified ELB. + """ attributes = connection.describe_load_balancer_attributes(aws_retry=True, LoadBalancerName=load_balancer_name).get( "LoadBalancerAttributes", {} ) return camel_dict_to_snake_dict(attributes) -def get_tags(connection, load_balancer_name): +def get_tags(connection: Any, load_balancer_name: str) -> Dict[str, Any]: + """ + Retrieves tags of specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary of tags associated with the specified ELB. + """ tags = connection.describe_tags(aws_retry=True, LoadBalancerNames=[load_balancer_name])["TagDescriptions"] if not tags: return {} return boto3_tag_list_to_ansible_dict(tags[0]["Tags"]) -def lb_instance_health(connection, load_balancer_name, instances, state): +def lb_instance_health( + connection: Any, load_balancer_name: str, instances: List[Dict[str, Any]], state: str +) -> Tuple[List[str], int]: + """ + Describes the health status of instances associated with a specific Elastic Load Balancer (ELB). + + Parameters: + connection (Any): The Boto3 client object for ELB. + load_balancer_name (str): The name of the ELB. + instances (List[Dict]): List of dictionaries containing instances associated with the ELB. + state (str): The health state to filter by (e.g., "InService", "OutOfService", "Unknown"). + + Returns: + Tuple[List, int]: A tuple containing a list of instance IDs matching state and the count of matching instances. + """ instance_states = connection.describe_instance_health(LoadBalancerName=load_balancer_name, Instances=instances).get( "InstanceStates", [] ) @@ -221,9 +502,7 @@ def main(): supports_check_mode=True, ) - connection = module.client( - "elb", retry_decorator=AWSRetry.jittered_backoff(retries=MAX_AWS_RETRIES, delay=MAX_AWS_DELAY) - ) + connection = module.client("elb", retry_decorator=AWSRetry.jittered_backoff(retries=5, delay=5)) try: elbs = list_elbs(connection, module.params.get("names")) From 7b516590372e0a32498864a3445033d79474cbab Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:24:32 +0200 Subject: [PATCH 49/77] Prepare modules ec2_vpc_egress_igw for promotion (#2152) SUMMARY Refactor module ec2_vpc_egress_igw to use shared code from amazon.aws.plugins.module_utils.ec2 ec2_vpc_egress_igw - add support for tagging ISSUE TYPE Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_egress_igw Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS --- ...23-refactor-ec2_vpc_egress_igw-modules.yml | 4 + plugins/modules/ec2_vpc_egress_igw.py | 191 +++++++++++------- .../targets/ec2_vpc_egress_igw/meta/main.yml | 1 - .../targets/ec2_vpc_egress_igw/tasks/main.yml | 159 +++++++++++---- 4 files changed, 238 insertions(+), 117 deletions(-) create mode 100644 changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml delete mode 100644 tests/integration/targets/ec2_vpc_egress_igw/meta/main.yml diff --git a/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml b/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml new file mode 100644 index 00000000000..c67e90cc8d4 --- /dev/null +++ b/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - ec2_vpc_egress_igw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` util (https://github.com/ansible-collections/community.aws/pull/2152). + - ec2_vpc_egress_igw - Add the possibility to update/add tags on Egress only internet gateway (https://github.com/ansible-collections/community.aws/pull/2152). \ No newline at end of file diff --git a/plugins/modules/ec2_vpc_egress_igw.py b/plugins/modules/ec2_vpc_egress_igw.py index 1bd65f501c8..8a1a520b7aa 100644 --- a/plugins/modules/ec2_vpc_egress_igw.py +++ b/plugins/modules/ec2_vpc_egress_igw.py @@ -25,10 +25,13 @@ default: present choices: [ 'present', 'absent' ] type: str +notes: + - Support for O(tags) and O(purge_tags) was added in release 9.0.0. extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules - amazon.aws.boto3 + - amazon.aws.tags.modules """ EXAMPLES = r""" @@ -36,10 +39,15 @@ # Ensure that the VPC has an Internet Gateway. # The Internet Gateway ID is can be accessed via {{eigw.gateway_id}} for use in setting up NATs etc. -- community.aws.ec2_vpc_egress_igw: +- name: Create Egress internet only gateway + community.aws.ec2_vpc_egress_igw: vpc_id: vpc-abcdefgh state: present - register: eigw + +- name: Delete Egress internet only gateway + community.aws.ec2_vpc_egress_igw: + vpc_id: vpc-abcdefgh + state: absent """ RETURN = r""" @@ -53,22 +61,30 @@ returned: always type: str sample: vpc-012345678 +tags: + description: Any tags assigned to the internet gateway. + returned: always + type: dict """ -try: - import botocore -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import Optional +from typing import Union from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_egress_only_internet_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_egress_only_internet_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_egress_only_internet_gateways +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def delete_eigw(module, connection, eigw_id): +def delete_eigw(module: AnsibleAWSModule, connection, eigw_id: str) -> Dict[str, Union[str, bool]]: """ Delete EIGW. @@ -76,27 +92,23 @@ def delete_eigw(module, connection, eigw_id): connection : boto3 client connection object eigw_id : ID of the EIGW to delete """ - changed = False - try: - response = connection.delete_egress_only_internet_gateway( - aws_retry=True, DryRun=module.check_mode, EgressOnlyInternetGatewayId=eigw_id + vpc_id = module.params.get("vpc_id") + + if module.check_mode: + return dict( + changed=True, msg=f"Would have deleted Egress internet only Gateway id '{eigw_id}' if not in check mode." ) - except is_boto3_error_code("DryRunOperation"): - changed = True - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg=f"Could not delete Egress-Only Internet Gateway {eigw_id} from VPC {module.vpc_id}") - if not module.check_mode: - changed = response.get("ReturnCode", False) + try: + changed = delete_egress_only_internet_gateway(connection, egress_only_internet_gateway_id=eigw_id) + except AnsibleEC2Error as e: + module.fail_json_aws(e) - return changed + return dict(changed=changed) -def create_eigw(module, connection, vpc_id): +def create_eigw(module: AnsibleAWSModule, connection, vpc_id: str) -> Dict[str, Union[str, bool]]: """ Create EIGW. @@ -104,43 +116,35 @@ def create_eigw(module, connection, vpc_id): connection : boto3 client connection object vpc_id : ID of the VPC we are operating on """ + + if module.check_mode: + return dict(changed=True, msg="Would have created Egress internet only Gateway if not in check mode.") + gateway_id = None changed = False try: - response = connection.create_egress_only_internet_gateway( - aws_retry=True, DryRun=module.check_mode, VpcId=vpc_id - ) - except is_boto3_error_code("DryRunOperation"): - # When boto3 method is run with DryRun=True it returns an error on success - # We need to catch the error and return something valid + response = create_egress_only_internet_gateway(connection, vpc_id=vpc_id, tags=module.params.get("tags")) changed = True - except is_boto3_error_code("InvalidVpcID.NotFound") as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg=f"invalid vpc ID '{vpc_id}' provided") - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg=f"Could not create Egress-Only Internet Gateway for vpc ID {vpc_id}") - - if not module.check_mode: - gateway = response.get("EgressOnlyInternetGateway", {}) - state = gateway.get("Attachments", [{}])[0].get("State") - gateway_id = gateway.get("EgressOnlyInternetGatewayId") - - if gateway_id and state in ("attached", "attaching"): - changed = True - else: - # EIGW gave back a bad attachment state or an invalid response so we error out - module.fail_json( - msg=f"Unable to create and attach Egress Only Internet Gateway to VPCId: {vpc_id}. Bad or no state in response", - **camel_dict_to_snake_dict(response), - ) + except AnsibleEC2Error as e: + module.fail_json_aws(e) + + gateway = response.get("EgressOnlyInternetGateway", {}) + state = gateway.get("Attachments", [{}])[0].get("State") + gateway_id = gateway.get("EgressOnlyInternetGatewayId") + tags = boto3_tag_list_to_ansible_dict(gateway.get("Tags", [])) + + if not gateway_id or state not in ("attached", "attaching"): + # EIGW gave back a bad attachment state or an invalid response so we error out + module.fail_json( + msg=f"Unable to create and attach Egress Only Internet Gateway to VPCId: {vpc_id}. Bad or no state in response", + **camel_dict_to_snake_dict(response), + ) - return changed, gateway_id + return dict(changed=changed, gateway_id=gateway_id, tags=tags) -def describe_eigws(module, connection, vpc_id): +def find_egress_only_igw(module: AnsibleAWSModule, connection, vpc_id: str) -> Optional[Dict[str, Any]]: """ Describe EIGWs. @@ -148,43 +152,80 @@ def describe_eigws(module, connection, vpc_id): connection : boto3 client connection object vpc_id : ID of the VPC we are operating on """ - gateway_id = None + result = None try: - response = connection.describe_egress_only_internet_gateways(aws_retry=True) - except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e: - module.fail_json_aws(e, msg="Could not get list of existing Egress-Only Internet Gateways") + for eigw in describe_egress_only_internet_gateways(connection): + for attachment in eigw.get("Attachments", []): + if attachment.get("VpcId") == vpc_id and attachment.get("State") in ("attached", "attaching"): + return { + "gateway_id": eigw.get("EgressOnlyInternetGatewayId"), + "tags": boto3_tag_list_to_ansible_dict(eigw.get("Tags", [])), + } + except AnsibleEC2Error as e: + module.fail_json_aws(e) - for eigw in response.get("EgressOnlyInternetGateways", []): - for attachment in eigw.get("Attachments", []): - if attachment.get("VpcId") == vpc_id and attachment.get("State") in ("attached", "attaching"): - gateway_id = eigw.get("EgressOnlyInternetGatewayId") + return result - return gateway_id + +def ensure_present(connection, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]]) -> None: + vpc_id = module.params.get("vpc_id") + result = dict(vpc_id=vpc_id, changed=False) + + if not existing: + result.update(create_eigw(module, connection, vpc_id)) + else: + egress_only_igw_id = existing.get("gateway_id") + changed = False + result = existing + tags = module.params.get("tags") + purge_tags = module.params.get("purge_tags") + if tags is not None: + changed = ensure_ec2_tags( + connection, + module, + egress_only_igw_id, + resource_type="egress-only-internet-gateway", + tags=tags, + purge_tags=purge_tags, + ) + result.update(dict(changed=changed, vpc_id=vpc_id)) + + module.exit_json(**result) + + +def ensure_absent(connection, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]]) -> None: + vpc_id = module.params.get("vpc_id") + if not existing: + module.exit_json(changed=False, msg=f"No Egress only internet gateway attached to the VPC id '{vpc_id}'") + + egress_only_igw_id = existing.get("gateway_id") + result = dict(gateway_id=egress_only_igw_id, vpc_id=vpc_id, changed=False) + result.update(delete_eigw(module, connection, egress_only_igw_id)) + module.exit_json(**result) def main(): - argument_spec = dict(vpc_id=dict(required=True), state=dict(default="present", choices=["present", "absent"])) + argument_spec = dict( + vpc_id=dict(required=True), + state=dict(default="present", choices=["present", "absent"]), + tags=dict(type="dict", aliases=["resource_tags"]), + purge_tags=dict(type="bool", default=True), + ) module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) - retry_decorator = AWSRetry.jittered_backoff(retries=10) - connection = module.client("ec2", retry_decorator=retry_decorator) + connection = module.client("ec2") vpc_id = module.params.get("vpc_id") state = module.params.get("state") - eigw_id = describe_eigws(module, connection, vpc_id) - - result = dict(gateway_id=eigw_id, vpc_id=vpc_id) - changed = False - - if state == "present" and not eigw_id: - changed, result["gateway_id"] = create_eigw(module, connection, vpc_id) - elif state == "absent" and eigw_id: - changed = delete_eigw(module, connection, eigw_id) + existing_egress_only_igw = find_egress_only_igw(module, connection, vpc_id) - module.exit_json(changed=changed, **result) + if state == "present": + ensure_present(connection, module, existing_egress_only_igw) + else: + ensure_absent(connection, module, existing_egress_only_igw) if __name__ == "__main__": diff --git a/tests/integration/targets/ec2_vpc_egress_igw/meta/main.yml b/tests/integration/targets/ec2_vpc_egress_igw/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_vpc_egress_igw/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml b/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml index 75fff0e4e22..56bb89decaf 100644 --- a/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml @@ -1,7 +1,5 @@ --- -- name: 'ec2_vpc_egress_igw integration tests' - collections: - - amazon.aws +- name: Run ec2_vpc_egress_igw integration tests module_defaults: group/aws: access_key: '{{ aws_access_key }}' @@ -11,35 +9,36 @@ block: # ============================================================ - - name: test failure with no parameters - ec2_vpc_egress_igw: + - name: Test failure with no parameters + community.aws.ec2_vpc_egress_igw: register: result ignore_errors: true - - name: assert failure with no parameters - assert: + - name: Assert failure with no parameters + ansible.builtin.assert: that: - - 'result.failed' + - result is failed - 'result.msg == "missing required arguments: vpc_id"' # ============================================================ - - name: test failure with non-existent VPC ID - ec2_vpc_egress_igw: + - name: Test failure with non-existent VPC ID + community.aws.ec2_vpc_egress_igw: state: present vpc_id: vpc-02394e50abc1807e8 register: result ignore_errors: true - - name: assert failure with non-existent VPC ID - assert: + - name: Assert failure with non-existent VPC ID + ansible.builtin.assert: that: - - 'result.failed' - - 'result.error.code == "InvalidVpcID.NotFound"' - - '"invalid vpc ID" in result.msg' + - result is failed + - e_msg in result.exception + vars: + e_msg: "The vpc ID 'vpc-02394e50abc1807e8' does not exist" # ============================================================ - - name: create a VPC - ec2_vpc_net: + - name: Create a VPC + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" state: present cidr_block: "10.232.232.128/26" @@ -49,55 +48,133 @@ register: vpc_result # ============================================================ - - name: create egress-only internet gateway (expected changed=true) - ec2_vpc_egress_igw: + - name: Create egress-only internet gateway using check_mode=true + community.aws.ec2_vpc_egress_igw: + state: present + vpc_id: "{{ vpc_result.vpc.id }}" + register: vpc_eigw_create_check_mode + check_mode: true + + - name: Assert module returned changed and the Egress IGW was not created + ansible.builtin.assert: + that: + - vpc_eigw_create_check_mode is changed + + # # ============================================================ + - name: Create egress-only internet gateway (expected changed=true) + community.aws.ec2_vpc_egress_igw: state: present vpc_id: "{{ vpc_result.vpc.id }}" register: vpc_eigw_create - - name: assert creation happened (expected changed=true) - assert: + - name: Assert module returned changed and the Egress IGW was not created + ansible.builtin.assert: that: - - 'vpc_eigw_create' - - 'vpc_eigw_create.gateway_id.startswith("eigw-")' - - 'vpc_eigw_create.vpc_id == vpc_result.vpc.id' + - vpc_eigw_create is changed - # ============================================================ - - name: attempt to recreate egress-only internet gateway on VPC (expected changed=false) - ec2_vpc_egress_igw: + # # ============================================================ + - name: Create egress-only internet gateway once again (idempotency) + community.aws.ec2_vpc_egress_igw: state: present vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_recreate + register: vpc_eigw_create_idempotency - - name: assert recreation did nothing (expected changed=false) + - name: Assert module returned changed and the Egress IGW was not created assert: that: - - 'vpc_eigw_recreate.changed == False' - - 'vpc_eigw_recreate.gateway_id == vpc_eigw_create.gateway_id' - - 'vpc_eigw_recreate.vpc_id == vpc_eigw_create.vpc_id' + - vpc_eigw_create_idempotency is not changed + - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_create.gateway_id - # ============================================================ - - name: test state=absent (expected changed=true) + # # ============================================================ + - name: Delete egress-only internet gateway (check_mode) ec2_vpc_egress_igw: state: absent vpc_id: "{{ vpc_result.vpc.id }}" + register: vpc_eigw_delete_check_mode + check_mode: true + + - name: Assert module returned changed and the Egress IGW was not created + ansible.builtin.assert: + that: + - vpc_eigw_delete_check_mode is changed + - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_delete_check_mode.gateway_id + + # # ============================================================ + - name: Delete egress-only internet gateway once again (idempotency) + community.aws.ec2_vpc_egress_igw: + state: absent + vpc_id: "{{ vpc_result.vpc.id }}" register: vpc_eigw_delete - - name: assert state=absent (expected changed=true) - assert: + - name: Assert module returned changed and the Egress IGW was not created + ansible.builtin.assert: + that: + - vpc_eigw_delete is changed + - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_delete.gateway_id + + # # ============================================================ + - name: Delete egress-only internet gateway + ec2_vpc_egress_igw: + state: absent + vpc_id: "{{ vpc_result.vpc.id }}" + register: vpc_eigw_delete_idempotency + + - name: Assert module returned changed and the Egress IGW was not created + ansible.builtin.assert: + that: + - vpc_eigw_delete_idempotency is not changed + + ## ============================================================ + ## Tagging + - name: Create Egress only internet gateway with tags + community.aws.ec2_vpc_egress_igw: + vpc_id: "{{ vpc_result.vpc.id }}" + tags: + ResourcePrefix: "{{ resource_prefix }}" + VpcId: "{{ vpc_result.vpc.id }}" + register: create_with_tags + + - name: Assert that the Egress IGW was created with tags + ansible.builtin.assert: + that: + - create_with_tags is changed + + - name: Trying to update tags (no change) + community.aws.ec2_vpc_egress_igw: + vpc_id: "{{ vpc_result.vpc.id }}" + tags: + ResourcePrefix: "{{ resource_prefix }}" + VpcId: "{{ vpc_result.vpc.id }}" + register: update_tags + + - name: Assert that the Egress IGW was not updated + ansible.builtin.assert: + that: + - update_tags is not changed + + - name: Add tag to existing tags + community.aws.ec2_vpc_egress_igw: + vpc_id: "{{ vpc_result.vpc.id }}" + tags: + Phase: integration + purge_tags: false + register: add_tag + + - name: Assert that the Egress IGW was created with tags + ansible.builtin.assert: that: - - 'vpc_eigw_delete.changed' + - add_tag is changed always: # ============================================================ - - name: tidy up EIGW - ec2_vpc_egress_igw: + - name: Tidy up EIGW + community.aws.ec2_vpc_egress_igw: state: absent vpc_id: "{{ vpc_result.vpc.id }}" ignore_errors: true - - name: tidy up VPC - ec2_vpc_net: + - name: Tidy up VPC + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" state: absent cidr_block: "10.232.232.128/26" From 7f11acb15425b200f6fe17600e534d6d113b7c09 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Mon, 7 Oct 2024 16:14:53 -0700 Subject: [PATCH 50/77] DNM Migrate elb_classic_lb_info* modules and tests (#2163) Depends-On: ansible-collections/amazon.aws#2315 Remove elb_classic_lb_info* modules and tests These modules have been migrated to amazon.aws Update runtime.yml with redirects to that collection Update ignore files Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis --- ...39-elb_classic_lb_info-refactor-module.yml | 2 - .../fragments/migrate_elb_classic_lb_info.yml | 5 + meta/runtime.yml | 3 +- plugins/modules/elb_classic_lb_info.py | 516 ------------------ .../targets/elb_classic_lb_info/aliases | 1 - .../elb_classic_lb_info/defaults/main.yml | 3 - .../targets/elb_classic_lb_info/meta/main.yml | 1 - .../elb_classic_lb_info/tasks/main.yml | 311 ----------- .../targets/elb_classic_lb_info/vars/main.yml | 2 - 9 files changed, 7 insertions(+), 837 deletions(-) delete mode 100644 changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml create mode 100644 changelogs/fragments/migrate_elb_classic_lb_info.yml delete mode 100644 plugins/modules/elb_classic_lb_info.py delete mode 100644 tests/integration/targets/elb_classic_lb_info/aliases delete mode 100644 tests/integration/targets/elb_classic_lb_info/defaults/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/meta/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/tasks/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/vars/main.yml diff --git a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml deleted file mode 100644 index e2ee0cb7a91..00000000000 --- a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: -- elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). diff --git a/changelogs/fragments/migrate_elb_classic_lb_info.yml b/changelogs/fragments/migrate_elb_classic_lb_info.yml new file mode 100644 index 00000000000..f48c34ee3c4 --- /dev/null +++ b/changelogs/fragments/migrate_elb_classic_lb_info.yml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - elb_classic_lb_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.elb_classic_lb_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index ea50b016258..fffae44294d 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -146,7 +146,6 @@ action_groups: - elasticache_subnet_group - elasticbeanstalk_app - elb_classic_lb - - elb_classic_lb_info - elb_instance - elb_network_lb - elb_target @@ -520,6 +519,8 @@ plugin_routing: redirect: amazon.aws.s3_bucket_info sts_assume_role: redirect: amazon.aws.sts_assume_role + elb_classic_lb_info: + redirect: amazon.aws.elb_classic_lb_info module_utils: route53: redirect: amazon.aws.route53 \ No newline at end of file diff --git a/plugins/modules/elb_classic_lb_info.py b/plugins/modules/elb_classic_lb_info.py deleted file mode 100644 index 2115ca70f1e..00000000000 --- a/plugins/modules/elb_classic_lb_info.py +++ /dev/null @@ -1,516 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Contributors to the Ansible project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: elb_classic_lb_info -version_added: 1.0.0 -short_description: Gather information about EC2 Classic Elastic Load Balancers in AWS -description: - - Gather information about EC2 Classic Elastic Load Balancers in AWS. -author: - - "Michael Schultz (@mjschultz)" - - "Fernando Jose Pando (@nand0p)" -options: - names: - description: - - List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned. - type: list - elements: str - default: [] -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. -# Output format tries to match amazon.aws.elb_classic_lb module input parameters - -- name: Gather information about all ELBs - community.aws.elb_classic_lb_info: - register: elb_info - -- ansible.builtin.debug: - msg: "{{ item.dns_name }}" - loop: "{{ elb_info.elbs }}" - -- name: Gather information about a particular ELB - community.aws.elb_classic_lb_info: - names: frontend-prod-elb - register: elb_info - -- ansible.builtin.debug: - msg: "{{ elb_info.elbs.0.dns_name }}" - -- name: Gather information about a set of ELBs - community.aws.elb_classic_lb_info: - names: - - frontend-prod-elb - - backend-prod-elb - register: elb_info - -- ansible.builtin.debug: - msg: "{{ item.dns_name }}" - loop: "{{ elb_info.elbs }}" -""" - -RETURN = r""" -elbs: - description: A list of load balancers. - returned: always - type: list - elements: dict - contains: - attributes: - description: Information about the load balancer attributes. - returned: always - type: dict - contains: - access_log: - description: Information on whether access logs are enabled or not. - type: dict - sample: { - "enabled": false - } - additional_attributes: - description: Information about additional load balancer attributes. - type: list - elements: dict - sample: [ - { - "key": "elb.http.desyncmitigationmode", - "value": "defensive" - } - ] - connection_draining: - description: - - Information on connection draining configuration of elastic load balancer. - type: dict - sample: { - "enabled": true, - "timeout": 300 - } - contains: - enabled: - description: Whether connection draining is enabled. - type: bool - returned: always - timeout: - description: The maximum time, in seconds, to keep the existing connections open before deregistering the instances. - type: int - returned: always - connection_settings: - description: Information on connection settings. - type: dict - sample: { - "idle_timeout": 60 - } - cross_zone_load_balancing: - description: Information on whether cross zone load balancing is enabled or not. - type: dict - sample: { - "enabled": true - } - availability_zones: - description: The Availability Zones for the load balancer. - type: list - elements: str - returned: always - sample: [ - "us-west-2a" - ] - backend_server_descriptions: - description: Information about your EC2 instances. - type: list - elements: dict - returned: always - sample: [ - { - instance_port: 8085, - policy_names: [ - 'MyPolicy1', - ] - }, - ] - canonical_hosted_zone_name: - description: The DNS name of the load balancer. - type: str - returned: always - sample: "test-123456789.us-west-2.elb.amazonaws.com" - canonical_hosted_zone_name_id: - description: The ID of the Amazon Route 53 hosted zone for the load balancer. - type: str - returned: always - sample: "Z1Z1ZZ5HABSF5" - created_time: - description: The date and time the load balancer was created. - type: str - returned: always - sample: "2024-09-04T17:52:22.270000+00:00" - dns_name: - description: The DNS name of the load balancer. - type: str - returned: "always" - sample: "test-123456789.us-west-2.elb.amazonaws.com" - health_check: - description: Information about the health checks conducted on the load balancer. - type: dict - returned: always - sample: { - "healthy_threshold": 10, - "interval": 5, - "target": "HTTP:80/index.html", - "timeout": 2, - "unhealthy_threshold": 2 - } - contains: - healthy_threshold: - description: The number of consecutive health checks successes required before moving the instance to the Healthy state. - type: int - returned: always - interval: - description: The approximate interval, in seconds, between health checks of an individual instance. - type: int - returned: always - target: - description: The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. - type: str - returned: always - timeout: - description: The amount of time, in seconds, during which no response means a failed health check. - type: int - returned: always - unhealthy_threshold: - description: The number of consecutive health checks successes required before moving the instance to the Unhealthy state. - type: int - returned: always - instances: - description: The IDs of the instances for the load balancer. - type: list - elements: dict - returned: always - sample: [ - { - "instance_id": "i-11d1f111ea111111b" - } - ] - instances_inservice: - description: Information about instances for load balancer in state "InService". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_inservice_count: - description: Total number of instances for load balancer with state "InService". - type: int - returned: always - sample: 1 - instances_outofservice: - description: Information about instances for load balancer in state "OutOfService". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_outofservice_count: - description: Total number of instances for load balancer with state "OutOfService". - type: int - returned: always - sample: 0 - instances_unknownservice: - description: Information about instances for load balancer in state "Unknown". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_unknownservice_count: - description: Total number of instances for load balancer with state "Unknown". - type: int - returned: always - sample: 1 - listener_descriptions: - description: Information about the listeners for the load balancer. - type: list - elements: dict - returned: always - sample: [ - { - "listener": { - "instance_port": 80, - "instance_protocol": "HTTP", - "load_balancer_port": 80, - "protocol": "HTTP" - }, - "policy_names": [] - } - ] - load_balancer_name: - description: The name of the elastic load balancer. - type: str - returned: always - sample: "MyLoadBalancer" - policies: - description: Information about the policies defined for the load balancer. - type: dict - returned: always - sample: { - "app_cookie_stickiness_policies": [], - "lb_cookie_stickiness_policies": [], - "other_policies": [] - } - contains: - app_cookie_stickiness_policies: - description: The stickiness policies created using CreateAppCookieStickinessPolicy. - type: list - returned: always - lb_cookie_stickiness_policies: - description: The stickiness policies created using CreateLBCookieStickinessPolicy. - type: list - returned: always - other_policies: - description: The policies other than the stickiness policies. - type: list - returned: always - scheme: - description: The type of load balancer. - type: str - returned: always - sample: "internet-facing" - security_groups: - description: The security groups for the load balancer. - type: list - returned: always - sample: [ - "sg-111111af1111cb111" - ] - source_security_group: - description: - - The security group for the load balancer, - which are used as part of inbound rules for registered instances. - type: dict - returned: always - sample: { - "group_name": "default", - "owner_alias": "721111111111" - } - contains: - group_name: - description: The name of the security group. - type: str - returned: always - owner_alias: - description: The owner of the security group. - type: str - returned: always - subnets: - description: The IDs of the subnets for the load balancer. - type: list - returned: always - sample: [ - "subnet-111111af1111cb111" - ] - tags: - description: The tags associated with a load balancer. - type: dict - returned: always - sample: { - "Env": "Dev", - "Owner": "Dev001" - } - vpc_id: - description: The ID of the VPC for the load balancer. - type: str - returned: always - sample: "vpc-0cc28c9e20d111111" -""" - -from typing import Any -from typing import Dict -from typing import List -from typing import Tuple -from typing import Union - -try: - import botocore -except ImportError: - pass # caught by AnsibleAWSModule - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict - - -def list_elbs(connection: Any, load_balancer_names: List[str]) -> List[Dict]: - """ - List Elastic Load Balancers (ELBs) and their detailed information. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_names (List[str]): List of ELB names to gather information about. - - Returns: - A list of dictionaries where each dictionary contains informtion about one ELB. - """ - results = [] - - if not load_balancer_names: - for lb in get_all_lb(connection): - results.append(describe_elb(connection, lb)) - - for load_balancer_name in load_balancer_names: - lb = get_lb(connection, load_balancer_name) - if not lb: - continue - results.append(describe_elb(connection, lb)) - return results - - -def describe_elb(connection: Any, lb: Dict[str, Any]) -> Dict[str, Any]: - """ - Describes an Elastic Load Balancer (ELB). - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - lb (Dict): Dictionary containing ELB . - - Returns: - A dictionary with detailed information of the ELB. - """ - description = camel_dict_to_snake_dict(lb) - name = lb["LoadBalancerName"] - instances = lb.get("Instances", []) - description["tags"] = get_tags(connection, name) - description["instances_inservice"], description["instances_inservice_count"] = lb_instance_health( - connection, name, instances, "InService" - ) - description["instances_outofservice"], description["instances_outofservice_count"] = lb_instance_health( - connection, name, instances, "OutOfService" - ) - description["instances_unknownservice"], description["instances_unknownservice_count"] = lb_instance_health( - connection, name, instances, "Unknown" - ) - description["attributes"] = get_lb_attributes(connection, name) - return description - - -@AWSRetry.jittered_backoff() -def get_all_lb(connection: Any) -> List: - """ - Get paginated result for information of all Elastic Load Balancers. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - - Returns: - A list of dictionaries containing descriptions of all ELBs. - """ - paginator = connection.get_paginator("describe_load_balancers") - return paginator.paginate().build_full_result()["LoadBalancerDescriptions"] - - -def get_lb(connection: Any, load_balancer_name: str) -> Union[Dict[str, Any], List]: - """ - Describes a specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary with detailed information of the specified ELB. - """ - try: - return connection.describe_load_balancers(aws_retry=True, LoadBalancerNames=[load_balancer_name])[ - "LoadBalancerDescriptions" - ][0] - except is_boto3_error_code("LoadBalancerNotFound"): - return [] - - -def get_lb_attributes(connection: Any, load_balancer_name: str) -> Dict[str, Any]: - """ - Retrieves attributes of specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary with detailed information of the attributes of specified ELB. - """ - attributes = connection.describe_load_balancer_attributes(aws_retry=True, LoadBalancerName=load_balancer_name).get( - "LoadBalancerAttributes", {} - ) - return camel_dict_to_snake_dict(attributes) - - -def get_tags(connection: Any, load_balancer_name: str) -> Dict[str, Any]: - """ - Retrieves tags of specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary of tags associated with the specified ELB. - """ - tags = connection.describe_tags(aws_retry=True, LoadBalancerNames=[load_balancer_name])["TagDescriptions"] - if not tags: - return {} - return boto3_tag_list_to_ansible_dict(tags[0]["Tags"]) - - -def lb_instance_health( - connection: Any, load_balancer_name: str, instances: List[Dict[str, Any]], state: str -) -> Tuple[List[str], int]: - """ - Describes the health status of instances associated with a specific Elastic Load Balancer (ELB). - - Parameters: - connection (Any): The Boto3 client object for ELB. - load_balancer_name (str): The name of the ELB. - instances (List[Dict]): List of dictionaries containing instances associated with the ELB. - state (str): The health state to filter by (e.g., "InService", "OutOfService", "Unknown"). - - Returns: - Tuple[List, int]: A tuple containing a list of instance IDs matching state and the count of matching instances. - """ - instance_states = connection.describe_instance_health(LoadBalancerName=load_balancer_name, Instances=instances).get( - "InstanceStates", [] - ) - instate = [instance["InstanceId"] for instance in instance_states if instance["State"] == state] - return instate, len(instate) - - -def main(): - argument_spec = dict( - names=dict(default=[], type="list", elements="str"), - ) - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - connection = module.client("elb", retry_decorator=AWSRetry.jittered_backoff(retries=5, delay=5)) - - try: - elbs = list_elbs(connection, module.params.get("names")) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to get load balancer information.") - - module.exit_json(elbs=elbs) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/elb_classic_lb_info/aliases b/tests/integration/targets/elb_classic_lb_info/aliases deleted file mode 100644 index 4ef4b2067d0..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/aws diff --git a/tests/integration/targets/elb_classic_lb_info/defaults/main.yml b/tests/integration/targets/elb_classic_lb_info/defaults/main.yml deleted file mode 100644 index bd059e26ea7..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# defaults file for test_ec2_eip -elb_name: 'ansible-test-{{ tiny_prefix }}-ecli' diff --git a/tests/integration/targets/elb_classic_lb_info/meta/main.yml b/tests/integration/targets/elb_classic_lb_info/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml deleted file mode 100644 index b09e8807269..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml +++ /dev/null @@ -1,311 +0,0 @@ ---- -# __Test Info__ -# Create a self signed cert and upload it to AWS -# http://www.akadia.com/services/ssh_test_certificate.html -# http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ssl-server-cert.html - -# __Test Outline__ -# -# __elb_classic_lb__ -# create test elb with listeners and certificate -# change AZ's -# change listeners -# remove listeners -# remove elb - -# __elb_classic_lb_info_ -# get nonexistent load balancer - -- module_defaults: - group/aws: - region: "{{ aws_region }}" - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - block: - - # ============================================================ - # create test elb with listeners, certificate, and health check - - - name: Create ELB - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - - protocol: http - load_balancer_port: 8080 - instance_port: 8080 - health_check: - ping_protocol: http - ping_port: 80 - ping_path: "/index.html" - response_timeout: 5 - interval: 30 - unhealthy_threshold: 2 - healthy_threshold: 10 - register: create - - - assert: - that: - - create is changed - # We rely on these for the info test, make sure they're what we expect - - aws_region ~ 'a' in create.elb.zones - - aws_region ~ 'b' in create.elb.zones - - create.elb.health_check.healthy_threshold == 10 - - create.elb.health_check.interval == 30 - - create.elb.health_check.target == "HTTP:80/index.html" - - create.elb.health_check.timeout == 5 - - create.elb.health_check.unhealthy_threshold == 2 - - '[80, 80, "HTTP", "HTTP"] in create.elb.listeners' - - '[8080, 8080, "HTTP", "HTTP"] in create.elb.listeners' - - - name: Get ELB info - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - info.elbs|length == 1 - - elb.availability_zones|length == 2 - - aws_region ~ 'a' in elb.availability_zones - - aws_region ~ 'b' in elb.availability_zones - - elb.health_check.healthy_threshold == 10 - - elb.health_check.interval == 30 - - elb.health_check.target == "HTTP:80/index.html" - - elb.health_check.timeout == 5 - - elb.health_check.unhealthy_threshold == 2 - - '{"instance_port": 80, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' - - '{"instance_port": 8080, "instance_protocol": "HTTP", "load_balancer_port": 8080, "protocol": "HTTP"} == listeners[1]' - vars: - elb: "{{ info.elbs[0] }}" - listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" - - # ============================================================ - - # check ports, would be cool, but we are at the mercy of AWS - # to start things in a timely manner - - #- name: check to make sure 80 is listening - # wait_for: host={{ info.elb.dns_name }} port=80 timeout=600 - # register: result - - #- name: assert can connect to port# - # assert: 'result.state == "started"' - - #- name: check to make sure 443 is listening - # wait_for: host={{ info.elb.dns_name }} port=443 timeout=600 - # register: result - - #- name: assert can connect to port# - # assert: 'result.state == "started"' - - # ============================================================ - - # Change AZ's - - - name: Change AZ's - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - purge_zones: yes - health_check: - ping_protocol: http - ping_port: 80 - ping_path: "/index.html" - response_timeout: 5 - interval: 30 - unhealthy_threshold: 2 - healthy_threshold: 10 - register: update_az - - - assert: - that: - - update_az is changed - - update_az.elb.zones[0] == aws_region ~ 'c' - - - name: Get ELB info after changing AZ's - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.availability_zones|length == 1 - - aws_region ~ 'c' in elb.availability_zones[0] - vars: - elb: "{{ info.elbs[0] }}" - - # ============================================================ - - # Update AZ's - - - name: Update AZ's - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - purge_zones: yes - register: update_az - - - assert: - that: - - update_az is changed - - aws_region ~ 'a' in update_az.elb.zones - - aws_region ~ 'b' in update_az.elb.zones - - aws_region ~ 'c' in update_az.elb.zones - - - name: Get ELB info after updating AZ's - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.availability_zones|length == 3 - - aws_region ~ 'a' in elb.availability_zones - - aws_region ~ 'b' in elb.availability_zones - - aws_region ~ 'c' in elb.availability_zones - vars: - elb: "{{ info.elbs[0] }}" - - # ============================================================ - - # Purge Listeners - - - name: Purge Listeners - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 81 - purge_listeners: yes - register: purge_listeners - - - assert: - that: - - purge_listeners is changed - - '[80, 81, "HTTP", "HTTP"] in purge_listeners.elb.listeners' - - purge_listeners.elb.listeners|length == 1 - - - name: Get ELB info after purging listeners - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.listener_descriptions|length == 1 - - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == elb.listener_descriptions[0].listener' - vars: - elb: "{{ info.elbs[0] }}" - - - # ============================================================ - - # add Listeners - - - name: Add Listeners - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 8081 - instance_port: 8081 - purge_listeners: no - register: update_listeners - - - assert: - that: - - update_listeners is changed - - '[80, 81, "HTTP", "HTTP"] in update_listeners.elb.listeners' - - '[8081, 8081, "HTTP", "HTTP"] in update_listeners.elb.listeners' - - update_listeners.elb.listeners|length == 2 - - - name: Get ELB info after adding listeners - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.listener_descriptions|length == 2 - - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' - - '{"instance_port": 8081, "instance_protocol": "HTTP", "load_balancer_port": 8081, "protocol": "HTTP"} == listeners[1]' - vars: - elb: "{{ info.elbs[0] }}" - listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" - - # ============================================================ - - # Test getting nonexistent load balancer - - name: get nonexistent load balancer - elb_classic_lb_info: - names: "invalid-elb" - register: info - - - assert: - that: - - info.elbs|length==0 - - # Test getting a valid and nonexistent load balancer - - name: get nonexistent load balancer - elb_classic_lb_info: - names: ["{{ elb_name }}", "invalid-elb"] - register: info - - - assert: - that: - - info.elbs|length==1 - - info.elbs[0].load_balancer_name == elb_name - - # ============================================================ - - - name: get all load balancers - elb_classic_lb_info: - names: "{{ omit }}" - register: info - - - assert: - that: - - info.elbs|length>0 - - always: - - # ============================================================ - - name: remove the test load balancer completely - elb_classic_lb: - name: "{{ elb_name }}" - state: absent - register: result - ignore_errors: true diff --git a/tests/integration/targets/elb_classic_lb_info/vars/main.yml b/tests/integration/targets/elb_classic_lb_info/vars/main.yml deleted file mode 100644 index 79194af1ef5..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for test_ec2_elb_lb From 4cf5a6f2f7c1367a20447ac29af0e63f39071afa Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 9 Oct 2024 17:02:16 -0700 Subject: [PATCH 51/77] Revert "DNM Migrate elb_classic_lb_info* modules and tests (#2163)" (#2170) This reverts commit 7f11acb. Reverts #2163 #2163 changes are being reverted as it has been agreed to hold off on merging the migration PRs until a plan is set to migrate all planned modules at once. We need to disable the squash strategy in github first to retain commit history. SUMMARY Reviewed-by: GomathiselviS --- ...39-elb_classic_lb_info-refactor-module.yml | 2 + .../fragments/migrate_elb_classic_lb_info.yml | 5 - meta/runtime.yml | 3 +- plugins/modules/elb_classic_lb_info.py | 516 ++++++++++++++++++ .../targets/elb_classic_lb_info/aliases | 1 + .../elb_classic_lb_info/defaults/main.yml | 3 + .../targets/elb_classic_lb_info/meta/main.yml | 1 + .../elb_classic_lb_info/tasks/main.yml | 311 +++++++++++ .../targets/elb_classic_lb_info/vars/main.yml | 2 + 9 files changed, 837 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml delete mode 100644 changelogs/fragments/migrate_elb_classic_lb_info.yml create mode 100644 plugins/modules/elb_classic_lb_info.py create mode 100644 tests/integration/targets/elb_classic_lb_info/aliases create mode 100644 tests/integration/targets/elb_classic_lb_info/defaults/main.yml create mode 100644 tests/integration/targets/elb_classic_lb_info/meta/main.yml create mode 100644 tests/integration/targets/elb_classic_lb_info/tasks/main.yml create mode 100644 tests/integration/targets/elb_classic_lb_info/vars/main.yml diff --git a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml new file mode 100644 index 00000000000..e2ee0cb7a91 --- /dev/null +++ b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml @@ -0,0 +1,2 @@ +minor_changes: +- elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). diff --git a/changelogs/fragments/migrate_elb_classic_lb_info.yml b/changelogs/fragments/migrate_elb_classic_lb_info.yml deleted file mode 100644 index f48c34ee3c4..00000000000 --- a/changelogs/fragments/migrate_elb_classic_lb_info.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - elb_classic_lb_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.elb_classic_lb_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index fffae44294d..ea50b016258 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -146,6 +146,7 @@ action_groups: - elasticache_subnet_group - elasticbeanstalk_app - elb_classic_lb + - elb_classic_lb_info - elb_instance - elb_network_lb - elb_target @@ -519,8 +520,6 @@ plugin_routing: redirect: amazon.aws.s3_bucket_info sts_assume_role: redirect: amazon.aws.sts_assume_role - elb_classic_lb_info: - redirect: amazon.aws.elb_classic_lb_info module_utils: route53: redirect: amazon.aws.route53 \ No newline at end of file diff --git a/plugins/modules/elb_classic_lb_info.py b/plugins/modules/elb_classic_lb_info.py new file mode 100644 index 00000000000..2115ca70f1e --- /dev/null +++ b/plugins/modules/elb_classic_lb_info.py @@ -0,0 +1,516 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright: Contributors to the Ansible project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +DOCUMENTATION = r""" +--- +module: elb_classic_lb_info +version_added: 1.0.0 +short_description: Gather information about EC2 Classic Elastic Load Balancers in AWS +description: + - Gather information about EC2 Classic Elastic Load Balancers in AWS. +author: + - "Michael Schultz (@mjschultz)" + - "Fernando Jose Pando (@nand0p)" +options: + names: + description: + - List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned. + type: list + elements: str + default: [] +extends_documentation_fragment: + - amazon.aws.common.modules + - amazon.aws.region.modules + - amazon.aws.boto3 +""" + +EXAMPLES = r""" +# Note: These examples do not set authentication details, see the AWS Guide for details. +# Output format tries to match amazon.aws.elb_classic_lb module input parameters + +- name: Gather information about all ELBs + community.aws.elb_classic_lb_info: + register: elb_info + +- ansible.builtin.debug: + msg: "{{ item.dns_name }}" + loop: "{{ elb_info.elbs }}" + +- name: Gather information about a particular ELB + community.aws.elb_classic_lb_info: + names: frontend-prod-elb + register: elb_info + +- ansible.builtin.debug: + msg: "{{ elb_info.elbs.0.dns_name }}" + +- name: Gather information about a set of ELBs + community.aws.elb_classic_lb_info: + names: + - frontend-prod-elb + - backend-prod-elb + register: elb_info + +- ansible.builtin.debug: + msg: "{{ item.dns_name }}" + loop: "{{ elb_info.elbs }}" +""" + +RETURN = r""" +elbs: + description: A list of load balancers. + returned: always + type: list + elements: dict + contains: + attributes: + description: Information about the load balancer attributes. + returned: always + type: dict + contains: + access_log: + description: Information on whether access logs are enabled or not. + type: dict + sample: { + "enabled": false + } + additional_attributes: + description: Information about additional load balancer attributes. + type: list + elements: dict + sample: [ + { + "key": "elb.http.desyncmitigationmode", + "value": "defensive" + } + ] + connection_draining: + description: + - Information on connection draining configuration of elastic load balancer. + type: dict + sample: { + "enabled": true, + "timeout": 300 + } + contains: + enabled: + description: Whether connection draining is enabled. + type: bool + returned: always + timeout: + description: The maximum time, in seconds, to keep the existing connections open before deregistering the instances. + type: int + returned: always + connection_settings: + description: Information on connection settings. + type: dict + sample: { + "idle_timeout": 60 + } + cross_zone_load_balancing: + description: Information on whether cross zone load balancing is enabled or not. + type: dict + sample: { + "enabled": true + } + availability_zones: + description: The Availability Zones for the load balancer. + type: list + elements: str + returned: always + sample: [ + "us-west-2a" + ] + backend_server_descriptions: + description: Information about your EC2 instances. + type: list + elements: dict + returned: always + sample: [ + { + instance_port: 8085, + policy_names: [ + 'MyPolicy1', + ] + }, + ] + canonical_hosted_zone_name: + description: The DNS name of the load balancer. + type: str + returned: always + sample: "test-123456789.us-west-2.elb.amazonaws.com" + canonical_hosted_zone_name_id: + description: The ID of the Amazon Route 53 hosted zone for the load balancer. + type: str + returned: always + sample: "Z1Z1ZZ5HABSF5" + created_time: + description: The date and time the load balancer was created. + type: str + returned: always + sample: "2024-09-04T17:52:22.270000+00:00" + dns_name: + description: The DNS name of the load balancer. + type: str + returned: "always" + sample: "test-123456789.us-west-2.elb.amazonaws.com" + health_check: + description: Information about the health checks conducted on the load balancer. + type: dict + returned: always + sample: { + "healthy_threshold": 10, + "interval": 5, + "target": "HTTP:80/index.html", + "timeout": 2, + "unhealthy_threshold": 2 + } + contains: + healthy_threshold: + description: The number of consecutive health checks successes required before moving the instance to the Healthy state. + type: int + returned: always + interval: + description: The approximate interval, in seconds, between health checks of an individual instance. + type: int + returned: always + target: + description: The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. + type: str + returned: always + timeout: + description: The amount of time, in seconds, during which no response means a failed health check. + type: int + returned: always + unhealthy_threshold: + description: The number of consecutive health checks successes required before moving the instance to the Unhealthy state. + type: int + returned: always + instances: + description: The IDs of the instances for the load balancer. + type: list + elements: dict + returned: always + sample: [ + { + "instance_id": "i-11d1f111ea111111b" + } + ] + instances_inservice: + description: Information about instances for load balancer in state "InService". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_inservice_count: + description: Total number of instances for load balancer with state "InService". + type: int + returned: always + sample: 1 + instances_outofservice: + description: Information about instances for load balancer in state "OutOfService". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_outofservice_count: + description: Total number of instances for load balancer with state "OutOfService". + type: int + returned: always + sample: 0 + instances_unknownservice: + description: Information about instances for load balancer in state "Unknown". + type: list + returned: always + sample: [ + "i-11d1f111ea111111b" + ] + instances_unknownservice_count: + description: Total number of instances for load balancer with state "Unknown". + type: int + returned: always + sample: 1 + listener_descriptions: + description: Information about the listeners for the load balancer. + type: list + elements: dict + returned: always + sample: [ + { + "listener": { + "instance_port": 80, + "instance_protocol": "HTTP", + "load_balancer_port": 80, + "protocol": "HTTP" + }, + "policy_names": [] + } + ] + load_balancer_name: + description: The name of the elastic load balancer. + type: str + returned: always + sample: "MyLoadBalancer" + policies: + description: Information about the policies defined for the load balancer. + type: dict + returned: always + sample: { + "app_cookie_stickiness_policies": [], + "lb_cookie_stickiness_policies": [], + "other_policies": [] + } + contains: + app_cookie_stickiness_policies: + description: The stickiness policies created using CreateAppCookieStickinessPolicy. + type: list + returned: always + lb_cookie_stickiness_policies: + description: The stickiness policies created using CreateLBCookieStickinessPolicy. + type: list + returned: always + other_policies: + description: The policies other than the stickiness policies. + type: list + returned: always + scheme: + description: The type of load balancer. + type: str + returned: always + sample: "internet-facing" + security_groups: + description: The security groups for the load balancer. + type: list + returned: always + sample: [ + "sg-111111af1111cb111" + ] + source_security_group: + description: + - The security group for the load balancer, + which are used as part of inbound rules for registered instances. + type: dict + returned: always + sample: { + "group_name": "default", + "owner_alias": "721111111111" + } + contains: + group_name: + description: The name of the security group. + type: str + returned: always + owner_alias: + description: The owner of the security group. + type: str + returned: always + subnets: + description: The IDs of the subnets for the load balancer. + type: list + returned: always + sample: [ + "subnet-111111af1111cb111" + ] + tags: + description: The tags associated with a load balancer. + type: dict + returned: always + sample: { + "Env": "Dev", + "Owner": "Dev001" + } + vpc_id: + description: The ID of the VPC for the load balancer. + type: str + returned: always + sample: "vpc-0cc28c9e20d111111" +""" + +from typing import Any +from typing import Dict +from typing import List +from typing import Tuple +from typing import Union + +try: + import botocore +except ImportError: + pass # caught by AnsibleAWSModule + +from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict + +from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code +from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule +from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict + + +def list_elbs(connection: Any, load_balancer_names: List[str]) -> List[Dict]: + """ + List Elastic Load Balancers (ELBs) and their detailed information. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_names (List[str]): List of ELB names to gather information about. + + Returns: + A list of dictionaries where each dictionary contains informtion about one ELB. + """ + results = [] + + if not load_balancer_names: + for lb in get_all_lb(connection): + results.append(describe_elb(connection, lb)) + + for load_balancer_name in load_balancer_names: + lb = get_lb(connection, load_balancer_name) + if not lb: + continue + results.append(describe_elb(connection, lb)) + return results + + +def describe_elb(connection: Any, lb: Dict[str, Any]) -> Dict[str, Any]: + """ + Describes an Elastic Load Balancer (ELB). + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + lb (Dict): Dictionary containing ELB . + + Returns: + A dictionary with detailed information of the ELB. + """ + description = camel_dict_to_snake_dict(lb) + name = lb["LoadBalancerName"] + instances = lb.get("Instances", []) + description["tags"] = get_tags(connection, name) + description["instances_inservice"], description["instances_inservice_count"] = lb_instance_health( + connection, name, instances, "InService" + ) + description["instances_outofservice"], description["instances_outofservice_count"] = lb_instance_health( + connection, name, instances, "OutOfService" + ) + description["instances_unknownservice"], description["instances_unknownservice_count"] = lb_instance_health( + connection, name, instances, "Unknown" + ) + description["attributes"] = get_lb_attributes(connection, name) + return description + + +@AWSRetry.jittered_backoff() +def get_all_lb(connection: Any) -> List: + """ + Get paginated result for information of all Elastic Load Balancers. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + + Returns: + A list of dictionaries containing descriptions of all ELBs. + """ + paginator = connection.get_paginator("describe_load_balancers") + return paginator.paginate().build_full_result()["LoadBalancerDescriptions"] + + +def get_lb(connection: Any, load_balancer_name: str) -> Union[Dict[str, Any], List]: + """ + Describes a specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary with detailed information of the specified ELB. + """ + try: + return connection.describe_load_balancers(aws_retry=True, LoadBalancerNames=[load_balancer_name])[ + "LoadBalancerDescriptions" + ][0] + except is_boto3_error_code("LoadBalancerNotFound"): + return [] + + +def get_lb_attributes(connection: Any, load_balancer_name: str) -> Dict[str, Any]: + """ + Retrieves attributes of specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary with detailed information of the attributes of specified ELB. + """ + attributes = connection.describe_load_balancer_attributes(aws_retry=True, LoadBalancerName=load_balancer_name).get( + "LoadBalancerAttributes", {} + ) + return camel_dict_to_snake_dict(attributes) + + +def get_tags(connection: Any, load_balancer_name: str) -> Dict[str, Any]: + """ + Retrieves tags of specific Elastic Load Balancer (ELB) by name. + + Parameters: + connection (boto3.client): The Boto3 ELB client object. + load_balancer_name (str): Name of the ELB to gather information about. + + Returns: + A dictionary of tags associated with the specified ELB. + """ + tags = connection.describe_tags(aws_retry=True, LoadBalancerNames=[load_balancer_name])["TagDescriptions"] + if not tags: + return {} + return boto3_tag_list_to_ansible_dict(tags[0]["Tags"]) + + +def lb_instance_health( + connection: Any, load_balancer_name: str, instances: List[Dict[str, Any]], state: str +) -> Tuple[List[str], int]: + """ + Describes the health status of instances associated with a specific Elastic Load Balancer (ELB). + + Parameters: + connection (Any): The Boto3 client object for ELB. + load_balancer_name (str): The name of the ELB. + instances (List[Dict]): List of dictionaries containing instances associated with the ELB. + state (str): The health state to filter by (e.g., "InService", "OutOfService", "Unknown"). + + Returns: + Tuple[List, int]: A tuple containing a list of instance IDs matching state and the count of matching instances. + """ + instance_states = connection.describe_instance_health(LoadBalancerName=load_balancer_name, Instances=instances).get( + "InstanceStates", [] + ) + instate = [instance["InstanceId"] for instance in instance_states if instance["State"] == state] + return instate, len(instate) + + +def main(): + argument_spec = dict( + names=dict(default=[], type="list", elements="str"), + ) + module = AnsibleAWSModule( + argument_spec=argument_spec, + supports_check_mode=True, + ) + + connection = module.client("elb", retry_decorator=AWSRetry.jittered_backoff(retries=5, delay=5)) + + try: + elbs = list_elbs(connection, module.params.get("names")) + except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: + module.fail_json_aws(e, msg="Failed to get load balancer information.") + + module.exit_json(elbs=elbs) + + +if __name__ == "__main__": + main() diff --git a/tests/integration/targets/elb_classic_lb_info/aliases b/tests/integration/targets/elb_classic_lb_info/aliases new file mode 100644 index 00000000000..4ef4b2067d0 --- /dev/null +++ b/tests/integration/targets/elb_classic_lb_info/aliases @@ -0,0 +1 @@ +cloud/aws diff --git a/tests/integration/targets/elb_classic_lb_info/defaults/main.yml b/tests/integration/targets/elb_classic_lb_info/defaults/main.yml new file mode 100644 index 00000000000..bd059e26ea7 --- /dev/null +++ b/tests/integration/targets/elb_classic_lb_info/defaults/main.yml @@ -0,0 +1,3 @@ +--- +# defaults file for test_ec2_eip +elb_name: 'ansible-test-{{ tiny_prefix }}-ecli' diff --git a/tests/integration/targets/elb_classic_lb_info/meta/main.yml b/tests/integration/targets/elb_classic_lb_info/meta/main.yml new file mode 100644 index 00000000000..32cf5dda7ed --- /dev/null +++ b/tests/integration/targets/elb_classic_lb_info/meta/main.yml @@ -0,0 +1 @@ +dependencies: [] diff --git a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml new file mode 100644 index 00000000000..b09e8807269 --- /dev/null +++ b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml @@ -0,0 +1,311 @@ +--- +# __Test Info__ +# Create a self signed cert and upload it to AWS +# http://www.akadia.com/services/ssh_test_certificate.html +# http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ssl-server-cert.html + +# __Test Outline__ +# +# __elb_classic_lb__ +# create test elb with listeners and certificate +# change AZ's +# change listeners +# remove listeners +# remove elb + +# __elb_classic_lb_info_ +# get nonexistent load balancer + +- module_defaults: + group/aws: + region: "{{ aws_region }}" + access_key: "{{ aws_access_key }}" + secret_key: "{{ aws_secret_key }}" + session_token: "{{ security_token | default(omit) }}" + block: + + # ============================================================ + # create test elb with listeners, certificate, and health check + + - name: Create ELB + elb_classic_lb: + name: "{{ elb_name }}" + state: present + zones: + - "{{ aws_region }}a" + - "{{ aws_region }}b" + listeners: + - protocol: http + load_balancer_port: 80 + instance_port: 80 + - protocol: http + load_balancer_port: 8080 + instance_port: 8080 + health_check: + ping_protocol: http + ping_port: 80 + ping_path: "/index.html" + response_timeout: 5 + interval: 30 + unhealthy_threshold: 2 + healthy_threshold: 10 + register: create + + - assert: + that: + - create is changed + # We rely on these for the info test, make sure they're what we expect + - aws_region ~ 'a' in create.elb.zones + - aws_region ~ 'b' in create.elb.zones + - create.elb.health_check.healthy_threshold == 10 + - create.elb.health_check.interval == 30 + - create.elb.health_check.target == "HTTP:80/index.html" + - create.elb.health_check.timeout == 5 + - create.elb.health_check.unhealthy_threshold == 2 + - '[80, 80, "HTTP", "HTTP"] in create.elb.listeners' + - '[8080, 8080, "HTTP", "HTTP"] in create.elb.listeners' + + - name: Get ELB info + elb_classic_lb_info: + names: "{{ elb_name }}" + register: info + + - assert: + that: + - info.elbs|length == 1 + - elb.availability_zones|length == 2 + - aws_region ~ 'a' in elb.availability_zones + - aws_region ~ 'b' in elb.availability_zones + - elb.health_check.healthy_threshold == 10 + - elb.health_check.interval == 30 + - elb.health_check.target == "HTTP:80/index.html" + - elb.health_check.timeout == 5 + - elb.health_check.unhealthy_threshold == 2 + - '{"instance_port": 80, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' + - '{"instance_port": 8080, "instance_protocol": "HTTP", "load_balancer_port": 8080, "protocol": "HTTP"} == listeners[1]' + vars: + elb: "{{ info.elbs[0] }}" + listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" + + # ============================================================ + + # check ports, would be cool, but we are at the mercy of AWS + # to start things in a timely manner + + #- name: check to make sure 80 is listening + # wait_for: host={{ info.elb.dns_name }} port=80 timeout=600 + # register: result + + #- name: assert can connect to port# + # assert: 'result.state == "started"' + + #- name: check to make sure 443 is listening + # wait_for: host={{ info.elb.dns_name }} port=443 timeout=600 + # register: result + + #- name: assert can connect to port# + # assert: 'result.state == "started"' + + # ============================================================ + + # Change AZ's + + - name: Change AZ's + elb_classic_lb: + name: "{{ elb_name }}" + state: present + zones: + - "{{ aws_region }}c" + listeners: + - protocol: http + load_balancer_port: 80 + instance_port: 80 + purge_zones: yes + health_check: + ping_protocol: http + ping_port: 80 + ping_path: "/index.html" + response_timeout: 5 + interval: 30 + unhealthy_threshold: 2 + healthy_threshold: 10 + register: update_az + + - assert: + that: + - update_az is changed + - update_az.elb.zones[0] == aws_region ~ 'c' + + - name: Get ELB info after changing AZ's + elb_classic_lb_info: + names: "{{ elb_name }}" + register: info + + - assert: + that: + - elb.availability_zones|length == 1 + - aws_region ~ 'c' in elb.availability_zones[0] + vars: + elb: "{{ info.elbs[0] }}" + + # ============================================================ + + # Update AZ's + + - name: Update AZ's + elb_classic_lb: + name: "{{ elb_name }}" + state: present + zones: + - "{{ aws_region }}a" + - "{{ aws_region }}b" + - "{{ aws_region }}c" + listeners: + - protocol: http + load_balancer_port: 80 + instance_port: 80 + purge_zones: yes + register: update_az + + - assert: + that: + - update_az is changed + - aws_region ~ 'a' in update_az.elb.zones + - aws_region ~ 'b' in update_az.elb.zones + - aws_region ~ 'c' in update_az.elb.zones + + - name: Get ELB info after updating AZ's + elb_classic_lb_info: + names: "{{ elb_name }}" + register: info + + - assert: + that: + - elb.availability_zones|length == 3 + - aws_region ~ 'a' in elb.availability_zones + - aws_region ~ 'b' in elb.availability_zones + - aws_region ~ 'c' in elb.availability_zones + vars: + elb: "{{ info.elbs[0] }}" + + # ============================================================ + + # Purge Listeners + + - name: Purge Listeners + elb_classic_lb: + name: "{{ elb_name }}" + state: present + zones: + - "{{ aws_region }}a" + - "{{ aws_region }}b" + - "{{ aws_region }}c" + listeners: + - protocol: http + load_balancer_port: 80 + instance_port: 81 + purge_listeners: yes + register: purge_listeners + + - assert: + that: + - purge_listeners is changed + - '[80, 81, "HTTP", "HTTP"] in purge_listeners.elb.listeners' + - purge_listeners.elb.listeners|length == 1 + + - name: Get ELB info after purging listeners + elb_classic_lb_info: + names: "{{ elb_name }}" + register: info + + - assert: + that: + - elb.listener_descriptions|length == 1 + - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == elb.listener_descriptions[0].listener' + vars: + elb: "{{ info.elbs[0] }}" + + + # ============================================================ + + # add Listeners + + - name: Add Listeners + elb_classic_lb: + name: "{{ elb_name }}" + state: present + zones: + - "{{ aws_region }}a" + - "{{ aws_region }}b" + - "{{ aws_region }}c" + listeners: + - protocol: http + load_balancer_port: 8081 + instance_port: 8081 + purge_listeners: no + register: update_listeners + + - assert: + that: + - update_listeners is changed + - '[80, 81, "HTTP", "HTTP"] in update_listeners.elb.listeners' + - '[8081, 8081, "HTTP", "HTTP"] in update_listeners.elb.listeners' + - update_listeners.elb.listeners|length == 2 + + - name: Get ELB info after adding listeners + elb_classic_lb_info: + names: "{{ elb_name }}" + register: info + + - assert: + that: + - elb.listener_descriptions|length == 2 + - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' + - '{"instance_port": 8081, "instance_protocol": "HTTP", "load_balancer_port": 8081, "protocol": "HTTP"} == listeners[1]' + vars: + elb: "{{ info.elbs[0] }}" + listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" + + # ============================================================ + + # Test getting nonexistent load balancer + - name: get nonexistent load balancer + elb_classic_lb_info: + names: "invalid-elb" + register: info + + - assert: + that: + - info.elbs|length==0 + + # Test getting a valid and nonexistent load balancer + - name: get nonexistent load balancer + elb_classic_lb_info: + names: ["{{ elb_name }}", "invalid-elb"] + register: info + + - assert: + that: + - info.elbs|length==1 + - info.elbs[0].load_balancer_name == elb_name + + # ============================================================ + + - name: get all load balancers + elb_classic_lb_info: + names: "{{ omit }}" + register: info + + - assert: + that: + - info.elbs|length>0 + + always: + + # ============================================================ + - name: remove the test load balancer completely + elb_classic_lb: + name: "{{ elb_name }}" + state: absent + register: result + ignore_errors: true diff --git a/tests/integration/targets/elb_classic_lb_info/vars/main.yml b/tests/integration/targets/elb_classic_lb_info/vars/main.yml new file mode 100644 index 00000000000..79194af1ef5 --- /dev/null +++ b/tests/integration/targets/elb_classic_lb_info/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for test_ec2_elb_lb From fcd780eee6864804561e3e45d09c3185c161852b Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 10 Oct 2024 20:32:27 +0200 Subject: [PATCH 52/77] Refactor ec2_vpc_peer* modules (#2153) SUMMARY Depends-On: ansible-collections/amazon.aws#2303 Refactor ec2_vpc_peer* modules Once the module is migrated to amazon.aws I will deprecate result returned by the info module and rename the ec2_vpc_peer module (see #2154). ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_peer ec2_vpc_peering_info ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS Reviewed-by: Alina Buzachis --- .../20240924-ec2_vpc_peer-refactor.yml | 4 + plugins/modules/ec2_vpc_peer.py | 479 +++++++++--------- plugins/modules/ec2_vpc_peering_info.py | 222 ++++++-- .../targets/ec2_vpc_peer/tasks/main.yml | 313 ++++++++---- 4 files changed, 648 insertions(+), 370 deletions(-) create mode 100644 changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml diff --git a/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml b/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml new file mode 100644 index 00000000000..97158a3bac0 --- /dev/null +++ b/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - ec2_vpc_peer - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). + - ec2_vpc_peering_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). diff --git a/plugins/modules/ec2_vpc_peer.py b/plugins/modules/ec2_vpc_peer.py index 2a731bf23e4..94f4b125219 100644 --- a/plugins/modules/ec2_vpc_peer.py +++ b/plugins/modules/ec2_vpc_peer.py @@ -51,9 +51,10 @@ default: false type: bool notes: - - Support for I(purge_tags) was added in release 2.0.0. + - Support for O(purge_tags) was added in release 2.0.0. author: - Mike Mochan (@mmochan) + - Alina Buzachis (@alinabuzachis) extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -63,152 +64,152 @@ EXAMPLES = r""" # Complete example to create and accept a local peering connection. -- name: Create local account VPC peering Connection +- name: Create local account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-87654321 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-87654321" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Accept local VPC peering request +- name: Accept local EC2 VPC Peering request community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - state: accept + state: "accept" register: action_peer # Complete example to delete a local peering connection. -- name: Create local account VPC peering Connection +- name: Create local account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-87654321 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-87654321" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: delete a local VPC peering Connection +- name: Delete a local EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - state: absent + state: "absent" register: vpc_peer # Complete example to create and accept a cross account peering connection. -- name: Create cross account VPC peering Connection +- name: Create cross account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-12345678 - peer_owner_id: 123456789012 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-12345678" + peer_owner_id: "123456789012" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Accept peering connection from remote account +- name: Accept EC2 VPC Peering Connection from remote account community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - profile: bot03_profile_for_cross_account - state: accept + profile: "bot03_profile_for_cross_account" + state: "accept" register: vpc_peer # Complete example to create and accept an intra-region peering connection. -- name: Create intra-region VPC peering Connection +- name: Create intra-region EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: us-east-1 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-87654321 - peer_region: us-west-2 - state: present + region: "us-east-1" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-87654321" + peer_region: "us-west-2" + state: "present" tags: - Name: Peering connection for us-east-1 VPC to us-west-2 VPC - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for us-east-1 VPC to us-west-2 VPC" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Accept peering connection from peer region +- name: Accept EC2 VPC Peering Connection from peer region community.aws.ec2_vpc_peer: - region: us-west-2 + region: "us-west-2" peering_id: "{{ vpc_peer.peering_id }}" - state: accept + state: "accept" register: vpc_peer # Complete example to create and reject a local peering connection. -- name: Create local account VPC peering Connection +- name: Create local account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-87654321 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-87654321" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Reject a local VPC peering Connection +- name: Reject a local EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - state: reject + state: "reject" # Complete example to create and accept a cross account peering connection. -- name: Create cross account VPC peering Connection +- name: Create cross account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-12345678 - peer_owner_id: 123456789012 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-12345678" + peer_owner_id: "123456789012" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Accept a cross account VPC peering connection request +- name: Accept a cross account EC2 VPC Peering Connection request community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - profile: bot03_profile_for_cross_account - state: accept + profile: "bot03_profile_for_cross_account" + state: "accept" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" # Complete example to create and reject a cross account peering connection. -- name: Create cross account VPC peering Connection +- name: Create cross account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 - vpc_id: vpc-12345678 - peer_vpc_id: vpc-12345678 - peer_owner_id: 123456789012 - state: present + region: "ap-southeast-2" + vpc_id: "vpc-12345678" + peer_vpc_id: "vpc-12345678" + peer_owner_id: "123456789012" + state: "present" tags: - Name: Peering connection for VPC 21 to VPC 22 - CostCode: CC1234 - Project: phoenix + Name: "Peering connection for VPC 21 to VPC 22" + CostCode: "CC1234" + Project: "phoenix" register: vpc_peer -- name: Reject a cross account VPC peering Connection +- name: Reject a cross account EC2 VPC Peering Connection community.aws.ec2_vpc_peer: - region: ap-southeast-2 + region: "ap-southeast-2" peering_id: "{{ vpc_peer.peering_id }}" - profile: bot03_profile_for_cross_account - state: reject + profile: "bot03_profile_for_cross_account" + state: "reject" """ RETURN = r""" @@ -216,37 +217,38 @@ description: The id of the VPC peering connection created/deleted. returned: always type: str - sample: pcx-034223d7c0aec3cde + sample: "pcx-034223d7c0aec3cde" vpc_peering_connection: - description: The details of the VPC peering connection as returned by Boto3 (snake cased). + description: The details of the VPC peering connection. returned: success - type: complex + type: dict contains: accepter_vpc_info: description: Information about the VPC which accepted the connection. returned: success - type: complex + type: dict contains: cidr_block: description: The primary CIDR for the VPC. returned: when connection is in the accepted state. type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" cidr_block_set: description: A list of all CIDRs for the VPC. returned: when connection is in the accepted state. - type: complex + type: list + elements: dict contains: cidr_block: description: A CIDR block used by the VPC. returned: success type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" owner_id: description: The AWS account that owns the VPC. returned: success type: str - example: 123456789012 + sample: "123456789012" peering_options: description: Additional peering configuration. returned: when connection is in the accepted state. @@ -268,37 +270,38 @@ description: The AWS region that the VPC is in. returned: success type: str - example: us-east-1 + sample: "us-east-1" vpc_id: description: The ID of the VPC returned: success type: str - example: vpc-0123456789abcdef0 + sample: "vpc-0123456789abcdef0" requester_vpc_info: description: Information about the VPC which requested the connection. returned: success - type: complex + type: dict contains: cidr_block: description: The primary CIDR for the VPC. returned: when connection is not in the deleted state. type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" cidr_block_set: description: A list of all CIDRs for the VPC. returned: when connection is not in the deleted state. - type: complex + type: list + elements: dict contains: cidr_block: description: A CIDR block used by the VPC returned: success type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" owner_id: description: The AWS account that owns the VPC. returned: success type: str - example: 123456789012 + sample: "123456789012" peering_options: description: Additional peering configuration. returned: when connection is not in the deleted state. @@ -320,12 +323,12 @@ description: The AWS region that the VPC is in. returned: success type: str - example: us-east-1 + sample: "us-east-1" vpc_id: description: The ID of the VPC returned: success type: str - example: vpc-0123456789abcdef0 + sample: "vpc-0123456789abcdef0" status: description: Details of the current status of the connection. returned: success @@ -335,21 +338,25 @@ description: A short code describing the status of the connection. returned: success type: str - example: active + sample: "active" message: description: Additional information about the status of the connection. returned: success type: str - example: Pending Acceptance by 123456789012 + sample: "Pending Acceptance by 123456789012" tags: description: Tags applied to the connection. returned: success type: dict + expiration_time: + description: The time that an unaccepted VPC peering connection will expire. + type: str + sample: "2024-10-01T12:11:12+00:00" vpc_peering_connection_id: description: The ID of the VPC peering connection. returned: success type: str - example: "pcx-0123456789abcdef0" + sample: "pcx-0123456789abcdef0" """ try: @@ -357,215 +364,214 @@ except ImportError: pass # Handled by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import NoReturn +from typing import Tuple + from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import add_ec2_tags +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import accept_vpc_peering_connection +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpc_peering_connection +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpc_peering_connection +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import reject_vpc_peering_connection from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def wait_for_state(client, module, state, pcx_id): +def wait_for_state(client, module: AnsibleAWSModule, state: str, peering_id: str) -> NoReturn: waiter = client.get_waiter("vpc_peering_connection_exists") - peer_filter = { - "vpc-peering-connection-id": pcx_id, + filters = { + "vpc-peering-connection-id": peering_id, "status-code": state, } try: - waiter.wait(Filters=ansible_dict_to_boto3_filter_list(peer_filter)) + waiter.wait(Filters=ansible_dict_to_boto3_filter_list(filters)) except botocore.exceptions.WaiterError as e: module.fail_json_aws(e, "Failed to wait for state change") except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, "Enable to describe Peerig Connection while waiting for state to change") + module.fail_json_aws(e, "Unable to describe Peering Connection while waiting for state to change") -def describe_peering_connections(params, client): - peer_filter = { +def describe_peering_connections(client, module: AnsibleAWSModule, params) -> Dict[str, Any]: + peering_connections: Dict = {} + + filters = { "requester-vpc-info.vpc-id": params["VpcId"], "accepter-vpc-info.vpc-id": params["PeerVpcId"], } - result = client.describe_vpc_peering_connections( - aws_retry=True, - Filters=ansible_dict_to_boto3_filter_list(peer_filter), - ) - if result["VpcPeeringConnections"] == []: + + peering_connections = describe_vpc_peering_connections(client, Filters=ansible_dict_to_boto3_filter_list(filters)) + if peering_connections == []: # Try again with the VPC/Peer relationship reversed - peer_filter = { + filters = { "requester-vpc-info.vpc-id": params["PeerVpcId"], "accepter-vpc-info.vpc-id": params["VpcId"], } - result = client.describe_vpc_peering_connections( - aws_retry=True, - Filters=ansible_dict_to_boto3_filter_list(peer_filter), + peering_connections = describe_vpc_peering_connections( + client, Filters=ansible_dict_to_boto3_filter_list(filters) ) - return result + return peering_connections + + +def is_active(peering_connection: Dict[str, Any]) -> bool: + return peering_connection["Status"]["Code"] == "active" + +def is_rejected(peering_connection: Dict[str, Any]) -> bool: + return peering_connection["Status"]["Code"] == "rejected" -def is_active(peering_conn): - return peering_conn["Status"]["Code"] == "active" +def is_pending(peering_connection: Dict[str, Any]) -> bool: + return peering_connection["Status"]["Code"] == "pending-acceptance" -def is_pending(peering_conn): - return peering_conn["Status"]["Code"] == "pending-acceptance" +def is_deleted(peering_connection: Dict[str, Any]) -> bool: + return peering_connection["Status"]["Code"] == "deleted" + + +def create_peering_connection(client, module: AnsibleAWSModule) -> Tuple[bool, Dict[str, Any]]: + changed: bool = False + params: Dict = {} -def create_peer_connection(client, module): - changed = False - params = dict() params["VpcId"] = module.params.get("vpc_id") params["PeerVpcId"] = module.params.get("peer_vpc_id") + if module.params.get("peer_region"): - params["PeerRegion"] = module.params.get("peer_region") + params["PeerRegion"] = module.params["peer_region"] + if module.params.get("peer_owner_id"): - params["PeerOwnerId"] = str(module.params.get("peer_owner_id")) - peering_conns = describe_peering_connections(params, client) - for peering_conn in peering_conns["VpcPeeringConnections"]: - pcx_id = peering_conn["VpcPeeringConnectionId"] - if ensure_ec2_tags( + params["PeerOwnerId"] = module.params["peer_owner_id"] + + peering_connections = describe_peering_connections(client, module, params) + for peering_connection in peering_connections: + changed |= ensure_ec2_tags( client, module, - pcx_id, + peering_connection["VpcPeeringConnectionId"], purge_tags=module.params.get("purge_tags"), tags=module.params.get("tags"), - ): - changed = True - if is_active(peering_conn): - return (changed, peering_conn) - if is_pending(peering_conn): - return (changed, peering_conn) - try: - peering_conn = client.create_vpc_peering_connection(aws_retry=True, **params) - pcx_id = peering_conn["VpcPeeringConnection"]["VpcPeeringConnectionId"] - if module.params.get("tags"): - # Once the minimum botocore version is bumped to > 1.17.24 - # (hopefully community.aws 3.0.0) we can add the tags to the - # creation parameters - add_ec2_tags( - client, - module, - pcx_id, - module.params.get("tags"), - retry_codes=["InvalidVpcPeeringConnectionID.NotFound"], - ) - if module.params.get("wait"): - wait_for_state(client, module, "pending-acceptance", pcx_id) - changed = True - return (changed, peering_conn["VpcPeeringConnection"]) - except botocore.exceptions.ClientError as e: - module.fail_json(msg=str(e)) + ) + if is_active(peering_connection): + return (changed, peering_connection) -def remove_peer_connection(client, module): - pcx_id = module.params.get("peering_id") - if pcx_id: - peering_conn = get_peering_connection_by_id(pcx_id, client, module) + if is_pending(peering_connection): + return (changed, peering_connection) + + if module.params.get("tags"): + params["TagSpecifications"] = boto3_tag_specifications(module.params["tags"], types="vpc-peering-connection") + + if module.check_mode: + return (True, {"VpcPeeringConnectionId": ""}) + + peering_connection = create_vpc_peering_connection(client, **params) + if module.params.get("wait"): + wait_for_state(client, module, "pending-acceptance", peering_connection["VpcPeeringConnectionId"]) + changed = True + return (changed, peering_connection) + + +def delete_peering_connection(client, module: AnsibleAWSModule) -> NoReturn: + peering_id = module.params.get("peering_id") + if peering_id: + peering_connection = get_peering_connection_by_id(client, module, peering_id) else: - params = dict() + params: Dict = {} params["VpcId"] = module.params.get("vpc_id") params["PeerVpcId"] = module.params.get("peer_vpc_id") params["PeerRegion"] = module.params.get("peer_region") + if module.params.get("peer_owner_id"): - params["PeerOwnerId"] = str(module.params.get("peer_owner_id")) - peering_conn = describe_peering_connections(params, client)["VpcPeeringConnections"][0] + params["PeerOwnerId"] = module.params["peer_owner_id"] + + peering_connection = describe_peering_connections(client, module, params)[0] - if not peering_conn: + if not peering_connection: module.exit_json(changed=False) else: - pcx_id = pcx_id or peering_conn["VpcPeeringConnectionId"] + peering_id = peering_id or peering_connection["VpcPeeringConnectionId"] + + if is_deleted(peering_connection): + module.exit_json(msg="Connection in deleted state.", changed=False, peering_id=peering_id) - if peering_conn["Status"]["Code"] == "deleted": - module.exit_json(msg="Connection in deleted state.", changed=False, peering_id=pcx_id) - if peering_conn["Status"]["Code"] == "rejected": + if is_rejected(peering_connection): module.exit_json( msg="Connection has been rejected. State cannot be changed and will be removed automatically by AWS", changed=False, - peering_id=pcx_id, + peering_id=peering_id, ) - try: - params = dict() - params["VpcPeeringConnectionId"] = pcx_id - client.delete_vpc_peering_connection(aws_retry=True, **params) + if not module.check_mode: + delete_vpc_peering_connection(client, peering_id) if module.params.get("wait"): - wait_for_state(client, module, "deleted", pcx_id) - module.exit_json(changed=True, peering_id=pcx_id) - except botocore.exceptions.ClientError as e: - module.fail_json(msg=str(e)) + wait_for_state(client, module, "deleted", peering_id) + + module.exit_json(changed=True, peering_id=peering_id) -def get_peering_connection_by_id(peering_id, client, module): - params = dict() - params["VpcPeeringConnectionIds"] = [peering_id] +def get_peering_connection_by_id(client, module: AnsibleAWSModule, peering_id: str) -> Dict[str, Any]: + filters: Dict = {} + filters["VpcPeeringConnectionIds"] = [peering_id] + try: - vpc_peering_connection = client.describe_vpc_peering_connections(aws_retry=True, **params) - return vpc_peering_connection["VpcPeeringConnections"][0] + result = describe_vpc_peering_connections(client, VpcPeeringConnectionIds=[peering_id]) + return result[0] except is_boto3_error_code("InvalidVpcPeeringConnectionId.Malformed") as e: module.fail_json_aws(e, msg="Malformed connection ID") - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg="Error while describing peering connection by peering_id") -def accept_reject(state, client, module): - changed = False - params = dict() +def accept_reject_peering_connection(client, module: AnsibleAWSModule, state: str) -> Tuple[bool, Dict[str, Any]]: + changed: bool = False + peering_id = module.params.get("peering_id") - params["VpcPeeringConnectionId"] = peering_id - vpc_peering_connection = get_peering_connection_by_id(peering_id, client, module) - peering_status = vpc_peering_connection["Status"]["Code"] + vpc_peering_connection = get_peering_connection_by_id(client, module, peering_id) - if peering_status not in ["active", "rejected"]: - try: + if not (is_active(vpc_peering_connection) or is_rejected(vpc_peering_connection)): + if not module.check_mode: if state == "accept": - client.accept_vpc_peering_connection(aws_retry=True, **params) + changed |= accept_vpc_peering_connection(client, peering_id) target_state = "active" else: - client.reject_vpc_peering_connection(aws_retry=True, **params) + changed |= reject_vpc_peering_connection(client, peering_id) target_state = "rejected" - if module.params.get("tags"): - add_ec2_tags( - client, - module, - peering_id, - module.params.get("tags"), - retry_codes=["InvalidVpcPeeringConnectionID.NotFound"], - ) - changed = True + if module.params.get("wait"): wait_for_state(client, module, target_state, peering_id) - except botocore.exceptions.ClientError as e: - module.fail_json(msg=str(e)) - if ensure_ec2_tags( + + changed = True + + changed |= ensure_ec2_tags( client, module, peering_id, purge_tags=module.params.get("purge_tags"), tags=module.params.get("tags"), - ): - changed = True + ) + + # Reload peering conection info to return latest state/params + vpc_peering_connection = get_peering_connection_by_id(client, module, peering_id) - # Relaod peering conection infos to return latest state/params - vpc_peering_connection = get_peering_connection_by_id(peering_id, client, module) return (changed, vpc_peering_connection) def main(): argument_spec = dict( - vpc_id=dict(), - peer_vpc_id=dict(), - peer_region=dict(), - peering_id=dict(), - peer_owner_id=dict(), + vpc_id=dict(type="str"), + peer_vpc_id=dict(type="str"), + peer_region=dict(type="str"), + peering_id=dict(type="str"), + peer_owner_id=dict(type="str"), tags=dict(required=False, type="dict", aliases=["resource_tags"]), purge_tags=dict(default=True, type="bool"), - state=dict(default="present", choices=["present", "absent", "accept", "reject"]), + state=dict(default="present", type="str", choices=["present", "absent", "accept", "reject"]), wait=dict(default=False, type="bool"), ) required_if = [ @@ -574,29 +580,26 @@ def main(): ("state", "reject", ["peering_id"]), ] - module = AnsibleAWSModule(argument_spec=argument_spec, required_if=required_if) + module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) state = module.params.get("state") peering_id = module.params.get("peering_id") vpc_id = module.params.get("vpc_id") peer_vpc_id = module.params.get("peer_vpc_id") - try: - client = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff()) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to connect to AWS") + client = module.client("ec2") if state == "present": - (changed, results) = create_peer_connection(client, module) + (changed, results) = create_peering_connection(client, module) elif state == "absent": if not peering_id and (not vpc_id or not peer_vpc_id): module.fail_json( msg="state is absent but one of the following is missing: peering_id or [vpc_id, peer_vpc_id]" ) - remove_peer_connection(client, module) + delete_peering_connection(client, module) else: - (changed, results) = accept_reject(state, client, module) + (changed, results) = accept_reject_peering_connection(client, module, state) formatted_results = camel_dict_to_snake_dict(results) # Turn the resource tags from boto3 into an ansible friendly tag dictionary diff --git a/plugins/modules/ec2_vpc_peering_info.py b/plugins/modules/ec2_vpc_peering_info.py index badc9f8fd80..066211ccbe5 100644 --- a/plugins/modules/ec2_vpc_peering_info.py +++ b/plugins/modules/ec2_vpc_peering_info.py @@ -6,7 +6,7 @@ DOCUMENTATION = r""" module: ec2_vpc_peering_info -short_description: Retrieves AWS VPC Peering details using AWS methods. +short_description: Retrieves AWS VPC Peering details using AWS methods version_added: 1.0.0 description: - Gets various details related to AWS VPC Peers @@ -25,6 +25,7 @@ default: {} author: - Karen Cheng (@Etherdaemon) + - Alina Buzachis (@alinabuzachis) extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -32,8 +33,7 @@ """ EXAMPLES = r""" -# Simple example of listing all VPC Peers -- name: List all vpc peers +- name: List all EC2 VPC Peering Connections community.aws.ec2_vpc_peering_info: region: ap-southeast-2 register: all_vpc_peers @@ -42,19 +42,19 @@ ansible.builtin.debug: msg: "{{ all_vpc_peers.result }}" -- name: Get details on specific VPC peer +- name: Get details on specific EC2 VPC Peering Connection community.aws.ec2_vpc_peering_info: peer_connection_ids: - - pcx-12345678 - - pcx-87654321 - region: ap-southeast-2 + - "pcx-12345678" + - "pcx-87654321" + region: "ap-southeast-2" register: all_vpc_peers -- name: Get all vpc peers with specific filters +- name: Get all EC2 VPC Peering Connections with specific filters community.aws.ec2_vpc_peering_info: - region: ap-southeast-2 + region: "ap-southeast-2" filters: - status-code: ['pending-acceptance'] + status-code: ["pending-acceptance"] register: pending_vpc_peers """ @@ -63,32 +63,34 @@ description: Details of the matching VPC peering connections. returned: success type: list + elements: dict contains: accepter_vpc_info: description: Information about the VPC which accepted the connection. returned: success - type: complex + type: dict contains: cidr_block: description: The primary CIDR for the VPC. returned: when connection is in the accepted state. type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" cidr_block_set: description: A list of all CIDRs for the VPC. returned: when connection is in the accepted state. - type: complex + type: list + elements: dict contains: cidr_block: description: A CIDR block used by the VPC. returned: success type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" owner_id: description: The AWS account that owns the VPC. returned: success type: str - example: 123456789012 + sample: "123456789012" peering_options: description: Additional peering configuration. returned: when connection is in the accepted state. @@ -110,37 +112,38 @@ description: The AWS region that the VPC is in. returned: success type: str - example: us-east-1 + sample: "us-east-1" vpc_id: description: The ID of the VPC returned: success type: str - example: vpc-0123456789abcdef0 + sample: "vpc-0123456789abcdef0" requester_vpc_info: description: Information about the VPC which requested the connection. returned: success - type: complex + type: dict contains: cidr_block: description: The primary CIDR for the VPC. returned: when connection is not in the deleted state. type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" cidr_block_set: description: A list of all CIDRs for the VPC. returned: when connection is not in the deleted state. - type: complex + type: list + elements: dict contains: cidr_block: description: A CIDR block used by the VPC returned: success type: str - example: '10.10.10.0/23' + sample: "10.10.10.0/23" owner_id: description: The AWS account that owns the VPC. returned: success type: str - example: 123456789012 + sample: "123456789012" peering_options: description: Additional peering configuration. returned: when connection is not in the deleted state. @@ -162,27 +165,27 @@ description: The AWS region that the VPC is in. returned: success type: str - example: us-east-1 + sample: "us-east-1" vpc_id: description: The ID of the VPC returned: success type: str - example: vpc-0123456789abcdef0 + sample: "vpc-0123456789abcdef0" status: description: Details of the current status of the connection. returned: success - type: complex + type: dict contains: code: description: A short code describing the status of the connection. returned: success type: str - example: active + sample: "active" message: description: Additional information about the status of the connection. returned: success type: str - example: Pending Acceptance by 123456789012 + sample: "Pending Acceptance by 123456789012" tags: description: Tags applied to the connection. returned: success @@ -191,41 +194,171 @@ description: The ID of the VPC peering connection. returned: success type: str - example: "pcx-0123456789abcdef0" + sample: "pcx-0123456789abcdef0" result: description: The result of the describe. returned: success type: list + elements: dict + contains: + accepter_vpc_info: + description: Information about the VPC which accepted the connection. + returned: success + type: dict + contains: + cidr_block: + description: The primary CIDR for the VPC. + returned: when connection is in the accepted state. + type: str + sample: "10.10.10.0/23" + cidr_block_set: + description: A list of all CIDRs for the VPC. + returned: when connection is in the accepted state. + type: list + elements: dict + contains: + cidr_block: + description: A CIDR block used by the VPC. + returned: success + type: str + sample: "10.10.10.0/23" + owner_id: + description: The AWS account that owns the VPC. + returned: success + type: str + sample: "123456789012" + peering_options: + description: Additional peering configuration. + returned: when connection is in the accepted state. + type: dict + contains: + allow_dns_resolution_from_remote_vpc: + description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. + returned: success + type: bool + allow_egress_from_local_classic_link_to_remote_vpc: + description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. + returned: success + type: bool + allow_egress_from_local_vpc_to_remote_classic_link: + description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. + returned: success + type: bool + region: + description: The AWS region that the VPC is in. + returned: success + type: str + sample: "us-east-1" + vpc_id: + description: The ID of the VPC + returned: success + type: str + sample: "vpc-0123456789abcdef0" + requester_vpc_info: + description: Information about the VPC which requested the connection. + returned: success + type: dict + contains: + cidr_block: + description: The primary CIDR for the VPC. + returned: when connection is not in the deleted state. + type: str + sample: "10.10.10.0/23" + cidr_block_set: + description: A list of all CIDRs for the VPC. + returned: when connection is not in the deleted state. + type: list + elements: dict + contains: + cidr_block: + description: A CIDR block used by the VPC + returned: success + type: str + sample: "10.10.10.0/23" + owner_id: + description: The AWS account that owns the VPC. + returned: success + type: str + sample: "123456789012" + peering_options: + description: Additional peering configuration. + returned: when connection is not in the deleted state. + type: dict + contains: + allow_dns_resolution_from_remote_vpc: + description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. + returned: success + type: bool + allow_egress_from_local_classic_link_to_remote_vpc: + description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. + returned: success + type: bool + allow_egress_from_local_vpc_to_remote_classic_link: + description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. + returned: success + type: bool + region: + description: The AWS region that the VPC is in. + returned: success + type: str + sample: "us-east-1" + vpc_id: + description: The ID of the VPC + returned: success + type: str + sample: "vpc-0123456789abcdef0" + status: + description: Details of the current status of the connection. + returned: success + type: dict + contains: + code: + description: A short code describing the status of the connection. + returned: success + type: str + sample: "active" + message: + description: Additional information about the status of the connection. + returned: success + type: str + sample: "Pending Acceptance by 123456789012" + tags: + description: Tags applied to the connection. + returned: success + type: dict + vpc_peering_connection_id: + description: The ID of the VPC peering connection. + returned: success + type: str + sample: "pcx-0123456789abcdef0" """ -try: - import botocore -except ImportError: - pass # Handled by AnsibleAWSModule + +from typing import Any +from typing import Dict +from typing import List from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def get_vpc_peers(client, module): - params = dict() +def get_vpc_peers(client, module: AnsibleAWSModule) -> List[Dict[str, Any]]: + params: Dict = {} params["Filters"] = ansible_dict_to_boto3_filter_list(module.params.get("filters")) + if module.params.get("peer_connection_ids"): params["VpcPeeringConnectionIds"] = module.params.get("peer_connection_ids") - try: - result = client.describe_vpc_peering_connections(aws_retry=True, **params) - result = normalize_boto3_result(result) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to describe peering connections") - return result["VpcPeeringConnections"] + result = describe_vpc_peering_connections(client, **params) + + return normalize_boto3_result(result) def main(): @@ -239,13 +372,10 @@ def main(): supports_check_mode=True, ) - try: - ec2 = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff()) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to connect to AWS") + client = module.client("ec2") # Turn the boto3 result in to ansible friendly_snaked_names - results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(ec2, module)] + results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(client, module)] # Turn the boto3 result in to ansible friendly tag dictionary for peer in results: diff --git a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml b/tests/integration/targets/ec2_vpc_peer/tasks/main.yml index b39b69b74b0..859e482b319 100644 --- a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_peer/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: ec2_vpc_igw tests +- name: EC2 VPC Peering Connection integration tests collections: - amazon.aws module_defaults: @@ -9,27 +9,29 @@ session_token: "{{ security_token | default(omit) }}" region: "{{ aws_region }}" block: - - name: get ARN of calling user + - name: Get ARN of calling user aws_caller_info: register: aws_caller_info + - name: Store Account ID for later use - set_fact: + ansible.builtin.set_fact: account_id: '{{ aws_caller_info.account }}' # ============================================================ - - name: Fetch Peers in check_mode - ec2_vpc_peering_info: + - name: Fetch EC2 VPC Peering Connections in check_mode + community.aws.ec2_vpc_peering_info: register: peers_info check_mode: True + - name: Assert success - assert: + ansible.builtin.assert: that: - peers_info is successful - '"result" in peers_info' # ============================================================ - - name: create VPC 1 - ec2_vpc_net: + - name: Create VPC 1 + amazon.aws.ec2_vpc_net: name: "{{ vpc_1_name }}" state: present cidr_block: "{{ vpc_1_cidr }}" @@ -37,13 +39,14 @@ Name: "{{ vpc_1_name }}" TestPrefex: "{{ resource_prefix }}" register: vpc_1_result + - name: Assert success - assert: + ansible.builtin.assert: that: - vpc_1_result is successful - - name: create VPC 2 - ec2_vpc_net: + - name: Create VPC 2 + amazon.aws.ec2_vpc_net: name: "{{ vpc_2_name }}" state: present cidr_block: "{{ vpc_2_cidr }}" @@ -51,8 +54,9 @@ Name: "{{ vpc_2_name }}" TestPrefex: "{{ resource_prefix }}" register: vpc_2_result + - name: Assert success - assert: + ansible.builtin.assert: that: - vpc_2_result is successful @@ -62,20 +66,35 @@ vpc_2: '{{ vpc_2_result.vpc.id }}' - name: Set a name to use with the connections - set_fact: + ansible.builtin.set_fact: connection_name: 'Peering connection for VPC {{ vpc_1 }} to VPC {{ vpc_2 }}' - - name: Create local account VPC peering Connection request - ec2_vpc_peer: + - name: Create local account EC2 VPC Peering Connection request (check_mode) + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present tags: Name: '{{ connection_name }}' + check_mode: true register: vpc_peer - name: Assert success - assert: + ansible.builtin.assert: + that: + - vpc_peer is changed + + - name: Create local account EC2 VPC Peering Connection request + community.aws.ec2_vpc_peer: + vpc_id: '{{ vpc_1 }}' + peer_vpc_id: '{{ vpc_2 }}' + state: present + tags: + Name: '{{ connection_name }}' + register: vpc_peer + + - name: Assert success + ansible.builtin.assert: that: - vpc_peer is changed - vpc_peer is successful @@ -84,48 +103,79 @@ - vpc_peer.peering_id.startswith('pcx-') - name: Store Connection ID - set_fact: + ansible.builtin.set_fact: peer_id_1: '{{ vpc_peer.peering_id }}' - - name: (re-) Create local account VPC peering Connection request (idempotency) - ec2_vpc_peer: + - name: Re-create local account EC2 VPC Peering Connection request (idempotency check_mode) + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present tags: Name: '{{ connection_name }}' + check_mode: true register: vpc_peer - name: Assert success - assert: + ansible.builtin.assert: + that: + - vpc_peer is not changed + + - name: Re-create local account EC2 VPC Peering Connection request (idempotency) + community.aws.ec2_vpc_peer: + vpc_id: '{{ vpc_1 }}' + peer_vpc_id: '{{ vpc_2 }}' + state: present + tags: + Name: '{{ connection_name }}' + register: vpc_peer + + - name: Assert success + ansible.builtin.assert: that: - vpc_peer is not changed - vpc_peer is successful - vpc_peer.peering_id == peer_id_1 - - name: (re-) Create local account VPC peering Connection request with accepter/requester reversed (idempotency) - ec2_vpc_peer: + - name: Create local account EC2 VPC Peering Connection request with accepter/requester reversed (idempotency check_mode) + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_2 }}' peer_vpc_id: '{{ vpc_1 }}' state: present tags: Name: '{{ connection_name }}' + check_mode: true register: vpc_peer - name: Assert success - assert: + ansible.builtin.assert: + that: + - vpc_peer is not changed + + - name: Create local account EC2 VPC Peering Connection request with accepter/requester reversed (idempotency) + community.aws.ec2_vpc_peer: + vpc_id: '{{ vpc_2 }}' + peer_vpc_id: '{{ vpc_1 }}' + state: present + tags: + Name: '{{ connection_name }}' + register: vpc_peer + + - name: Assert success + ansible.builtin.assert: that: - vpc_peer is not changed - vpc_peer is successful - vpc_peer.peering_id == peer_id_1 - - name: Get details on specific VPC peer - ec2_vpc_peering_info: + - name: Get details on specific EC2 VPC Peering Connection + community.aws.ec2_vpc_peering_info: peer_connection_ids: - '{{ peer_id_1 }}' register: peer_info + - name: Assert expected values - assert: + ansible.builtin.assert: that: - peer_info is successful - "'vpc_peering_connections' in peer_info" @@ -170,13 +220,14 @@ acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' requester_details: '{{ peer_details["requester_vpc_info"] }}' - - name: Get all vpc peers with specific filters - ec2_vpc_peering_info: + - name: Get all EC2 VPC Peering Connections with specific filters + community.aws.ec2_vpc_peering_info: filters: status-code: ['pending-acceptance'] register: pending_vpc_peers + - name: Assert expected values - assert: + ansible.builtin.assert: that: # Not guaranteed to just be us, only assert the shape - pending_vpc_peers is successful @@ -210,8 +261,24 @@ acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' requester_details: '{{ peer_details["requester_vpc_info"] }}' - - name: Update tags on the VPC Peering Connection - ec2_vpc_peer: + - name: Update tags on the EC2 VPC Peering Connection (check_mode) + community.aws.ec2_vpc_peer: + vpc_id: '{{ vpc_1 }}' + peer_vpc_id: '{{ vpc_2 }}' + state: present + tags: + Name: '{{ connection_name }}' + testPrefix: '{{ resource_prefix }}' + check_mode: true + register: tag_peer + + - name: Assert success + ansible.builtin.assert: + that: + - tag_peer is changed + + - name: Update tags on the EC2 VPC Peering Connection + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present @@ -219,36 +286,55 @@ Name: '{{ connection_name }}' testPrefix: '{{ resource_prefix }}' register: tag_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - tag_peer is changed - tag_peer is successful - tag_peer.peering_id == peer_id_1 - - name: (re-) Update tags on the VPC Peering Connection (idempotency) - ec2_vpc_peer: + - name: Update tags on the EC2 VPC Peering Connection (idempotency check_mode) + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present tags: Name: '{{ connection_name }}' testPrefix: '{{ resource_prefix }}' + check_mode: true register: tag_peer + - name: Assert success - assert: + ansible.builtin.assert: + that: + - tag_peer is not changed + + - name: Update tags on the EC2 VPC Peering Connection (idempotency) + community.aws.ec2_vpc_peer: + vpc_id: '{{ vpc_1 }}' + peer_vpc_id: '{{ vpc_2 }}' + state: present + tags: + Name: '{{ connection_name }}' + testPrefix: '{{ resource_prefix }}' + register: tag_peer + + - name: Assert success + ansible.builtin.assert: that: - tag_peer is not changed - tag_peer is successful - tag_peer.peering_id == peer_id_1 - - name: Get details on specific VPC peer - ec2_vpc_peering_info: + - name: Get details on specific EC2 VPC Peering Connection + community.aws.ec2_vpc_peering_info: peer_connection_ids: - '{{ peer_id_1 }}' register: peer_info + - name: Assert expected tags - assert: + ansible.builtin.assert: that: - peer_info is successful - "'tags' in peer_details" @@ -259,14 +345,28 @@ vars: peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - - name: Accept local VPC peering request - ec2_vpc_peer: + - name: Accept local EC2 VPC Peering request (check_mode) + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer.peering_id }}" state: accept - wait: True + wait: true + check_mode: true + register: action_peer + + - name: Assert success + ansible.builtin.assert: + that: + - action_peer is changed + + - name: Accept local EC2 VPC Peering request + community.aws.ec2_vpc_peer: + peering_id: "{{ vpc_peer.peering_id }}" + state: accept + wait: true register: action_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - action_peer is changed - action_peer is successful @@ -274,13 +374,14 @@ - action_peer.vpc_peering_connection.accepter_vpc_info.cidr_block == vpc_2_cidr - action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1 - - name: Get details on specific VPC peer - ec2_vpc_peering_info: + - name: Get details on specific EC2 VPC Peering Connection + community.aws.ec2_vpc_peering_info: peer_connection_ids: - '{{ peer_id_1 }}' register: peer_info + - name: Assert expected values - assert: + ansible.builtin.assert: that: - peer_info is successful - "'vpc_peering_connections' in peer_info" @@ -331,38 +432,65 @@ acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' requester_details: '{{ peer_details["requester_vpc_info"] }}' - - name: (re-) Accept local VPC peering request (idempotency) - ec2_vpc_peer: + - name: Accept local EC2 VPC Peering request (idempotency check_mode) + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer.peering_id }}" state: accept + check_mode: true register: action_peer + - name: Assert success - assert: + ansible.builtin.assert: + that: + - action_peer is not changed + + - name: Accept local EC2 VPC Peering request (idempotency) + community.aws.ec2_vpc_peer: + peering_id: "{{ vpc_peer.peering_id }}" + state: accept + register: action_peer + + - name: Assert success + ansible.builtin.assert: that: - action_peer is not changed - action_peer is successful - action_peer.peering_id == peer_id_1 - action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1 - - name: delete a local VPC peering Connection - ec2_vpc_peer: + - name: Delete a local EC2 VPC Peering Connection (check_mode) + community.aws.ec2_vpc_peer: + peering_id: "{{ vpc_peer.peering_id }}" + state: absent + check_mode: true + register: delete_peer + + - name: Assert success + ansible.builtin.assert: + that: + - delete_peer is changed + + - name: Delete a local EC2 VPC Peering Connection + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer.peering_id }}" state: absent register: delete_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - delete_peer is changed - delete_peer is successful - "'peering_id' in delete_peer" - - name: Get details on specific VPC peer - ec2_vpc_peering_info: + - name: Get details on specific EC2 VPC Peering Connection + community.aws.ec2_vpc_peering_info: peer_connection_ids: - '{{ peer_id_1}}' register: peer_info + - name: Assert expected values - assert: + ansible.builtin.assert: that: - peer_info is successful - "'vpc_peering_connections' in peer_info" @@ -405,27 +533,41 @@ acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' requester_details: '{{ peer_details["requester_vpc_info"] }}' - - name: (re-) delete a local VPC peering Connection (idempotency) - ec2_vpc_peer: + - name: Delete a local EC2 VPC Peering Connection (idempotency check_mode) + community.aws.ec2_vpc_peer: + peering_id: "{{ vpc_peer.peering_id }}" + state: absent + check_mode: true + register: delete_peer + + - name: Assert success + ansible.builtin.assert: + that: + - delete_peer is not changed + + - name: Delete a local EC2 VPC Peering Connection (idempotency) + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer.peering_id }}" state: absent register: delete_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - delete_peer is not changed - delete_peer is successful - - name: Create local account VPC peering Connection - ec2_vpc_peer: + - name: Create local account EC2 VPC Peering Connection + community.aws.ec2_vpc_peer: vpc_id: '{{ vpc_1 }}' peer_vpc_id: '{{ vpc_2 }}' state: present tags: Name: 'Peering connection for VPC {{ vpc_1 }} to VPC {{ vpc_2 }}' register: vpc_peer2 + - name: Assert success - assert: + ansible.builtin.assert: that: - vpc_peer2 is changed - vpc_peer2 is successful @@ -433,50 +575,53 @@ - vpc_peer2.peering_id.startswith('pcx-') - name: Store Connection ID - set_fact: + ansible.builtin.set_fact: peer_id_2: '{{ vpc_peer2.peering_id }}' - - name: reject a local VPC peering Connection - ec2_vpc_peer: + - name: Reject a local EC2 VPC Peering Connection + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer2.peering_id }}" state: reject wait: True register: reject_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - reject_peer is changed - reject_peer is successful - reject_peer.peering_id == peer_id_2 - - name: (re-) reject a local VPC peering Connection - ec2_vpc_peer: + - name: Reject a local EC2 VPC Peering Connection (idempotency) + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer2.peering_id }}" state: reject register: reject_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - reject_peer is not changed - reject_peer is successful - reject_peer.peering_id == peer_id_2 - reject_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_2 - - name: delete a local VPC peering Connection - ec2_vpc_peer: + - name: Delete a local EC2 VPC Peering Connections + community.aws.ec2_vpc_peer: peering_id: "{{ vpc_peer2.peering_id }}" state: absent register: delete_peer + - name: Assert success - assert: + ansible.builtin.assert: that: - delete_peer is not changed - delete_peer is successful always: - - name: Find all VPC Peering connections for our VPCs - ec2_vpc_peering_info: + - name: Find all EC2 VPC Peering Connections for our VPCs + community.aws.ec2_vpc_peering_info: filters: accepter-vpc-info.vpc-id: '{{ item }}' register: peering_info @@ -484,7 +629,7 @@ - '{{ vpc_1 }}' - '{{ vpc_2 }}' - - set_fact: + - ansible.builtin.set_fact: vpc_peering_connection_ids: '{{ _vpc_peering_connections | map(attribute="vpc_peering_connection_id") | list }}' vars: _vpc_peering_connections: '{{ peering_info.results | map(attribute="vpc_peering_connections") | flatten }}' @@ -492,23 +637,19 @@ # ============================================================ - - name: Delete remaining Peering connections - ec2_vpc_peer: + - name: Delete remaining EC2 VPC Peering Connections + community.aws.ec2_vpc_peer: peering_id: "{{ item }}" state: absent ignore_errors: True loop: '{{ vpc_peering_connection_ids }}' - - name: tidy up VPC 2 - ec2_vpc_net: - name: "{{ vpc_2_name }}" + - name: Tidy up VPCs + amazon.aws.ec2_vpc_net: + name: "{{ item.name }}" state: absent - cidr_block: "{{ vpc_2_cidr }}" - ignore_errors: true - - - name: tidy up VPC 1 - ec2_vpc_net: - name: "{{ vpc_1_name }}" - state: absent - cidr_block: "{{ vpc_1_cidr }}" + cidr_block: "{{ item.cidr }}" ignore_errors: true + loop: + - { name: "{{ vpc_2_name }}", cidr: "{{ vpc_2_cidr }}"} + - { name: "{{ vpc_1_name }}", cidr: "{{ vpc_1_cidr }}"} From 86d268f3391b49c5767d2243de7a5f0d74e49cb5 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:34:05 +0200 Subject: [PATCH 53/77] Prepare modules ec2_vpc_nacl and ec2_vpc_nacl_info for promotion (#2159) SUMMARY Use shared code from amazon.aws.plugins.module_utils.ec2 Refactor module ec2_vpc_nacl and ec2_vpc_nacl_info ISSUE TYPE Feature Pull Request Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS --- ...0240924-refactor-ec2_vpc_nacl-modules.yaml | 4 + plugins/modules/ec2_vpc_nacl.py | 606 ++++++++---------- plugins/modules/ec2_vpc_nacl_info.py | 109 ++-- .../ec2_vpc_nacl/tasks/ingress_and_egress.yml | 75 +-- .../targets/ec2_vpc_nacl/tasks/ipv6.yml | 57 +- .../targets/ec2_vpc_nacl/tasks/main.yml | 101 ++- .../targets/ec2_vpc_nacl/tasks/subnet_ids.yml | 76 +-- .../ec2_vpc_nacl/tasks/subnet_names.yml | 59 +- .../targets/ec2_vpc_nacl/tasks/tags.yml | 224 +++---- 9 files changed, 635 insertions(+), 676 deletions(-) create mode 100644 changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml diff --git a/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml b/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml new file mode 100644 index 00000000000..475d00cb9b9 --- /dev/null +++ b/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml @@ -0,0 +1,4 @@ +--- +minor_changes: + - ec2_vpc_nacl_info - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). + - ec2_vpc_nacl - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). diff --git a/plugins/modules/ec2_vpc_nacl.py b/plugins/modules/ec2_vpc_nacl.py index cf109de1c8b..bc92003d17c 100644 --- a/plugins/modules/ec2_vpc_nacl.py +++ b/plugins/modules/ec2_vpc_nacl.py @@ -15,13 +15,15 @@ name: description: - Tagged name identifying a network ACL. - - One and only one of the I(name) or I(nacl_id) is required. + - One and only one of the O(name) or O(nacl_id) is required. + - Mutually exclusive with O(nacl_id). required: false type: str nacl_id: description: - NACL id identifying a network ACL. - - One and only one of the I(name) or I(nacl_id) is required. + - One and only one of the O(name) or O(nacl_id) is required. + - Mutually exclusive with O(name). required: false type: str vpc_id: @@ -142,25 +144,27 @@ """ RETURN = r""" -task: - description: The result of the create, or delete action. - returned: success - type: dict nacl_id: - description: The id of the NACL (when creating or updating an ACL) + description: The id of the NACL (when creating or updating an ACL). returned: success type: str - sample: acl-123456789abcdef01 + sample: "acl-123456789abcdef01" """ -try: - import botocore -except ImportError: - pass # Handled by AnsibleAWSModule - +from typing import Any +from typing import Dict +from typing import List +from typing import Optional + +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_network_acl +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_network_acl_entry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_network_acl +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_network_acl_entry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_network_acls +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_subnets from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import replace_network_acl_association from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule @@ -170,70 +174,63 @@ # Utility methods -def icmp_present(entry): - if len(entry) == 6 and entry[1] in ["icmp", "ipv6-icmp"] or entry[1] in [1, 58]: - return True - - -def subnets_removed(nacl_id, subnets, client, module): - results = find_acl_by_id(nacl_id, client, module) - associations = results["NetworkAcls"][0]["Associations"] - subnet_ids = [assoc["SubnetId"] for assoc in associations] - return [subnet for subnet in subnet_ids if subnet not in subnets] +def icmp_present(entry: List[str]) -> bool: + return len(entry) == 6 and entry[1] in ["icmp", "ipv6-icmp"] or entry[1] in [1, 58] -def subnets_added(nacl_id, subnets, client, module): - results = find_acl_by_id(nacl_id, client, module) - associations = results["NetworkAcls"][0]["Associations"] - subnet_ids = [assoc["SubnetId"] for assoc in associations] - return [subnet for subnet in subnets if subnet not in subnet_ids] - - -def subnets_changed(nacl, client, module): +def subnets_changed(client, module: AnsibleAWSModule, nacl_id: str, subnets_ids: List[str]) -> bool: changed = False vpc_id = module.params.get("vpc_id") - nacl_id = nacl["NetworkAcls"][0]["NetworkAclId"] - subnets = subnets_to_associate(nacl, client, module) - if not subnets: - default_nacl_id = find_default_vpc_nacl(vpc_id, client, module)[0] - subnets = find_subnet_ids_by_nacl_id(nacl_id, client, module) - if subnets: - replace_network_acl_association(default_nacl_id, subnets, client, module) - changed = True - return changed - changed = False + + if not subnets_ids: + default_nacl_id = find_default_vpc_nacl(client, vpc_id) + # Find subnets by Network ACL ids + network_acls = describe_network_acls( + client, Filters=[{"Name": "association.network-acl-id", "Values": [nacl_id]}] + ) + subnets = [ + association["SubnetId"] + for nacl in network_acls + for association in nacl["Associations"] + if association["SubnetId"] + ] + changed = associate_nacl_to_subnets(client, module, default_nacl_id, subnets) return changed - subs_added = subnets_added(nacl_id, subnets, client, module) - if subs_added: - replace_network_acl_association(nacl_id, subs_added, client, module) - changed = True - subs_removed = subnets_removed(nacl_id, subnets, client, module) - if subs_removed: - default_nacl_id = find_default_vpc_nacl(vpc_id, client, module)[0] - replace_network_acl_association(default_nacl_id, subs_removed, client, module) - changed = True + + network_acls = describe_network_acls(client, NetworkAclIds=[nacl_id]) + current_subnets = [ + association["SubnetId"] + for nacl in network_acls + for association in nacl["Associations"] + if association["SubnetId"] + ] + subnets_added = [subnet for subnet in subnets_ids if subnet not in current_subnets] + subnets_removed = [subnet for subnet in current_subnets if subnet not in subnets_ids] + + if subnets_added: + changed |= associate_nacl_to_subnets(client, module, nacl_id, subnets_added) + if subnets_removed: + default_nacl_id = find_default_vpc_nacl(client, vpc_id) + changed |= associate_nacl_to_subnets(client, module, default_nacl_id, subnets_removed) + return changed -def nacls_changed(nacl, client, module): +def nacls_changed(client, module: AnsibleAWSModule, nacl_info: Dict[str, Any]) -> bool: changed = False - params = dict() - params["egress"] = module.params.get("egress") - params["ingress"] = module.params.get("ingress") - - nacl_id = nacl["NetworkAcls"][0]["NetworkAclId"] - nacl = describe_network_acl(client, module) - entries = nacl["NetworkAcls"][0]["Entries"] - egress = [rule for rule in entries if rule["Egress"] is True and rule["RuleNumber"] < 32767] - ingress = [rule for rule in entries if rule["Egress"] is False and rule["RuleNumber"] < 32767] - if rules_changed(egress, params["egress"], True, nacl_id, client, module): - changed = True - if rules_changed(ingress, params["ingress"], False, nacl_id, client, module): - changed = True + entries = nacl_info["Entries"] + nacl_id = nacl_info["NetworkAclId"] + aws_egress_rules = [rule for rule in entries if rule["Egress"] is True and rule["RuleNumber"] < 32767] + aws_ingress_rules = [rule for rule in entries if rule["Egress"] is False and rule["RuleNumber"] < 32767] + + # Egress Rules + changed |= rules_changed(client, nacl_id, module.params.get("egress"), aws_egress_rules, True, module.check_mode) + # Ingress Rules + changed |= rules_changed(client, nacl_id, module.params.get("ingress"), aws_ingress_rules, False, module.check_mode) return changed -def tags_changed(nacl_id, client, module): +def tags_changed(client, module: AnsibleAWSModule, nacl_id: str) -> bool: tags = module.params.get("tags") name = module.params.get("name") purge_tags = module.params.get("purge_tags") @@ -255,42 +252,84 @@ def tags_changed(nacl_id, client, module): ) -def rules_changed(aws_rules, param_rules, Egress, nacl_id, client, module): +def ansible_to_boto3_dict_rule(ansible_rule: List[Any], egress: bool) -> Dict[str, Any]: + boto3_rule = {} + if isinstance(ansible_rule, list): + boto3_rule["RuleNumber"] = ansible_rule[0] + boto3_rule["Protocol"] = str(PROTOCOL_NUMBERS[ansible_rule[1]]) + boto3_rule["RuleAction"] = ansible_rule[2] + boto3_rule["Egress"] = egress + if is_ipv6(ansible_rule[3]): + boto3_rule["Ipv6CidrBlock"] = ansible_rule[3] + else: + boto3_rule["CidrBlock"] = ansible_rule[3] + if icmp_present(ansible_rule): + boto3_rule["IcmpTypeCode"] = {"Type": int(ansible_rule[4]), "Code": int(ansible_rule[5])} + else: + if ansible_rule[6] or ansible_rule[7]: + boto3_rule["PortRange"] = {"From": ansible_rule[6], "To": ansible_rule[7]} + return boto3_rule + + +def find_added_rules(rules_a: List[Dict[str, Any]], rules_b: List[Dict[str, Any]]) -> List[Dict[str, Any]]: + results = [] + # A rule is considered as a new rule if either the RuleNumber does exist in the list of + # current Rules stored in AWS or if the Rule differs with the Rule stored in AWS with the same RuleNumber + for a in rules_a: + if not any(a["RuleNumber"] == b["RuleNumber"] and a == b for b in rules_b): + results.append(a) + return results + + +def rules_changed( + client, + nacl_id: str, + ansible_rules: List[List[str]], + aws_rules: List[Dict[str, Any]], + egress: bool, + check_mode: bool, +) -> bool: + # transform rules: from ansible list to boto3 dict + ansible_rules = [ansible_to_boto3_dict_rule(r, egress) for r in ansible_rules] + + # find added rules + added_rules = find_added_rules(ansible_rules, aws_rules) + # find removed rules + removed_rules = find_added_rules(aws_rules, ansible_rules) + changed = False - rules = list() - for entry in param_rules: - rules.append(process_rule_entry(entry, Egress)) - if rules == aws_rules: - return changed - else: - removed_rules = [x for x in aws_rules if x not in rules] - if removed_rules: - params = dict() - for rule in removed_rules: - params["NetworkAclId"] = nacl_id - params["RuleNumber"] = rule["RuleNumber"] - params["Egress"] = Egress - delete_network_acl_entry(params, client, module) - changed = True - added_rules = [x for x in rules if x not in aws_rules] - if added_rules: - for rule in added_rules: - rule["NetworkAclId"] = nacl_id - create_network_acl_entry(rule, client, module) - changed = True + for rule in added_rules: + changed = True + if not check_mode: + rule_number = rule.pop("RuleNumber") + protocol = rule.pop("Protocol") + rule_action = rule.pop("RuleAction") + egress = rule.pop("Egress") + create_network_acl_entry( + client, + network_acl_id=nacl_id, + protocol=protocol, + egress=egress, + rule_action=rule_action, + rule_number=rule_number, + **rule, + ) + + # Removed Rules + for rule in removed_rules: + changed = True + if not check_mode: + delete_network_acl_entry(client, network_acl_id=nacl_id, rule_number=rule["RuleNumber"], egress=egress) + return changed -def is_ipv6(cidr): +def is_ipv6(cidr: str) -> bool: return ":" in cidr -def process_rule_entry(entry, Egress): - params = dict() - params["RuleNumber"] = entry[0] - params["Protocol"] = str(PROTOCOL_NUMBERS[entry[1]]) - params["RuleAction"] = entry[2] - params["Egress"] = Egress +def process_rule_entry(entry: List[Any]) -> Dict[str, Any]: + params = {} if is_ipv6(entry[3]): params["Ipv6CidrBlock"] = entry[3] else: @@ -300,275 +339,161 @@ def process_rule_entry(entry, Egress): else: if entry[6] or entry[7]: params["PortRange"] = {"From": entry[6], "To": entry[7]} - return params - -def restore_default_associations(assoc_ids, default_nacl_id, client, module): - if assoc_ids: - params = dict() - params["NetworkAclId"] = default_nacl_id[0] - for assoc_id in assoc_ids: - params["AssociationId"] = assoc_id - restore_default_acl_association(params, client, module) - return True - - -def construct_acl_entries(nacl, client, module): - for entry in module.params.get("ingress"): - params = process_rule_entry(entry, Egress=False) - params["NetworkAclId"] = nacl["NetworkAcl"]["NetworkAclId"] - create_network_acl_entry(params, client, module) - for rule in module.params.get("egress"): - params = process_rule_entry(rule, Egress=True) - params["NetworkAclId"] = nacl["NetworkAcl"]["NetworkAclId"] - create_network_acl_entry(params, client, module) + return params -# Module invocations -def setup_network_acl(client, module): +def add_network_acl_entries( + client, nacl_id: str, ansible_entries: List[List[str]], egress: bool, check_mode: bool +) -> bool: changed = False - nacl = describe_network_acl(client, module) - if not nacl["NetworkAcls"]: - tags = {} - if module.params.get("name"): - tags["Name"] = module.params.get("name") - tags.update(module.params.get("tags") or {}) - nacl = create_network_acl(module.params.get("vpc_id"), client, module, tags) - nacl_id = nacl["NetworkAcl"]["NetworkAclId"] - subnets = subnets_to_associate(nacl, client, module) - replace_network_acl_association(nacl_id, subnets, client, module) - construct_acl_entries(nacl, client, module) + for entry in ansible_entries: changed = True - return changed, nacl["NetworkAcl"]["NetworkAclId"] - else: - changed = False - nacl_id = nacl["NetworkAcls"][0]["NetworkAclId"] - changed |= subnets_changed(nacl, client, module) - changed |= nacls_changed(nacl, client, module) - changed |= tags_changed(nacl_id, client, module) - return changed, nacl_id + if not check_mode: + create_network_acl_entry( + client, + network_acl_id=nacl_id, + protocol=str(PROTOCOL_NUMBERS[entry[1]]), + egress=egress, + rule_action=entry[2], + rule_number=entry[0], + **process_rule_entry(entry), + ) + return changed -def remove_network_acl(client, module): +def associate_nacl_to_subnets(client, module: AnsibleAWSModule, nacl_id: str, subnets_ids: List[str]) -> bool: changed = False - result = dict() - nacl = describe_network_acl(client, module) - if nacl["NetworkAcls"]: - nacl_id = nacl["NetworkAcls"][0]["NetworkAclId"] - vpc_id = nacl["NetworkAcls"][0]["VpcId"] - associations = nacl["NetworkAcls"][0]["Associations"] - assoc_ids = [a["NetworkAclAssociationId"] for a in associations] - default_nacl_id = find_default_vpc_nacl(vpc_id, client, module) - if not default_nacl_id: - result = {vpc_id: "Default NACL ID not found - Check the VPC ID"} - return changed, result - if restore_default_associations(assoc_ids, default_nacl_id, client, module): - delete_network_acl(nacl_id, client, module) + if subnets_ids: + network_acls = describe_network_acls(client, Filters=[{"Name": "association.subnet-id", "Values": subnets_ids}]) + associations = [ + association["NetworkAclAssociationId"] + for nacl in network_acls + for association in nacl["Associations"] + if association["SubnetId"] in subnets_ids + ] + for association_id in associations: changed = True - result[nacl_id] = "Successfully deleted" - return changed, result - if not assoc_ids: - delete_network_acl(nacl_id, client, module) - changed = True - result[nacl_id] = "Successfully deleted" - return changed, result - return changed, result - + if not module.check_mode: + replace_network_acl_association(client, network_acl_id=nacl_id, association_id=association_id) + return changed -# Boto3 client methods -@AWSRetry.jittered_backoff() -def _create_network_acl(client, *args, **kwargs): - return client.create_network_acl(*args, **kwargs) +def ensure_present(client, module: AnsibleAWSModule) -> None: + changed = False + nacl = describe_network_acl(client, module) + nacl_id = None + subnets_ids = [] + subnets = module.params.get("subnets") + if subnets: + subnets_ids = find_subnets_ids(client, module, subnets) -def create_network_acl(vpc_id, client, module, tags): - params = dict(VpcId=vpc_id) - if tags: - params["TagSpecifications"] = boto3_tag_specifications(tags, ["network-acl"]) - try: + if not nacl: if module.check_mode: - nacl = dict(NetworkAcl=dict(NetworkAclId="nacl-00000000")) - else: - nacl = _create_network_acl(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - return nacl - + module.exit_json(changed=True, msg="Would have created Network ACL if not in check mode.") -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _create_network_acl_entry(client, *args, **kwargs): - return client.create_network_acl_entry(*args, **kwargs) - - -def create_network_acl_entry(params, client, module): - try: - if not module.check_mode: - _create_network_acl_entry(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) + # Create Network ACL + tags = {} + name = module.params.get("name") + vpc_id = module.params.get("vpc_id") + if name: + tags["Name"] = name + if module.params.get("tags"): + tags.update(module.params.get("tags")) + nacl = create_network_acl(client, vpc_id, tags) + changed = True + # Associate Subnets to Network ACL + nacl_id = nacl["NetworkAclId"] + changed |= associate_nacl_to_subnets(client, module, nacl_id, subnets_ids) -@AWSRetry.jittered_backoff() -def _delete_network_acl(client, *args, **kwargs): - return client.delete_network_acl(*args, **kwargs) + # Create Network ACL entries (ingress and egress) + changed |= add_network_acl_entries( + client, nacl_id, module.params.get("ingress"), egress=False, check_mode=module.check_mode + ) + changed |= add_network_acl_entries( + client, nacl_id, module.params.get("egress"), egress=True, check_mode=module.check_mode + ) + else: + nacl_id = nacl["NetworkAclId"] + changed |= subnets_changed(client, module, nacl_id, subnets_ids) + changed |= nacls_changed(client, module, nacl) + changed |= tags_changed(client, module, nacl_id) + module.exit_json(changed=changed, nacl_id=nacl_id) -def delete_network_acl(nacl_id, client, module): - try: - if not module.check_mode: - _delete_network_acl(client, NetworkAclId=nacl_id) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) +def ensure_absent(client, module: AnsibleAWSModule) -> None: + changed = False + result = {} + nacl = describe_network_acl(client, module) + if not nacl: + module.exit_json(changed=changed) -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _delete_network_acl_entry(client, *args, **kwargs): - return client.delete_network_acl_entry(*args, **kwargs) + nacl_id = nacl["NetworkAclId"] + vpc_id = nacl["VpcId"] + associations = nacl["Associations"] + assoc_ids = [a["NetworkAclAssociationId"] for a in associations] + # Find default NACL associated to the VPC + default_nacl_id = find_default_vpc_nacl(client, vpc_id) + if not default_nacl_id: + module.exit_json(changed=changed, msg="Default NACL ID not found - Check the VPC ID") -def delete_network_acl_entry(params, client, module): - try: + # Replace Network ACL association + for assoc_id in assoc_ids: + changed = True if not module.check_mode: - _delete_network_acl_entry(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - - -@AWSRetry.jittered_backoff() -def _describe_network_acls(client, **kwargs): - return client.describe_network_acls(**kwargs) - - -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _describe_network_acls_retry_missing(client, **kwargs): - return client.describe_network_acls(**kwargs) + replace_network_acl_association(client, network_acl_id=default_nacl_id, association_id=assoc_id) + # Delete Network ACL + changed = True + if module.check_mode: + module.exit_json(changed=changed, msg=f"Would have deleted Network ACL id '{nacl_id}' if not in check mode.") -def describe_acl_associations(subnets, client, module): - if not subnets: - return [] - try: - results = _describe_network_acls_retry_missing( - client, Filters=[{"Name": "association.subnet-id", "Values": subnets}] - ) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - associations = results["NetworkAcls"][0]["Associations"] - return [a["NetworkAclAssociationId"] for a in associations if a["SubnetId"] in subnets] - + changed = delete_network_acl(client, network_acl_id=nacl_id) + module.exit_json(changed=changed, msg=f"Network ACL id '{nacl_id}' successfully deleted.") -def describe_network_acl(client, module): - try: - if module.params.get("nacl_id"): - nacl = _describe_network_acls( - client, Filters=[{"Name": "network-acl-id", "Values": [module.params.get("nacl_id")]}] - ) - else: - nacl = _describe_network_acls(client, Filters=[{"Name": "tag:Name", "Values": [module.params.get("name")]}]) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - return nacl - - -def find_acl_by_id(nacl_id, client, module): - try: - return _describe_network_acls_retry_missing(client, NetworkAclIds=[nacl_id]) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - - -def find_default_vpc_nacl(vpc_id, client, module): - try: - response = _describe_network_acls_retry_missing(client, Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - nacls = response["NetworkAcls"] - return [n["NetworkAclId"] for n in nacls if n["IsDefault"] is True] +def describe_network_acl(client, module: AnsibleAWSModule) -> Optional[Dict[str, Any]]: + nacl_id = module.params.get("nacl_id") + name = module.params.get("name") -def find_subnet_ids_by_nacl_id(nacl_id, client, module): - try: - results = _describe_network_acls_retry_missing( - client, Filters=[{"Name": "association.network-acl-id", "Values": [nacl_id]}] - ) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - if results["NetworkAcls"]: - associations = results["NetworkAcls"][0]["Associations"] - return [s["SubnetId"] for s in associations if s["SubnetId"]] + if nacl_id: + filters = [{"Name": "network-acl-id", "Values": [nacl_id]}] else: - return [] - - -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _replace_network_acl_association(client, *args, **kwargs): - return client.replace_network_acl_association(*args, **kwargs) + filters = [{"Name": "tag:Name", "Values": [name]}] + network_acls = describe_network_acls(client, Filters=filters) + return None if not network_acls else network_acls[0] -def replace_network_acl_association(nacl_id, subnets, client, module): - params = dict() - params["NetworkAclId"] = nacl_id - for association in describe_acl_associations(subnets, client, module): - params["AssociationId"] = association - try: - if not module.check_mode: - _replace_network_acl_association(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - - -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _replace_network_acl_entry(client, *args, **kwargs): - return client.replace_network_acl_entry(*args, **kwargs) +def find_default_vpc_nacl(client, vpc_id: str) -> Optional[str]: + default_nacl_id = None + for nacl in describe_network_acls(client, Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]): + if nacl.get("IsDefault", False): + default_nacl_id = nacl["NetworkAclId"] + break + return default_nacl_id -def replace_network_acl_entry(entries, Egress, nacl_id, client, module): - for entry in entries: - params = entry - params["NetworkAclId"] = nacl_id - try: - if not module.check_mode: - _replace_network_acl_entry(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - +def find_subnets_ids(client, module: AnsibleAWSModule, subnets_ids_or_names: List[str]) -> List[str]: + subnets_ids = [] + subnets_names = [] -@AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidNetworkAclID.NotFound"]) -def _replace_network_acl_association(client, *args, **kwargs): - return client.replace_network_acl_association(*args, **kwargs) + # Find Subnets by ID + subnets = describe_subnets(client, Filters=[{"Name": "subnet-id", "Values": subnets_ids_or_names}]) + subnets_ids += [subnet["SubnetId"] for subnet in subnets] + subnets_names += [tag["Value"] for subnet in subnets for tag in subnet.get("Tags", []) if tag["Key"] == "Name"] + # Find Subnets by Name + subnets = describe_subnets(client, Filters=[{"Name": "tag:Name", "Values": subnets_ids_or_names}]) + subnets_ids += [subnet["SubnetId"] for subnet in subnets] + subnets_names += [tag["Value"] for subnet in subnets for tag in subnet.get("Tags", []) if tag["Key"] == "Name"] -def restore_default_acl_association(params, client, module): - try: - if not module.check_mode: - _replace_network_acl_association(client, **params) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - - -@AWSRetry.jittered_backoff() -def _describe_subnets(client, *args, **kwargs): - return client.describe_subnets(*args, **kwargs) - - -def subnets_to_associate(nacl, client, module): - params = list(module.params.get("subnets")) - if not params: - return [] - all_found = [] - if any(x.startswith("subnet-") for x in params): - try: - subnets = _describe_subnets(client, Filters=[{"Name": "subnet-id", "Values": params}]) - all_found.extend(subnets.get("Subnets", [])) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - if len(params) != len(all_found): - try: - subnets = _describe_subnets(client, Filters=[{"Name": "tag:Name", "Values": params}]) - all_found.extend(subnets.get("Subnets", [])) - except botocore.exceptions.ClientError as e: - module.fail_json_aws(e) - return list(set(s["SubnetId"] for s in all_found if s.get("SubnetId"))) + unexisting_subnets = [s for s in subnets_ids_or_names if s not in subnets_names + subnets_ids] + if unexisting_subnets: + module.fail_json(msg=f"The following subnets do not exist: {unexisting_subnets}") + return subnets_ids def main(): @@ -576,30 +501,35 @@ def main(): vpc_id=dict(), name=dict(), nacl_id=dict(), - subnets=dict(required=False, type="list", default=list(), elements="str"), + subnets=dict(required=False, type="list", default=[], elements="str"), tags=dict(required=False, type="dict", aliases=["resource_tags"]), purge_tags=dict(required=False, type="bool", default=True), ingress=dict(required=False, type="list", default=list(), elements="list"), egress=dict(required=False, type="list", default=list(), elements="list"), state=dict(default="present", choices=["present", "absent"]), ) + + mutually_exclusive = [ + ["name", "nacl_id"], + ] + module = AnsibleAWSModule( argument_spec=argument_spec, supports_check_mode=True, required_one_of=[["name", "nacl_id"]], required_if=[["state", "present", ["vpc_id"]]], + mutually_exclusive=mutually_exclusive, ) - state = module.params.get("state").lower() - client = module.client("ec2") - invocations = { - "present": setup_network_acl, - "absent": remove_network_acl, - } - (changed, results) = invocations[state](client, module) - module.exit_json(changed=changed, nacl_id=results) + try: + if module.params.get("state") == "present": + ensure_present(client, module) + else: + ensure_absent(client, module) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) if __name__ == "__main__": diff --git a/plugins/modules/ec2_vpc_nacl_info.py b/plugins/modules/ec2_vpc_nacl_info.py index d95508a894e..9e0bc4e7f05 100644 --- a/plugins/modules/ec2_vpc_nacl_info.py +++ b/plugins/modules/ec2_vpc_nacl_info.py @@ -102,15 +102,15 @@ sample: [[100, 'all', 'allow', '0.0.0.0/0', null, null, null, null]] """ -try: - import botocore -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import List +from typing import Union from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_network_acls from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list @@ -121,55 +121,60 @@ PROTOCOL_NAMES = {"-1": "all", "1": "icmp", "6": "tcp", "17": "udp"} -def list_ec2_vpc_nacls(connection, module): +def format_nacl(nacl: Dict[str, Any]) -> Dict[str, Any]: + # Turn the boto3 result into ansible friendly snake cases + nacl = camel_dict_to_snake_dict(nacl) + + # convert boto3 tags list into ansible dict + if "tags" in nacl: + nacl["tags"] = boto3_tag_list_to_ansible_dict(nacl["tags"], "key", "value") + + # Convert NACL entries + if "entries" in nacl: + nacl["egress"] = [ + nacl_entry_to_list(entry) for entry in nacl["entries"] if entry["rule_number"] < 32767 and entry["egress"] + ] + nacl["ingress"] = [ + nacl_entry_to_list(entry) + for entry in nacl["entries"] + if entry["rule_number"] < 32767 and not entry["egress"] + ] + del nacl["entries"] + + # Read subnets from NACL Associations + if "associations" in nacl: + nacl["subnets"] = [a["subnet_id"] for a in nacl["associations"]] + del nacl["associations"] + + # Read Network ACL id + if "network_acl_id" in nacl: + nacl["nacl_id"] = nacl["network_acl_id"] + del nacl["network_acl_id"] + + return nacl + + +def list_ec2_vpc_nacls(connection, module: AnsibleAWSModule) -> None: nacl_ids = module.params.get("nacl_ids") - filters = ansible_dict_to_boto3_filter_list(module.params.get("filters")) + filters = module.params.get("filters") - if nacl_ids is None: - nacl_ids = [] + params = {} + if filters: + params["Filters"] = ansible_dict_to_boto3_filter_list(filters) + if nacl_ids: + params["NetworkAclIds"] = nacl_ids try: - nacls = connection.describe_network_acls(aws_retry=True, NetworkAclIds=nacl_ids, Filters=filters) - except is_boto3_error_code("InvalidNetworkAclID.NotFound"): - module.fail_json(msg="Unable to describe ACL. NetworkAcl does not exist") - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg=f"Unable to describe network ACLs {nacl_ids}") - - # Turn the boto3 result in to ansible_friendly_snaked_names - snaked_nacls = [] - for nacl in nacls["NetworkAcls"]: - snaked_nacls.append(camel_dict_to_snake_dict(nacl)) - - # Turn the boto3 result in to ansible friendly tag dictionary - for nacl in snaked_nacls: - if "tags" in nacl: - nacl["tags"] = boto3_tag_list_to_ansible_dict(nacl["tags"], "key", "value") - if "entries" in nacl: - nacl["egress"] = [ - nacl_entry_to_list(entry) - for entry in nacl["entries"] - if entry["rule_number"] < 32767 and entry["egress"] - ] - nacl["ingress"] = [ - nacl_entry_to_list(entry) - for entry in nacl["entries"] - if entry["rule_number"] < 32767 and not entry["egress"] - ] - del nacl["entries"] - if "associations" in nacl: - nacl["subnets"] = [a["subnet_id"] for a in nacl["associations"]] - del nacl["associations"] - if "network_acl_id" in nacl: - nacl["nacl_id"] = nacl["network_acl_id"] - del nacl["network_acl_id"] - - module.exit_json(nacls=snaked_nacls) - - -def nacl_entry_to_list(entry): + network_acls = describe_network_acls(connection, **params) + if not network_acls: + module.fail_json(msg="Unable to describe ACL. NetworkAcl does not exist") + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) + + module.exit_json(nacls=[format_nacl(nacl) for nacl in network_acls]) + + +def nacl_entry_to_list(entry: Dict[str, Any]) -> List[Union[str, int, None]]: # entry list format # [ rule_num, protocol name or number, allow or deny, ipv4/6 cidr, icmp type, icmp code, port from, port to] elist = [] @@ -217,7 +222,7 @@ def main(): supports_check_mode=True, ) - connection = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff()) + connection = module.client("ec2") list_ec2_vpc_nacls(connection, module) diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml index 875e7f0b2d7..432aaf3ba99 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml @@ -1,7 +1,8 @@ # ============================================================ -- block: - - name: create ingress and egress rules using subnet IDs - ec2_vpc_nacl: +- name: Test Ingress and Egress rules + block: + - name: Create ingress and egress rules using subnet IDs + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -16,20 +17,20 @@ state: 'present' register: nacl - - name: assert the network acl was created - assert: + - name: Assert the network acl was created + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - - name: get network ACL facts - ec2_vpc_nacl_info: + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 3 @@ -37,8 +38,8 @@ # ============================================================ - - name: remove an ingress rule - ec2_vpc_nacl: + - name: Remove an ingress rule + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -52,20 +53,20 @@ state: 'present' register: nacl - - name: assert the network acl changed - assert: + - name: Assert the network acl changed + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - - name: get network ACL facts - ec2_vpc_nacl_info: + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 2 @@ -73,8 +74,8 @@ # ============================================================ - - name: remove the egress rule - ec2_vpc_nacl: + - name: Remove the egress rule + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -87,20 +88,20 @@ state: 'present' register: nacl - - name: assert the network acl changed - assert: + - name: Assert the network acl changed + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - - name: get network ACL facts - ec2_vpc_nacl_info: + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 2 @@ -108,8 +109,8 @@ # ============================================================ - - name: add egress rules - ec2_vpc_nacl: + - name: Add egress rules + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -124,20 +125,20 @@ state: 'present' register: nacl - - name: assert the network acl changed - assert: + - name: Assert the network acl changed + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - - name: get network ACL facts - ec2_vpc_nacl_info: + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 2 @@ -145,14 +146,14 @@ # ============================================================ - - name: remove the network ACL - ec2_vpc_nacl: + - name: Remove the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: nacl - - name: assert nacl was removed - assert: + - name: Assert nacl was removed + ansible.builtin.assert: that: - nacl.changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml index 1366971613a..2113fb4aa9c 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml @@ -1,9 +1,10 @@ -- block: +- name: Test using IPv6 + block: # ============================================================ - - name: create ingress and egress rules using subnet names - ec2_vpc_nacl: + - name: Create ingress and egress rules using subnet names + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_ipv6_id }}" name: "{{ nacl_name }}" subnets: @@ -18,15 +19,18 @@ - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] state: 'present' register: nacl - - assert: + + - name: Assert that module returned the Network ACL id + ansible.builtin.assert: that: - nacl.nacl_id - - set_fact: + - name: Set fact for Network ACL ID + ansible.builtin.set_fact: nacl_id: "{{ nacl.nacl_id }}" - - name: add ipv6 entries - ec2_vpc_nacl: + - name: Add ipv6 entries + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_ipv6_id }}" name: "{{ nacl_name }}" subnets: @@ -45,26 +49,27 @@ state: 'present' register: nacl - - assert: + - name: Assert that module reported change while the Network ACL remained unchanged + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id == nacl_id - - name: get network ACL facts (test that it works with ipv6 entries) - ec2_vpc_nacl_info: + - name: Get network ACL facts (test that it works with ipv6 entries) + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 5 - nacl_facts.nacls[0].egress | length == 2 - - name: purge ingress entries - ec2_vpc_nacl: + - name: Purge ingress entries + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_ipv6_id }}" name: "{{ nacl_name }}" subnets: @@ -78,13 +83,14 @@ state: 'present' register: nacl - - assert: + - name: Assert that module reported change while the Network ACL remained unchanged + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id == nacl_id - - name: purge egress entries - ec2_vpc_nacl: + - name: Purge egress entries + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_ipv6_id }}" name: "{{ nacl_name }}" subnets: @@ -96,18 +102,19 @@ state: 'present' register: nacl - - assert: + - name: Assert that module reported change + ansible.builtin.assert: that: - nacl.changed - - name: get network ACL facts (test that removed entries are gone) - ec2_vpc_nacl_info: + - name: Get network ACL facts (test that removed entries are gone) + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl_id }}" register: nacl_facts - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].ingress | length == 0 @@ -115,10 +122,10 @@ always: - - name: remove network ACL - ec2_vpc_nacl: + - name: Remove network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_ipv6_id }}" name: "{{ nacl_name }}" state: absent register: removed_acl - ignore_errors: yes + ignore_errors: true diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml index 36c7ab2d8bb..445161ccd82 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml @@ -5,40 +5,39 @@ secret_key: "{{ aws_secret_key }}" session_token: "{{ security_token | default(omit) }}" region: "{{ aws_region }}" - collections: - - amazon.aws + block: # ============================================================ - - name: test without any parameters - ec2_vpc_nacl: + - name: Test without any parameters + community.aws.ec2_vpc_nacl: register: result - ignore_errors: yes + ignore_errors: true - - name: assert required parameters - assert: + - name: Assert required parameters + ansible.builtin.assert: that: - result.failed - "result.msg == 'one of the following is required: name, nacl_id'" - - name: get network ACL info without any parameters - ec2_vpc_nacl_info: + - name: Get network ACL info without any parameters + community.aws.ec2_vpc_nacl_info: register: nacl_facts - - name: assert we don't error + - name: Assert we don't error assert: that: - nacl_facts is succeeded - - name: get network ACL info with invalid ID - ec2_vpc_nacl_info: + - name: Get network ACL info with invalid ID + community.aws.ec2_vpc_nacl_info: nacl_ids: - 'acl-000000000000' register: nacl_facts - ignore_errors: yes + ignore_errors: true - - name: assert message mentions missing ACLs + - name: Assert message mentions missing ACLs assert: that: - nacl_facts is failed @@ -46,34 +45,34 @@ # ============================================================ - - name: fetch AZ availability - aws_az_info: + - name: Fetch AZ availability + amazon.aws.aws_az_info: register: az_info - name: Assert that we have multiple AZs available to us - assert: + ansible.builtin.assert: that: az_info.availability_zones | length >= 2 - - name: pick AZs - set_fact: + - name: Pick AZs + ansible.builtin.set_fact: az_one: '{{ az_info.availability_zones[0].zone_name }}' az_two: '{{ az_info.availability_zones[1].zone_name }}' # ============================================================ - - name: create a VPC - ec2_vpc_net: + - name: Create a VPC + amazon.aws.ec2_vpc_net: cidr_block: "{{ vpc_cidr }}" name: "{{ vpc_name }}" state: present register: vpc - name: Save VPC ID for later - set_fact: + ansible.builtin.set_fact: vpc_id: "{{ vpc.vpc.id }}" - - name: create subnets - ec2_vpc_subnet: + - name: Create subnets + amazon.aws.ec2_vpc_subnet: cidr: "{{ item.cidr }}" az: "{{ item.az }}" vpc_id: "{{ vpc_id }}" @@ -95,27 +94,29 @@ name: "{{ subnet_name }}-4" register: subnets - - name: set helpful facts about subnets - set_fact: + - name: Set helpful facts about subnets + ansible.builtin.set_fact: subnet_ids: "{{ subnets | community.general.json_query('results[*].subnet.id') }}" subnet_names: "{{ subnets | community.general.json_query('results[*].subnet.tags.Name') }}" - - name: create VPC for IPv6 tests - ec2_vpc_net: + - name: Create VPC for IPv6 tests + amazon.aws.ec2_vpc_net: cidr_block: "{{ vpc_ipv6_cidr }}" name: "{{ vpc_ipv6_name }}" state: present - ipv6_cidr: yes + ipv6_cidr: true register: vpc_result - - set_fact: + + - name: Set helpful IPv6 facts + ansible.builtin.set_fact: vpc_ipv6_id: "{{ vpc_result.vpc.id }}" vpc_ipv6_cidr_v6: "{{ _ipv6_cidr }}" subnet_ipv6: "{{ _ipv6_cidr | regex_replace('::/56', '::/64') }}" vars: _ipv6_cidr: "{{ vpc_result.vpc.ipv6_cidr_block_association_set[0].ipv6_cidr_block }}" - - name: create subnet with IPv6 - ec2_vpc_subnet: + - name: Create subnet with IPv6 + amazon.aws.ec2_vpc_subnet: cidr: "{{ vpc_ipv6_cidr }}" vpc_id: "{{ vpc_ipv6_id }}" ipv6_cidr: "{{ subnet_ipv6 }}" @@ -124,31 +125,29 @@ Name: "{{ subnet_name }}-ipv6" # ============================================================ - - - include_tasks: tasks/subnet_ids.yml - - - include_tasks: tasks/subnet_names.yml - - - include_tasks: tasks/tags.yml - - - include_tasks: tasks/ingress_and_egress.yml - - - include_tasks: tasks/ipv6.yml + - name: Run individual tasks + ansible.builtin.include_tasks: "tasks/{{ item }}.yml" + with_items: + - subnet_ids + - subnet_names + - tags + - ingress_and_egress + - ipv6 # ============================================================ always: - - name: remove network ACL - ec2_vpc_nacl: + - name: Remove network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: removed_acl - ignore_errors: yes + ignore_errors: true - - name: remove subnets - ec2_vpc_subnet: + - name: Remove subnets + amazon.aws.ec2_vpc_subnet: cidr: "{{ item.cidr }}" vpc_id: "{{ item.vpc_id | default(vpc_id) }}" state: absent @@ -159,14 +158,14 @@ - cidr: "{{ subnet_4 }}" - cidr: "{{ vpc_ipv6_cidr }}" vpc_id: "{{ vpc_ipv6_id }}" - ignore_errors: yes + ignore_errors: true register: removed_subnets - - name: remove the VPCs - ec2_vpc_net: + - name: Remove the VPCs + amazon.aws.ec2_vpc_net: vpc_id: "{{ item }}" state: absent - ignore_errors: yes + ignore_errors: true register: removed_vpc with_items: - '{{ vpc_id }}' diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml index 4e1affa1f34..3a367e84f89 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml @@ -1,7 +1,7 @@ # ============================================================ -- name: create ingress and egress rules using subnet IDs - ec2_vpc_nacl: +- name: Create ingress and egress rules using subnet IDs + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -16,23 +16,24 @@ state: 'present' register: nacl -- set_fact: +- name: Set helpful fact for Network ACL ID + ansible.builtin.set_fact: nacl_id: "{{ nacl.nacl_id }}" -- name: assert the network acl was created - assert: +- name: Assert the network acl was created + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl_id }}" register: nacl_facts -- name: assert the nacl has the correct attributes - assert: +- name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].nacl_id == nacl_id @@ -44,8 +45,8 @@ # ============================================================ -- name: test idempotence - ec2_vpc_nacl: +- name: Test idempotence + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -60,28 +61,28 @@ state: 'present' register: nacl -- name: assert the network acl already existed - assert: +- name: Assert the network acl already existed + ansible.builtin.assert: that: - not nacl.changed - nacl.nacl_id == nacl_id - nacl.nacl_id.startswith('acl-') -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts_idem -- name: assert the facts are the same as before - assert: +- name: Assert the facts are the same as before + ansible.builtin.assert: that: - nacl_facts_idem == nacl_facts # ============================================================ -- name: remove a subnet from the network ACL - ec2_vpc_nacl: +- name: Remove a subnet from the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: @@ -99,21 +100,21 @@ state: 'present' register: nacl -- name: assert the network ACL changed - assert: +- name: Assert the network ACL changed + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - nacl.nacl_id == nacl_id -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_id: - "{{ nacl.nacl_id }}" register: nacl_facts -- name: assert the nacl has the correct attributes - assert: +- name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].nacl_id == nacl_id @@ -125,37 +126,38 @@ # ============================================================ -- name: remove the network ACL - ec2_vpc_nacl: +- name: Remove the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: nacl -- name: assert nacl was removed - assert: +- name: Assert nacl was removed + ansible.builtin.assert: that: - nacl.changed -- name: re-remove the network ACL by name (test idempotency) - ec2_vpc_nacl: +- name: Re-remove the network ACL by name (test idempotency) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: nacl -- name: assert nacl was removed - assert: + +- name: Assert nacl was removed + ansible.builtin.assert: that: - nacl is not changed -- name: re-remove the network ACL by id (test idempotency) - ec2_vpc_nacl: +- name: Re-remove the network ACL by id (test idempotency) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" nacl_id: "{{ nacl_id }}" state: absent register: nacl -- name: assert nacl was removed - assert: +- name: Assert nacl was removed + ansible.builtin.assert: that: - nacl is not changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml index 4db7e1b2068..dc44fef804a 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml @@ -1,7 +1,7 @@ # ============================================================ -- name: create ingress and egress rules using subnet names - ec2_vpc_nacl: +- name: Create ingress and egress rules using subnet names + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_names }}" @@ -16,23 +16,24 @@ state: 'present' register: nacl -- set_fact: +- name: Set helpful fact for Network ACL ID + ansible.builtin.set_fact: nacl_id: "{{ nacl.nacl_id }}" -- name: assert the network acl was created - assert: +- name: Assert the network acl was created + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl_id }}" register: nacl_facts -- name: assert the nacl has the correct attributes - assert: +- name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].nacl_id == nacl_id @@ -43,8 +44,8 @@ # ============================================================ -- name: test idempotence - ec2_vpc_nacl: +- name: Test idempotence + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_names }}" @@ -59,28 +60,28 @@ state: 'present' register: nacl -- name: assert the network acl already existed - assert: +- name: Assert the network acl already existed + ansible.builtin.assert: that: - not nacl.changed - nacl.nacl_id == nacl_id - nacl.nacl_id.startswith('acl-') -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts_idem -- name: assert the facts are the same as before - assert: +- name: Assert the facts are the same as before + ansible.builtin.assert: that: - nacl_facts_idem == nacl_facts # ============================================================ -- name: remove a subnet from the network ACL - ec2_vpc_nacl: +- name: Remove a subnet from the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: @@ -98,21 +99,21 @@ state: 'present' register: nacl -- name: assert the network ACL changed - assert: +- name: Assert the network ACL changed + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id == nacl_id - nacl.nacl_id.startswith('acl-') -- name: get network ACL facts - ec2_vpc_nacl_info: +- name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_facts -- name: assert the nacl has the correct attributes - assert: +- name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_facts.nacls | length == 1 - nacl_facts.nacls[0].nacl_id == nacl_id @@ -123,14 +124,14 @@ # ============================================================ -- name: remove the network ACL - ec2_vpc_nacl: +- name: Remove the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: nacl -- name: assert nacl was removed - assert: +- name: Assert nacl was removed + ansible.builtin.assert: that: - nacl.changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml index da3ad71dda3..0e69ce760ac 100644 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml +++ b/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml @@ -1,4 +1,5 @@ -- vars: +- name: Run test from tags.yml + vars: first_tags: 'Key with Spaces': Value with spaces CamelCaseKey: CamelCaseValue @@ -30,40 +31,40 @@ # ============================================================ - - name: create a network ACL using subnet IDs - ec2_vpc_nacl: + - name: Create a network ACL using subnet IDs + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" state: 'present' register: nacl - - name: assert the network acl was created - assert: + - name: Assert the network acl was created + ansible.builtin.assert: that: - nacl.changed - nacl.nacl_id.startswith('acl-') - name: Store NACL ID - set_fact: + ansible.builtin.set_fact: nacl_id: '{{ nacl.nacl_id }}' - - name: get network ACL facts - ec2_vpc_nacl_info: + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl_id }}" register: nacl_info - - name: assert the nacl has the correct attributes - assert: + - name: Assert the nacl has the correct attributes + ansible.builtin.assert: that: - nacl_info.nacls[0].nacl_id == nacl_id - nacl_info.nacls[0].tags == name_tags # ============================================================ - - name: (check) add tags - ec2_vpc_nacl: + - name: Add tags (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -72,36 +73,37 @@ register: nacl check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - - name: add tags - ec2_vpc_nacl: + - name: Add tags + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: "{{ first_tags }}" state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - nacl_info.nacls[0].nacl_id == nacl_id - nacl_info.nacls[0].tags == ( first_tags | combine(name_tags) ) - - name: (check) add tags - IDEMPOTENCY - ec2_vpc_nacl: + - name: Add tags - IDEMPOTENCY (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -110,28 +112,29 @@ register: nacl check_mode: True - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id - - name: add tags - IDEMPOTENCY - ec2_vpc_nacl: + - name: Add tags - IDEMPOTENCY + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: "{{ first_tags }}" state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id @@ -140,14 +143,14 @@ # ============================================================ - - name: get network ACL facts by filter - ec2_vpc_nacl_info: + - name: Get network ACL facts by filter + community.aws.ec2_vpc_nacl_info: filters: "tag:Name": "{{ nacl_name }}" register: nacl_info - - name: assert the facts are the same as before - assert: + - name: Assert the facts are the same as before + ansible.builtin.assert: that: - nacl_info.nacls | length == 1 - nacl.nacl_id == nacl_id @@ -155,8 +158,8 @@ # ============================================================ - - name: (check) modify tags with purge - ec2_vpc_nacl: + - name: Modify tags with purge (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -165,36 +168,37 @@ register: nacl check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - - name: modify tags with purge - ec2_vpc_nacl: + - name: Modify tags with purge + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: "{{ second_tags }}" state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - nacl_info.nacls[0].nacl_id == nacl_id - nacl_info.nacls[0].tags == ( second_tags | combine(name_tags) ) - - name: (check) modify tags with purge - IDEMPOTENCY - ec2_vpc_nacl: + - name: Modify tags with purge - IDEMPOTENCY (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -203,28 +207,29 @@ register: nacl check_mode: True - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id - - name: modify tags with purge - IDEMPOTENCY - ec2_vpc_nacl: + - name: Modify tags with purge - IDEMPOTENCY + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: "{{ second_tags }}" state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id @@ -233,8 +238,8 @@ # ============================================================ - - name: (check) modify tags without purge - ec2_vpc_nacl: + - name: Modify tags without purge (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -244,14 +249,14 @@ register: nacl check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - - name: modify tags without purge - ec2_vpc_nacl: + - name: Modify tags without purge + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -259,22 +264,23 @@ state: 'present' purge_tags: False register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - nacl_info.nacls[0].nacl_id == nacl_id - nacl_info.nacls[0].tags == ( final_tags | combine(name_tags) ) - - name: (check) modify tags without purge - IDEMPOTENCY - ec2_vpc_nacl: + - name: Modify tags without purge - IDEMPOTENCY (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -284,14 +290,14 @@ register: nacl check_mode: True - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id - - name: modify tags without purge - IDEMPOTENCY - ec2_vpc_nacl: + - name: Modify tags without purge - IDEMPOTENCY + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -299,14 +305,15 @@ state: 'present' purge_tags: False register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id @@ -315,8 +322,8 @@ # ============================================================ - - name: (check) No change to tags without setting tags - ec2_vpc_nacl: + - name: No change to tags without setting tags (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -324,27 +331,28 @@ register: nacl check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id - name: No change to tags without setting tags - ec2_vpc_nacl: + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id @@ -353,8 +361,8 @@ # ============================================================ - - name: (check) remove non name tags - ec2_vpc_nacl: + - name: Remove non name tags (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -363,36 +371,37 @@ register: nacl check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - - name: remove non name tags - ec2_vpc_nacl: + - name: Remove non name tags + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: {} state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - nacl is changed - nacl.nacl_id == nacl_id - nacl_info.nacls[0].nacl_id == nacl_id - nacl_info.nacls[0].tags == name_tags - - name: (check) remove non name tags - IDEMPOTENCY - ec2_vpc_nacl: + - name: Remove non name tags - IDEMPOTENCY (check mode) + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" @@ -401,28 +410,29 @@ register: nacl check_mode: True - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id - - name: remove non name tags - IDEMPOTENCY - ec2_vpc_nacl: + - name: Remove non name tags - IDEMPOTENCY + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" subnets: "{{ subnet_ids }}" tags: {} state: 'present' register: nacl - - name: get network ACL facts - ec2_vpc_nacl_info: + + - name: Get network ACL facts + community.aws.ec2_vpc_nacl_info: nacl_ids: - "{{ nacl.nacl_id }}" register: nacl_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - nacl is not changed - nacl.nacl_id == nacl_id @@ -432,14 +442,14 @@ # ============================================================ always: - - name: remove the network ACL - ec2_vpc_nacl: + - name: Remove the network ACL + community.aws.ec2_vpc_nacl: vpc_id: "{{ vpc_id }}" name: "{{ nacl_name }}" state: absent register: nacl - - name: assert nacl was removed - assert: + - name: Assert nacl was removed + ansible.builtin.assert: that: - nacl.changed From d2403ab9630a58ea37b8f7d60c0aab908ec1c83d Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 15 Oct 2024 17:35:31 +0200 Subject: [PATCH 54/77] Refactor ec2_vpc_vpn* modules (#2160) SUMMARY Refactor ec2_vpc_vpn* modules ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_vpn ec2_vpc_vpn_info ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Bikouo Aubin --- .../20240930-ec2_vpc_vpn_refactoring.yml | 3 + plugins/modules/ec2_vpc_vpn.py | 748 ++++++++++-------- plugins/modules/ec2_vpc_vpn_info.py | 154 ++-- .../targets/ec2_vpc_vpn/tasks/main.yml | 122 +-- .../targets/ec2_vpc_vpn/tasks/tags.yml | 228 +++--- .../unit/plugins/modules/test_ec2_vpc_vpn.py | 668 ++++++---------- 6 files changed, 946 insertions(+), 977 deletions(-) create mode 100644 changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml diff --git a/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml b/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml new file mode 100644 index 00000000000..6ed1c793a65 --- /dev/null +++ b/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml @@ -0,0 +1,3 @@ +minor_changes: + - ec2_vpc_vpn - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). + - ec2_vpc_vpn_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). diff --git a/plugins/modules/ec2_vpc_vpn.py b/plugins/modules/ec2_vpc_vpn.py index abc97f796b7..2555e4cc3a7 100644 --- a/plugins/modules/ec2_vpc_vpn.py +++ b/plugins/modules/ec2_vpc_vpn.py @@ -10,15 +10,15 @@ version_added: 1.0.0 short_description: Create, modify, and delete EC2 VPN connections description: - - This module creates, modifies, and deletes VPN connections. Idempotence is achieved by using the filters - option or specifying the VPN connection identifier. + - This module creates, modifies, and deletes VPN connections. + - Idempotence is achieved by using the O(filters) option or specifying the VPN connection identifier. author: - - "Sloane Hertel (@s-hertel)" + - Sloane Hertel (@s-hertel) options: state: description: - The desired state of the VPN connection. - choices: ['present', 'absent'] + choices: ["present", "absent"] default: present required: false type: str @@ -29,13 +29,13 @@ connection_type: description: - The type of VPN connection. - - At this time only C(ipsec.1) is supported. - default: ipsec.1 + - At this time only V(ipsec.1) is supported. + default: "ipsec.1" type: str vpn_gateway_id: description: - The ID of the virtual private gateway. - - Mutually exclusive with I(transit_gateway_id). + - Mutually exclusive with O(transit_gateway_id). type: str vpn_connection_id: description: @@ -44,20 +44,27 @@ static_only: description: - Indicates whether the VPN connection uses static routes only. Static routes must be used for devices that don't support BGP. - default: False + default: false type: bool required: false transit_gateway_id: description: - The ID of the transit gateway. - - Mutually exclusive with I(vpn_gateway_id). + - Mutually exclusive with O(vpn_gateway_id). type: str version_added: 6.2.0 + local_ipv4_network_cidr: + description: + - The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. + required: false + type: str + default: "0.0.0.0/0" + version_added: 9.0.0 tunnel_options: description: - - An optional list object containing no more than two dict members, each of which may contain I(TunnelInsideCidr) - and/or I(PreSharedKey) keys with appropriate string values. AWS defaults will apply in absence of either of - the aforementioned keys. + - An optional list object containing no more than two dict members, each of which may contain O(tunnel_options.TunnelInsideCidr) + and/or O(tunnel_options.PreSharedKey) keys with appropriate string values. + AWS defaults will apply in absence of either of the aforementioned keys. required: false type: list elements: dict @@ -65,26 +72,34 @@ suboptions: TunnelInsideCidr: type: str - description: The range of inside IP addresses for the tunnel. + description: + - The range of inside IPv4 addresses for the tunnel. + TunnelInsideIpv6Cidr: + type: str + description: + - The range of inside IPv6 addresses for the tunnel. + version_added: 9.0.0 PreSharedKey: type: str - description: The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway. + description: + - The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway. filters: description: - - An alternative to using I(vpn_connection_id). If multiple matches are found, vpn_connection_id is required. + - An alternative to using O(vpn_connection_id). If multiple matches are found, O(vpn_connection_id) is required. If one of the following suboptions is a list of items to filter by, only one item needs to match to find the VPN - that correlates. e.g. if the filter I(cidr) is C(['194.168.2.0/24', '192.168.2.0/24']) and the VPN route only has the - destination cidr block of C(192.168.2.0/24) it will be found with this filter (assuming there are not multiple - VPNs that are matched). Another example, if the filter I(vpn) is equal to C(['vpn-ccf7e7ad', 'vpn-cb0ae2a2']) and one + that correlates. e.g. if the filter O(filters.cidr) is V(["194.168.2.0/24", "192.168.2.0/24"]) and the VPN route only has the + destination cidr block of V(192.168.2.0/24) it will be found with this filter (assuming there are not multiple + VPNs that are matched). Another example, if the filter O(filters.vpn) is equal to V(["vpn-ccf7e7ad", "vpn-cb0ae2a2"]) and one of of the VPNs has the state deleted (exists but is unmodifiable) and the other exists and is not deleted, - it will be found via this filter. See examples. + it will be found via this filter. suboptions: cgw-config: description: - The customer gateway configuration of the VPN as a string (in the format of the return value) or a list of those strings. static-routes-only: description: - - The type of routing; C(true) or C(false). + - The type of routing; V(true) or V(false). + type: bool cidr: description: - The destination cidr of the VPN's route as a string or a list of those strings. @@ -107,6 +122,7 @@ tags: description: - A dict of key value pairs. + type: dict cgw: description: - The customer gateway id as a string or a list of those strings. @@ -145,79 +161,77 @@ EXAMPLES = r""" # Note: These examples do not set authentication details, see the AWS Guide for details. -- name: create a VPN connection with vpn_gateway_id +- name: Create a VPN connection with vpn_gateway_id community.aws.ec2_vpc_vpn: - state: present - vpn_gateway_id: vgw-XXXXXXXX - customer_gateway_id: cgw-XXXXXXXX + state: "present" + vpn_gateway_id: "vgw-XXXXXXXX" + customer_gateway_id: "cgw-XXXXXXXX" - name: Attach a vpn connection to transit gateway community.aws.ec2_vpc_vpn: - state: present - transit_gateway_id: tgw-XXXXXXXX - customer_gateway_id: cgw-XXXXXXXX + state: "present" + transit_gateway_id: "tgw-XXXXXXXX" + customer_gateway_id: "cgw-XXXXXXXX" -- name: modify VPN connection tags +- name: Modify VPN connection tags community.aws.ec2_vpc_vpn: - state: present - vpn_connection_id: vpn-XXXXXXXX + state: "present" + vpn_connection_id: "vpn-XXXXXXXX" tags: - Name: ansible-tag-1 - Other: ansible-tag-2 + Name: "ansible-tag-1" + Other: "ansible-tag-2" -- name: delete a connection +- name: Delete a connection community.aws.ec2_vpc_vpn: - vpn_connection_id: vpn-XXXXXXXX - state: absent + vpn_connection_id: "vpn-XXXXXXXX" + state: "absent" -- name: modify VPN tags (identifying VPN by filters) +- name: Modify VPN tags (identifying VPN by filters) community.aws.ec2_vpc_vpn: - state: present + state: "present" filters: - cidr: 194.168.1.0/24 + cidr: "194.168.1.0/24" tag-keys: - - Ansible - - Other + - "Ansible" + - "Other" tags: - New: Tag + New: "Tag" purge_tags: true static_only: true -- name: set up VPN with tunnel options utilizing 'TunnelInsideCidr' only +- name: Set up VPN with tunnel options utilizing 'TunnelInsideCidr' only community.aws.ec2_vpc_vpn: - state: present + state: "present" filters: - vpn: vpn-XXXXXXXX + vpn: "vpn-XXXXXXXX" static_only: true tunnel_options: - - - TunnelInsideCidr: '169.254.100.1/30' - - - TunnelInsideCidr: '169.254.100.5/30' + - TunnelInsideCidr: "169.254.100.1/30" + - TunnelInsideCidr: "169.254.100.5/30" -- name: add routes and remove any preexisting ones +- name: Add routes and remove any preexisting ones community.aws.ec2_vpc_vpn: - state: present + state: "present" filters: - vpn: vpn-XXXXXXXX + vpn: "vpn-XXXXXXXX" routes: - - 195.168.2.0/24 - - 196.168.2.0/24 + - "195.168.2.0/24" + - "196.168.2.0/24" purge_routes: true -- name: remove all routes +- name: Remove all routes community.aws.ec2_vpc_vpn: - state: present - vpn_connection_id: vpn-XXXXXXXX + state: "present" + vpn_connection_id: "vpn-XXXXXXXX" routes: [] purge_routes: true -- name: delete a VPN identified by filters +- name: Delete a VPN identified by filters community.aws.ec2_vpc_vpn: - state: absent + state: "absent" filters: tags: - Ansible: Tag + Ansible: "Tag" """ RETURN = r""" @@ -225,203 +239,281 @@ description: If the VPN connection has changed. type: bool returned: always - sample: - changed: true + sample: true customer_gateway_configuration: description: The configuration of the VPN connection. - returned: I(state=present) + returned: O(state=present) type: str customer_gateway_id: description: The customer gateway connected via the connection. type: str - returned: I(state=present) - sample: - customer_gateway_id: cgw-1220c87b + returned: O(state=present) + sample: "cgw-1220c87b" +gateway_association_state: + description: The current state of the gateway association. + type: str + returned: O(state=present) + sample: "associated" vpn_gateway_id: description: The virtual private gateway connected via the connection. type: str - returned: I(state=present) - sample: - vpn_gateway_id: vgw-cb0ae2a2 + returned: O(state=present) + sample: "vgw-cb0ae2a2" transit_gateway_id: description: The transit gateway id to which the vpn connection can be attached. type: str - returned: I(state=present) - sample: - transit_gateway_id: tgw-cb0ae2a2 + returned: O(state=present) + sample: "tgw-cb0ae2a2" options: - description: The VPN connection options (currently only containing static_routes_only). - type: complex - returned: I(state=present) + description: The VPN connection options. + type: list + elements: dict + returned: O(state=present) contains: static_routes_only: description: If the VPN connection only allows static routes. - returned: I(state=present) + returned: O(state=present) + type: bool + sample: true + enable_acceleration: + description: Indicates whether acceleration is enabled for the VPN connection. + returned: O(state=present) + type: bool + sample: false + local_ipv4_network_cidr: + description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. + returned: O(state=present) + type: str + sample: "0.0.0.0/0" + outside_ip_address_type: + description: The external IP address of the VPN tunnel. + returned: O(state=present) + type: str + sample: "PublicIpv4" + remote_ipv4_network_cidr: + description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. + returned: O(state=present) type: str - sample: - static_routes_only: true + sample: "0.0.0.0/0" + tunnel_inside_ip_version: + description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. + returned: O(state=present) + type: str + sample: "ipv4" + tunnel_options: + description: Indicates the VPN tunnel options. + returned: O(state=present) + type: list + elements: dict + sample: [{ + "log_options": { + "cloud_watch_log_options": { + "log_enabled": false + } + }, + "outside_ip_address": "34.225.101.10", + "pre_shared_key": "8n7hnjNE8zhIt4VpMOIfcrw6XnUTHLW9", + "tunnel_inside_cidr": "169.254.31.8/30" + }] + contains: + log_options: + description: Options for logging VPN tunnel activity. + returned: O(state=present) + type: dict + contains: + cloud_watch_log_options: + description: Options for sending VPN tunnel logs to CloudWatch. + type: dict + returned: O(state=present) + outside_ip_address: + description: The external IP address of the VPN tunnel. + type: str + returned: O(state=present) + pre_shared_key: + description: + - The pre-shared key (PSK) to establish initial authentication between the + virtual private gateway and the customer gateway. + type: str + returned: O(state=present) + tunnel_inside_cidr: + description: The range of inside IPv4 addresses for the tunnel. + type: str + returned: O(state=present) routes: description: The routes of the VPN connection. type: list - returned: I(state=present) - sample: - routes: [{ - 'destination_cidr_block': '192.168.1.0/24', - 'state': 'available' + returned: O(state=present) + sample: [{ + "destination_cidr_block": "192.168.1.0/24", + "state": "available" }] + contains: + destination_cidr_block: + description: + - The CIDR block associated with the local subnet of the customer data center. + type: str + returned: O(state=present) + source: + description: Indicates how the routes were provided. + type: str + returned: O(state=present) + state: + description: The current state of the static route. + type: str + returned: O(state=present) state: description: The status of the VPN connection. type: str - returned: I(state=present) - sample: - state: available + returned: O(state=present) + sample: "available" tags: description: The tags associated with the connection. type: dict - returned: I(state=present) - sample: - tags: - name: ansible-test - other: tag + returned: O(state=present) + sample: { + "name": "ansible-test", + "other": "tag" + } type: description: The type of VPN connection (currently only ipsec.1 is available). type: str - returned: I(state=present) - sample: - type: "ipsec.1" + returned: O(state=present) + sample: "ipsec.1" vgw_telemetry: type: list - returned: I(state=present) + returned: O(state=present) description: The telemetry for the VPN tunnel. - sample: - vgw_telemetry: [{ - 'outside_ip_address': 'string', - 'status': 'up', - 'last_status_change': 'datetime(2015, 1, 1)', - 'status_message': 'string', - 'accepted_route_count': 123 - }] + sample: [{ + "accepted_route_count": 0, + "last_status_change": "2024-09-30T13:12:33+00:00", + "outside_ip_address": "34.225.101.10", + "status": "DOWN", + "status_message": "IPSEC IS DOWN" + }] + contains: + accepted_route_count: + type: int + returned: O(state=present) + description: The number of accepted routes. + last_status_change: + type: str + returned: O(state=present) + description: The date and time of the last change in status. + outside_ip_address: + type: str + returned: O(state=present) + description: + - The Internet-routable IP address of the virtual private gateway's outside interface. + status: + type: str + returned: O(state=present) + description: The status of the VPN tunnel. + status_message: + type: str + returned: O(state=present) + description: If an error occurs, a description of the error. + certificate_arn: + description: The Amazon Resource Name of the virtual private gateway tunnel endpoint certificate. + returned: when a private certificate is used for authentication + type: str + sample: "arn:aws:acm:us-east-1:123456789012:certificate/c544d8ce-20b8-4fff-98b0-example" vpn_connection_id: description: The identifier for the VPN connection. type: str - returned: I(state=present) - sample: - vpn_connection_id: vpn-781e0e19 + returned: O(state=present) + sample: "vpn-781e0e19" """ try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError from botocore.exceptions import WaiterError except ImportError: pass # Handled by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import List +from typing import NoReturn +from typing import Optional +from typing import Tuple +from typing import Union + from ansible.module_utils._text import to_text from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import ansible_dict_to_boto3_tag_list +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_connection +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_connection_route +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_connection +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_connection_route +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_connections +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.tagging import compare_aws_tags from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -class VPNConnectionException(Exception): - def __init__(self, msg, exception=None): - super(VPNConnectionException, self).__init__(msg) - self.msg = msg - self.exception = exception - - -# AWS uses VpnGatewayLimitExceeded for both 'Too many VGWs' and 'Too many concurrent changes' -# we need to look at the mesage to tell the difference. -class VPNRetry(AWSRetry): - @staticmethod - def status_code_from_exception(error): - return ( - error.response["Error"]["Code"], - error.response["Error"]["Message"], - ) - - @staticmethod - def found(response_code, catch_extra_error_codes=None): - retry_on = ["The maximum number of mutating objects has been reached."] - - if catch_extra_error_codes: - retry_on.extend(catch_extra_error_codes) - if not isinstance(response_code, tuple): - response_code = (response_code,) - - for code in response_code: - if super().found(response_code, catch_extra_error_codes): - return True - - return False - - -def find_connection(connection, module_params, vpn_connection_id=None): +def find_vpn_connection( + client, module: AnsibleAWSModule, vpn_connection_id: Optional[str] = None +) -> Union[None, Dict[str, Any]]: """Looks for a unique VPN connection. Uses find_connection_response() to return the connection found, None, or raise an error if there were multiple viable connections.""" - filters = module_params.get("filters") + filters = module.params.get("filters") + params: Dict[str, Any] = {} # vpn_connection_id may be provided via module option; takes precedence over any filter values - if not vpn_connection_id and module_params.get("vpn_connection_id"): - vpn_connection_id = module_params.get("vpn_connection_id") + if not vpn_connection_id and module.params.get("vpn_connection_id"): + vpn_connection_id = module.params["vpn_connection_id"] if not isinstance(vpn_connection_id, list) and vpn_connection_id: vpn_connection_id = [to_text(vpn_connection_id)] elif isinstance(vpn_connection_id, list): vpn_connection_id = [to_text(connection) for connection in vpn_connection_id] - formatted_filter = [] + formatted_filter: List = [] # if vpn_connection_id is provided it will take precedence over any filters since it is a unique identifier if not vpn_connection_id: - formatted_filter = create_filter(module_params, provided_filters=filters) + formatted_filter = create_filter(module, filters) + + if vpn_connection_id: + params["VpnConnectionIds"] = vpn_connection_id + params["Filters"] = formatted_filter # see if there is a unique matching connection try: - if vpn_connection_id: - existing_conn = connection.describe_vpn_connections( - aws_retry=True, VpnConnectionIds=vpn_connection_id, Filters=formatted_filter - ) - else: - existing_conn = connection.describe_vpn_connections(aws_retry=True, Filters=formatted_filter) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException(msg="Failed while describing VPN connection.", exception=e) + existing_conn = describe_vpn_connections(client, **params) + except AnsibleEC2Error as e: + module.fail_json_aws(e, msg="Failed while describing VPN connection.") - return find_connection_response(connections=existing_conn) + return find_connection_response(module, connections=existing_conn) -def add_routes(connection, vpn_connection_id, routes_to_add): +def add_routes(client, module: AnsibleAWSModule, vpn_connection_id: str, routes_to_add: List[Dict[str, Any]]) -> bool: + changed: bool = False for route in routes_to_add: try: - connection.create_vpn_connection_route( - aws_retry=True, VpnConnectionId=vpn_connection_id, DestinationCidrBlock=route - ) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException( - msg=f"Failed while adding route {route} to the VPN connection {vpn_connection_id}.", - exception=e, - ) + changed |= create_vpn_connection_route(client, vpn_connection_id, route) + except AnsibleEC2Error as e: + module.fail_json_aws(e, msg=f"Failed while adding route {route} to the VPN connection {vpn_connection_id}.") + return changed -def remove_routes(connection, vpn_connection_id, routes_to_remove): +def remove_routes( + client, module: AnsibleAWSModule, vpn_connection_id: str, routes_to_remove: List[Dict[str, Any]] +) -> bool: + changed: bool = False for route in routes_to_remove: try: - connection.delete_vpn_connection_route( - aws_retry=True, VpnConnectionId=vpn_connection_id, DestinationCidrBlock=route - ) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException( - msg=f"Failed to remove route {route} from the VPN connection {vpn_connection_id}.", - exception=e, - ) + changed |= delete_vpn_connection_route(client, vpn_connection_id, route) + except AnsibleEC2Error as e: + module.fail_json_aws(e, msg=f"Failed to remove route {route} from the VPN connection {vpn_connection_id}.") + return changed -def create_filter(module_params, provided_filters): +def create_filter(module, provided_filters: Dict[str, Any]) -> List[Dict[str, Any]]: """Creates a filter using the user-specified parameters and unmodifiable options that may have been specified in the task""" + boto3ify_filter = { "cgw-config": "customer-gateway-configuration", "static-routes-only": "option.static-routes-only", @@ -444,7 +536,7 @@ def create_filter(module_params, provided_filters): } flat_filter_dict = {} - formatted_filter = [] + formatted_filter: List = [] for raw_param in dict(provided_filters): # fix filter names to be recognized by boto3 @@ -454,7 +546,7 @@ def create_filter(module_params, provided_filters): elif raw_param in list(boto3ify_filter.items()): param = raw_param else: - raise VPNConnectionException(msg=f"{raw_param} is not a valid filter.") + module.fail_json(msg=f"{raw_param} is not a valid filter.") # reformat filters with special formats if param == "tag": @@ -474,8 +566,8 @@ def create_filter(module_params, provided_filters): # if customer_gateway, vpn_gateway, or vpn_connection was specified in the task but not the filter, add it for param in param_to_filter: - if param_to_filter[param] not in flat_filter_dict and module_params.get(param): - flat_filter_dict[param_to_filter[param]] = [module_params.get(param)] + if param_to_filter[param] not in flat_filter_dict and module.params.get(param): + flat_filter_dict[param_to_filter[param]] = [module.params.get(param)] # change the flat dict into something boto3 will understand formatted_filter = [{"Name": key, "Values": value} for key, value in flat_filter_dict.items()] @@ -483,18 +575,18 @@ def create_filter(module_params, provided_filters): return formatted_filter -def find_connection_response(connections=None): +def find_connection_response(module, connections: Optional[List[Dict[str, Any]]] = None) -> Optional[Dict[str, Any]]: """Determine if there is a viable unique match in the connections described. Returns the unique VPN connection if one is found, returns None if the connection does not exist, raise an error if multiple matches are found.""" # Found no connections - if not connections or "VpnConnections" not in connections: + if not connections: return None # Too many results - elif connections and len(connections["VpnConnections"]) > 1: + elif connections and len(connections) > 1: viable = [] - for each in connections["VpnConnections"]: + for each in connections: # deleted connections are not modifiable if each["State"] not in ("deleted", "deleting"): viable.append(each) @@ -505,7 +597,7 @@ def find_connection_response(connections=None): # Found a result but it was deleted already; since there was only one viable result create a new one return None else: - raise VPNConnectionException( + module.fail_json( msg=( "More than one matching VPN connection was found. " "To modify or delete a VPN please specify vpn_connection_id or add filters." @@ -513,26 +605,29 @@ def find_connection_response(connections=None): ) # Found unique match - elif connections and len(connections["VpnConnections"]) == 1: + elif connections and len(connections) == 1: # deleted connections are not modifiable - if connections["VpnConnections"][0]["State"] not in ("deleted", "deleting"): - return connections["VpnConnections"][0] + if connections[0]["State"] not in ("deleted", "deleting"): + return connections[0] def create_connection( - connection, - customer_gateway_id, - static_only, - vpn_gateway_id, - transit_gateway_id, - connection_type, - max_attempts, - delay, - tunnel_options=None, -): + client, + module: AnsibleAWSModule, + customer_gateway_id: Optional[str], + static_only: Optional[bool], + vpn_gateway_id: str, + transit_gateway_id: str, + connection_type: Optional[str], + max_attempts: Optional[int], + delay: Optional[int], + local_ipv4_network_cidr: Optional[str], + tunnel_options: Optional[List[Dict[str, Any]]] = None, +) -> Dict[str, Any]: """Creates a VPN connection""" - options = {"StaticRoutesOnly": static_only} + options = {"StaticRoutesOnly": static_only, "LocalIpv4NetworkCidr": local_ipv4_network_cidr} + if tunnel_options and len(tunnel_options) <= 2: t_opt = [] for m in tunnel_options: @@ -545,87 +640,67 @@ def create_connection( options["TunnelOptions"] = t_opt if not (customer_gateway_id and (vpn_gateway_id or transit_gateway_id)): - raise VPNConnectionException( + module.fail_json( msg=( "No matching connection was found. To create a new connection you must provide " "customer_gateway_id and one of either transit_gateway_id or vpn_gateway_id." ) ) - vpn_connection_params = {"Type": connection_type, "CustomerGatewayId": customer_gateway_id, "Options": options} + vpn_connection_params: Dict[str, Any] = { + "Type": connection_type, + "CustomerGatewayId": customer_gateway_id, + "Options": options, + } + if vpn_gateway_id: vpn_connection_params["VpnGatewayId"] = vpn_gateway_id if transit_gateway_id: vpn_connection_params["TransitGatewayId"] = transit_gateway_id try: - vpn = connection.create_vpn_connection(**vpn_connection_params) - connection.get_waiter("vpn_connection_available").wait( - VpnConnectionIds=[vpn["VpnConnection"]["VpnConnectionId"]], + vpn = create_vpn_connection(client, **vpn_connection_params) + client.get_waiter("vpn_connection_available").wait( + VpnConnectionIds=[vpn["VpnConnectionId"]], WaiterConfig={"Delay": delay, "MaxAttempts": max_attempts}, ) except WaiterError as e: - raise VPNConnectionException( - msg=f"Failed to wait for VPN connection {vpn['VpnConnection']['VpnConnectionId']} to be available", - exception=e, + module.fail_json_aws( + e, msg=f"Failed to wait for VPN connection {vpn['VpnConnection']['VpnConnectionId']} to be available" ) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException(msg="Failed to create VPN connection", exception=e) + except AnsibleEC2Error as e: + module.fail_json_aws(e, msg="Failed to create VPN connection") - return vpn["VpnConnection"] + return vpn -def delete_connection(connection, vpn_connection_id, delay, max_attempts): +def delete_connection(client, module: AnsibleAWSModule, vpn_connection_id: str) -> NoReturn: """Deletes a VPN connection""" + + delay = module.params.get("delay") + max_attempts = module.params.get("wait_timeout") // delay + try: - connection.delete_vpn_connection(aws_retry=True, VpnConnectionId=vpn_connection_id) - connection.get_waiter("vpn_connection_deleted").wait( + delete_vpn_connection(client, vpn_connection_id) + client.get_waiter("vpn_connection_deleted").wait( VpnConnectionIds=[vpn_connection_id], WaiterConfig={"Delay": delay, "MaxAttempts": max_attempts} ) except WaiterError as e: - raise VPNConnectionException( - msg=f"Failed to wait for VPN connection {vpn_connection_id} to be removed", exception=e - ) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException(msg=f"Failed to delete the VPN connection: {vpn_connection_id}", exception=e) - - -def add_tags(connection, vpn_connection_id, add): - try: - connection.create_tags(aws_retry=True, Resources=[vpn_connection_id], Tags=add) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException(msg=f"Failed to add the tags: {add}.", exception=e) + module.fail_json_aws(e, msg=f"Failed to wait for VPN connection {vpn_connection_id} to be removed") + except AnsibleEC2Error as e: + module.fail_json_aws(e, msg=f"Failed to delete the VPN connection: {vpn_connection_id}") -def remove_tags(connection, vpn_connection_id, remove): - # format tags since they are a list in the format ['tag1', 'tag2', 'tag3'] - key_dict_list = [{"Key": tag} for tag in remove] - try: - connection.delete_tags(aws_retry=True, Resources=[vpn_connection_id], Tags=key_dict_list) - except (BotoCoreError, ClientError) as e: - raise VPNConnectionException(msg=f"Failed to remove the tags: {remove}.", exception=e) - - -def check_for_update(connection, module_params, vpn_connection_id): - """Determines if there are any tags or routes that need to be updated. Ensures non-modifiable attributes aren't expected to change.""" - tags = module_params.get("tags") - routes = module_params.get("routes") - purge_tags = module_params.get("purge_tags") - purge_routes = module_params.get("purge_routes") +def check_for_routes_update(client, module: AnsibleAWSModule, vpn_connection_id: str) -> Dict[str, Any]: + """Determines if there are any routes that need to be updated. Ensures non-modifiable attributes aren't expected to change.""" + routes = module.params.get("routes") + purge_routes = module.params.get("purge_routes") - vpn_connection = find_connection(connection, module_params, vpn_connection_id=vpn_connection_id) + vpn_connection = find_vpn_connection(client, module, vpn_connection_id) current_attrs = camel_dict_to_snake_dict(vpn_connection) # Initialize changes dict - changes = {"tags_to_add": [], "tags_to_remove": [], "routes_to_add": [], "routes_to_remove": []} + changes: Dict[str, Any] = {"routes_to_add": [], "routes_to_remove": []} - # Get changes to tags - current_tags = boto3_tag_list_to_ansible_dict(current_attrs.get("tags", []), "key", "value") - if tags is None: - changes["tags_to_remove"] = [] - changes["tags_to_add"] = [] - else: - tags_to_add, changes["tags_to_remove"] = compare_aws_tags(current_tags, tags, purge_tags) - changes["tags_to_add"] = ansible_dict_to_boto3_tag_list(tags_to_add) # Get changes to routes if "Routes" in vpn_connection: current_routes = [route["DestinationCidrBlock"] for route in vpn_connection["Routes"]] @@ -638,18 +713,18 @@ def check_for_update(connection, module_params, vpn_connection_id): if attribute in ("tags", "routes", "state"): continue elif attribute == "options": - will_be = module_params.get("static_only", None) + will_be = module.params.get("static_only") is_now = bool(current_attrs[attribute]["static_routes_only"]) attribute = "static_only" elif attribute == "type": - will_be = module_params.get("connection_type", None) + will_be = module.params.get("connection_type") is_now = current_attrs[attribute] else: is_now = current_attrs[attribute] - will_be = module_params.get(attribute, None) + will_be = module.params.get(attribute) if will_be is not None and to_text(will_be) != to_text(is_now): - raise VPNConnectionException( + module.fail_json( msg=( f"You cannot modify {attribute}, the current value of which is {is_now}. Modifiable VPN connection" f" attributes are tags and routes. The value you tried to change it to is {will_be}." @@ -659,42 +734,37 @@ def check_for_update(connection, module_params, vpn_connection_id): return changes -def make_changes(connection, vpn_connection_id, changes): - """changes is a dict with the keys 'tags_to_add', 'tags_to_remove', 'routes_to_add', 'routes_to_remove', - the values of which are lists (generated by check_for_update()). +def make_changes(client, module: AnsibleAWSModule, vpn_connection_id: str, changes: Dict[str, Any]) -> bool: + """changes is a dict with the keys 'routes_to_add', 'routes_to_remove', + the values of which are lists (generated by check_for_routes_update()). """ - changed = False - - if changes["tags_to_add"]: - changed = True - add_tags(connection, vpn_connection_id, changes["tags_to_add"]) - - if changes["tags_to_remove"]: - changed = True - remove_tags(connection, vpn_connection_id, changes["tags_to_remove"]) + changed: bool = False + + if module.params.get("tags") is not None: + changed |= ensure_ec2_tags( + client, + module, + vpn_connection_id, + resource_type="vpn-connection", + tags=module.params.get("tags"), + purge_tags=module.params.get("purge_tags"), + ) if changes["routes_to_add"]: - changed = True - add_routes(connection, vpn_connection_id, changes["routes_to_add"]) + changed |= add_routes(client, module, vpn_connection_id, changes["routes_to_add"]) if changes["routes_to_remove"]: - changed = True - remove_routes(connection, vpn_connection_id, changes["routes_to_remove"]) + changed |= remove_routes(client, module, vpn_connection_id, changes["routes_to_remove"]) return changed -def get_check_mode_results(connection, module_params, vpn_connection_id=None, current_state=None): +def get_check_mode_results( + module_params: Dict[str, Any], vpn_connection_id: Optional[str] = None, current_state: Optional[str] = None +) -> Tuple[bool, Dict[str, Any]]: """Returns the changes that would be made to a VPN Connection""" - state = module_params.get("state") - if state == "absent": - if vpn_connection_id: - return True, {} - else: - return False, {} - - changed = False - results = { + changed: bool = False + results: Dict[str, Any] = { "customer_gateway_configuration": "", "customer_gateway_id": module_params.get("customer_gateway_id"), "vpn_gateway_id": module_params.get("vpn_gateway_id"), @@ -703,8 +773,8 @@ def get_check_mode_results(connection, module_params, vpn_connection_id=None, cu "routes": [module_params.get("routes")], } - # get combined current tags and tags to set present_tags = module_params.get("tags") + # get combined current tags and tags to set if present_tags is None: pass elif current_state and "Tags" in current_state: @@ -717,6 +787,7 @@ def get_check_mode_results(connection, module_params, vpn_connection_id=None, cu results["tags"] = current_tags elif module_params.get("tags"): changed = True + if present_tags: results["tags"] = present_tags @@ -745,75 +816,75 @@ def get_check_mode_results(connection, module_params, vpn_connection_id=None, cu return changed, results -def ensure_present(connection, module_params, check_mode=False): +def ensure_present( + client, module: AnsibleAWSModule, vpn_connection: Optional[Dict[str, Any]] +) -> Tuple[bool, Dict[str, Any]]: """Creates and adds tags to a VPN connection. If the connection already exists update tags.""" - vpn_connection = find_connection(connection, module_params) - changed = False - delay = module_params.get("delay") - max_attempts = module_params.get("wait_timeout") // delay + changed: bool = False + delay = module.params.get("delay") + max_attempts = module.params.get("wait_timeout") // delay # No match but vpn_connection_id was specified. - if not vpn_connection and module_params.get("vpn_connection_id"): - raise VPNConnectionException( - msg="There is no VPN connection available or pending with that id. Did you delete it?" - ) + if not vpn_connection and module.params.get("vpn_connection_id"): + module.fail_json(msg="There is no VPN connection available or pending with that id. Did you delete it?") # Unique match was found. Check if attributes provided differ. elif vpn_connection: vpn_connection_id = vpn_connection["VpnConnectionId"] - # check_for_update returns a dict with the keys tags_to_add, tags_to_remove, routes_to_add, routes_to_remove - changes = check_for_update(connection, module_params, vpn_connection_id) - if check_mode: - return get_check_mode_results(connection, module_params, vpn_connection_id, current_state=vpn_connection) - changed = make_changes(connection, vpn_connection_id, changes) + # check_for_update returns a dict with the keys routes_to_add, routes_to_remove + changes = check_for_routes_update(client, module, vpn_connection_id) + + if module.check_mode: + return get_check_mode_results(module.params, vpn_connection_id, current_state=vpn_connection) + + changed |= make_changes(client, module, vpn_connection_id, changes) # No match was found. Create and tag a connection and add routes. else: changed = True - if check_mode: - return get_check_mode_results(connection, module_params) + + if module.check_mode: + return get_check_mode_results(module.params) + vpn_connection = create_connection( - connection, - customer_gateway_id=module_params.get("customer_gateway_id"), - static_only=module_params.get("static_only"), - vpn_gateway_id=module_params.get("vpn_gateway_id"), - transit_gateway_id=module_params.get("transit_gateway_id"), - connection_type=module_params.get("connection_type"), - tunnel_options=module_params.get("tunnel_options"), + client, + module, + customer_gateway_id=module.params.get("customer_gateway_id"), + static_only=module.params.get("static_only"), + vpn_gateway_id=module.params.get("vpn_gateway_id"), + transit_gateway_id=module.params.get("transit_gateway_id"), + connection_type=module.params.get("connection_type"), + local_ipv4_network_cidr=module.params.get("local_ipv4_network_cidr"), + tunnel_options=module.params.get("tunnel_options"), max_attempts=max_attempts, delay=delay, ) - changes = check_for_update(connection, module_params, vpn_connection["VpnConnectionId"]) - make_changes(connection, vpn_connection["VpnConnectionId"], changes) + + changes = check_for_routes_update(client, module, vpn_connection["VpnConnectionId"]) + make_changes(client, module, vpn_connection["VpnConnectionId"], changes) # get latest version if a change has been made and make tags output nice before returning it if vpn_connection: - vpn_connection = find_connection(connection, module_params, vpn_connection["VpnConnectionId"]) + vpn_connection = find_vpn_connection(client, module, vpn_connection["VpnConnectionId"]) if "Tags" in vpn_connection: vpn_connection["Tags"] = boto3_tag_list_to_ansible_dict(vpn_connection["Tags"]) - return changed, vpn_connection + return (changed, vpn_connection) -def ensure_absent(connection, module_params, check_mode=False): +def ensure_absent(client, module: AnsibleAWSModule, vpn_connection: Dict[str, Any]) -> bool: """Deletes a VPN connection if it exists.""" - vpn_connection = find_connection(connection, module_params) - - if check_mode: - return get_check_mode_results( - connection, module_params, vpn_connection["VpnConnectionId"] if vpn_connection else None - ) - - delay = module_params.get("delay") - max_attempts = module_params.get("wait_timeout") // delay + changed: bool = False if vpn_connection: - delete_connection(connection, vpn_connection["VpnConnectionId"], delay=delay, max_attempts=max_attempts) changed = True - else: - changed = False - return changed, {} + if module.check_mode: + return changed + + delete_connection(client, module, vpn_connection["VpnConnectionId"]) + + return changed def main(): @@ -824,7 +895,18 @@ def main(): tags=dict(type="dict", aliases=["resource_tags"]), connection_type=dict(default="ipsec.1", type="str"), transit_gateway_id=dict(type="str"), - tunnel_options=dict(no_log=True, type="list", default=[], elements="dict"), + local_ipv4_network_cidr=dict(type="str", default="0.0.0.0/0"), + tunnel_options=dict( + no_log=True, + type="list", + default=[], + elements="dict", + options=dict( + TunnelInsideCidr=dict(type="str"), + TunnelInsideIpv6Cidr=dict(type="str"), + PreSharedKey=dict(type="str", no_log=True), + ), + ), static_only=dict(default=False, type="bool"), customer_gateway_id=dict(type="str"), vpn_connection_id=dict(type="str"), @@ -843,21 +925,17 @@ def main(): supports_check_mode=True, mutually_exclusive=mutually_exclusive, ) - connection = module.client("ec2", retry_decorator=VPNRetry.jittered_backoff(retries=10)) + client = module.client("ec2") + response: Dict[str, Any] = {} state = module.params.get("state") - parameters = dict(module.params) - try: - if state == "present": - changed, response = ensure_present(connection, parameters, module.check_mode) - elif state == "absent": - changed, response = ensure_absent(connection, parameters, module.check_mode) - except VPNConnectionException as e: - if e.exception: - module.fail_json_aws(e.exception, msg=e.msg) - else: - module.fail_json(msg=e.msg) + vpn_connection = find_vpn_connection(client, module) + + if state == "present": + changed, response = ensure_present(client, module, vpn_connection) + elif state == "absent": + changed = ensure_absent(client, module, vpn_connection) module.exit_json(changed=changed, **camel_dict_to_snake_dict(response)) diff --git a/plugins/modules/ec2_vpc_vpn_info.py b/plugins/modules/ec2_vpc_vpn_info.py index d304e456833..a5d3f65db7d 100644 --- a/plugins/modules/ec2_vpc_vpn_info.py +++ b/plugins/modules/ec2_vpc_vpn_info.py @@ -8,9 +8,9 @@ --- module: ec2_vpc_vpn_info version_added: 1.0.0 -short_description: Gather information about VPN Connections in AWS. +short_description: Gather information about EC2 VPN Connections in AWS description: - - Gather information about VPN Connections in AWS. + - Gather information about EC2 VPN Connections in AWS. author: - Madhura Naniwadekar (@Madhura-CSI) options: @@ -23,7 +23,7 @@ default: {} vpn_connection_ids: description: - - Get details of a specific VPN connections using vpn connection ID/IDs. This value should be provided as a list. + - Get details of specific EC2 VPN Connection(s) using vpn connection ID/IDs. This value should be provided as a list. required: false type: list elements: str @@ -36,33 +36,34 @@ EXAMPLES = r""" # # Note: These examples do not set authentication details, see the AWS Guide for details. -- name: Gather information about all vpn connections +- name: Gather information about all EC2 VPN Connections community.aws.ec2_vpc_vpn_info: -- name: Gather information about a filtered list of vpn connections, based on tags +- name: Gather information about a filtered list of EC2 VPN Connections, based on tags community.aws.ec2_vpc_vpn_info: filters: - "tag:Name": test-connection + "tag:Name": "test-connection" register: vpn_conn_info -- name: Gather information about vpn connections by specifying connection IDs. +- name: Gather information about EC2 VPN Connections by specifying connection IDs community.aws.ec2_vpc_vpn_info: filters: - vpn-gateway-id: vgw-cbe66beb + "vpn-gateway-id": "vgw-cbe66beb" register: vpn_conn_info """ RETURN = r""" vpn_connections: - description: List of one or more VPN Connections. + description: List of one or more EC2 VPN Connections. + type: list + elements: dict returned: always - type: complex contains: category: description: The category of the VPN connection. returned: always type: str - sample: VPN + sample: "VPN" customer_gatway_configuration: description: The configuration information for the VPN connection's customer gateway (in the native XML format). returned: always @@ -71,50 +72,112 @@ description: The ID of the customer gateway at your end of the VPN connection. returned: always type: str - sample: cgw-17a53c37 + sample: "cgw-17a53c37" + gateway_association_state: + description: The current state of the gateway association. + type: str + sample: "associated" options: description: The VPN connection options. - returned: always - type: dict - sample: { - "static_routes_only": false - } + type: list + elements: dict + contains: + static_routes_only: + description: If the VPN connection only allows static routes. + type: bool + sample: true + enable_acceleration: + description: Indicates whether acceleration is enabled for the VPN connection. + type: bool + sample: false + local_ipv4_network_cidr: + description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. + type: str + sample: "0.0.0.0/0" + outside_ip_address_type: + description: The external IP address of the VPN tunnel. + type: str + sample: "PublicIpv4" + remote_ipv4_network_cidr: + description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. + type: str + sample: "0.0.0.0/0" + tunnel_inside_ip_version: + description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. + type: str + sample: "ipv4" + tunnel_options: + description: Indicates the VPN tunnel options. + type: list + elements: dict + sample: [ + { + "log_options": { + "cloud_watch_log_options": { + "log_enabled": false + } + }, + "outside_ip_address": "34.225.101.10", + "pre_shared_key": "8n7hnjNE8zhIt4VpMOIfcrw6XnUTHLW9", + "tunnel_inside_cidr": "169.254.31.8/30" + }, + ] + contains: + log_options: + description: Options for logging VPN tunnel activity. + type: dict + contains: + cloud_watch_log_options: + description: Options for sending VPN tunnel logs to CloudWatch. + type: dict + outside_ip_address: + description: The external IP address of the VPN tunnel. + type: str + pre_shared_key: + description: + - The pre-shared key (PSK) to establish initial authentication between the + virtual private gateway and the customer gateway. + type: str + tunnel_inside_cidr: + description: The range of inside IPv4 addresses for the tunnel. + type: str routes: description: List of static routes associated with the VPN connection. returned: always - type: complex + type: list + elements: dict contains: destination_cidr_block: - description: The CIDR block associated with the local subnet of the customer data center. - returned: always + description: + - The CIDR block associated with the local subnet of the customer data center. + type: str + source: + description: Indicates how the routes were provided. type: str - sample: 10.0.0.0/16 state: description: The current state of the static route. - returned: always type: str - sample: available state: description: The current state of the VPN connection. returned: always type: str - sample: available + sample: "available" tags: description: Any tags assigned to the VPN connection. returned: always type: dict sample: { - "Name": "test-conn" + "Name": "test-conn" } type: description: The type of VPN connection. returned: always type: str - sample: ipsec.1 + sample: "ipsec.1" vgw_telemetry: description: Information about the VPN tunnel. returned: always - type: complex + type: dict contains: accepted_route_count: description: The number of accepted routes. @@ -130,17 +193,17 @@ description: The Internet-routable IP address of the virtual private gateway's outside interface. returned: always type: str - sample: 13.127.79.191 + sample: "13.127.79.191" status: description: The status of the VPN tunnel. returned: always type: str - sample: DOWN + sample: "DOWN" status_message: description: If an error occurs, a description of the error. returned: always type: str - sample: IPSEC IS DOWN + sample: "IPSEC IS DOWN" certificate_arn: description: The Amazon Resource Name of the virtual private gateway tunnel endpoint certificate. returned: when a private certificate is used for authentication @@ -150,50 +213,51 @@ description: The ID of the VPN connection. returned: always type: str - sample: vpn-f700d5c0 + sample: "vpn-f700d5c0" vpn_gateway_id: description: The ID of the virtual private gateway at the AWS side of the VPN connection. returned: always type: str - sample: vgw-cbe56bfb + sample: "vgw-cbe56bfb" """ import json - -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import NoReturn from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_connections from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def date_handler(obj): +def date_handler(obj: Dict[str, Any]) -> Dict[str, Any]: return obj.isoformat() if hasattr(obj, "isoformat") else obj -def list_vpn_connections(connection, module): - params = dict() +def list_vpn_connections(client, module: AnsibleAWSModule) -> NoReturn: + params: Dict[str, Any] = {} params["Filters"] = ansible_dict_to_boto3_filter_list(module.params.get("filters")) params["VpnConnectionIds"] = module.params.get("vpn_connection_ids") try: - result = json.loads(json.dumps(connection.describe_vpn_connections(**params), default=date_handler)) + result = json.loads(json.dumps(describe_vpn_connections(client, **params), default=date_handler)) except ValueError as e: - module.fail_json_aws(e, msg="Cannot validate JSON data") - except (ClientError, BotoCoreError) as e: + module.fail_json(e, msg="Cannot validate JSON data") + except AnsibleEC2Error as e: module.fail_json_aws(e, msg="Could not describe customer gateways") - snaked_vpn_connections = [camel_dict_to_snake_dict(vpn_connection) for vpn_connection in result["VpnConnections"]] + + snaked_vpn_connections = [camel_dict_to_snake_dict(vpn_connection) for vpn_connection in result] if snaked_vpn_connections: for vpn_connection in snaked_vpn_connections: vpn_connection["tags"] = boto3_tag_list_to_ansible_dict(vpn_connection.get("tags", [])) + module.exit_json(changed=False, vpn_connections=snaked_vpn_connections) diff --git a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml b/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml index 9514d7cf350..6a9f9125688 100644 --- a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: 'ec2_vpc_vpn_info integration tests' +- name: EC2 VPN Connection integration tests collections: - amazon.aws module_defaults: @@ -11,8 +11,8 @@ block: # ============================================================ - - name: create a VPC - ec2_vpc_net: + - name: Create a VPC + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" state: present cidr_block: "10.0.0.0/26" @@ -21,27 +21,27 @@ Description: "Created by ansible-test" register: vpc_result - - name: create vpn gateway and attach it to vpc - ec2_vpc_vgw: + - name: Create an EC2 VPC gateway and attach it to VPC + community.aws.ec2_vpc_vgw: state: present vpc_id: '{{ vpc_result.vpc.id }}' name: "{{ resource_prefix }}-vgw" register: vgw - - name: create customer gateway - ec2_customer_gateway: + - name: Create customer gateway + community.aws.ec2_customer_gateway: bgp_asn: 12345 ip_address: 1.2.3.4 name: testcgw register: cgw - - name: create transit gateway - ec2_transit_gateway: + - name: Create transit gateway + community.aws.ec2_transit_gateway: description: "Transit Gateway for vpn attachment" register: tgw - - name: create vpn connection, with customer gateway, vpn_gateway_id and transit_gateway - ec2_vpc_vpn: + - name: Create an EC2 VPN Connection, with customer gateway, vpn_gateway_id and transit_gateway + community.aws.ec2_vpc_vpn: customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' vpn_gateway_id: '{{ vgw.vgw.id }}' transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' @@ -49,38 +49,38 @@ register: result ignore_errors: true - - name: assert creation of vpn failed - assert: + - name: Assert creation of vpn failed + ansible.builtin.assert: that: - result is failed - result.msg == "parameters are mutually exclusive: vpn_gateway_id|transit_gateway_id" - - - name: create vpn connection, with customer gateway and transit_gateway - ec2_vpc_vpn: + - name: Create EC2 VPN Connection, with customer gateway and transit_gateway + community.aws.ec2_vpc_vpn: customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' state: present + wait_timeout: 1000 register: tgw_vpn - name: Store ID of VPN - set_fact: + ansible.builtin.set_fact: vpn_id: '{{ tgw_vpn.vpn_connection_id }}' # ============================================================ - - name: test success with no parameters - ec2_vpc_vpn_info: + - name: Test success with no parameters + community.aws.ec2_vpc_vpn_info: register: result - - name: assert success with no parameters - assert: + - name: Assert success with no parameters + ansible.builtin.assert: that: - 'result.changed == false' - 'result.vpn_connections != []' # ============================================================ - - name: Delete vpn created with transit gateway - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection created with transit gateway + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn_id }}' register: result @@ -91,38 +91,38 @@ # ============================================================ - - name: create vpn connection, with customer gateway and vpn gateway - ec2_vpc_vpn: + - name: Create EC2 VPN Connection, with customer gateway and vpn gateway + community.aws.ec2_vpc_vpn: customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' vpn_gateway_id: '{{ vgw.vgw.id }}' state: present register: vpn - - name: Store ID of VPN - set_fact: + - name: Store ID of the EC2 VPN Connection + ansible.builtin.set_fact: vpn_id: '{{ vpn.vpn_connection_id }}' # ============================================================ - - name: test success with no parameters - ec2_vpc_vpn_info: + - name: Test success with no parameters + community.aws.ec2_vpc_vpn_info: register: result - - name: assert success with no parameters - assert: + - name: Assert success with no parameters + ansible.builtin.assert: that: - 'result.changed == false' - 'result.vpn_connections != []' - - name: test success with customer gateway id as a filter - ec2_vpc_vpn_info: + - name: Test success with customer gateway id as a filter + community.aws.ec2_vpc_vpn_info: filters: customer-gateway-id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' vpn-connection-id: '{{ vpn.vpn_connection_id }}' register: result - - name: assert success with customer gateway id as filter - assert: + - name: Assert success with customer gateway id as filter + ansible.builtin.assert: that: - 'result.changed == false' - 'result.vpn_connections != []' @@ -133,53 +133,57 @@ # ============================================================ - - name: delete vpn connection (check) - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection (check_mode) + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn_id }}' register: result - check_mode: True + check_mode: true - - assert: + - name: Assert EC2 VPN Connection is deleted (check_mode) + ansible.builtin.assert: that: - result is changed - - name: delete vpn connection - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn_id }}' register: result - - assert: + - name: Assert EC2 VPN Connection is deleted + ansible.builtin.assert: that: - result is changed - - name: delete vpn connection - idempotency (check) - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection - idempotency (check) + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn_id }}' register: result - check_mode: True + check_mode: true - - assert: + - name: Assert result has not changed (idempotency check_mode) + ansible.builtin.assert: that: - result is not changed - - name: delete vpn connection - idempotency - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection - idempotency + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn_id }}' register: result - - assert: + - name: Assert result has not changed (idempotency) + ansible.builtin.assert: that: - result is not changed # ============================================================ always: - - name: delete vpn connection - ec2_vpc_vpn: + - name: Delete EC2 VPN Connection + community.aws.ec2_vpc_vpn: state: absent vpn_connection_id: '{{ vpn.vpn_connection_id }}' register: result @@ -188,8 +192,8 @@ until: result is not failed ignore_errors: true - - name: delete customer gateway - ec2_customer_gateway: + - name: Delete customer gateway + community.aws.ec2_customer_gateway: state: absent ip_address: 1.2.3.4 name: testcgw @@ -200,8 +204,8 @@ until: result is not failed ignore_errors: true - - name: delete vpn gateway - ec2_vpc_vgw: + - name: Delete VPN gateway + community.aws.ec2_vpc_vgw: state: absent vpn_gateway_id: '{{ vgw.vgw.id }}' register: result @@ -210,8 +214,8 @@ until: result is not failed ignore_errors: true - - name: delete vpc - ec2_vpc_net: + - name: Delete VPC + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" state: absent cidr_block: "10.0.0.0/26" @@ -221,8 +225,8 @@ until: result is not failed ignore_errors: true - - name: delete transit gateway - ec2_transit_gateway: + - name: Delete transit gateway + community.aws.ec2_transit_gateway: transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' state: absent ignore_errors: true diff --git a/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml b/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml index fb97f01faab..21ea2cfd618 100644 --- a/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml +++ b/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml @@ -34,61 +34,62 @@ # ============================================================ - - name: (check) add tags - ec2_vpc_vpn: + - name: Add tags (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ first_tags }}' state: 'present' register: tag_vpn - check_mode: True + check_mode: true - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - - name: add tags - ec2_vpc_vpn: + - name: Add tags + community.aws.ec2_vpc_vpn: tags: '{{ first_tags }}' state: 'present' register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: {} + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: {} register: tag_vpn_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].tags == first_tags - - name: (check) add tags - IDEMPOTENCY - ec2_vpc_vpn: + - name: Add tags - IDEMPOTENCY (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ first_tags }}' state: 'present' register: tag_vpn - check_mode: True + check_mode: true - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id - - name: add tags - IDEMPOTENCY - ec2_vpc_vpn: + - name: Add tags - IDEMPOTENCY + community.aws.ec2_vpc_vpn: tags: '{{ first_tags }}' state: 'present' register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: {} + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: {} register: tag_vpn_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id @@ -97,80 +98,66 @@ # ============================================================ -# - name: get VPC VPN facts by filter -# ec2_vpc_vpn_info: -# filters: -# 'tag:Name': '{{ vgw_name }}' -# vpn_connection_ids: '{{ omit }}' -# register: tag_vpn_info -# -# - name: assert the facts are the same as before -# assert: -# that: -# - tag_vpn_info.vpn_connections | length == 1 -# - tag_vpn.vpn_connection_id == vpn_id -# - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - # ============================================================ - - - name: (check) modify tags with purge - ec2_vpc_vpn: + - name: Modify tags with purge (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ second_tags }}' state: 'present' purge_tags: true register: tag_vpn - check_mode: True + check_mode: true - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - - name: modify tags with purge - ec2_vpc_vpn: + - name: Modify tags with purge + community.aws.ec2_vpc_vpn: tags: '{{ second_tags }}' state: 'present' purge_tags: true register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].tags == second_tags - - name: (check) modify tags with purge - IDEMPOTENCY - ec2_vpc_vpn: + - name: Modify tags with purge - IDEMPOTENCY (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ second_tags }}' state: 'present' purge_tags: true register: tag_vpn check_mode: True - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id - - name: modify tags with purge - IDEMPOTENCY - ec2_vpc_vpn: + - name: Modify tags with purge - IDEMPOTENCY + community.aws.ec2_vpc_vpn: tags: '{{ second_tags }}' state: 'present' purge_tags: true register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id @@ -179,64 +166,66 @@ # ============================================================ - - name: (check) modify tags without purge - ec2_vpc_vpn: + - name: Modify tags without purge (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ third_tags }}' state: 'present' purge_tags: False register: tag_vpn check_mode: True - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - - name: modify tags without purge - ec2_vpc_vpn: + - name: Modify tags without purge + community.aws.ec2_vpc_vpn: tags: '{{ third_tags }}' state: 'present' purge_tags: False register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - name: verify the tags were added - assert: + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].tags == final_tags - - name: (check) modify tags without purge - IDEMPOTENCY - ec2_vpc_vpn: + - name: Modify tags without purge - IDEMPOTENCY (check_mode) + community.aws.ec2_vpc_vpn: tags: '{{ third_tags }}' state: 'present' - purge_tags: False + purge_tags: false register: tag_vpn - check_mode: True + check_mode: true - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id - - name: modify tags without purge - IDEMPOTENCY - ec2_vpc_vpn: + - name: Modify tags without purge - IDEMPOTENCY + community.aws.ec2_vpc_vpn: tags: '{{ third_tags }}' state: 'present' - purge_tags: False + purge_tags: false register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id @@ -245,28 +234,29 @@ # ============================================================ - - name: (check) No change to tags without setting tags - ec2_vpc_vpn: + - name: No change to tags without setting tag (check_mode) + community.aws.ec2_vpc_vpn: state: 'present' register: tag_vpn - check_mode: True + check_mode: true - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id - name: No change to tags without setting tags - ec2_vpc_vpn: + community.aws.ec2_vpc_vpn: state: 'present' register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get CE2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify no tags were added - assert: + - name: Verify no tags were added + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id @@ -275,63 +265,65 @@ # ============================================================ - - name: (check) remove tags - ec2_vpc_vpn: + - name: Remove tags (check_mode) + community.aws.ec2_vpc_vpn: tags: {} state: 'present' - purge_tags: True + purge_tags: true register: tag_vpn - check_mode: True + check_mode: true - - name: assert would change - assert: + - name: Assert would change + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - - name: remove tags - ec2_vpc_vpn: + - name: Remove tags + community.aws.ec2_vpc_vpn: tags: {} - state: 'present' - purge_tags: True + state: present + purge_tags: true register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get EC2 VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify the tags were removed - assert: + - name: Verify the tags were removed + ansible.builtin.assert: that: - tag_vpn is changed - tag_vpn.vpn_connection_id == vpn_id - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - name: (check) remove tags - IDEMPOTENCY - ec2_vpc_vpn: + - name: Remove tags - IDEMPOTENCY (check_mode) + community.aws.ec2_vpc_vpn: tags: {} state: 'present' - purge_tags: True + purge_tags: true register: tag_vpn - check_mode: True + check_mode: true - - name: assert would not change - assert: + - name: Assert would not change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id - - name: remove tags - IDEMPOTENCY - ec2_vpc_vpn: + - name: Remove tags - IDEMPOTENCY + community.aws.ec2_vpc_vpn: tags: {} state: 'present' - purge_tags: True + purge_tags: true register: tag_vpn - - name: get VPC VPN facts - ec2_vpc_vpn_info: + + - name: Get VPC VPN facts + community.aws.ec2_vpc_vpn_info: register: tag_vpn_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vpn is not changed - tag_vpn.vpn_connection_id == vpn_id diff --git a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py b/tests/unit/plugins/modules/test_ec2_vpc_vpn.py index 2b5db4226dd..8a7d2dee494 100644 --- a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py +++ b/tests/unit/plugins/modules/test_ec2_vpc_vpn.py @@ -1,435 +1,263 @@ # (c) 2017 Red Hat Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -__metaclass__ = type - -import os +from unittest.mock import MagicMock +from unittest.mock import Mock import pytest -import ansible_collections.amazon.aws.plugins.module_utils.retries as aws_retries -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_conn -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import get_aws_connection_info - -# Magic... Incorrectly identified by pylint as unused -# isort: off -# pylint: disable=unused-import -from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import maybe_sleep -from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import placeboify - -# pylint: enable=unused-import -# isort: on - from ansible_collections.community.aws.plugins.modules import ec2_vpc_vpn -class FailException(Exception): - pass - - -class FakeModule(object): - def __init__(self, **kwargs): - self.params = kwargs - - def fail_json_aws(self, *args, **kwargs): - self.exit_args = args - self.exit_kwargs = kwargs - raise FailException("FAIL") - - def fail_json(self, *args, **kwargs): - self.exit_args = args - self.exit_kwargs = kwargs - raise FailException("FAIL") - - def exit_json(self, *args, **kwargs): - self.exit_args = args - self.exit_kwargs = kwargs - - -def get_vgw(connection): - # see if two vgw exist and return them if so - vgw = connection.describe_vpn_gateways(Filters=[{"Name": "tag:Ansible_VPN", "Values": ["Test"]}]) - if len(vgw["VpnGateways"]) >= 2: - return [vgw["VpnGateways"][0]["VpnGatewayId"], vgw["VpnGateways"][1]["VpnGatewayId"]] - # otherwise create two and return them - vgw_1 = connection.create_vpn_gateway(Type="ipsec.1") - vgw_2 = connection.create_vpn_gateway(Type="ipsec.1") - for resource in (vgw_1, vgw_2): - connection.create_tags( - Resources=[resource["VpnGateway"]["VpnGatewayId"]], Tags=[{"Key": "Ansible_VPN", "Value": "Test"}] - ) - return [vgw_1["VpnGateway"]["VpnGatewayId"], vgw_2["VpnGateway"]["VpnGatewayId"]] - - -def get_cgw(connection): - # see if two cgw exist and return them if so - cgw = connection.describe_customer_gateways( - DryRun=False, - Filters=[{"Name": "state", "Values": ["available"]}, {"Name": "tag:Name", "Values": ["Ansible-CGW"]}], - ) - if len(cgw["CustomerGateways"]) >= 2: - return [cgw["CustomerGateways"][0]["CustomerGatewayId"], cgw["CustomerGateways"][1]["CustomerGatewayId"]] - # otherwise create and return them - cgw_1 = connection.create_customer_gateway(DryRun=False, Type="ipsec.1", PublicIp="9.8.7.6", BgpAsn=65000) - cgw_2 = connection.create_customer_gateway(DryRun=False, Type="ipsec.1", PublicIp="5.4.3.2", BgpAsn=65000) - for resource in (cgw_1, cgw_2): - connection.create_tags( - Resources=[resource["CustomerGateway"]["CustomerGatewayId"]], Tags=[{"Key": "Ansible-CGW", "Value": "Test"}] - ) - return [cgw_1["CustomerGateway"]["CustomerGatewayId"], cgw_2["CustomerGateway"]["CustomerGatewayId"]] - - -def get_dependencies(): - if os.getenv("PLACEBO_RECORD"): - module = FakeModule(**{}) - region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True) - connection = boto3_conn( - module, conn_type="client", resource="ec2", region=region, endpoint=ec2_url, **aws_connect_kwargs - ) - vgw = get_vgw(connection) - cgw = get_cgw(connection) +@pytest.fixture +def ansible_module(): + module = MagicMock() + module.check_mode = False + module.params = {"delay": 5, "wait_timeout": 30} + module.fail_json.side_effect = SystemExit(1) + module.fail_json_aws.side_effect = SystemExit(1) + + return module + + +@pytest.mark.parametrize( + "vpn_connections, expected_result, expected_exception", + [ + # Case 1: Single VPN connection available + ( + [{"VpnConnectionId": "vpn-123", "State": "available"}], + {"VpnConnectionId": "vpn-123", "State": "available"}, + None, + ), + # Case 2: Multiple valid VPN connections available (expecting an exception) + ( + [ + {"VpnConnectionId": "vpn-123", "State": "available"}, + {"VpnConnectionId": "vpn-456", "State": "available"}, + ], + None, + "More than one matching VPN connection was found. To modify or delete a VPN please specify vpn_connection_id or add filters.", + ), + # Case 3: No VPN connections available + ([], None, None), + # Case 4: Multiple connections with one deleted (expecting the viable connection) + ( + [ + {"VpnConnectionId": "vpn-123", "State": "deleted"}, + {"VpnConnectionId": "vpn-456", "State": "available"}, + ], + {"VpnConnectionId": "vpn-456", "State": "available"}, + None, + ), + ], +) +def test_find_connection_response(ansible_module, vpn_connections, expected_result, expected_exception): + if expected_exception: + with pytest.raises(SystemExit) as e: # Assuming fail_json raises SystemExit + ec2_vpc_vpn.find_connection_response(ansible_module, vpn_connections) + assert e.value.code == 1 # Ensure exit code is as expected + # Check that the message is the same as expected + assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception else: - vgw = ["vgw-35d70c2b", "vgw-32d70c2c"] - cgw = ["cgw-6113c87f", "cgw-9e13c880"] - - return cgw, vgw - - -def setup_mod_conn(placeboify, params): - conn = placeboify.client("ec2") - retry_decorator = aws_retries.AWSRetry.jittered_backoff() - wrapped_conn = aws_retries.RetryingBotoClientWrapper(conn, retry_decorator) - m = FakeModule(**params) - return m, wrapped_conn - - -def make_params(cgw, vgw, tags=None, filters=None, routes=None): - tags = {} if tags is None else tags - filters = {} if filters is None else filters - routes = [] if routes is None else routes - - return { - "customer_gateway_id": cgw, - "static_only": True, - "vpn_gateway_id": vgw, - "connection_type": "ipsec.1", - "purge_tags": True, - "tags": tags, - "filters": filters, + result = ec2_vpc_vpn.find_connection_response(ansible_module, vpn_connections) + assert result == expected_result + + +@pytest.mark.parametrize( + "vpn_connection_id, filters, describe_response, expected_result, expected_exception", + [ + # Case 1: Single VPN connection found + ( + "vpn-123", + None, + {"VpnConnections": [{"VpnConnectionId": "vpn-123", "State": "available"}]}, + {"VpnConnectionId": "vpn-123", "State": "available"}, + None, + ), + # Case 2: Multiple VPN connections found (expecting an exception) + ( + "vpn-123", + None, + { + "VpnConnections": [ + {"VpnConnectionId": "vpn-123", "State": "available"}, + {"VpnConnectionId": "vpn-456", "State": "available"}, + ] + }, + None, + "More than one matching VPN connection was found. To modify or delete a VPN please specify vpn_connection_id or add filters.", + ), + # Case 3: No VPN connections found + ("vpn-123", None, {"VpnConnections": []}, None, None), + ], +) +def test_find_vpn_connection( + ansible_module, vpn_connection_id, filters, describe_response, expected_result, expected_exception +): + client = Mock() + ansible_module.params = {"vpn_connection_id": vpn_connection_id, "filters": filters} + + # Mock the describe_vpn_connections function + client.describe_vpn_connections.return_value = describe_response if describe_response else {} + + if expected_exception: + if "More than one matching VPN connection" in expected_exception: + with pytest.raises(SystemExit) as e: + ec2_vpc_vpn.find_vpn_connection(client, ansible_module) + # Check that the exception message matches the expected exception + assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception + else: + result = ec2_vpc_vpn.find_vpn_connection(client, ansible_module) + assert result == expected_result + + +@pytest.mark.parametrize( + "provided_filters, expected_result, expected_exception", + [ + ({"cgw": "cgw-123"}, [{"Name": "customer-gateway-id", "Values": ["cgw-123"]}], None), + ({"invalid_filter": "value"}, None, "invalid_filter is not a valid filter."), + ( + {"tags": {"key1": "value1", "key2": "value2"}}, + [{"Name": "tag:key1", "Values": ["value1"]}, {"Name": "tag:key2", "Values": ["value2"]}], + None, + ), + ({"static-routes-only": True}, [{"Name": "option.static-routes-only", "Values": ["true"]}], None), + ], +) +def test_create_filter(ansible_module, provided_filters, expected_result, expected_exception): + if expected_exception: + with pytest.raises(SystemExit) as e: + ec2_vpc_vpn.create_filter(ansible_module, provided_filters) + # Check that the exception message matches the expected exception + assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception + else: + result = ec2_vpc_vpn.create_filter(ansible_module, provided_filters) + assert result == expected_result + + +@pytest.mark.parametrize( + "params, expected_result, expected_exception", + [ + # Case 1: Successful creation of a VPN connection + ( + {"customer_gateway_id": "cgw-123", "vpn_gateway_id": "vgw-123", "static_only": True}, + {"VpnConnectionId": "vpn-123"}, + None, + ), + # Case 3: Missing required parameters (simulating failure) + ( + {"customer_gateway_id": None, "vpn_gateway_id": "vgw-123", "static_only": True}, + None, + "No matching connection was found. To create a new connection you must provide customer_gateway_id" + + " and one of either transit_gateway_id or vpn_gateway_id.", + ), + # Case 4: Both customer gateway and VPN gateway are None + ( + {"customer_gateway_id": None, "vpn_gateway_id": None, "static_only": False}, + None, + "No matching connection was found. To create a new connection you must provide customer_gateway_id" + + " and one of either transit_gateway_id or vpn_gateway_id.", + ), + # Case 5: Optional parameters passed (e.g., static routes) + ( + {"customer_gateway_id": "cgw-123", "vpn_gateway_id": "vgw-123", "static_only": True}, + {"VpnConnectionId": "vpn-456"}, + None, + ), + ], +) +def test_create_connection(ansible_module, params, expected_result, expected_exception): + client = Mock() + ansible_module.params = params + + if expected_exception: + client.create_vpn_connection.side_effect = Exception("AWS Error") + with pytest.raises(SystemExit) as e: # Assuming fail_json raises SystemExit + ec2_vpc_vpn.create_connection( + client, + ansible_module, + params["customer_gateway_id"], + params["static_only"], + params["vpn_gateway_id"], + None, + None, + None, + None, + None, + ) + # Check that the exception message matches the expected exception + assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception + else: + client.create_vpn_connection.return_value = {"VpnConnection": expected_result} + result = ec2_vpc_vpn.create_connection( + client, + ansible_module, + params["customer_gateway_id"], + params["static_only"], + params["vpn_gateway_id"], + None, + None, + None, + None, + None, + ) + assert result == expected_result + + +@pytest.mark.parametrize( + "vpn_connection_id, routes, purge_routes, current_routes, expected_result", + [ + # Case 1: No changes in routes + ( + "vpn-123", + ["10.0.0.0/16"], + False, + [{"DestinationCidrBlock": "10.0.0.0/16"}], + {"routes_to_add": [], "routes_to_remove": []}, + ), + # Case 3: Old routes empty, new routes not empty + ("vpn-123", ["10.0.1.0/16"], False, [], {"routes_to_add": ["10.0.1.0/16"], "routes_to_remove": []}), + # Case 4: New routes empty, old routes not empty + ( + "vpn-123", + [], + False, + [{"DestinationCidrBlock": "10.0.0.0/16"}], + {"routes_to_add": [], "routes_to_remove": []}, + ), + # Case 5: Purge routes - removing non-existent routes + ( + "vpn-123", + ["10.0.1.0/16"], + True, + [{"DestinationCidrBlock": "10.0.0.0/16"}], + {"routes_to_add": ["10.0.1.0/16"], "routes_to_remove": ["10.0.0.0/16"]}, + ), + # Case 6: Both old and new routes are empty + ("vpn-123", [], False, [], {"routes_to_add": [], "routes_to_remove": []}), + # Case 7: Purge routes with existing routes + ( + "vpn-123", + [], + True, + [{"DestinationCidrBlock": "10.0.0.0/16"}], + {"routes_to_add": [], "routes_to_remove": ["10.0.0.0/16"]}, + ), + ], +) +def test_check_for_routes_update( + ansible_module, vpn_connection_id, routes, purge_routes, current_routes, expected_result +): + ansible_module.params = { "routes": routes, - "delay": 15, - "wait_timeout": 600, + "purge_routes": purge_routes, } + # Mock the find_vpn_connection function + client = MagicMock() + ec2_vpc_vpn.find_vpn_connection = Mock(return_value={"Routes": current_routes}) -def make_conn(placeboify, module, connection): - customer_gateway_id = module.params["customer_gateway_id"] - static_only = module.params["static_only"] - vpn_gateway_id = module.params["vpn_gateway_id"] - connection_type = module.params["connection_type"] - changed = True - vpn = ec2_vpc_vpn.create_connection(connection, customer_gateway_id, static_only, vpn_gateway_id, connection_type) - return changed, vpn - - -def tear_down_conn(placeboify, connection, vpn_connection_id): - ec2_vpc_vpn.delete_connection(connection, vpn_connection_id, delay=15, max_attempts=40) - - -def setup_req(placeboify, number_of_results=1): - """returns dependencies for VPN connections""" - assert number_of_results in (1, 2) - results = [] - cgw, vgw = get_dependencies() - for each in range(0, number_of_results): - params = make_params(cgw[each], vgw[each]) - m, conn = setup_mod_conn(placeboify, params) - vpn = ec2_vpc_vpn.ensure_present(conn, params)[1] - - results.append({"module": m, "connection": conn, "vpn": vpn, "params": params}) - if number_of_results == 1: - return results[0] - else: - return results[0], results[1] - - -def test_find_connection_vpc_conn_id(placeboify, maybe_sleep): - # setup dependencies for 2 vpn connections - dependencies = setup_req(placeboify, 2) - dep1, dep2 = dependencies[0], dependencies[1] - params1, vpn1, _m1, conn1 = dep1["params"], dep1["vpn"], dep1["module"], dep1["connection"] - _params2, vpn2, _m2, conn2 = dep2["params"], dep2["vpn"], dep2["module"], dep2["connection"] - - # find the connection with a vpn_connection_id and assert it is the expected one - assert ( - vpn1["VpnConnectionId"] - == ec2_vpc_vpn.find_connection(conn1, params1, vpn1["VpnConnectionId"])["VpnConnectionId"] - ) - - tear_down_conn(placeboify, conn1, vpn1["VpnConnectionId"]) - tear_down_conn(placeboify, conn2, vpn2["VpnConnectionId"]) - - -def test_find_connection_filters(placeboify, maybe_sleep): - # setup dependencies for 2 vpn connections - dependencies = setup_req(placeboify, 2) - dep1, dep2 = dependencies[0], dependencies[1] - params1, vpn1, _m1, conn1 = dep1["params"], dep1["vpn"], dep1["module"], dep1["connection"] - params2, vpn2, _m2, conn2 = dep2["params"], dep2["vpn"], dep2["module"], dep2["connection"] - - # update to different tags - params1.update(tags={"Wrong": "Tag"}) - params2.update(tags={"Correct": "Tag"}) - ec2_vpc_vpn.ensure_present(conn1, params1) - ec2_vpc_vpn.ensure_present(conn2, params2) - - # create some new parameters for a filter - params = {"filters": {"tags": {"Correct": "Tag"}}} - - # find the connection that has the parameters above - found = ec2_vpc_vpn.find_connection(conn1, params) - - # assert the correct connection was found - assert found["VpnConnectionId"] == vpn2["VpnConnectionId"] - - # delete the connections - tear_down_conn(placeboify, conn1, vpn1["VpnConnectionId"]) - tear_down_conn(placeboify, conn2, vpn2["VpnConnectionId"]) - - -def test_find_connection_insufficient_filters(placeboify, maybe_sleep): - # get list of customer gateways and virtual private gateways - cgw, vgw = get_dependencies() - - # create two connections with the same tags - params = make_params(cgw[0], vgw[0], tags={"Correct": "Tag"}) - params2 = make_params(cgw[1], vgw[1], tags={"Correct": "Tag"}) - m, conn = setup_mod_conn(placeboify, params) - m2, conn2 = setup_mod_conn(placeboify, params2) - vpn1 = ec2_vpc_vpn.ensure_present(conn, m.params)[1] - vpn2 = ec2_vpc_vpn.ensure_present(conn2, m2.params)[1] - - # reset the parameters so only filtering by tags will occur - m.params = {"filters": {"tags": {"Correct": "Tag"}}} - - expected_message = "More than one matching VPN connection was found" - # assert that multiple matching connections have been found - with pytest.raises(ec2_vpc_vpn.VPNConnectionException, match=expected_message): - ec2_vpc_vpn.find_connection(conn, m.params) - - # delete the connections - tear_down_conn(placeboify, conn, vpn1["VpnConnectionId"]) - tear_down_conn(placeboify, conn, vpn2["VpnConnectionId"]) - - -def test_find_connection_nonexistent(placeboify, maybe_sleep): - # create parameters but don't create a connection with them - params = {"filters": {"tags": {"Correct": "Tag"}}} - m, conn = setup_mod_conn(placeboify, params) - - # try to find a connection with matching parameters and assert None are found - assert ec2_vpc_vpn.find_connection(conn, m.params) is None - - -def test_create_connection(placeboify, maybe_sleep): - # get list of customer gateways and virtual private gateways - cgw, vgw = get_dependencies() - - # create a connection - params = make_params(cgw[0], vgw[0]) - m, conn = setup_mod_conn(placeboify, params) - changed, vpn = ec2_vpc_vpn.ensure_present(conn, m.params) - - # assert that changed is true and that there is a connection id - assert changed is True - assert "VpnConnectionId" in vpn - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_create_connection_that_exists(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - params, vpn, _m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # try to recreate the same connection - changed, vpn2 = ec2_vpc_vpn.ensure_present(conn, params) - - # nothing should have changed - assert changed is False - assert vpn["VpnConnectionId"] == vpn2["VpnConnectionId"] - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_modify_deleted_connection(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - _params, vpn, m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # delete it - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - # try to update the deleted connection - m.params.update(vpn_connection_id=vpn["VpnConnectionId"]) - expected_message = "no VPN connection available or pending with that id" - with pytest.raises(ec2_vpc_vpn.VPNConnectionException, match=expected_message): - ec2_vpc_vpn.ensure_present(conn, m.params) - - -def test_delete_connection(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - _params, vpn, m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # delete it - changed, vpn = ec2_vpc_vpn.ensure_absent(conn, m.params) - - assert changed is True - assert vpn == {} - - -def test_delete_nonexistent_connection(placeboify, maybe_sleep): - # create parameters and ensure any connection matching (None) is deleted - params = {"filters": {"tags": {"ThisConnection": "DoesntExist"}}, "delay": 15, "wait_timeout": 600} - m, conn = setup_mod_conn(placeboify, params) - changed, vpn = ec2_vpc_vpn.ensure_absent(conn, m.params) - - assert changed is False - assert vpn == {} - - -def test_check_for_update_tags(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - _params, vpn, m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # add and remove a number of tags - m.params["tags"] = {"One": "one", "Two": "two"} - ec2_vpc_vpn.ensure_present(conn, m.params) - m.params["tags"] = {"Two": "two", "Three": "three", "Four": "four"} - changes = ec2_vpc_vpn.check_for_update(conn, m.params, vpn["VpnConnectionId"]) - - flat_dict_changes = boto3_tag_list_to_ansible_dict(changes["tags_to_add"]) - correct_changes = boto3_tag_list_to_ansible_dict( - [{"Key": "Three", "Value": "three"}, {"Key": "Four", "Value": "four"}] - ) - assert flat_dict_changes == correct_changes - assert changes["tags_to_remove"] == ["One"] - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_check_for_update_nonmodifiable_attr(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - params, vpn, m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - current_vgw = params["vpn_gateway_id"] - - # update a parameter that isn't modifiable - m.params.update(vpn_gateway_id="invalidchange") - - expected_message = f"You cannot modify vpn_gateway_id, the current value of which is {current_vgw}. Modifiable VPN connection attributes are" - with pytest.raises(ec2_vpc_vpn.VPNConnectionException, match=expected_message): - ec2_vpc_vpn.check_for_update(conn, m.params, vpn["VpnConnectionId"]) - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_add_tags(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - params, vpn, _m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # add a tag to the connection - ec2_vpc_vpn.add_tags(conn, vpn["VpnConnectionId"], add=[{"Key": "Ansible-Test", "Value": "VPN"}]) - - # assert tag is there - current_vpn = ec2_vpc_vpn.find_connection(conn, params) - assert current_vpn["Tags"] == [{"Key": "Ansible-Test", "Value": "VPN"}] - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_remove_tags(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - params, vpn, _m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # remove a tag from the connection - ec2_vpc_vpn.remove_tags(conn, vpn["VpnConnectionId"], remove=["Ansible-Test"]) - - # assert the tag is gone - current_vpn = ec2_vpc_vpn.find_connection(conn, params) - assert "Tags" not in current_vpn - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) - - -def test_add_routes(placeboify, maybe_sleep): - # setup dependencies for 1 vpn connection - dependencies = setup_req(placeboify, 1) - params, vpn, _m, conn = ( - dependencies["params"], - dependencies["vpn"], - dependencies["module"], - dependencies["connection"], - ) - - # create connection with a route - ec2_vpc_vpn.add_routes(conn, vpn["VpnConnectionId"], ["195.168.2.0/24", "196.168.2.0/24"]) - - # assert both routes are there - current_vpn = ec2_vpc_vpn.find_connection(conn, params) - assert set(each["DestinationCidrBlock"] for each in current_vpn["Routes"]) == set( - ["195.168.2.0/24", "196.168.2.0/24"] - ) - - # delete connection - tear_down_conn(placeboify, conn, vpn["VpnConnectionId"]) + # Call the function and check results + result = ec2_vpc_vpn.check_for_routes_update(client, ansible_module, vpn_connection_id) + assert result == expected_result From 290e89a836d585a52256f6c2e0b0783421c4efc9 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Wed, 16 Oct 2024 11:23:51 -0400 Subject: [PATCH 55/77] Prepare ec2_placement_group* module for promotion (#2167) SUMMARY This PR refactors ec2_placement_group*. Depends-On: ansible-collections/amazon.aws#2322 Refer: https://issues.redhat.com/browse/ACA-1886 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS Reviewed-by: Alina Buzachis --- .../refactor_ec2_placement_group.yml | 2 + plugins/modules/ec2_placement_group.py | 125 +++++++------- plugins/modules/ec2_placement_group_info.py | 45 +++-- .../ec2_placement_group/tasks/env_cleanup.yml | 34 ++-- .../ec2_placement_group/tasks/env_setup.yml | 16 +- .../ec2_placement_group/tasks/main.yml | 155 +++++++++--------- 6 files changed, 187 insertions(+), 190 deletions(-) create mode 100644 changelogs/fragments/refactor_ec2_placement_group.yml diff --git a/changelogs/fragments/refactor_ec2_placement_group.yml b/changelogs/fragments/refactor_ec2_placement_group.yml new file mode 100644 index 00000000000..c4366ed2c1f --- /dev/null +++ b/changelogs/fragments/refactor_ec2_placement_group.yml @@ -0,0 +1,2 @@ +minor_changes: + - ec2_placement_group - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2167). diff --git a/plugins/modules/ec2_placement_group.py b/plugins/modules/ec2_placement_group.py index b045ea34b25..1a38252ac97 100644 --- a/plugins/modules/ec2_placement_group.py +++ b/plugins/modules/ec2_placement_group.py @@ -25,8 +25,8 @@ partition_count: description: - The number of partitions. - - Valid only when I(Strategy) is set to C(partition). - - Must be a value between C(1) and C(7). + - Valid only when O(strategy) is set to V(partition). + - Must be a value between V(1) and V(7). type: int version_added: 3.1.0 state: @@ -86,23 +86,42 @@ placement_group: description: Placement group attributes returned: when state != absent - type: complex + type: dict contains: + group_arn: + description: Placement Group ARN. + type: str + returned: always + sample: "arn:aws:ec2:us-east-1:123456789012:placement-group" + group_id: + description: Placement Group Id. + type: str + returned: always + sample: "pg-123456789012" name: - description: PG name + description: Placement Group name. + type: str + returned: always + sample: "my-cluster" + partition_count: + description: Partition Count. type: str - sample: my-cluster + returned: If applicable + sample: "my-cluster" state: - description: PG state + description: Placement Groupt state. type: str + returned: If applicable sample: "available" strategy: - description: PG strategy + description: Placement Group strategy. type: str + returned: If applicable sample: "cluster" tags: - description: Tags associated with the placement group + description: Tags associated with the placement group. type: dict + returned: If applicable version_added: 8.1.0 sample: tags: @@ -110,59 +129,45 @@ other: value2 """ -try: - import botocore -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict + +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_ec2_placement_group +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_ec2_placement_group +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_placement_groups from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -@AWSRetry.exponential_backoff() -def search_placement_group(connection, module): +def search_placement_group(connection, name: str) -> Dict[str, Any]: """ Check if a placement group exists. """ - name = module.params.get("name") - try: - response = connection.describe_placement_groups(Filters=[{"Name": "group-name", "Values": [name]}]) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg=f"Couldn't find placement group named [{name}]") + response = describe_ec2_placement_groups(connection, Filters=[{"Name": "group-name", "Values": [name]}]) - if len(response["PlacementGroups"]) != 1: + if len(response) != 1: return None else: - placement_group = response["PlacementGroups"][0] - return { - "name": placement_group["GroupName"], - "state": placement_group["State"], - "strategy": placement_group["Strategy"], - "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), - } + return format_placement_group_information(response[0]) -@AWSRetry.exponential_backoff(catch_extra_error_codes=["InvalidPlacementGroup.Unknown"]) -def get_placement_group_information(connection, name): +def format_placement_group_information(response: Dict[str, Any]) -> Dict[str, Any]: """ - Retrieve information about a placement group. + Format placement group information """ - response = connection.describe_placement_groups(GroupNames=[name]) - placement_group = response["PlacementGroups"][0] - return { - "name": placement_group["GroupName"], - "state": placement_group["State"], - "strategy": placement_group["Strategy"], - "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), - } - - -@AWSRetry.exponential_backoff() -def create_placement_group(connection, module): + + response = camel_dict_to_snake_dict(response, ignore_list=["Tags"]) + if "tags" in response: + response["tags"] = boto3_tag_list_to_ansible_dict(response.get("tags", [])) + response["name"] = response["group_name"] + return response + + +def create_placement_group(connection, module: AnsibleAWSModule) -> None: name = module.params.get("name") strategy = module.params.get("strategy") tags = module.params.get("tags") @@ -178,38 +183,26 @@ def create_placement_group(connection, module): params["TagSpecifications"] = boto3_tag_specifications(tags, types=["placement-group"]) if partition_count: params["PartitionCount"] = partition_count - params["DryRun"] = module.check_mode - - try: - connection.create_placement_group(**params) - except is_boto3_error_code("DryRunOperation"): + if module.check_mode: module.exit_json( changed=True, placement_group={ "name": name, - "state": "DryRun", "strategy": strategy, "tags": tags, }, + msg="EC2 placement group would be created if not in check mode", ) - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg=f"Couldn't create placement group [{name}]") - module.exit_json(changed=True, placement_group=get_placement_group_information(connection, name)) + response = create_ec2_placement_group(connection, **params) + module.exit_json(changed=True, placement_group=format_placement_group_information(response)) -@AWSRetry.exponential_backoff() -def delete_placement_group(connection, module): +def delete_placement_group(connection, module: AnsibleAWSModule) -> None: + if module.check_mode: + module.exit_json(changed=True, msg="VPC would be deleted if not in check mode") name = module.params.get("name") - - try: - connection.delete_placement_group(GroupName=name, DryRun=module.check_mode) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg=f"Couldn't delete placement group [{name}]") - + delete_ec2_placement_group(connection, name) module.exit_json(changed=True) @@ -227,9 +220,10 @@ def main(): connection = module.client("ec2") state = module.params.get("state") + name = module.params.get("name") + placement_group = search_placement_group(connection, name) if state == "present": - placement_group = search_placement_group(connection, module) if placement_group is None: create_placement_group(connection, module) else: @@ -243,7 +237,6 @@ def main(): ) elif state == "absent": - placement_group = search_placement_group(connection, module) if placement_group is None: module.exit_json(changed=False) else: diff --git a/plugins/modules/ec2_placement_group_info.py b/plugins/modules/ec2_placement_group_info.py index 74b32558246..8c67e2b5fa4 100644 --- a/plugins/modules/ec2_placement_group_info.py +++ b/plugins/modules/ec2_placement_group_info.py @@ -58,7 +58,7 @@ name: description: PG name type: str - sample: my-cluster + sample: "my-cluster" state: description: PG state type: str @@ -77,36 +77,28 @@ other: value2 """ -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass # caught by AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import List +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_placement_groups +from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - -def get_placement_groups_details(connection, module): - names = module.params.get("names") - try: - if len(names) > 0: - response = connection.describe_placement_groups( - Filters=[ - { - "Name": "group-name", - "Values": names, - } - ] - ) - else: - response = connection.describe_placement_groups() - except (BotoCoreError, ClientError) as e: - module.fail_json_aws(e, msg=f"Couldn't find placement groups named [{names}]") +def get_placement_groups_details(connection, names: List) -> Dict[str, Any]: + params = {} + if len(names) > 0: + params["Filters"] = [ + { + "Name": "group-name", + "Values": names, + } + ] + response = describe_ec2_placement_groups(connection, **params) results = [] - for placement_group in response["PlacementGroups"]: + for placement_group in response: results.append( { "name": placement_group["GroupName"], @@ -129,8 +121,9 @@ def main(): ) connection = module.client("ec2") + names = module.params.get("names") - placement_groups = get_placement_groups_details(connection, module) + placement_groups = get_placement_groups_details(connection, names) module.exit_json(changed=False, placement_groups=placement_groups) diff --git a/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml b/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml index ce626b69c3d..be84fe8f17a 100644 --- a/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml +++ b/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml @@ -1,5 +1,5 @@ -- name: remove any instances in the test VPC - ec2_instance: +- name: Remove any instances in the test VPC + amazon.aws.ec2_instance: filters: vpc_id: "{{ testing_vpc.vpc.id }}" state: absent @@ -9,13 +9,13 @@ retries: 10 - name: Get ENIs - ec2_eni_info: + amazon.aws.ec2_eni_info: filters: vpc-id: "{{ testing_vpc.vpc.id }}" register: enis -- name: delete all ENIs - ec2_eni: +- name: Delete all ENIs + amazon.aws.ec2_eni: eni_id: "{{ item.id }}" state: absent until: removed is not failed @@ -23,8 +23,8 @@ ignore_errors: yes retries: 10 -- name: remove the security group - ec2_security_group: +- name: Remove the security group + amazon.aws.ec2_security_group: name: "{{ resource_prefix }}-sg" description: a security group for ansible tests vpc_id: "{{ testing_vpc.vpc.id }}" @@ -34,8 +34,8 @@ ignore_errors: yes retries: 10 -- name: remove routing rules - ec2_vpc_route_table: +- name: Remove routing rules + amazon.aws.ec2_vpc_route_table: state: absent vpc_id: "{{ testing_vpc.vpc.id }}" tags: @@ -51,8 +51,8 @@ ignore_errors: yes retries: 10 -- name: remove internet gateway - ec2_vpc_igw: +- name: Remove internet gateway + amazon.aws.ec2_vpc_igw: vpc_id: "{{ testing_vpc.vpc.id }}" state: absent register: removed @@ -60,8 +60,8 @@ ignore_errors: yes retries: 10 -- name: remove subnet A - ec2_vpc_subnet: +- name: Remove subnet A + amazon.aws.ec2_vpc_subnet: state: absent vpc_id: "{{ testing_vpc.vpc.id }}" cidr: 10.22.32.0/24 @@ -70,8 +70,8 @@ ignore_errors: yes retries: 10 -- name: remove subnet B - ec2_vpc_subnet: +- name: Remove subnet B + amazon.aws.ec2_vpc_subnet: state: absent vpc_id: "{{ testing_vpc.vpc.id }}" cidr: 10.22.33.0/24 @@ -80,8 +80,8 @@ ignore_errors: yes retries: 10 -- name: remove the VPC - ec2_vpc_net: +- name: Remove the VPC + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" cidr_block: 10.22.32.0/23 state: absent diff --git a/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml b/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml index d48bae66c83..54fa62a35db 100644 --- a/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml +++ b/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml @@ -1,5 +1,5 @@ - name: Create VPC for use in testing - ec2_vpc_net: + amazon.aws.ec2_vpc_net: name: "{{ resource_prefix }}-vpc" cidr_block: 10.22.32.0/23 tags: @@ -8,7 +8,7 @@ register: testing_vpc - name: Create internet gateway for use in testing - ec2_vpc_igw: + amazon.aws.ec2_vpc_igw: vpc_id: "{{ testing_vpc.vpc.id }}" state: present tags: @@ -16,7 +16,7 @@ register: igw - name: Create default subnet in zone A - ec2_vpc_subnet: + amazon.aws.ec2_vpc_subnet: state: present vpc_id: "{{ testing_vpc.vpc.id }}" cidr: 10.22.32.0/24 @@ -26,7 +26,7 @@ register: testing_subnet_a - name: Create secondary subnet in zone B - ec2_vpc_subnet: + amazon.aws.ec2_vpc_subnet: state: present vpc_id: "{{ testing_vpc.vpc.id }}" cidr: 10.22.33.0/24 @@ -35,8 +35,8 @@ Name: "{{ resource_prefix }}-subnet-b" register: testing_subnet_b -- name: create routing rules - ec2_vpc_route_table: +- name: Create routing rules + amazon.aws.ec2_vpc_route_table: vpc_id: "{{ testing_vpc.vpc.id }}" tags: created: "{{ resource_prefix }}-route" @@ -47,8 +47,8 @@ - "{{ testing_subnet_a.subnet.id }}" - "{{ testing_subnet_b.subnet.id }}" -- name: create a security group with the vpc - ec2_security_group: +- name: Create a security group with the vpc + amazon.aws.ec2_security_group: name: "{{ resource_prefix }}-sg" description: a security group for ansible tests vpc_id: "{{ testing_vpc.vpc.id }}" diff --git a/tests/integration/targets/ec2_placement_group/tasks/main.yml b/tests/integration/targets/ec2_placement_group/tasks/main.yml index eec1b168ef0..130f347db97 100644 --- a/tests/integration/targets/ec2_placement_group/tasks/main.yml +++ b/tests/integration/targets/ec2_placement_group/tasks/main.yml @@ -12,7 +12,7 @@ block: - - name: set up environment for testing. + - name: Set up environment for testing. include_tasks: env_setup.yml - name: Create a placement group 1 - check_mode @@ -22,12 +22,11 @@ check_mode: true register: pg_1_create_check_mode - - assert: + - name: Assert that placement group data is returned (check mode) + ansible.builtin.assert: that: - pg_1_create_check_mode is changed - pg_1_create_check_mode.placement_group.name == resource_prefix ~ '-pg1' - - pg_1_create_check_mode.placement_group.state == "DryRun" - - '"ec2:CreatePlacementGroup" in pg_1_create_check_mode.resource_actions' - name: Create a placement group 1 community.aws.ec2_placement_group: @@ -35,10 +34,11 @@ state: present register: pg_1_create - - set_fact: + - ansible.builtin.set_fact: placement_group_names: "{{ placement_group_names + [pg_1_create.placement_group.name] }}" - - assert: + - name: Assert that placement group is created + ansible.builtin.assert: that: - pg_1_create is changed - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' @@ -51,7 +51,8 @@ - '{{ resource_prefix }}-pg1' register: pg_1_info_result - - assert: + - name: Assert that placement group is created + ansible.builtin.assert: that: - pg_1_info_result is not changed - pg_1_info_result.placement_groups[0].name == resource_prefix ~ '-pg1' @@ -65,7 +66,8 @@ state: present register: pg_1_create - - assert: + - name: Assert that placement group is not created (idempotent) + ansible.builtin.assert: that: - pg_1_create is not changed - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' @@ -79,12 +81,12 @@ check_mode: true register: pg_1_create_check_mode_idem - - assert: + - name: Assert that placement group is not created (idempotent - check_mode) + ansible.builtin.assert: that: - pg_1_create_check_mode_idem is not changed - pg_1_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg1' - pg_1_create_check_mode_idem.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_1_create_check_mode_idem.resource_actions' - name: Create a placement group 2 - check_mode community.aws.ec2_placement_group: @@ -94,12 +96,11 @@ check_mode: true register: pg_2_create_check_mode - - assert: + - name: Assert that placement group is created + ansible.builtin.assert: that: - pg_2_create_check_mode is changed - pg_2_create_check_mode.placement_group.name == resource_prefix ~ '-pg2' - - pg_2_create_check_mode.placement_group.state == "DryRun" - - '"ec2:CreatePlacementGroup" in pg_2_create_check_mode.resource_actions' - name: Create a placement group 2 with spread strategy community.aws.ec2_placement_group: @@ -108,14 +109,15 @@ strategy: spread register: pg_2_create - - assert: + - name: Assert that placement group is created + ansible.builtin.assert: that: - pg_2_create is changed - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" in pg_2_create.resource_actions' - - set_fact: + - ansible.builtin.set_fact: placement_group_names: "{{ placement_group_names + [pg_2_create.placement_group.name] }}" - name: Gather information about placement group 2 @@ -124,7 +126,8 @@ - '{{ resource_prefix }}-pg2' register: pg_2_info_result - - assert: + - name: Assert that placement group is created + ansible.builtin.assert: that: - pg_2_info_result is not changed - pg_2_info_result.placement_groups[0].name == resource_prefix ~ '-pg2' @@ -139,7 +142,8 @@ strategy: spread register: pg_2_create - - assert: + - name: Assert that placement group exists (idempotent) + ansible.builtin.assert: that: - pg_2_create is not changed - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' @@ -154,12 +158,12 @@ check_mode: true register: pg_2_create_check_mode_idem - - assert: + - name: Assert that placement group exists (idempotent - check_mode) + ansible.builtin.assert: that: - pg_2_create_check_mode_idem is not changed - pg_2_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg2' - pg_2_create_check_mode_idem.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_2_create_check_mode_idem.resource_actions' - name: Create a placement group 3 - check_mode community.aws.ec2_placement_group: @@ -170,12 +174,11 @@ check_mode: true register: pg_3_create_check_mode - - assert: + - name: Assert that placement group exists + ansible.builtin.assert: that: - pg_3_create_check_mode is changed - pg_3_create_check_mode.placement_group.name == resource_prefix ~ '-pg3' - - pg_3_create_check_mode.placement_group.state == "DryRun" - - '"ec2:CreatePlacementGroup" in pg_3_create_check_mode.resource_actions' - name: Create a placement group 3 with Partition strategy community.aws.ec2_placement_group: @@ -185,14 +188,15 @@ partition_count: 4 register: pg_3_create - - assert: + - name: Assert that placement group exists + ansible.builtin.assert: that: - pg_3_create is changed - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create.placement_group.state == "available" - '"ec2:CreatePlacementGroup" in pg_3_create.resource_actions' - - set_fact: + - ansible.builtin.set_fact: placement_group_names: "{{ placement_group_names + [pg_3_create.placement_group.name] }}" @@ -202,7 +206,8 @@ - '{{ resource_prefix }}-pg3' register: pg_3_info_result - - assert: + - name: Assert that placement group exists + ansible.builtin.assert: that: - pg_3_info_result is not changed - pg_3_info_result.placement_groups[0].name == resource_prefix ~ '-pg3' @@ -218,7 +223,8 @@ partition_count: 4 register: pg_3_create - - assert: + - name: Assert that placement group exists (idempotent) + ansible.builtin.assert: that: - pg_3_create is not changed - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' @@ -234,12 +240,12 @@ check_mode: true register: pg_3_create_check_mode_idem - - assert: + - name: Assert that placement group exists (idempotent - check_mode) + ansible.builtin.assert: that: - pg_3_create_check_mode_idem is not changed - pg_3_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg3' - pg_3_create_check_mode_idem.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_3_create_check_mode_idem.resource_actions' - name: Create a placement group 4 with tags - check_mode community.aws.ec2_placement_group: @@ -252,14 +258,13 @@ check_mode: true register: pg_4_create_check_mode - - assert: + - name: Assert that placement group exists (check-mode) + ansible.builtin.assert: that: - pg_4_create_check_mode is changed - pg_4_create_check_mode.placement_group.name == resource_prefix ~ '-pg4' - - pg_4_create_check_mode.placement_group.state == "DryRun" - pg_4_create_check_mode.placement_group.tags.foo == "test1" - pg_4_create_check_mode.placement_group.tags.bar == "test2" - - '"ec2:CreatePlacementGroup" in pg_4_create_check_mode.resource_actions' - name: Create a placement group 4 with tags community.aws.ec2_placement_group: @@ -271,7 +276,8 @@ bar: test2 register: pg_4_create - - assert: + - name: Assert that placement group exists + ansible.builtin.assert: that: - pg_4_create is changed - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' @@ -280,7 +286,7 @@ - pg_4_create.placement_group.tags.bar == "test2" - '"ec2:CreatePlacementGroup" in pg_4_create.resource_actions' - - set_fact: + - ansible.builtin.set_fact: placement_group_names: "{{ placement_group_names + [pg_4_create.placement_group.name] }}" - name: Gather information about placement group 4 @@ -289,7 +295,8 @@ - '{{ resource_prefix }}-pg4' register: pg_4_info_result - - assert: + - name: Assert that placement group exists + ansible.builtin.assert: that: - pg_4_info_result is not changed - pg_4_info_result.placement_groups[0].name == resource_prefix ~ '-pg4' @@ -309,7 +316,8 @@ bar: test2 register: pg_4_create - - assert: + - name: Assert that placement group exists (idempotent) + ansible.builtin.assert: that: - pg_4_create is not changed - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' @@ -330,7 +338,8 @@ check_mode: true register: pg_4_create_check_mode_idem - - assert: + - name: Assert that placement group exists (idempotent - check-mode) + ansible.builtin.assert: that: - pg_4_create_check_mode_idem is not changed - pg_4_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg4' @@ -338,7 +347,6 @@ - pg_4_create_check_mode_idem.placement_group.strategy == "cluster" - pg_4_create_check_mode_idem.placement_group.tags.foo == "test1" - pg_4_create_check_mode_idem.placement_group.tags.bar == "test2" - - '"ec2:CreatePlacementGroup" not in pg_4_create_check_mode_idem.resource_actions' - name: List all placement groups. community.aws.ec2_placement_group_info: @@ -346,9 +354,6 @@ # Delete Placement Group ========================================== - # On using check_mode for delete placement group operation - # If operation would have succeeded, the error response is DryRunOperation. - # Otherwise, it is UnauthorizedOperation . - name: Delete a placement group 1 - check_mode community.aws.ec2_placement_group: name: '{{ resource_prefix }}-pg1' @@ -357,11 +362,10 @@ register: pg_1_delete_check_mode ignore_errors: true - - assert: + - name: Assert check mode (check mode) + ansible.builtin.assert: that: - - pg_1_delete_check_mode is not changed - - pg_1_delete_check_mode.error.code == 'DryRunOperation' - - '"ec2:DeletePlacementGroup" in pg_1_delete_check_mode.resource_actions' + - pg_1_delete_check_mode is changed - name: Delete a placement group 1 community.aws.ec2_placement_group: @@ -369,7 +373,8 @@ state: absent register: pg_1_delete - - assert: + - name: Assert that deletion is successful + ansible.builtin.assert: that: - pg_1_delete is changed - '"ec2:DeletePlacementGroup" in pg_1_delete.resource_actions' @@ -380,7 +385,8 @@ state: absent register: pg_1_delete - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_1_delete is not changed - '"ec2:DeletePlacementGroup" not in pg_1_delete.resource_actions' @@ -393,10 +399,10 @@ register: pg_1_delete_check_mode_idem ignore_errors: true - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_1_delete_check_mode_idem is not changed - - '"ec2:DeletePlacementGroup" not in pg_1_delete_check_mode_idem.resource_actions' - name: Delete a placement group 2 - check_mode community.aws.ec2_placement_group: @@ -406,11 +412,10 @@ register: pg_2_delete_check_mode ignore_errors: true - - assert: + - name: Assert that check mode is successful + ansible.builtin.assert: that: - - pg_2_delete_check_mode is not changed - - pg_2_delete_check_mode.error.code == 'DryRunOperation' - - '"ec2:DeletePlacementGroup" in pg_2_delete_check_mode.resource_actions' + - pg_2_delete_check_mode is changed - name: Delete a placement group 2 community.aws.ec2_placement_group: @@ -418,7 +423,8 @@ state: absent register: pg_2_delete - - assert: + - name: Assert that there is change + ansible.builtin.assert: that: - pg_2_delete is changed - '"ec2:DeletePlacementGroup" in pg_2_delete.resource_actions' @@ -429,7 +435,8 @@ state: absent register: pg_2_delete - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_2_delete is not changed - '"ec2:DeletePlacementGroup" not in pg_2_delete.resource_actions' @@ -442,10 +449,10 @@ register: pg_2_delete_check_mode_idem ignore_errors: true - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_2_delete_check_mode_idem is not changed - - '"ec2:DeletePlacementGroup" not in pg_2_delete_check_mode_idem.resource_actions' - name: Delete a placement group 3 - check_mode community.aws.ec2_placement_group: @@ -455,11 +462,10 @@ register: pg_3_delete_check_mode ignore_errors: true - - assert: + - name: Assert that there is change - check mode + ansible.builtin.assert: that: - - pg_3_delete_check_mode is not changed - - pg_3_delete_check_mode.error.code == 'DryRunOperation' - - '"ec2:DeletePlacementGroup" in pg_3_delete_check_mode.resource_actions' + - pg_3_delete_check_mode is changed - name: Delete a placement group 3 community.aws.ec2_placement_group: @@ -467,7 +473,8 @@ state: absent register: pg_3_delete - - assert: + - name: Assert that there is change + ansible.builtin.assert: that: - pg_3_delete is changed - '"ec2:DeletePlacementGroup" in pg_3_delete.resource_actions' @@ -477,8 +484,9 @@ name: '{{ resource_prefix }}-pg3' state: absent register: pg_3_delete - - - assert: + + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_3_delete is not changed - '"ec2:DeletePlacementGroup" not in pg_3_delete.resource_actions' @@ -491,10 +499,10 @@ register: pg_3_delete_check_mode_idem ignore_errors: true - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_3_delete_check_mode_idem is not changed - - '"ec2:DeletePlacementGroup" not in pg_3_delete_check_mode_idem.resource_actions' - name: Delete a placement group 4 - check_mode community.aws.ec2_placement_group: @@ -504,11 +512,10 @@ register: pg_4_delete_check_mode ignore_errors: true - - assert: + - name: Assert that there is change check mode + ansible.builtin.assert: that: - - pg_4_delete_check_mode is not changed - - pg_4_delete_check_mode.error.code == 'DryRunOperation' - - '"ec2:DeletePlacementGroup" in pg_4_delete_check_mode.resource_actions' + - pg_4_delete_check_mode is changed - name: Delete a placement group 4 @@ -517,7 +524,8 @@ state: absent register: pg_4_delete - - assert: + - name: Assert that there is change + ansible.builtin.assert: that: - pg_4_delete is changed - '"ec2:DeletePlacementGroup" in pg_4_delete.resource_actions' @@ -528,7 +536,8 @@ state: absent register: pg_4_delete - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_4_delete is not changed - '"ec2:DeletePlacementGroup" not in pg_4_delete.resource_actions' @@ -541,10 +550,10 @@ register: pg_4_delete_check_mode_idem ignore_errors: true - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - pg_4_delete_check_mode_idem is not changed - - '"ec2:DeletePlacementGroup" not in pg_4_delete_check_mode_idem.resource_actions' always: From 7dabfccc73b77239b95de01069890f3ee7bf95f0 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 18 Oct 2024 06:05:47 -0400 Subject: [PATCH 56/77] ec2_transit_gateway_vpc_attachment - Prepare module for migration to amazon.aws (#2157) SUMMARY Refer: https://issues.redhat.com/browse/ACA-1868 This PR refactors and adds necessary documentation to ec2_transit_gateway_vpc_attachment and ec2_transit_gateway_vpc_attachment_info ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin --- ...20240924-fix-documentation-tgw-vpc-att.yml | 2 + plugins/module_utils/transitgateway.py | 718 +++++++++++------- .../ec2_transit_gateway_vpc_attachment.py | 257 +++---- ...ec2_transit_gateway_vpc_attachment_info.py | 122 +-- .../tasks/cleanup.yml | 44 +- .../tasks/complex.yml | 112 +-- .../tasks/setup.yml | 20 +- .../tasks/simple.yml | 655 +++++++++------- 8 files changed, 1094 insertions(+), 836 deletions(-) create mode 100644 changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml diff --git a/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml b/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml new file mode 100644 index 00000000000..0fa478776bb --- /dev/null +++ b/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml @@ -0,0 +1,2 @@ +minor_changes: + - ec2_transit_gateway_vpc_attachment - Modify doumentation and refactor to adhere to coding guidelines (https://github.com/ansible-collections/community.aws/pull/2157). diff --git a/plugins/module_utils/transitgateway.py b/plugins/module_utils/transitgateway.py index 8a82a839ff1..a3454931205 100644 --- a/plugins/module_utils/transitgateway.py +++ b/plugins/module_utils/transitgateway.py @@ -5,221 +5,234 @@ from copy import deepcopy -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +try: + from botocore.exceptions import BotoCoreError + from botocore.exceptions import ClientError +except ImportError: + pass + +from typing import Any +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple + +from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict + +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_transit_gateway_vpc_attachment +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_transit_gateway_vpc_attachment +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_subnets +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_transit_gateway_vpc_attachments +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import modify_transit_gateway_vpc_attachment +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list +from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict +from ansible_collections.amazon.aws.plugins.module_utils.waiters import get_waiter + +from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule + + +def get_states() -> List[str]: + return [ + "available", + "deleting", + "failed", + "failing", + "initiatingRequest", + "modifying", + "pendingAcceptance", + "pending", + "rollingBack", + "rejected", + "rejecting", + ] + + +def subnets_to_vpc( + client, module: AnsibleAWSModule, subnets: List[str], subnet_details: Optional[List[Dict[str, Any]]] = None +) -> Optional[str]: + if not subnets: + return None + + if subnet_details is None: + try: + subnet_details = describe_subnets(client, SubnetIds=list(subnets)) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) + + vpcs = [s.get("VpcId") for s in subnet_details] + if len(set(vpcs)) > 1: + module.fail_json( + msg="Attachment subnets may only be in one VPC, multiple VPCs found", + vpcs=list(set(vpcs)), + subnets=subnet_details, + ) + + return vpcs[0] + + +def find_existing_attachment( + client, module: AnsibleAWSModule, filters: Optional[Dict[str, Any]] = None, attachment_id: Optional[str] = None +) -> Optional[Dict[str, Any]]: + """Find an existing transit gateway attachment based on filters or attachment ID. + + Args: + client: The AWS client used to interact with the EC2 service. + module: The Ansible module instance used for error handling. + filters (Optional[Dict[str, Any]]): A dictionary of filters to apply when searching for attachments. + attachment_id (Optional[str]): The ID of a specific attachment to find. + + Returns: + Optional[Dict[str, Any]]: The found attachment details or None if not found. -from ansible_collections.community.aws.plugins.module_utils.ec2 import BaseEc2Manager -from ansible_collections.community.aws.plugins.module_utils.ec2 import Boto3Mixin -from ansible_collections.community.aws.plugins.module_utils.ec2 import Ec2WaiterFactory + Raises: + ValueError: If multiple attachments match the criteria. + """ + # Find an existing attachment based on filters + params = {} + if attachment_id: + params["TransitGatewayAttachmentIds"] = [attachment_id] + elif filters: + params["Filters"] = ansible_dict_to_boto3_filter_list(filters) + + try: + attachments = describe_transit_gateway_vpc_attachments(client, **params) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) + + if len(attachments) > 1: + raise ValueError("Multiple matching attachments found, provide an ID.") + + return attachments[0] if attachments else None + + +class TransitGatewayAttachmentStateManager: + def __init__(self, client, module: AnsibleAWSModule, attachment_id: str) -> None: + self.client = client + self.module = module + self.attachment_id = attachment_id -class TgwWaiterFactory(Ec2WaiterFactory): @property - def _waiter_model_data(self): - data = super(TgwWaiterFactory, self)._waiter_model_data - # split the TGW waiters so we can keep them close to everything else. - tgw_data = dict( - tgw_attachment_available=dict( - operation="DescribeTransitGatewayAttachments", - delay=5, - maxAttempts=120, - acceptors=[ - dict( - state="success", - matcher="pathAll", - expected="available", - argument="TransitGatewayAttachments[].State", - ), - ], - ), - tgw_attachment_deleted=dict( - operation="DescribeTransitGatewayAttachments", - delay=5, - maxAttempts=120, - acceptors=[ - dict( - state="retry", - matcher="pathAll", - expected="deleting", - argument="TransitGatewayAttachments[].State", - ), - dict( - state="success", - matcher="pathAll", - expected="deleted", - argument="TransitGatewayAttachments[].State", - ), - dict( - state="success", - matcher="path", - expected=True, - argument="length(TransitGatewayAttachments[]) == `0`", - ), - dict(state="success", matcher="error", expected="InvalidRouteTableID.NotFound"), - ], - ), - ) - data.update(tgw_data) - return data - - -class TGWAttachmentBoto3Mixin(Boto3Mixin): - def __init__(self, module, **kwargs): - self.tgw_waiter_factory = TgwWaiterFactory(module) - super(TGWAttachmentBoto3Mixin, self).__init__(module, **kwargs) - - # Paginators can't be (easily) wrapped, so we wrap this method with the - # retry - retries the full fetch, but better than simply giving up. - @AWSRetry.jittered_backoff() - def _paginated_describe_transit_gateway_vpc_attachments(self, **params): - paginator = self.client.get_paginator("describe_transit_gateway_vpc_attachments") - return paginator.paginate(**params).build_full_result() - - @Boto3Mixin.aws_error_handler("describe transit gateway attachments") - def _describe_vpc_attachments(self, **params): - result = self._paginated_describe_transit_gateway_vpc_attachments(**params) - return result.get("TransitGatewayVpcAttachments", None) - - @Boto3Mixin.aws_error_handler("create transit gateway attachment") - def _create_vpc_attachment(self, **params): - result = self.client.create_transit_gateway_vpc_attachment(aws_retry=True, **params) - return result.get("TransitGatewayVpcAttachment", None) - - @Boto3Mixin.aws_error_handler("modify transit gateway attachment") - def _modify_vpc_attachment(self, **params): - result = self.client.modify_transit_gateway_vpc_attachment(aws_retry=True, **params) - return result.get("TransitGatewayVpcAttachment", None) - - @Boto3Mixin.aws_error_handler("delete transit gateway attachment") - def _delete_vpc_attachment(self, **params): - try: - result = self.client.delete_transit_gateway_vpc_attachment(aws_retry=True, **params) - except is_boto3_error_code("ResourceNotFoundException"): - return None - return result.get("TransitGatewayVpcAttachment", None) + def waiter_config(self) -> Dict[str, Any]: + params: Dict[str, Any] = {} - @Boto3Mixin.aws_error_handler("transit gateway attachment to finish deleting") - def _wait_tgw_attachment_deleted(self, **params): - waiter = self.tgw_waiter_factory.get_waiter("tgw_attachment_deleted") - waiter.wait(**params) + delay = min(5, self.module.params.get("wait_timeout")) + max_attempts = self.module.params.get("wait_timeout") // delay + config = dict(Delay=delay, MaxAttempts=max_attempts) + params["WaiterConfig"] = config - @Boto3Mixin.aws_error_handler("transit gateway attachment to become available") - def _wait_tgw_attachment_available(self, **params): - waiter = self.tgw_waiter_factory.get_waiter("tgw_attachment_available") - waiter.wait(**params) + return params - def _normalize_tgw_attachment(self, rtb): - return self._normalize_boto3_resource(rtb) + def create_attachment(self, params: Dict[str, Any]) -> str: + """ + Create a new transit gateway attachment. - def _get_tgw_vpc_attachment(self, **params): - # Only for use with a single attachment, use _describe_vpc_attachments for - # multiple tables. - attachments = self._describe_vpc_attachments(**params) + Args: + params (Dict[str, Any]): A dictionary containing the parameters needed to + create the transit gateway attachment. - if not attachments: - return None + Returns: + str: The ID of the newly created transit gateway attachment. - attachment = attachments[0] - return attachment + Raises: + AnsibleEC2Error: If there is an error while creating the VPC attachment, + it will fail the module and provide an error message. + """ + try: + tags = params.pop("Tags") + except KeyError: + tags = None + if tags: + params["TagSpecifications"] = boto3_tag_specifications(tags, types=["transit-gateway-attachment"]) -class BaseTGWManager(BaseEc2Manager): - @Boto3Mixin.aws_error_handler("connect to AWS") - def _create_client(self, client_name="ec2"): - if client_name == "ec2": - error_codes = ["IncorrectState"] - else: - error_codes = [] + try: + response = create_transit_gateway_vpc_attachment(self.client, **params) + except AnsibleEC2Error as e: + self.module.fail_json_aws_error(e) - retry_decorator = AWSRetry.jittered_backoff( - catch_extra_error_codes=error_codes, - ) - client = self.module.client(client_name, retry_decorator=retry_decorator) - return client - - -class TransitGatewayVpcAttachmentManager(TGWAttachmentBoto3Mixin, BaseTGWManager): - TAG_RESOURCE_TYPE = "transit-gateway-attachment" - - def __init__(self, module, id=None): - self._subnet_updates = dict() - super(TransitGatewayVpcAttachmentManager, self).__init__(module=module, id=id) - - def _get_id_params(self, id=None, id_list=False): - if not id: - id = self.resource_id - if not id: - # Users should never see this, but let's cover ourself - self.module.fail_json(msg="Attachment identifier parameter missing") - - if id_list: - return dict(TransitGatewayAttachmentIds=[id]) - return dict(TransitGatewayAttachmentId=id) - - def _extra_error_output(self): - output = super(TransitGatewayVpcAttachmentManager, self)._extra_error_output() - if self.resource_id: - output["TransitGatewayAttachmentId"] = self.resource_id - return output - - def _filter_immutable_resource_attributes(self, resource): - resource = super(TransitGatewayVpcAttachmentManager, self)._filter_immutable_resource_attributes(resource) - resource.pop("TransitGatewayId", None) - resource.pop("VpcId", None) - resource.pop("VpcOwnerId", None) - resource.pop("State", None) - resource.pop("SubnetIds", None) - resource.pop("CreationTime", None) - resource.pop("Tags", None) - return resource + self.attachment_id = response["TransitGatewayAttachmentId"] - def _set_option(self, name, value): - if value is None: + return response["TransitGatewayAttachmentId"] + + def delete_attachment(self) -> bool: + # Delete the transit gateway attachment + + if not self.attachment_id: return False - # For now VPC Attachment options are all enable/disable - if value: - value = "enable" - else: - value = "disable" - options = deepcopy(self._preupdate_resource.get("Options", dict())) - options.update(self._resource_updates.get("Options", dict())) - options[name] = value + if not self.module.check_mode: + try: + delete_transit_gateway_vpc_attachment(self.client, self.attachment_id) + except AnsibleEC2Error as e: + self.module.fail_json_aws_error(e) - return self._set_resource_value("Options", options) + return True - def set_dns_support(self, value): - return self._set_option("DnsSupport", value) + def wait_for_state_change(self, desired_state: str) -> None: + # Wait until attachment reaches the desired state + params = {"TransitGatewayAttachmentIds": [self.attachment_id]} + params.update(self.waiter_config) + try: + waiter = get_waiter(self.client, f"transit_gateway_vpc_attachment_{desired_state}") + waiter.wait(**params) + except (BotoCoreError, ClientError) as e: + self.module.fail_json_aws_error(e) - def set_multicast_support(self, value): - return self._set_option("MulticastSupport", value) - def set_ipv6_support(self, value): - return self._set_option("Ipv6Support", value) +class AttachmentConfigurationManager: + def __init__(self, client, module: AnsibleAWSModule, attachment_id: str, existing: Dict[str, Any]) -> None: + self.client = client + self.module = module + self.attachment_id = attachment_id - def set_appliance_mode_support(self, value): - return self._set_option("ApplianceModeSupport", value) + self.existing = existing or {} + self._resource_updates = {} + self._subnets_to_add = [] + self._subnets_to_remove = [] - def set_transit_gateway(self, tgw_id): - return self._set_resource_value("TransitGatewayId", tgw_id) + @property + def resource_updates(self) -> Dict[str, Any]: + return self._resource_updates - def set_vpc(self, vpc_id): - return self._set_resource_value("VpcId", vpc_id) + @property + def subnets_to_add(self) -> List[str]: + return self._subnets_to_add - def set_subnets(self, subnets=None, purge=True): + @property + def subnets_to_remove(self) -> List[str]: + return self._subnets_to_remove + + def set_subnets(self, subnets: Optional[List[str]] = None, purge: bool = True) -> None: + """ + Set or update the subnets associated with the transit gateway attachment. + + Args: + subnets (Optional[List[str]]): A list of subnet IDs to associate with + the attachment. + purge (bool): If True, the existing subnets will be replaced with the + specified subnets. + """ + # Set or update the subnets associated with the attachment if subnets is None: - return False + return - current_subnets = set(self._preupdate_resource.get("SubnetIds", [])) + current_subnets = set(self.existing.get("SubnetIds", [])) desired_subnets = set(subnets) if not purge: desired_subnets = desired_subnets.union(current_subnets) # We'll pull the VPC ID from the subnets, no point asking for # information we 'know'. - subnet_details = self._describe_subnets(SubnetIds=list(desired_subnets)) - vpc_id = self.subnets_to_vpc(desired_subnets, subnet_details) + try: + subnet_details = describe_subnets(self.client, SubnetIds=list(desired_subnets)) + except AnsibleEC2Error as e: + self.module.fail_json_aws_error(e) + vpc_id = subnets_to_vpc(self.client, self.module, desired_subnets, subnet_details) self._set_resource_value("VpcId", vpc_id, immutable=True) # Only one subnet per-AZ is permitted @@ -231,138 +244,269 @@ def set_subnets(self, subnets=None, purge=True): subnets=subnet_details, ) - subnets_to_add = list(desired_subnets.difference(current_subnets)) - subnets_to_remove = list(current_subnets.difference(desired_subnets)) - if not subnets_to_remove and not subnets_to_add: - return False - self._subnet_updates = dict(add=subnets_to_add, remove=subnets_to_remove) + self._subnets_to_add = list(desired_subnets.difference(current_subnets)) + self._subnets_to_remove = list(current_subnets.difference(desired_subnets)) self._set_resource_value("SubnetIds", list(desired_subnets)) - return True - def subnets_to_vpc(self, subnets, subnet_details=None): - if not subnets: - return None + def set_dns_support(self, value): + return self._set_option("DnsSupport", value) - if subnet_details is None: - subnet_details = self._describe_subnets(SubnetIds=list(subnets)) + def set_ipv6_support(self, value): + return self._set_option("Ipv6Support", value) - vpcs = [s.get("VpcId") for s in subnet_details] - if len(set(vpcs)) > 1: - self.module.fail_json( - msg="Attachment subnets may only be in one VPC, multiple VPCs found", - vpcs=list(set(vpcs)), - subnets=subnet_details, - ) + def set_appliance_mode_support(self, value): + return self._set_option("ApplianceModeSupport", value) - return vpcs[0] - - def _do_deletion_wait(self, id=None, **params): - all_params = self._get_id_params(id=id, id_list=True) - all_params.update(**params) - return self._wait_tgw_attachment_deleted(**all_params) - - def _do_creation_wait(self, id=None, **params): - all_params = self._get_id_params(id=id, id_list=True) - all_params.update(**params) - return self._wait_tgw_attachment_available(**all_params) - - def _do_update_wait(self, id=None, **params): - all_params = self._get_id_params(id=id, id_list=True) - all_params.update(**params) - return self._wait_tgw_attachment_available(**all_params) - - def _do_create_resource(self): - params = self._merge_resource_changes(filter_immutable=False, creation=True) - response = self._create_vpc_attachment(**params) - if response: - self.resource_id = response.get("TransitGatewayAttachmentId", None) - return response - - def _do_update_resource(self): - if self._preupdate_resource.get("State", None) == "pending": - # Resources generally don't like it if you try to update before creation - # is complete. If things are in a 'pending' state they'll often throw - # exceptions. - self._wait_for_creation() - elif self._preupdate_resource.get("State", None) == "deleting": - self.module.fail_json(msg="Deletion in progress, unable to update", route_tables=[self.original_resource]) + def set_transit_gateway(self, tgw_id: str): + return self._set_resource_value("TransitGatewayId", tgw_id) - updates = self._filter_immutable_resource_attributes(self._resource_updates) - subnets_to_add = self._subnet_updates.get("add", []) - subnets_to_remove = self._subnet_updates.get("remove", []) - if subnets_to_add: - updates["AddSubnetIds"] = subnets_to_add - if subnets_to_remove: - updates["RemoveSubnetIds"] = subnets_to_remove + def set_vpc(self, vpc_id: str): + return self._set_resource_value("VpcId", vpc_id) + + def set_tags(self, tags, purge_tags): + current_tags = boto3_tag_list_to_ansible_dict(self.existing.get("Tags", None)) - if not updates: + if purge_tags: + desired_tags = deepcopy(tags) + else: + desired_tags = {**current_tags, **tags} + + self._set_resource_value("Tags", desired_tags) + + def _get_resource_value(self, key, default=None): + default_value = self.existing.get(key, default) + return self._resource_updates.get(key, default_value) + + def _set_option(self, name: str, value: Optional[bool]) -> bool: + """ + Set a VPC attachment option to either enable or disable. + + Args: + name (str): The name of the option to be updated. + value (Optional[bool]): A boolean indicating whether to enable (True) + or disable (False) the specified option. If None, no action is + taken. + + Returns: + bool: Returns True if the option was successfully set, or False if + no update was made (because the value was None). + """ + if value is None: return False - if self.module.check_mode: - return True + # For now VPC Attachment options are all enable/disable + value = "enable" if value else "disable" + + options = deepcopy(self.existing.get("Options", dict())) + options.update(self._resource_updates.get("Options", dict())) + options[name] = value + + return self._set_resource_value("Options", options) + + def _set_resource_value(self, key, value, description: Optional[str] = None, immutable: bool = False) -> bool: + """ + Set a value for a resource attribute and track changes. + + Args: + key (str): The attribute key to be updated. + value (Any): The new value to set for the specified key. + description (Optional[str], optional): A human-readable description of the + resource attribute. + immutable (bool, optional): A flag indicating whether the attribute is + immutable. If True, and the resource exists, an error will be raised + if attempting to change the value. Defaults to False. + + Returns: + bool: Returns True if the value was successfully set, or False if no + update was made. + """ + if value is None or value == self._get_resource_value(key): + return False + + if immutable and self.existing: + description = description or key + self.module.fail_json(msg=f"{description} can not be updated after creation") + + self.resource_updates[key] = value - updates.update(self._get_id_params(id_list=False)) - self._modify_vpc_attachment(**updates) return True - def get_resource(self): - return self.get_attachment() + def filter_immutable_resource_attributes(self, resource: Dict[str, Any]) -> Dict[str, Any]: + """ + Filter out immutable resource attributes from the given resource dictionary. - def delete(self, id=None): - if id: - id_params = self._get_id_params(id=id, id_list=True) - result = self._get_tgw_vpc_attachment(**id_params) - else: - result = self._preupdate_resource + Args: + resource (Dict[str, Any]): A dictionary representing the resource, which + may contain various attributes, including both mutable and immutable ones. + + Returns: + Dict[str, Any]: A new dictionary containing only the mutable attributes + of the resource. + """ + immutable_options = ["TransitGatewayId", "VpcId", "VpcOwnerId", "State", "SubnetIds", "CreationTime", "Tags"] + return {key: value for key, value in resource.items() if key not in immutable_options} - self.updated_resource = dict() - if not result: +class TransitGatewayVpcAttachmentManager: + def __init__( + self, client, module: AnsibleAWSModule, existing: Dict[str, Any], attachment_id: Optional[str] = None + ) -> None: + self.client = client + self.module = module + self.attachment_id = attachment_id + self.existing = existing or {} + self.updated = {} + self.changed = False + + self.state_manager = TransitGatewayAttachmentStateManager(client, module, attachment_id) + self.config_manager = AttachmentConfigurationManager(client, module, attachment_id, existing) + + def merge_resource_changes(self, filter_immutable: bool = True) -> Dict[str, Any]: + """Merge existing resource attributes with updates, optionally filtering out immutable attributes. + + Args: + filter_immutable (bool): Whether to filter out immutable resource attributes. Defaults to True. + + Returns: + Dict[str, Any]: The merged resource attributes. + """ + resource = deepcopy(self.existing) + resource.update(self.config_manager.resource_updates) + + if filter_immutable: + resource = self.config_manager.filter_immutable_resource_attributes(resource) + + return resource + + def apply_configuration(self): + """Apply configuration changes to the transit gateway attachment. + + Returns: + bool: True if configuration changes were applied, False otherwise. + """ + # Apply any configuration changes to the attachment + if not self.attachment_id: return False - if result.get("State") == "deleting": - self._wait_for_deletion() + updates = self.config_manager.filter_immutable_resource_attributes(self.config_manager.resource_updates) + + subnets_to_add = self.config_manager.subnets_to_add + subnets_to_remove = self.config_manager.subnets_to_remove + + # Check if there are no changes to apply + if not updates and not subnets_to_add and not subnets_to_remove: return False - if self.module.check_mode: - self.changed = True - return True + if subnets_to_add: + updates["AddSubnetIds"] = subnets_to_add + if subnets_to_remove: + updates["RemoveSubnetIds"] = subnets_to_remove - id_params = self._get_id_params(id=id, id_list=False) + updates["TransitGatewayAttachmentId"] = self.attachment_id - result = self._delete_vpc_attachment(**id_params) + if not self.module.check_mode: + try: + modify_transit_gateway_vpc_attachment(self.client, **updates) + except AnsibleEC2Error as e: + self.module.fail_json_aws_error(e) + return True - self.changed |= bool(result) + def _set_configuration_parameters(self) -> None: + """Set configuration parameters for the transit gateway attachment.""" + self.config_manager.set_transit_gateway(self.module.params.get("transit_gateway")) + self.config_manager.set_subnets(self.module.params["subnets"], self.module.params.get("purge_subnets", True)) + self.config_manager.set_dns_support(self.module.params.get("dns_support")) + self.config_manager.set_ipv6_support(self.module.params.get("ipv6_support")) + self.config_manager.set_appliance_mode_support(self.module.params.get("appliance_mode_support")) + + def _prepare_tags(self) -> Tuple[Optional[Dict[str, str]], bool]: + """Prepare and return the tags and purge flag. + + Returns: + Tuple[Optional[Dict[str, str]], bool]: A tuple containing the tags dictionary and the purge flag. + """ + tags = self.module.params.get("tags") + purge_tags = self.module.params.get("purge_tags") + + if self.module.params.get("name"): + new_tags = {"Name": self.module.params["name"]} + if tags is None: + purge_tags = False + else: + new_tags.update(tags) + tags = new_tags + + return {} if tags is None else tags, purge_tags + + def _create_attachment(self) -> None: + """Create a new transit gateway attachment.""" + if not self.module.check_mode: + params = self.merge_resource_changes(filter_immutable=False) + self.attachment_id = self.state_manager.create_attachment(params) + + if self.module.params.get("wait"): + self.state_manager.wait_for_state_change("available") + + self.changed = True + + def _update_attachment(self, tags: Dict[str, Any], purge_tags: bool) -> None: + """Update an existing transit gateway attachment.""" + if self.existing.get("State") == "pending": + # Wait for resources to finish creating before updating + self.state_manager.wait_for_state_change("available") + elif self.existing.get("State") == "deleting": + self.module.fail_json(msg="Deletion in progress, unable to update", route_tables=[self.original_resource]) - self._wait_for_deletion() - return bool(result) + # Apply the configuration + if self.apply_configuration(): + self.changed = True + if self.module.params.get("wait"): + self.state_manager.wait_for_state_change("available") + + # Ensure tags are applied + self.changed |= ensure_ec2_tags( + self.client, + self.module, + self.attachment_id, + resource_type="transit-gateway-attachment", + tags=tags, + purge_tags=purge_tags, + ) - def list(self, filters=None, id=None): - params = dict() - if id: - params["TransitGatewayAttachmentIds"] = [id] - if filters: - params["Filters"] = ansible_dict_to_boto3_filter_list(filters) - attachments = self._describe_vpc_attachments(**params) - if not attachments: - return list() + def create_or_modify_attachment(self): + """Create or modify a transit gateway attachment based on the provided parameters.""" - return [self._normalize_tgw_attachment(a) for a in attachments] + # Set the configuration parameters + self._set_configuration_parameters() - def get_attachment(self, id=None): - # RouteTable needs a list, Association/Propagation needs a single ID - id_params = self._get_id_params(id=id, id_list=True) - id_param = self._get_id_params(id=id, id_list=False) - result = self._get_tgw_vpc_attachment(**id_params) + # Handle tags + tags, purge_tags = self._prepare_tags() - if not result: - return None + # Set tags in the configuration manager + self.config_manager.set_tags(tags, purge_tags) - if not id: - self._preupdate_resource = deepcopy(result) + if not self.existing: + self._create_attachment() + else: + self._update_attachment(tags, purge_tags) - attachment = self._normalize_tgw_attachment(result) - return attachment + # Handle check mode updates + if self.module.check_mode: + self.updated = camel_dict_to_snake_dict( + self.merge_resource_changes(filter_immutable=False), ignore_list=["Tags"] + ) + else: + self.updated = boto3_resource_to_ansible_dict( + find_existing_attachment(self.client, self.module, attachment_id=self.attachment_id) + ) - def _normalize_resource(self, resource): - return self._normalize_tgw_attachment(resource) + def delete_attachment(self): + """Delete attachment""" + if self.existing.get("State") == "deleting": + if self.module.params.get("wait"): + self.state_manager.wait_for_state_change("deleted") + self.change = False + else: + self.changed |= self.state_manager.delete_attachment() + if self.module.params.get("wait"): + self.state_manager.wait_for_state_change("deleted") diff --git a/plugins/modules/ec2_transit_gateway_vpc_attachment.py b/plugins/modules/ec2_transit_gateway_vpc_attachment.py index cfb6809a803..9ecdeb3b2bb 100644 --- a/plugins/modules/ec2_transit_gateway_vpc_attachment.py +++ b/plugins/modules/ec2_transit_gateway_vpc_attachment.py @@ -14,30 +14,30 @@ transit_gateway: description: - The ID of the Transit Gateway that the attachment belongs to. - - When creating a new attachment, I(transit_gateway) must be provided. - - At least one of I(name), I(transit_gateway) and I(id) must be provided. - - I(transit_gateway) is an immutable setting and can not be updated on an + - When creating a new attachment, O(transit_gateway) must be provided. + - At least one of O(name), O(transit_gateway) and O(id) must be provided. + - O(transit_gateway) is an immutable setting and can not be updated on an existing attachment. type: str required: false - aliases: ['transit_gateway_id'] + aliases: ["transit_gateway_id"] id: description: - The ID of the Transit Gateway Attachment. - - When I(id) is not set, a search using I(transit_gateway) and I(name) will be - performed. If multiple results are returned, the module will fail. - - At least one of I(name), I(transit_gateway) and I(id) must be provided. + - When O(id) is not set, a search using O(transit_gateway) and O(name) will be + performed. If multiple results are returned, the module will fail. + - At least one of O(name), O(transit_gateway) and O(id) must be provided. type: str required: false - aliases: ['attachment_id'] + aliases: ["attachment_id"] name: description: - - The C(Name) tag of the Transit Gateway attachment. - - Providing both I(id) and I(name) will set the C(Name) tag on an existing - attachment the matching I(id). - - Setting the C(Name) tag in I(tags) will also result in the C(Name) tag being + - The V(Name) tag of the Transit Gateway attachment. + - Providing both O(id) and O(name) will set the V(Name) tag on an existing + attachment the matching O(id). + - Setting the V(Name) tag in O(tags) will also result in the V(Name) tag being updated. - - At least one of I(name), I(transit_gateway) and I(id) must be provided. + - At least one of O(name), O(transit_gateway) and O(id) must be provided. type: str required: false state: @@ -45,7 +45,7 @@ - Create or remove the Transit Gateway attachment. type: str required: false - choices: ['present', 'absent'] + choices: ["present", "absent"] default: 'present' subnets: description: @@ -56,8 +56,8 @@ required: false purge_subnets: description: - - If I(purge_subnets=true), existing subnets will be removed from the - attachment as necessary to match exactly what is defined by I(subnets). + - If O(purge_subnets=true), existing subnets will be removed from the + attachment as necessary to match exactly what is defined by O(subnets). type: bool required: false default: true @@ -92,9 +92,11 @@ to reach the expected state. - Defaults to 600 seconds. type: int + default: 600 required: false author: - - "Mark Chappell (@tremble)" + - Mark Chappell (@tremble) + - Alina Buzachis (@alinabuzachis) extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -103,40 +105,40 @@ """ EXAMPLES = r""" -# Create a Transit Gateway attachment -- community.aws.ec2_transit_gateway_vpc_attachment: - state: present - transit_gateway: 'tgw-123456789abcdef01' - name: AnsibleTest-1 +- name: Create a Transit Gateway attachment + community.aws.ec2_transit_gateway_vpc_attachment: + state: "present" + transit_gateway: "tgw-123456789abcdef01" + name: "AnsibleTest-1" subnets: - - subnet-00000000000000000 - - subnet-11111111111111111 - - subnet-22222222222222222 + - "subnet-00000000000000000" + - "subnet-11111111111111111" + - "subnet-22222222222222222" ipv6_support: true purge_subnets: true dns_support: true appliance_mode_support: true tags: - TestTag: changed data in Test Tag + TestTag: "changed data in Test Tag" -# Set sub options on a Transit Gateway attachment -- community.aws.ec2_transit_gateway_vpc_attachment: - state: present - id: 'tgw-attach-0c0c5fd0b0f01d1c9' - name: AnsibleTest-1 +- name: Set sub options on a Transit Gateway attachment + community.aws.ec2_transit_gateway_vpc_attachment: + state: "present" + id: "tgw-attach-0c0c5fd0b0f01d1c9" + name: "AnsibleTest-1" ipv6_support: true purge_subnets: false dns_support: false appliance_mode_support: true -# Delete the transit gateway -- community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: 'tgw-attach-0c0c5fd0b0f01d1c9' +- name: Delete the transit gateway + community.aws.ec2_transit_gateway_vpc_attachment: + state: "absent" + id: "tgw-attach-0c0c5fd0b0f01d1c9" """ RETURN = r""" -transit_gateway_attachments: +attachments: description: The attributes of the Transit Gateway attachments. type: list elements: dict @@ -147,7 +149,7 @@ - An ISO 8601 date time stamp of when the attachment was created. type: str returned: success - example: '2022-03-10T16:40:26+00:00' + sample: "2022-03-10T16:40:26+00:00" options: description: - Additional VPC attachment options. @@ -159,32 +161,38 @@ - Indicates whether appliance mode support is enabled. type: str returned: success - example: 'enable' + sample: "enable" dns_support: description: - Indicates whether DNS support is enabled. type: str returned: success - example: 'disable' + sample: "disable" ipv6_support: description: - Indicates whether IPv6 support is disabled. type: str returned: success - example: 'disable' + sample: "disable" + security_group_referencing_support: + description: + - Indicated weather security group referencing support is disabled. + type: str + returned: success + sample: "enable" state: description: - The state of the attachment. type: str returned: success - example: 'deleting' + sample: "deleting" subnet_ids: description: - The IDs of the subnets in use by the attachment. type: list elements: str returned: success - example: ['subnet-0123456789abcdef0', 'subnet-11111111111111111'] + sample: ["subnet-0123456789abcdef0", "subnet-11111111111111111"] tags: description: - A dictionary representing the resource tags. @@ -195,29 +203,92 @@ - The ID of the attachment. type: str returned: success - example: 'tgw-attach-0c0c5fd0b0f01d1c9' + sample: "tgw-attach-0c0c5fd0b0f01d1c9" transit_gateway_id: description: - The ID of the transit gateway that the attachment is connected to. type: str returned: success - example: 'tgw-0123456789abcdef0' + sample: "tgw-0123456789abcdef0" vpc_id: description: - The ID of the VPC that the attachment is connected to. type: str returned: success - example: 'vpc-0123456789abcdef0' + sample: "vpc-0123456789abcdef0" vpc_owner_id: description: - The ID of the account that the VPC belongs to. type: str returned: success - example: '123456789012' + sample: "1234567890122" """ +from typing import NoReturn + +from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict + from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule from ansible_collections.community.aws.plugins.module_utils.transitgateway import TransitGatewayVpcAttachmentManager +from ansible_collections.community.aws.plugins.module_utils.transitgateway import find_existing_attachment +from ansible_collections.community.aws.plugins.module_utils.transitgateway import get_states +from ansible_collections.community.aws.plugins.module_utils.transitgateway import subnets_to_vpc + + +def handle_vpc_attachments(client, module: AnsibleAWSModule) -> NoReturn: + """ + Handle the creation, modification, or deletion of VPC attachments + based on the parameters provided in the Ansible module. + + Args: + client: The AWS client to interact with EC2 services. + module: An instance of AnsibleAWSModule. + + Returns: + NoReturn: The function exits by calling module.exit_json() + with the results of the operation. + """ + attach_id = module.params.get("id", None) + attachment = None + + if not attach_id: + filters = {} + if module.params.get("transit_gateway"): + filters["transit-gateway-id"] = module.params["transit_gateway"] + if module.params.get("name"): + filters["tag:Name"] = module.params["name"] + if module.params.get("subnets"): + vpc_id = subnets_to_vpc(client, module, module.params["subnets"]) + filters["vpc-id"] = vpc_id + + # Attachments lurk in a 'deleted' state, for a while, ignore them so we + # can reuse the names + filters["state"] = get_states() + + attachment = find_existing_attachment(client, module, filters=filters) + if attachment: + attach_id = attachment["TransitGatewayAttachmentId"] + else: + attachment = find_existing_attachment(client, module, attachment_id=attach_id) + + manager = TransitGatewayVpcAttachmentManager(client, module, attachment, attachment_id=attach_id) + + if module.params["state"] == "absent": + manager.delete_attachment() + else: + manager.create_or_modify_attachment() + + results = dict( + changed=manager.changed, + attachments=[manager.updated], + ) + if manager.changed: + results["diff"] = dict( + before=boto3_resource_to_ansible_dict(manager.existing), + after=manager.updated, + ) + + module.exit_json(**results) def main(): @@ -234,7 +305,7 @@ def main(): dns_support=dict(type="bool", required=False), ipv6_support=dict(type="bool", required=False), wait=dict(type="bool", required=False, default=True), - wait_timeout=dict(type="int", required=False), + wait_timeout=dict(type="int", default=600, required=False), ) one_of = [ @@ -247,97 +318,9 @@ def main(): required_one_of=one_of, ) - attach_id = module.params.get("id", None) - tgw = module.params.get("transit_gateway", None) - name = module.params.get("name", None) - tags = module.params.get("tags", None) - purge_tags = module.params.get("purge_tags") - state = module.params.get("state") - subnets = module.params.get("subnets", None) - purge_subnets = module.params.get("purge_subnets") - - # When not provided with an ID see if one exists. - if not attach_id: - search_manager = TransitGatewayVpcAttachmentManager(module=module) - filters = dict() - if tgw: - filters["transit-gateway-id"] = tgw - if name: - filters["tag:Name"] = name - if subnets: - vpc_id = search_manager.subnets_to_vpc(subnets) - filters["vpc-id"] = vpc_id - - # Attachments lurk in a 'deleted' state, for a while, ignore them so we - # can reuse the names - filters["state"] = [ - "available", - "deleting", - "failed", - "failing", - "initiatingRequest", - "modifying", - "pendingAcceptance", - "pending", - "rollingBack", - "rejected", - "rejecting", - ] - attachments = search_manager.list(filters=filters) - if len(attachments) > 1: - module.fail_json("Multiple matching attachments found, provide an ID", attachments=attachments) - # If we find a match then we'll modify it by ID, otherwise we'll be - # creating a new RTB. - if attachments: - attach_id = attachments[0]["transit_gateway_attachment_id"] - - manager = TransitGatewayVpcAttachmentManager(module=module, id=attach_id) - manager.set_wait(module.params.get("wait", None)) - manager.set_wait_timeout(module.params.get("wait_timeout", None)) + client = module.client("ec2") - if state == "absent": - manager.delete() - else: - if not attach_id: - if not tgw: - module.fail_json( - "No existing attachment found. To create a new attachment" - " the `transit_gateway` parameter must be provided." - ) - if not subnets: - module.fail_json( - "No existing attachment found. To create a new attachment" - " the `subnets` parameter must be provided." - ) - - # name is just a special case of tags. - if name: - new_tags = dict(Name=name) - if tags is None: - purge_tags = False - else: - new_tags.update(tags) - tags = new_tags - - manager.set_transit_gateway(tgw) - manager.set_subnets(subnets, purge_subnets) - manager.set_tags(tags, purge_tags) - manager.set_dns_support(module.params.get("dns_support", None)) - manager.set_ipv6_support(module.params.get("ipv6_support", None)) - manager.set_appliance_mode_support(module.params.get("appliance_mode_support", None)) - manager.flush_changes() - - results = dict( - changed=manager.changed, - attachments=[manager.updated_resource], - ) - if manager.changed: - results["diff"] = dict( - before=manager.original_resource, - after=manager.updated_resource, - ) - - module.exit_json(**results) + handle_vpc_attachments(client, module) if __name__ == "__main__": diff --git a/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py b/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py index a665e4080cc..2ec87583a94 100644 --- a/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py +++ b/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py @@ -14,31 +14,32 @@ id: description: - The ID of the Transit Gateway Attachment. - - Mutually exclusive with I(name) and I(filters) + - Mutually exclusive with O(name) and O(filters). type: str required: false - aliases: ['attachment_id'] + aliases: ["attachment_id"] name: description: - - The C(Name) tag of the Transit Gateway attachment. + - The V(Name) tag of the Transit Gateway attachment. type: str required: false filters: description: - A dictionary of filters to apply. Each dict item consists of a filter key and a filter value. - - Setting a C(tag:Name) filter will override the I(name) parameter. + - Setting a V(tag:Name) filter will override the O(name) parameter. type: dict required: false include_deleted: description: - - If I(include_deleted=True), then attachments in a deleted state will + - If O(include_deleted=True), then attachments in a deleted state will also be returned. - - Setting a C(state) filter will override the I(include_deleted) parameter. + - Setting a V(state) filter will override the O(include_deleted) parameter. type: bool required: false default: false author: - - "Mark Chappell (@tremble)" + - Mark Chappell (@tremble) + - Alina Buzachis (@alinabuzachis) extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -46,23 +47,21 @@ """ EXAMPLES = r""" -# Describe a specific Transit Gateway attachment. -- community.aws.ec2_transit_gateway_vpc_attachment_info: - id: 'tgw-attach-0123456789abcdef0' +- name: Describe a specific Transit Gateway attachment + community.aws.ec2_transit_gateway_vpc_attachment_info: + id: "tgw-attach-0123456789abcdef0" -# Describe all attachments attached to a transit gateway. -- community.aws.ec2_transit_gateway_vpc_attachment_info: +- name: Describe all attachments attached to a transit gateway + community.aws.ec2_transit_gateway_vpc_attachment_info: filters: - transit-gateway-id: tgw-0fedcba9876543210' + transit-gateway-id: "tgw-0fedcba9876543210" -# Describe all attachments in an account. -- community.aws.ec2_transit_gateway_vpc_attachment_info: - filters: - transit-gateway-id: tgw-0fedcba9876543210' +- name: Describe all attachments in an account + community.aws.ec2_transit_gateway_vpc_attachment_info: """ RETURN = r""" -transit_gateway_attachments: +attachments: description: The attributes of the Transit Gateway attachments. type: list elements: dict @@ -73,7 +72,7 @@ - An ISO 8601 date time stamp of when the attachment was created. type: str returned: success - example: '2022-03-10T16:40:26+00:00' + sample: "2022-03-10T16:40:26+00:00" options: description: - Additional VPC attachment options. @@ -85,32 +84,38 @@ - Indicates whether appliance mode support is enabled. type: str returned: success - example: 'enable' + sample: "enable" dns_support: description: - Indicates whether DNS support is enabled. type: str returned: success - example: 'disable' + sample: "disable" ipv6_support: description: - Indicates whether IPv6 support is disabled. type: str returned: success - example: 'disable' + sample: "disable" + security_group_referencing_support: + description: + - Indicated weather security group referencing support is disabled. + type: str + returned: success + sample: "enable" state: description: - The state of the attachment. type: str returned: success - example: 'deleting' + sample: "deleting" subnet_ids: description: - The IDs of the subnets in use by the attachment. type: list elements: str returned: success - example: ['subnet-0123456789abcdef0', 'subnet-11111111111111111'] + sample: ["subnet-0123456789abcdef0", "subnet-11111111111111111"] tags: description: - A dictionary representing the resource tags. @@ -121,29 +126,38 @@ - The ID of the attachment. type: str returned: success - example: 'tgw-attach-0c0c5fd0b0f01d1c9' + sample: "tgw-attach-0c0c5fd0b0f01d1c9" transit_gateway_id: description: - The ID of the transit gateway that the attachment is connected to. type: str returned: success - example: 'tgw-0123456789abcdef0' + sample: "tgw-0123456789abcdef0" vpc_id: description: - The ID of the VPC that the attachment is connected to. type: str returned: success - example: 'vpc-0123456789abcdef0' + sample: "vpc-0123456789abcdef0" vpc_owner_id: description: - The ID of the account that the VPC belongs to. type: str returned: success - example: '123456789012' + sample: "123456789012" """ +from typing import Any +from typing import Dict +from typing import List + +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_transit_gateway_vpc_attachments +from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list +from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict + from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -from ansible_collections.community.aws.plugins.module_utils.transitgateway import TransitGatewayVpcAttachmentManager +from ansible_collections.community.aws.plugins.module_utils.transitgateway import get_states def main(): @@ -162,39 +176,45 @@ def main(): module = AnsibleAWSModule( argument_spec=argument_spec, supports_check_mode=True, + mutually_exclusive=mutually_exclusive, ) - name = module.params.get("name", None) - id = module.params.get("id", None) - opt_filters = module.params.get("filters", None) + name = module.params.get("name") + attachment_id = module.params.get("id") + opt_filters = module.params.get("filters") + include_deleted = module.params.get("include_deleted") + + client = module.client("ec2") + + params: Dict[str, Any] = {} + filters: Dict[str, Any] = {} + attachments: List[Dict[str, Any]] = [] - search_manager = TransitGatewayVpcAttachmentManager(module=module) - filters = dict() + if attachment_id: + params["TransitGatewayAttachmentIds"] = [attachment_id] + # Add filter by name if provided if name: filters["tag:Name"] = name - if not module.params.get("include_deleted"): - # Attachments lurk in a 'deleted' state, for a while, ignore them so we - # can reuse the names - filters["state"] = [ - "available", - "deleting", - "failed", - "failing", - "initiatingRequest", - "modifying", - "pendingAcceptance", - "pending", - "rollingBack", - "rejected", - "rejecting", - ] + # Include only active states if "include_deleted" is False + if not include_deleted: + filters["state"] = get_states() + # Include any additional filters provided by the user if opt_filters: filters.update(opt_filters) - attachments = search_manager.list(filters=filters, id=id) + if filters: + params["Filters"] = ansible_dict_to_boto3_filter_list(filters) + + try: + result = describe_transit_gateway_vpc_attachments(client, **params) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) + + if result: + attachments = [boto3_resource_to_ansible_dict(attachment) for attachment in result] module.exit_json(changed=False, attachments=attachments, filters=filters) diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml index e59723bdc30..b917be3907a 100644 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml +++ b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml @@ -1,29 +1,29 @@ --- -- name: 'Describe all attachments on our VPC' - ec2_transit_gateway_vpc_attachment_info: +- name: Describe all attachments on our VPC + community.aws.ec2_transit_gateway_vpc_attachment_info: filters: transit-gateway-id: '{{ tgw_id }}' register: info - ignore_errors: True + ignore_errors: true -- name: 'Start deletion of all attachments' - ec2_transit_gateway_vpc_attachment: +- name: Start deletion of all attachments + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ item.transit_gateway_attachment_id }}' - wait: False + wait: false loop: '{{ info.attachments }}' - ignore_errors: True + ignore_errors: true -- name: 'Wait for deletion of all attachments' - ec2_transit_gateway_vpc_attachment: +- name: Wait for deletion of all attachments + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ item.transit_gateway_attachment_id }}' - wait: True + wait: true loop: '{{ info.attachments }}' - ignore_errors: True + ignore_errors: true -- name: 'Delete subnets' - ec2_vpc_subnet: +- name: Delete subnets + amazon.aws.ec2_vpc_subnet: state: absent cidr: '{{ item.cidr }}' vpc_id: '{{ item.vpc_id }}' @@ -42,8 +42,8 @@ vpc_id: '{{ vpc_id_a }}' ignore_errors: True -- name: 'Create VPCs to attach to TGW' - ec2_vpc_net: +- name: Delete VPCs to attach to TGW + amazon.aws.ec2_vpc_net: state: absent cidr_block: '{{ item.cidr }}' name: '{{ item.name }}' @@ -52,13 +52,19 @@ name: '{{ vpc_name_a }}' - cidr: '{{ vpc_cidr_b }}' name: '{{ vpc_name_b }}' - ignore_errors: True + ignore_errors: true + +- name: Gather info about all transit gateways + community.aws.ec2_transit_gateway_info: + transit_gateway_ids: + - '{{ tgw_id }}' + - '{{ tgw_id_2 }}' -- name: 'Create Transit Gateways' - ec2_transit_gateway: +- name: Delete Transit Gateways + community.aws.ec2_transit_gateway: state: absent transit_gateway_id: '{{ item.tgw_id }}' loop: - tgw_id: '{{ tgw_id }}' - tgw_id: '{{ tgw_id_2 }}' - ignore_errors: True + ignore_errors: true diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml index eda3ab2ace4..2a234bb165f 100644 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml +++ b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml @@ -8,9 +8,9 @@ # Creation - block: - - name: '(CHECK_MODE) Create an attachment - complex parameters' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Create an attachment - complex parameters + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: @@ -19,11 +19,12 @@ tags: tagA: 'example Value' Tag_B: 'second value' - appliance_mode_support: True - ipv6_support: True + appliance_mode_support: true + ipv6_support: true register: complex_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - complex_attach is changed - '"attachments" in complex_attach' @@ -52,8 +53,8 @@ vars: attachment: '{{ complex_attach.attachments[0] }}' - - name: 'Create an attachment - complex parameters' - ec2_transit_gateway_vpc_attachment: + - name: Create an attachment - complex parameters + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: @@ -62,11 +63,12 @@ tags: tagA: 'example Value' Tag_B: 'second value' - appliance_mode_support: True - ipv6_support: True + appliance_mode_support: true + ipv6_support: true register: complex_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - complex_attach is changed - '"attachments" in complex_attach' @@ -108,9 +110,9 @@ set_fact: complex_attachment_id: '{{ complex_attach.attachments[0].transit_gateway_attachment_id }}' - - name: '(CHECK_MODE) Create an attachment - complex parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Create an attachment - complex parameters -- IDEMPOTENCY + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: @@ -119,11 +121,12 @@ tags: tagA: 'example Value' Tag_B: 'second value' - appliance_mode_support: True - ipv6_support: True + appliance_mode_support: true + ipv6_support: true register: complex_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - complex_attach is not changed - '"attachments" in complex_attach' @@ -161,8 +164,8 @@ vars: attachment: '{{ complex_attach.attachments[0] }}' - - name: 'Create an attachment - complex parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + - name: Create an attachment - complex parameters -- IDEMPOTENCY + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: @@ -171,11 +174,12 @@ tags: tagA: 'example Value' Tag_B: 'second value' - appliance_mode_support: True - ipv6_support: True + appliance_mode_support: true + ipv6_support: true register: complex_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - complex_attach is not changed - '"attachments" in complex_attach' @@ -216,23 +220,24 @@ # ============================================================================= # Update - - name: '(CHECK_MODE) Update an attachment - complex parameters' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Update an attachment - complex parameters + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_b_1 }}' - purge_subnets: True + purge_subnets: true tags: tagC: '3' Tag_D: 'Hello again dear world' - purge_tags: False - dns_support: False - ipv6_support: False + purge_tags: false + dns_support: false + ipv6_support: false register: complex_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - complex_attach is changed - '"attachments" in complex_attach' @@ -273,22 +278,23 @@ vars: attachment: '{{ complex_attach.attachments[0] }}' - - name: 'Update an attachment - complex parameters' - ec2_transit_gateway_vpc_attachment: + - name: Update an attachment - complex parameters + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_b_1 }}' - purge_subnets: True + purge_subnets: true tags: tagC: '3' Tag_D: 'Hello again dear world' - purge_tags: False - dns_support: False - ipv6_support: False + purge_tags: false + dns_support: false + ipv6_support: false register: complex_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - complex_attach is changed - '"attachments" in complex_attach' @@ -329,23 +335,24 @@ vars: attachment: '{{ complex_attach.attachments[0] }}' - - name: '(CHECK_MODE) Update an attachment - complex parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Update an attachment - complex parameters -- IDEMPOTENCY + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_b_1 }}' - purge_subnets: True + purge_subnets: true tags: tagC: '3' Tag_D: 'Hello again dear world' - purge_tags: False - dns_support: False - ipv6_support: False + purge_tags: false + dns_support: false + ipv6_support: false register: complex_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - complex_attach is not changed - '"attachments" in complex_attach' @@ -386,22 +393,23 @@ vars: attachment: '{{ complex_attach.attachments[0] }}' - - name: 'Update an attachment - complex parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + - name: Update an attachment - complex parameters -- IDEMPOTENCY + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name_complex }}' transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_b_1 }}' - purge_subnets: True + purge_subnets: true tags: tagC: '3' Tag_D: 'Hello again dear world' - purge_tags: False - dns_support: False - ipv6_support: False + purge_tags: false + dns_support: false + ipv6_support: false register: complex_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - complex_attach is not changed - '"attachments" in complex_attach' diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml index 86d5aa51b5f..f3b3e86f387 100644 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml +++ b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml @@ -1,5 +1,5 @@ --- -- name: 'Pick 2 AZs available for use' +- name: Pick 2 AZs available for use set_fact: subnet_az_a_1: '{{ ec2_availability_zone_names[0] }}' subnet_az_a_1a: '{{ ec2_availability_zone_names[0] }}' @@ -8,23 +8,23 @@ subnet_az_b_1: '{{ ec2_availability_zone_names[0] }}' subnet_az_b_2: '{{ ec2_availability_zone_names[1] }}' -- name: 'Create Transit Gateways' - ec2_transit_gateway: +- name: Create Transit Gateways + community.aws.ec2_transit_gateway: description: '{{ item.description }}' tags: Name: '{{ item.name }}' loop: - - description: 'Transit Gateway for testing ec2_transit_gateway_attachment' + - description: 'Transit Gateway for testing community.aws.ec2_transit_gateway_attachment' name: '{{ tgw_name }}' - - description: 'Second Transit Gateway for testing ec2_transit_gateway_attachment' + - description: 'Second Transit Gateway for testing community.aws.ec2_transit_gateway_attachment' name: '{{ tgw_name_2 }}' register: create_tgws -- name: 'Create VPCs to attach to TGW' - ec2_vpc_net: +- name: Create VPCs to attach to TGW + amazon.aws.ec2_vpc_net: cidr_block: '{{ item.cidr }}' name: '{{ item.name }}' - ipv6_cidr: True + ipv6_cidr: true loop: - cidr: '{{ vpc_cidr_a }}' name: '{{ vpc_name_a }}' @@ -51,8 +51,8 @@ vpc_ipv6_a: '{{ vpc_a.ipv6_cidr_block_association_set[0].ipv6_cidr_block }}' vpc_ipv6_b: '{{ vpc_b.ipv6_cidr_block_association_set[0].ipv6_cidr_block }}' -- name: 'Create subnets' - ec2_vpc_subnet: +- name: Create subnets + amazon.aws.ec2_vpc_subnet: az: '{{ item.az }}' cidr: '{{ item.cidr }}' ipv6_cidr: '{{ item.ipv6_cidr }}' diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml index 0085813a322..2cee6627e2c 100644 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml +++ b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml @@ -2,15 +2,16 @@ # ============================================================================= # Creation - block: - - name: '(CHECK_MODE) Create an attachment - minimal parameters' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Create an attachment - minimal parameters + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that attachment parameters are returned in CHECK_MODE + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -25,14 +26,15 @@ vars: attachment: '{{ simple_attach.attachments[0] }}' - - name: 'Create an attachment - minimal parameters' - ec2_transit_gateway_vpc_attachment: + - name: Create an attachment - minimal parameters + community.aws.ec2_transit_gateway_vpc_attachment: transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that the create attachment is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -64,18 +66,19 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: Save Attachment ID - set_fact: + ansible.builtin.set_fact: simple_attachment_id: '{{ simple_attach.attachments[0].transit_gateway_attachment_id }}' - - name: '(CHECK_MODE) Create an attachment - minimal parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) Create an attachment - minimal parameters -- IDEMPOTENCY + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -107,13 +110,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Create an attachment - minimal parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: transit_gateway: '{{ tgw_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -146,15 +150,16 @@ # ===== - - name: '(CHECK_MODE) By Id - minimal parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + - name: (CHECK_MODE) By Id - minimal parameters -- IDEMPOTENCY + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -186,13 +191,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'By Id - minimal parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -227,13 +233,14 @@ # Set a name - name: '(CHECK_MODE) Set name' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that the attachment parameters are returned in CHECK_MODE + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -267,12 +274,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set name' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that 'Set name' is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -306,13 +314,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Set name -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -346,12 +355,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set name -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -387,14 +397,15 @@ # ===== - name: '(CHECK_MODE) By Name - minimal parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -428,13 +439,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'By Name - minimal parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' subnets: - '{{ subnet_id_a_1 }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -471,10 +483,11 @@ # Describe - name: 'Describe all attachments' - ec2_transit_gateway_vpc_attachment_info: + community.aws.ec2_transit_gateway_vpc_attachment_info: register: info - - assert: + - name: Assert that the transit_gateway_vpc_attachment_info is returned sucessfully + ansible.builtin.assert: that: - info is not changed - '"attachments" in info' @@ -497,12 +510,13 @@ attachment: '{{ info.attachments[0] }}' - name: 'Describe attachments on a specific VPC' - ec2_transit_gateway_vpc_attachment_info: + community.aws.ec2_transit_gateway_vpc_attachment_info: filters: transit-gateway-id: '{{ tgw_id }}' register: info - - assert: + - name: Assert that the returned info is correct + ansible.builtin.assert: that: - info is not changed - '"attachments" in info' @@ -526,11 +540,12 @@ attachment: '{{ info.attachments[0] }}' - name: 'Describe attachment with a specific name' - ec2_transit_gateway_vpc_attachment_info: + community.aws.ec2_transit_gateway_vpc_attachment_info: name: '{{ attachment_name }}' register: info - - assert: + - name: Assert that the returned info is correct + ansible.builtin.assert: that: - info is not changed - '"attachments" in info' @@ -564,11 +579,12 @@ attachment: '{{ info.attachments[0] }}' - name: 'Describe attachment by ID' - ec2_transit_gateway_vpc_attachment_info: + community.aws.ec2_transit_gateway_vpc_attachment_info: id: '{{ simple_attachment_id }}' register: info - - assert: + - name: Assert that the returned info is correct + ansible.builtin.assert: that: - info is not changed - '"attachments" in info' @@ -605,8 +621,8 @@ # Tag attachment - name: '(CHECK_MODE) Set tags' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue @@ -615,7 +631,8 @@ "Tag with Space": value with space register: simple_attach - - assert: + - name: Assert that 'Set tags' is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -657,7 +674,7 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set tags' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue @@ -666,7 +683,8 @@ "Tag with Space": value with space register: simple_attach - - assert: + - name: Assert that 'Set tags' is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -708,8 +726,8 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Set tags -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue @@ -718,7 +736,8 @@ "Tag with Space": value with space register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -760,7 +779,7 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set tags -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue @@ -769,7 +788,8 @@ "Tag with Space": value with space register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -811,11 +831,12 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Describe attachment with tags set' - ec2_transit_gateway_vpc_attachment_info: + community.aws.ec2_transit_gateway_vpc_attachment_info: id: '{{ simple_attachment_id }}' register: info - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - info is not changed - '"attachments" in info' @@ -859,12 +880,13 @@ # ===== - name: '(CHECK_MODE) No change to tags with name set -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -906,11 +928,12 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'No change to tags with name set -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -954,8 +977,8 @@ # ===== - name: '(CHECK_MODE) Update tags' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: @@ -963,7 +986,8 @@ "Tag with Space": value with space 2 register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1005,7 +1029,7 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update tags' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: @@ -1013,7 +1037,8 @@ "Tag with Space": value with space 2 register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1055,8 +1080,8 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Update tags -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: @@ -1064,7 +1089,8 @@ "Tag with Space": value with space 2 register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1106,7 +1132,7 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update tags -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: @@ -1114,7 +1140,8 @@ "Tag with Space": value with space 2 register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1158,15 +1185,16 @@ # ===== - name: '(CHECK_MODE) Remove tags' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue pascalCase: pascalCaseValue register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1204,14 +1232,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove tags' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue pascalCase: pascalCaseValue register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1249,15 +1278,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Remove tags -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue pascalCase: pascalCaseValue register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1295,14 +1325,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove tags -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: CamelCase: CamelCaseValue pascalCase: pascalCaseValue register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1342,15 +1373,16 @@ # ===== - name: '(CHECK_MODE) Add tags with no purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: AnotherTag: Another Value register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1390,14 +1422,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add tags with no purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: AnotherTag: Another Value register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1437,15 +1470,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Add tags with no purge -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: AnotherTag: Another Value register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1485,14 +1519,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add tags with no purge -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' purge_tags: False tags: AnotherTag: Another Value register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1534,13 +1569,14 @@ # ===== - name: '(CHECK_MODE) Remove all tags with name set' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: {} register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1574,12 +1610,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove all tags with name set' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: {} register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1613,13 +1650,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Remove all tags with name set -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: {} register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1653,12 +1691,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove all tags with name set -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: name: '{{ attachment_name }}' tags: {} register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1694,13 +1733,14 @@ # ===== - name: '(CHECK_MODE) Remove all tags including name' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' tags: {} register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1732,12 +1772,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove all tags including name' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' tags: {} register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1769,13 +1810,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Remove all tags including name -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' tags: {} register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1807,12 +1849,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove all tags including name -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' tags: {} register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1847,13 +1890,14 @@ # Options - name: '(CHECK_MODE) Set IPv6 support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - ipv6_support: True + ipv6_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1885,12 +1929,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set IPv6 support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - ipv6_support: True + ipv6_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -1922,13 +1967,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Set IPv6 support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - ipv6_support: True + ipv6_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1960,12 +2006,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set IPv6 support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - ipv6_support: True + ipv6_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -1999,13 +2046,14 @@ # ===== - name: '(CHECK_MODE) Set DNS support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' dns_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2037,12 +2085,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set DNS support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' dns_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2074,13 +2123,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Set DNS support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' dns_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2112,12 +2162,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set DNS support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' dns_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2151,13 +2202,14 @@ # ===== - name: '(CHECK_MODE) Set Appliance Mode support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - appliance_mode_support: True + appliance_mode_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2189,12 +2241,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set Appliance Mode support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - appliance_mode_support: True + appliance_mode_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2226,13 +2279,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Set Appliance Mode support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - appliance_mode_support: True + appliance_mode_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2264,12 +2318,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Set Appliance Mode support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - appliance_mode_support: True + appliance_mode_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2303,13 +2358,14 @@ # ===== - name: '(CHECK_MODE) Update IPv6 support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' ipv6_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2341,12 +2397,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update IPv6 support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' ipv6_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2378,13 +2435,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Update IPv6 support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' ipv6_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2416,12 +2474,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update IPv6 support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' ipv6_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2455,13 +2514,14 @@ # ===== - name: '(CHECK_MODE) Update DNS support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - dns_support: True + dns_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2493,12 +2553,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update DNS support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - dns_support: True + dns_support: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2530,13 +2591,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Update DNS support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - dns_support: True + dns_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2568,12 +2630,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update DNS support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' - dns_support: True + dns_support: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2607,13 +2670,14 @@ # ===== - name: '(CHECK_MODE) Update Appliance Mode support' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' appliance_mode_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2645,12 +2709,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update Appliance Mode support' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' appliance_mode_support: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2682,13 +2747,14 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Update Appliance Mode support -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' appliance_mode_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2720,12 +2786,13 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Update Appliance Mode support -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' appliance_mode_support: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -2760,135 +2827,144 @@ # Subnet Management - name: '(CHECK_MODE) Try to add subnet from a different VPC - no purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_b_2 }}' purge_subnets: False register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed - name: 'Try to add subnet from a different VPC - no purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_b_2 }}' purge_subnets: False register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed # ===== - name: '(CHECK_MODE) Try to add subnet from a different VPC - with purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_b_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed - name: 'Try to add subnet from a different VPC - with purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_b_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed # ===== - name: '(CHECK_MODE) Try to add subnet in the same AZ - no purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_b_1a }}' purge_subnets: False register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed - name: 'Try to add subnet in the same AZ - no purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1a }}' purge_subnets: False register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed # ===== - name: '(CHECK_MODE) Try to add subnet in the same AZ - with purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_1a }}' - purge_subnets: True + purge_subnets: true register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed - name: 'Try to add subnet in the same AZ - with purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_1a }}' - purge_subnets: True + purge_subnets: true register: simple_attach - ignore_errors: True + ignore_errors: true - - assert: + - name: Assert that the test failed + ansible.builtin.assert: that: - simple_attach is failed # ===== - name: '(CHECK_MODE) Add subnet - without purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' purge_subnets: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2921,14 +2997,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add subnet - without purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' purge_subnets: False register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -2961,15 +3038,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Add subnet - without purge -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' purge_subnets: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3002,14 +3080,15 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add subnet - without purge -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' purge_subnets: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3044,17 +3123,18 @@ # ===== - name: '(CHECK_MODE) Add subnet - with purge' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3088,16 +3168,17 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add subnet - with purge' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3131,17 +3212,18 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Add subnet - with purge -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3175,16 +3257,17 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Add subnet - with purge -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3220,16 +3303,17 @@ # ===== - name: '(CHECK_MODE) Remove subnet' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3262,15 +3346,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove subnet' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3303,16 +3388,17 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Remove subnet -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3345,15 +3431,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove subnet -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_2 }}' - '{{ subnet_id_a_3 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3388,16 +3475,17 @@ # ===== - name: '(CHECK_MODE) Remove and add subnet' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3430,15 +3518,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove and add subnet' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - '"attachments" in simple_attach' @@ -3471,16 +3560,17 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: '(CHECK_MODE) Remove and add subnet -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3513,15 +3603,16 @@ attachment: '{{ simple_attach.attachments[0] }}' - name: 'Remove and add subnet -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: id: '{{ simple_attachment_id }}' subnets: - '{{ subnet_id_a_1 }}' - '{{ subnet_id_a_2 }}' - purge_subnets: True + purge_subnets: true register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - '"attachments" in simple_attach' @@ -3557,55 +3648,59 @@ # Deletion - name: '(CHECK_MODE) Delete an attachment - minimal parameters' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ simple_attachment_id }}' - wait: False + wait: false register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - name: 'Delete an attachment - minimal parameters' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ simple_attachment_id }}' - wait: False + wait: false register: simple_attach - - assert: + - name: Assert that the test is successful + ansible.builtin.assert: that: - simple_attach is changed - name: '(CHECK_MODE) Delete an attachment - minimal parameters -- IDEMPOTENCY' - check_mode: True - ec2_transit_gateway_vpc_attachment: + check_mode: true + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ simple_attachment_id }}' wait: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed - name: 'Delete an attachment - minimal parameters -- IDEMPOTENCY' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ simple_attachment_id }}' wait: False register: simple_attach - - assert: + - name: Assert that there is no change + ansible.builtin.assert: that: - simple_attach is not changed always: - name: 'Delete attachment' - ec2_transit_gateway_vpc_attachment: + community.aws.ec2_transit_gateway_vpc_attachment: state: absent id: '{{ simple_attachment_id }}' wait: False - ignore_errors: True + ignore_errors: true From 40d61f0e959ce4684a067746e51bcaa1804fb280 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:13:37 +0200 Subject: [PATCH 57/77] Prepare module ec2_launch_template for promotion (#2164) SUMMARY Depends-On: ansible-collections/amazon.aws#2319 Add some type hint for the module Use shared code from amazon.aws.plugins.module_utils.ec2 Add the possibility to delete specific version of a launch template Add support for tagging for launch template resource (Closes #176) Add the possibility to tag specific resources, not always instance and volume (Closes [#48](#48, Closes #2083) Support EBS Throughput (Closes #1944) Fix issue occurring when launch template contains more than 200 versions (Closes #2131) ISSUE TYPE Feature Pull Request COMPONENT NAME ec2_launch_template Reviewed-by: Alina Buzachis Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS --- .../20240110-ec2_launch_template-refactor.yml | 9 + plugins/modules/ec2_launch_template.py | 1404 +++++++++++++---- .../targets/ec2_launch_template/aliases | 2 + .../ec2_launch_template/tasks/cpu_options.yml | 38 - .../ec2_launch_template/tasks/deletion.yml | 404 +++++ .../tasks/iam_instance_role.yml | 141 +- .../tasks/instance-metadata.yml | 30 - .../ec2_launch_template/tasks/main.yml | 6 +- .../tasks/network_interfaces.yml | 53 - .../ec2_launch_template/tasks/tagging.yml | 210 +++ .../tasks/tags_and_vpc_settings.yml | 208 --- .../tasks/template_data.yml | 145 ++ .../ec2_launch_template/tasks/versions.yml | 485 +++++- 13 files changed, 2397 insertions(+), 738 deletions(-) create mode 100644 changelogs/fragments/20240110-ec2_launch_template-refactor.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/cpu_options.yml create mode 100644 tests/integration/targets/ec2_launch_template/tasks/deletion.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/instance-metadata.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/network_interfaces.yml create mode 100644 tests/integration/targets/ec2_launch_template/tasks/tagging.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/tags_and_vpc_settings.yml create mode 100644 tests/integration/targets/ec2_launch_template/tasks/template_data.yml diff --git a/changelogs/fragments/20240110-ec2_launch_template-refactor.yml b/changelogs/fragments/20240110-ec2_launch_template-refactor.yml new file mode 100644 index 00000000000..d2e7293fa9a --- /dev/null +++ b/changelogs/fragments/20240110-ec2_launch_template-refactor.yml @@ -0,0 +1,9 @@ +--- +breaking_changes: + - ec2_launch_template - Tags defined using option ``tags`` are now applied to the launch template resources not the resource created using this launch template (https://github.com/ansible-collections/community.aws/issues/176). +minor_changes: + - ec2_launch_template - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2164). + - ec2_launch_template - Add the possibility to delete specific versions of a launch template using ``versions_to_delete`` (https://github.com/ansible-collections/community.aws/pull/2164). + - ec2_launch_template - Add suboption ``throughput`` to ``block_device_mappings`` argument (https://github.com/ansible-collections/community.aws/issues/1944). + - ec2_launch_template - Add option ``tag_specifications`` to define tags to be applied to the resources created with the launch template (https://github.com/ansible-collections/community.aws/issues/176). + - ec2_launch_template - Add support ``purge_tags`` parameter (https://github.com/ansible-collections/community.aws/issues/176). diff --git a/plugins/modules/ec2_launch_template.py b/plugins/modules/ec2_launch_template.py index 9fd32711f91..aa055535a9a 100644 --- a/plugins/modules/ec2_launch_template.py +++ b/plugins/modules/ec2_launch_template.py @@ -21,6 +21,7 @@ template_id: description: - The ID for the launch template, can be used for all cases except creating a new Launch Template. + - At least one of O(template_id) and O(template_name) must be specified. aliases: [id] type: str template_name: @@ -31,6 +32,7 @@ nothing happens. - If a launch template with the specified name already exists and the configuration has changed, a new version of the launch template is created. + - At least one of O(template_id) and O(template_name) must be specified. aliases: [name] type: str default_version: @@ -44,6 +46,15 @@ - The description of a launch template version. default: "" type: str + versions_to_delete: + description: + - The version numbers of a launch template versions to delete. + - Use O(default_version) to specify a new default version when deleting the current default version. + - By default, the latest version will be made the default. + - Ignored when O(state=present). + type: list + elements: int + version_added: 9.0.0 state: description: - Whether the launch template should exist or not. @@ -63,7 +74,7 @@ elements: dict suboptions: device_name: - description: The device name (for example, /dev/sdh or xvdh). + description: The device name (for example, V(/dev/sdh) or V(xvdh)). type: str no_device: description: Suppresses the specified device included in the block device mapping of the AMI. @@ -119,6 +130,12 @@ volume_type: description: The volume type type: str + throughput: + description: > + The throughput to provision for a gp3 volume, with a maximum of 1,000 MiB/s. + Valid Range - Minimum value of V(125). Maximum value of V(1000). + type: int + version_added: 9.0.0 cpu_options: description: - Choose CPU settings for the EC2 instances that will be created with this template. @@ -131,24 +148,21 @@ threads_per_core: description: > The number of threads per CPU core. To disable Intel Hyper-Threading - Technology for the instance, specify a value of 1. Otherwise, specify - the default value of 2. + Technology for the instance, specify a value of V(1). Otherwise, specify + the default value of V(2). type: int credit_specification: description: The credit option for CPU usage of the instance. Valid for T2 or T3 instances only. type: dict suboptions: cpu_credits: - description: > - The credit option for CPU usage of a T2 or T3 instance. Valid values - are C(standard) and C(unlimited). + description: + - The credit option for CPU usage of a T2 or T3 instance. Valid values are C(standard) and C(unlimited). type: str disable_api_termination: - description: > - This helps protect instances from accidental termination. If set to true, - you can't terminate the instance using the Amazon EC2 console, CLI, or - API. To change this attribute to false after launch, use - I(ModifyInstanceAttribute). + description: + - This helps protect instances from accidental termination. + - If set to V(true), you can't terminate the instance using the Amazon EC2 console, CLI, or API. type: bool ebs_optimized: description: > @@ -187,20 +201,19 @@ type: dict suboptions: market_type: - description: The market type. This should always be 'spot'. + description: The market type. This should always be V(spot). type: str spot_options: description: Spot-market specific settings. type: dict suboptions: block_duration_minutes: - description: > - The required duration for the Spot Instances (also known as Spot - blocks), in minutes. This value must be a multiple of 60 (60, - 120, 180, 240, 300, or 360). + description: + - The required duration for the Spot Instances (also known as Spot blocks), in minutes. + - This value must be a multiple of V(60) (V(60), V(120), V(180), V(240), V(300), or V(360)). type: int instance_interruption_behavior: - description: The behavior when a Spot Instance is interrupted. The default is C(terminate). + description: The behavior when a Spot Instance is interrupted. The default is V(terminate). choices: [hibernate, stop, terminate] type: str max_price: @@ -211,22 +224,21 @@ choices: [one-time, persistent] type: str instance_type: - description: > - The instance type, such as C(c5.2xlarge). For a full list of instance types, see - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). + description: + - The instance type, such as V(c5.2xlarge). For a full list of instance types, see + U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). type: str kernel_id: - description: > - The ID of the kernel. We recommend that you use PV-GRUB instead of - kernels and RAM disks. For more information, see - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) + description: + - The ID of the kernel. + - We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see + U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) type: str key_name: description: - The name of the key pair. You can create a key pair using M(amazon.aws.ec2_key). - If you do not specify a key pair, you can't connect to the instance - unless you choose an AMI that is configured to allow users another way to - log in. + unless you choose an AMI that is configured to allow users another way to log in. type: str monitoring: description: Settings for instance monitoring. @@ -257,16 +269,15 @@ type: list elements: str ipv6_address_count: - description: > - The number of IPv6 addresses to assign to a network interface. Amazon - EC2 automatically selects the IPv6 addresses from the subnet range. - You can't use this option if specifying the I(ipv6_addresses) option. + description: + - The number of IPv6 addresses to assign to a network interface. + - Amazon EC2 automatically selects the IPv6 addresses from the subnet range. + - You can't use this option if specifying the O(network_interfaces.ipv6_addresses) option. type: int ipv6_addresses: - description: > - A list of one or more specific IPv6 addresses from the IPv6 CIDR - block range of your subnet. You can't use this option if you're - specifying the I(ipv6_address_count) option. + description: + - A list of one or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. + - You can't use this option if you're specifying the O(network_interfaces.ipv6_address_count) option. type: list elements: str network_interface_id: @@ -312,24 +323,41 @@ security_groups: description: > A list of security group names (Default VPC or EC2-Classic) that the new instances will be added to. - For any VPC other than Default, you must use I(security_group_ids). + For any VPC other than Default, you must use O(security_group_ids). type: list elements: str source_version: - description: > - The version number of the launch template version on which to base the new version. - The new version inherits the same launch parameters as the source version, except for parameters that you explicity specify. - Snapshots applied to the block device mapping are ignored when creating a new version unless they are explicitly included. + description: + - The version number of the launch template version on which to base the new version. + - The new version inherits the same launch parameters as the source version, except for parameters that you explicity specify. + - Snapshots applied to the O(block_device_mappings) are ignored when creating a new version unless they are explicitly included. type: str default: latest version_added: 4.1.0 - tags: - type: dict + tag_specifications: description: - - A set of key-value pairs to be applied to resources when this Launch Template is used. - - "Tag key constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with I(aws:)" - - "Tag value constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters." - aliases: ['resource_tags'] + - The tags to apply to the resources when this Launch template is used. + type: list + elements: dict + version_added: 9.0.0 + suboptions: + resource_type: + description: + - The type of resource to tag. + - If the instance does not include the resource type that you specify, the instance launch fails. + type: str + default: instance + choices: + - instance + - volume + - network-interface + - spot-instances-request + tags: + description: + - A set of key-value pairs to be applied to the resource type. + - "Tag key constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with I(aws:)" + - "Tag value constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters." + type: dict user_data: description: > The Base64-encoded user data to make available to the instance. For more information, see the Linux @@ -347,40 +375,43 @@ suboptions: http_endpoint: type: str - description: > - This parameter enables or disables the HTTP metadata endpoint on your instances. + description: This parameter enables or disables the HTTP metadata endpoint on your instances. choices: [enabled, disabled] default: 'enabled' http_put_response_hop_limit: type: int - description: > - The desired HTTP PUT response hop limit for instance metadata requests. - The larger the number, the further instance metadata requests can travel. + description: + - The desired HTTP PUT response hop limit for instance metadata requests. + - The larger the number, the further instance metadata requests can travel. default: 1 http_tokens: type: str - description: > - The state of token usage for your instance metadata requests. + description: The state of token usage for your instance metadata requests. choices: [optional, required] default: 'optional' http_protocol_ipv6: version_added: 3.1.0 type: str - description: > - - Wether the instance metadata endpoint is available via IPv6 (C(enabled)) or not (C(disabled)). + description: + - Whether the instance metadata endpoint is available via IPv6. choices: [enabled, disabled] default: 'disabled' instance_metadata_tags: version_added: 3.1.0 type: str description: - - Wether the instance tags are availble (C(enabled)) via metadata endpoint or not (C(disabled)). + - Whether the instance tags are availble (V(enabled)) via metadata endpoint or not (V(disabled)). choices: [enabled, disabled] default: 'disabled' +notes: + - The O(tags) option used has been in release 9.0.0 to be applied to the launch template resource instead of launch template resource. + - Use O(tag_specifications) to define tags to be applied to resources when this Launch Template is used. + - Support for O(purge_tags) was added in release 9.0.0. extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules - amazon.aws.boto3 +- amazon.aws.tags """ EXAMPLES = r""" @@ -406,122 +437,751 @@ name: "my_template" state: absent -# This module does not yet allow deletion of specific versions of launch templates +- name: Delete a specific version of an ec2 launch template + community.aws.ec2_launch_template: + name: "my_template" + versions_to_delete: + - 2 + state: absent + +- name: Delete a specific version of an ec2 launch template and change the default version + community.aws.ec2_launch_template: + name: "my_template" + versions_to_delete: + - 1 + default_version: 2 + state: absent + +- name: Create an ec2 launch template with specific tags + community.aws.ec2_launch_template: + name: "my_template" + image_id: "ami-04b762b4289fba92b" + instance_type: t2.micro + disable_api_termination: true + tags: + Some: tag + Another: tag + +- name: Create an ec2 launch template with different tag for volume and instance + community.aws.ec2_launch_template: + name: "my_template" + image_id: "ami-04b762b4289fba92b" + instance_type: t2.micro + block_device_mappings: + - device_name: /dev/sdb + ebs: + volume_size: 20 + delete_on_termination: true + volume_type: standard + tag_specifications: + - resource_type: instance + tags: + OsType: Linux + - resource_type: volume + tags: + foo: bar """ RETURN = r""" latest_version: - description: Latest available version of the launch template - returned: when state=present + description: The latest available version number of the launch template. + returned: when RV(latest_template) has a version number. type: int default_version: description: The version that will be used if only the template name is specified. Often this is the same as the latest version, but not always. - returned: when state=present + returned: when RV(default_template) has a version number. type: int +template: + description: Latest available version of the launch template. + returned: when O(state=present) + type: complex + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + create_time: + description: The time launch template was created. + type: str + returned: always + created_by: + description: The principal that created the launch template. + type: str + returned: always + default_version_number: + description: The version number of the default version of the launch template. + type: int + returned: always + latest_version_number: + description: The version number of the latest version of the launch template. + type: int + returned: always + tags: + description: A dictionary of tags assigned to image. + returned: when AMI is created or already exists + type: dict + sample: { + "Env": "devel", + "Name": "nat-server" + } +versions: + description: All available versions of the launch template. + returned: when O(state=present) + type: list + elements: dict + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + create_time: + description: The time the version was created. + type: str + returned: always + created_by: + description: The principal that created the version. + type: str + returned: always + default_version: + description: Indicates whether the version is the default version. + type: bool + returned: always + version_number: + description: The version number. + type: int + returned: always + version_description: + description: The description for the version. + type: str + returned: always + launch_template_data: + description: Information about the launch template. + returned: always + type: dict + contains: + kernel_id: + description: + - The ID of the kernel. + returned: if applicable + type: str + image_id: + description: The ID of the AMI or a Systems Manager parameter. + type: str + returned: if applicable + instance_type: + description: The instance type. + type: str + returned: if applicable + key_name: + description: The name of the key pair. + type: str + returned: if applicable + monitoring: + description: The monitoring for the instance. + type: dict + returned: if applicable + contains: + enabled: + description: Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled. + type: bool + returned: always + placement: + description: The placement of the instance. + type: dict + returned: if applicable + contains: + availability_zone: + description: The Availability Zone of the instance. + type: str + returned: if applicable + affinity: + description: The affinity setting for the instance on the Dedicated Host. + type: str + returned: if applicable + group_name: + description: The name of the placement group for the instance. + type: str + returned: if applicable + host_id: + description: The ID of the Dedicated Host for the instance. + type: str + returned: if applicable + tenancy: + description: The tenancy of the instance. + type: str + returned: if applicable + host_resource_group_arn: + description: The ARN of the host resource group in which to launch the instances. + type: str + returned: if applicable + partition_number: + description: The number of the partition the instance should launch in. + type: int + returned: if applicable + group_id: + description: The Group ID of the placement group. + type: str + returned: if applicable + ebs_optimized: + description: + - Indicates whether the instance is optimized for Amazon EBS I/O. + type: bool + returned: always + iam_instance_profile: + description: + - The IAM instance profile. + type: dict + returned: if application + contains: + arn: + description: The Amazon Resource Name (ARN) of the instance profile. + type: str + returned: always + name: + description: The name of the instance profile. + type: str + returned: always + block_device_mappings: + description: The block device mappings. + type: list + elements: dict + returned: if applicable + contains: + device_name: + description: The device name. + type: str + returned: always + virtual_name: + description: The virtual device name. + type: str + returned: always + ebs: + description: Information about the block device for an EBS volume. + type: str + returned: if applicable + contains: + encrypted: + description: Indicates whether the EBS volume is encrypted. + type: bool + returned: always + delete_on_termination: + description: Indicates whether the EBS volume is deleted on instance termination. + type: bool + returned: always + iops: + description: The number of I/O operations per second (IOPS) that the volume supports. + type: int + returned: always + kms_key_id: + description: The ARN of the Key Management Service (KMS) CMK used for encryption. + type: int + returned: always + snapshot_id: + description: The ID of the snapshot. + type: str + returned: always + volume_size: + description: The size of the volume, in GiB. + type: int + returned: always + volume_type: + description: The volume type. + type: str + returned: always + throughput: + description: The throughput that the volume supports, in MiB/s. + type: int + returned: always + no_device: + description: To omit the device from the block device mapping, specify an empty string. + type: str + network_interfaces: + description: The network interfaces. + type: list + elements: dict + returned: if applicable + contains: + associate_carrier_ip_address: + description: Indicates whether to associate a Carrier IP address with eth0 for a new network interface. + type: bool + returned: always + associate_public_ip_address: + description: Indicates whether to associate a public IPv4 address with eth0 for a new network interface. + type: bool + returned: always + delete_on_termination: + description: Indicates whether the network interface is deleted when the instance is terminated. + type: bool + returned: always + description: + description: A description for the network interface. + type: str + returned: always + device_index: + description: The device index for the network interface attachment. + type: int + returned: always + groups: + description: The IDs of one or more security groups. + type: list + elements: str + returned: if applicable + interface_type: + description: The type of network interface. + type: str + returned: always + ipv6_address_count: + description: The number of IPv6 addresses for the network interface. + type: int + returned: if applicable + ipv6_addresses: + description: The IPv6 addresses for the network interface. + returned: if applicable + type: list + elements: dict + contains: + ipv6_address: + description: The IPv6 address. + type: str + returned: always + is_primary_ipv6: + description: Determines if an IPv6 address associated with a network interface is the primary IPv6 address. + type: bool + returned: always + network_interface_id: + description: The ID of the network interface. + type: str + returned: always + private_ip_address: + description: The primary private IPv4 address of the network interface. + type: str + returned: if applicable + private_ip_addresses: + description: A list of private IPv4 addresses. + type: list + elements: str + returned: if applicable + contains: + primary: + description: Indicates whether the private IPv4 address is the primary private IPv4 address. + type: bool + returned: always + private_ip_address: + description: The private IPv4 address. + type: bool + returned: always + secondary_private_ip_address_count: + description: The number of secondary private IPv4 addresses for the network interface. + type: int + returned: if applicable + subnet_id: + description: The ID of the subnet for the network interface. + type: str + returned: always + network_card_index: + description: The index of the network card. + type: int + returned: if applicable + ipv4_prefixes: + description: A list of IPv4 prefixes assigned to the network interface. + type: list + elements: dict + returned: if applicable + contains: + ipv4_prefix: + description: The IPv4 delegated prefixes assigned to the network interface. + type: str + returned: always + ipv4_prefix_count: + description: The number of IPv4 prefixes that Amazon Web Services automatically assigned to the network interface. + type: int + returned: if applicable + ipv6_prefixes: + description: A list of IPv6 prefixes assigned to the network interface. + type: list + elements: dict + returned: if applicable + contains: + ipv6_prefix: + description: The IPv6 delegated prefixes assigned to the network interface. + type: str + returned: always + ipv6_prefix_count: + description: The number of IPv6 prefixes that Amazon Web Services automatically assigned to the network interface. + type: int + returned: if applicable + primary_ipv6: + description: The primary IPv6 address of the network interface. + type: str + returned: if applicable + ena_srd_specification: + description: Contains the ENA Express settings for instances launched from your launch template. + type: dict + returned: if applicable + contains: + ena_srd_enabled: + description: Indicates whether ENA Express is enabled for the network interface. + type: bool + returned: always + ena_srd_udp_specification: + description: Configures ENA Express for UDP network traffic. + type: dict + returned: always + contains: + ena_srd_udp_enabled: + description: Indicates whether UDP traffic to and from the instance uses ENA Express. + type: bool + returned: always + connection_tracking_specification: + description: + - A security group connection tracking specification that enables you to set the timeout + for connection tracking on an Elastic network interface. + type: dict + returned: if applicable + contains: + tcp_established_timeout: + description: Timeout (in seconds) for idle TCP connections in an established state. + type: int + returned: always + udp_timeout: + description: + - Timeout (in seconds) for idle UDP flows that have seen traffic only in a single direction + or a single request-response transaction. + type: int + returned: always + udp_stream_timeout: + description: + - Timeout (in seconds) for idle UDP flows classified as streams which have seen more + than one request-response transaction. + type: int + returned: always + ram_disk_id: + description: The ID of the RAM disk, if applicable. + type: str + returned: if applicable + disable_api_termination: + description: If set to true, indicates that the instance cannot be terminated using the Amazon EC2 console, command line tool, or API. + type: bool + returned: if applicable + instance_initiated_shutdown_behavior: + description: Indicates whether an instance stops or terminates when you initiate shutdown from the instance. + type: str + returned: if applicable + user_data: + description: The user data for the instance. + type: str + returned: if applicable + tag_specifications: + description: The tags that are applied to the resources that are created during instance launch. + type: list + elements: dict + returned: if applicable + contains: + resource_type: + description: The type of resource to tag. + type: str + returned: always + tags: + description: The tags for the resource. + type: list + elements: dict + contains: + key: + description: The key of the tag. + type: str + returned: always + value: + description: The value of the tag. + type: str + returned: always + enclave_options: + description: Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. + type: dict + returned: if applicable + contains: + enabled: + description: If this parameter is set to true, the instance is enabled for Amazon Web Services Nitro Enclaves. + type: bool + returned: always + metadata_options: + description: The metadata options for the instance. + type: dict + returned: if applicable + contains: + state: + description: The state of the metadata option changes. + type: str + returned: if applicable + http_tokens: + description: Indicates whether IMDSv2 is required. + type: str + returned: if applicable + http_put_response_hop_limit: + description: The desired HTTP PUT response hop limit for instance metadata requests. + type: int + returned: if applicable + http_endpoint: + description: Enables or disables the HTTP metadata endpoint on your instances. + type: str + returned: if applicable + http_protocol_ipv6: + description: Enables or disables the IPv6 endpoint for the instance metadata service. + type: str + returned: if applicable + instance_metadata_tags: + description: Set to enabled to allow access to instance tags from the instance metadata. + type: str + returned: if applicable + cpu_options: + description: The CPU options for the instance. + type: dict + returned: if applicable + contains: + core_count: + description: The number of CPU cores for the instance. + type: int + returned: if applicable + threads_per_core: + description: The number of threads per CPU core. + type: int + returned: if applicable + amd_sev_snp: + description: Indicates whether the instance is enabled for AMD SEV-SNP. + type: int + returned: if applicable + security_group_ids: + description: The security group IDs. + type: list + elements: str + returned: if applicable + security_groups: + description: The security group names. + type: list + elements: str + returned: if applicable + sample: { + "block_device_mappings": [ + { + "device_name": "/dev/sdb", + "ebs": { + "delete_on_termination": true, + "encrypted": true, + "volumeSize": 5 + } + } + ], + "ebs_optimized": false, + "image_id": "ami-0231217be14a6f3ba", + "instance_type": "t2.micro", + "network_interfaces": [ + { + "associate_public_ip_address": false, + "device_index": 0, + "ipv6_addresses": [ + { + "ipv6_address": "2001:0:130F:0:0:9C0:876A:130B" + } + ] + } + ] + } +latest_template: + description: The latest available version of the launch template. + returned: when O(state=present) + type: complex + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + create_time: + description: The time launch template was created. + type: str + returned: always + created_by: + description: The principal that created the launch template. + type: str + returned: always + default_version_number: + description: The version number of the default version of the launch template. + type: int + returned: always + latest_version_number: + description: The version number of the latest version of the launch template. + type: int + returned: always + tags: + description: A dictionary of tags assigned to image. + returned: when AMI is created or already exists + type: dict + sample: { + "Env": "devel", + "Name": "nat-server" + } +default_template: + description: + - The launch template version that will be used if only the template name is specified. + - Often this is the same as the latest version, but not always. + returned: when O(state=present) + type: complex + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + create_time: + description: The time launch template was created. + type: str + returned: always + created_by: + description: The principal that created the launch template. + type: str + returned: always + default_version_number: + description: The version number of the default version of the launch template. + type: int + returned: always + latest_version_number: + description: The version number of the latest version of the launch template. + type: int + returned: always + tags: + description: A dictionary of tags assigned to image. + returned: when AMI is created or already exists + type: dict + sample: { + "Env": "devel", + "Name": "nat-server" + } +deleted_template: + description: information about a launch template deleted. + returned: when O(state=absent) + type: complex + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + create_time: + description: The time launch template was created. + type: str + returned: always + created_by: + description: The principal that created the launch template. + type: str + returned: always + default_version_number: + description: The version number of the default version of the launch template. + type: int + returned: always + latest_version_number: + description: The version number of the latest version of the launch template. + type: int + returned: always + tags: + description: A dictionary of tags assigned to image. + returned: when AMI is created or already exists + type: dict + sample: { + "Env": "devel", + "Name": "nat-server" + } +deleted_versions: + description: Information about deleted launch template versions. + returned: when O(state=absent) + type: list + elements: dict + contains: + launch_template_id: + description: The ID of the launch template. + type: str + returned: always + launch_template_name: + description: The name of the launch template. + type: str + returned: always + version_number: + description: The version number of the launch template. + type: int + returned: always """ +from typing import Any +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple from uuid import uuid4 -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError - from botocore.exceptions import WaiterError -except ImportError: - pass # caught by AnsibleAWSModule - from ansible.module_utils._text import to_text from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict -from ansible_collections.amazon.aws.plugins.module_utils.arn import validate_aws_arn -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import ansible_dict_to_boto3_tag_list +from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_launch_template +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_launch_template_version +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_launch_template +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_launch_template_versions +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_launch_template_versions +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_launch_templates +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import determine_iam_arn_from_name +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import modify_launch_template from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict +from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -def determine_iam_role(module, name_or_arn): - if validate_aws_arn(name_or_arn, service="iam", resource_type="instance-profile"): - return {"arn": name_or_arn} - iam = module.client("iam", retry_decorator=AWSRetry.jittered_backoff()) - try: - role = iam.get_instance_profile(InstanceProfileName=name_or_arn, aws_retry=True) - return {"arn": role["InstanceProfile"]["Arn"]} - except is_boto3_error_code("NoSuchEntity") as e: - module.fail_json_aws(e, msg=f"Could not find instance_role {name_or_arn}") - except (BotoCoreError, ClientError) as e: # pylint: disable=duplicate-except - module.fail_json_aws( - e, - msg=f"An error occurred while searching for instance_role {name_or_arn}. Please try supplying the full ARN.", - ) - - -def existing_templates(module): - ec2 = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff()) - matches = None - try: - if module.params.get("template_id"): - matches = ec2.describe_launch_templates( - LaunchTemplateIds=[module.params.get("template_id")], aws_retry=True - ) - elif module.params.get("template_name"): - matches = ec2.describe_launch_templates( - LaunchTemplateNames=[module.params.get("template_name")], aws_retry=True - ) - except is_boto3_error_code("InvalidLaunchTemplateName.NotFoundException") as e: - # no named template was found, return nothing/empty versions - return None, [] - except is_boto3_error_code("InvalidLaunchTemplateId.Malformed") as e: # pylint: disable=duplicate-except - module.fail_json_aws( - e, - msg=( - f"Launch template with ID {module.params.get('launch_template_id')} is not a valid ID. It should start" - " with `lt-....`" - ), - ) - except is_boto3_error_code("InvalidLaunchTemplateId.NotFoundException") as e: # pylint: disable=duplicate-except - module.fail_json_aws( - e, - msg=( - f"Launch template with ID {module.params.get('launch_template_id')} could not be found, please supply a" - " name instead so that a new template can be created" - ), - ) - except (ClientError, BotoCoreError, WaiterError) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg="Could not check existing launch templates. This may be an IAM permission problem.") +def find_existing(client, module: AnsibleAWSModule) -> Tuple[Optional[Dict[str, Any]], Optional[List[Dict[str, Any]]]]: + launch_template = None + launch_template_versions = [] + params = {} + template_id = module.params.get("template_id") + template_name = module.params.get("template_name") + if template_id: + params["launch_template_ids"] = [template_id] else: - template = matches["LaunchTemplates"][0] - template_id, template_version, template_default = ( - template["LaunchTemplateId"], - template["LatestVersionNumber"], - template["DefaultVersionNumber"], + params["launch_template_names"] = [template_name] + launch_templates = describe_launch_templates(client, **params) + if launch_templates: + launch_template = launch_templates[0] + launch_template_versions = describe_launch_template_versions( + client, LaunchTemplateId=launch_template["LaunchTemplateId"] ) - try: - return ( - template, - ec2.describe_launch_template_versions(LaunchTemplateId=template_id, aws_retry=True)[ - "LaunchTemplateVersions" - ], - ) - except (ClientError, BotoCoreError, WaiterError) as e: - module.fail_json_aws( - e, - msg=f"Could not find launch template versions for {template['LaunchTemplateName']} (ID: {template_id}).", - ) + return normalize_boto3_result(launch_template), normalize_boto3_result(launch_template_versions) -def params_to_launch_data(module, template_params): - if template_params.get("tags"): - tag_list = ansible_dict_to_boto3_tag_list(template_params.get("tags")) - template_params["tag_specifications"] = [ - {"resource_type": r_type, "tags": tag_list} for r_type in ("instance", "volume") - ] - del template_params["tags"] - if module.params.get("iam_instance_profile"): - template_params["iam_instance_profile"] = determine_iam_role(module, module.params["iam_instance_profile"]) +def params_to_launch_data( + template_params: Dict[str, Any], iam_instance_profile_arn: Optional[str] = None +) -> Dict[str, Any]: + if iam_instance_profile_arn: + template_params["iam_instance_profile"] = {"arn": iam_instance_profile_arn} + for interface in template_params.get("network_interfaces") or []: + if interface.get("ipv6_addresses"): + interface["ipv6_addresses"] = [{"ipv6_address": x} for x in interface["ipv6_addresses"]] params = snake_dict_to_camel_dict( dict((k, v) for k, v in template_params.items() if v is not None), capitalize_first=True, @@ -529,170 +1189,279 @@ def params_to_launch_data(module, template_params): return params -def delete_template(module): - ec2 = module.client("ec2", retry_decorator=AWSRetry.jittered_backoff()) - template, template_versions = existing_templates(module) +def validate_string_as_int(module: AnsibleAWSModule, version: str, param_name: str) -> int: + try: + return int(version) + except ValueError: + module.fail_json(msg=f'{param_name} param was not a valid integer, got "{version}"') + + +def validate_version_deletion( + module: AnsibleAWSModule, launch_template_id: str, existing_versions: List[Dict[str, Any]] +) -> Tuple[List[str], Optional[int]]: + versions_to_delete = module.params.get("versions_to_delete") + launch_template_versions_to_delete = [] + default_version_to_set = None + if versions_to_delete: + unique_versions_to_delete = list(set(versions_to_delete)) + launch_template_versions_to_delete = [ + t["VersionNumber"] for t in existing_versions if t["VersionNumber"] in unique_versions_to_delete + ] + if len(launch_template_versions_to_delete) != len(unique_versions_to_delete): + missing = [m for m in unique_versions_to_delete if m not in launch_template_versions_to_delete] + module.fail_json( + msg=f"The following versions {missing} do not exist for launch template id '{launch_template_id}'." + ) + + remaining_versions = [ + t["VersionNumber"] + for t in existing_versions + if t["VersionNumber"] not in launch_template_versions_to_delete + ] + + # Find the default version + default_version = module.params.get("default_version") + if default_version in (None, ""): + default_version_int = [t["VersionNumber"] for t in existing_versions if t["DefaultVersion"]][0] + elif default_version == "latest": + default_version_int = max(remaining_versions, default=None) + default_version_to_set = default_version_int + else: + default_version_int = validate_string_as_int(module, default_version, "default_version") + default_version_to_set = default_version_int + + # Ensure we are not deleting the default version + if default_version_int in launch_template_versions_to_delete or not remaining_versions: + module.fail_json(msg="Cannot delete the launch template default version.") + + if default_version_to_set and default_version_to_set not in remaining_versions: + module.fail_json( + msg=f"Could not set version '{default_version_to_set}' as default, " + "the launch template version was not found for the specified launch template id '{launch_template_id}'." + ) + else: + # By default delete all non default version before the launch template deletion + launch_template_versions_to_delete = [t["VersionNumber"] for t in existing_versions if not t["DefaultVersion"]] + + return [to_text(v) for v in launch_template_versions_to_delete], default_version_to_set + + +def ensure_absent( + client, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]], existing_versions: List[Dict[str, Any]] +) -> None: deleted_versions = [] - if template or template_versions: - non_default_versions = [to_text(t["VersionNumber"]) for t in template_versions if not t["DefaultVersion"]] - if non_default_versions: - try: - v_resp = ec2.delete_launch_template_versions( - LaunchTemplateId=template["LaunchTemplateId"], - Versions=non_default_versions, - aws_retry=True, + deleted_template = {} + changed = False + + if existing: + launch_template_id = existing["LaunchTemplateId"] + v_to_delete, v_default = validate_version_deletion(module, launch_template_id, existing_versions) + + # Update default version + if v_default: + changed = True + if not module.check_mode: + modify_launch_template( + client, + LaunchTemplateId=launch_template_id, + ClientToken=uuid4().hex, + DefaultVersion=to_text(v_default), ) - if v_resp["UnsuccessfullyDeletedLaunchTemplateVersions"]: + # Delete versions + if v_to_delete: + changed = True + if not module.check_mode: + response = delete_launch_template_versions( + client, launch_template_id=launch_template_id, versions=v_to_delete + ) + if response["UnsuccessfullyDeletedLaunchTemplateVersions"]: module.warn( - f"Failed to delete template versions {v_resp['UnsuccessfullyDeletedLaunchTemplateVersions']} on" - f" launch template {template['LaunchTemplateId']}" + f"Failed to delete template versions {response['UnsuccessfullyDeletedLaunchTemplateVersions']} on" + f" launch template {launch_template_id}" ) deleted_versions = [ - camel_dict_to_snake_dict(v) for v in v_resp["SuccessfullyDeletedLaunchTemplateVersions"] + camel_dict_to_snake_dict(v) for v in response["SuccessfullyDeletedLaunchTemplateVersions"] ] - except (ClientError, BotoCoreError) as e: - module.fail_json_aws( - e, - msg=f"Could not delete existing versions of the launch template {template['LaunchTemplateId']}", - ) - try: - resp = ec2.delete_launch_template( - LaunchTemplateId=template["LaunchTemplateId"], - aws_retry=True, - ) - except (ClientError, BotoCoreError) as e: - module.fail_json_aws(e, msg=f"Could not delete launch template {template['LaunchTemplateId']}") - return { - "deleted_versions": deleted_versions, - "deleted_template": camel_dict_to_snake_dict(resp["LaunchTemplate"]), - "changed": True, - } - else: - return {"changed": False} + # Delete the launch template when a list of versions was not specified + if not module.params.get("versions_to_delete"): + changed = True + if not module.check_mode: + deleted_template = delete_launch_template(client, launch_template_id=launch_template_id) + deleted_template = camel_dict_to_snake_dict(deleted_template, ignore_list=["Tags"]) + if "tags" in deleted_template: + deleted_template["tags"] = boto3_tag_list_to_ansible_dict(deleted_template.get("tags")) + + module.exit_json(changed=changed, deleted_versions=deleted_versions, deleted_template=deleted_template) + + +def add_launch_template_version( + client, + module: AnsibleAWSModule, + launch_template_id: str, + launch_template_data: Dict[str, Any], + existing_versions: List[Dict[str, Any]], + most_recent_version_number: str, +) -> int: + source_version = module.params.get("source_version") + version_description = module.params.get("version_description") + + params = { + "LaunchTemplateId": launch_template_id, + "ClientToken": uuid4().hex, + "VersionDescription": version_description, + } + + if source_version == "latest": + params.update({"SourceVersion": most_recent_version_number}) + elif source_version not in (None, ""): + # Source version passed as int + source_version_int = validate_string_as_int(module, source_version, "source_version") + # get source template version + next_source_version = next( + (v for v in existing_versions if v["VersionNumber"] == source_version_int), + None, + ) + if next_source_version is None: + module.fail_json(msg=f'source_version does not exist, got "{source_version}"') + params.update({"SourceVersion": str(next_source_version["VersionNumber"])}) + + if module.check_mode: + module.exit_json(changed=True, msg="Would have created launch template version if not in check mode.") -def create_or_update(module, template_options): - ec2 = module.client( - "ec2", retry_decorator=AWSRetry.jittered_backoff(catch_extra_error_codes=["InvalidLaunchTemplateId.NotFound"]) + # Create Launch template version + launch_template_version = create_launch_template_version( + client, launch_template_data=launch_template_data, **params ) - template, template_versions = existing_templates(module) - out = {} - lt_data = params_to_launch_data(module, dict((k, v) for k, v in module.params.items() if k in template_options)) - lt_data = scrub_none_parameters(lt_data, descend_into_lists=True) - - if not (template or template_versions): - # create a full new one - try: - resp = ec2.create_launch_template( - LaunchTemplateName=module.params["template_name"], - LaunchTemplateData=lt_data, - ClientToken=uuid4().hex, - aws_retry=True, - ) - except (ClientError, BotoCoreError) as e: - module.fail_json_aws(e, msg="Couldn't create launch template") - template, template_versions = existing_templates(module) - out["changed"] = True - elif template and template_versions: - most_recent = sorted(template_versions, key=lambda x: x["VersionNumber"])[-1] - if lt_data == most_recent["LaunchTemplateData"] and module.params["version_description"] == most_recent.get( - "VersionDescription", "" - ): - out["changed"] = False - return out - try: - if module.params.get("source_version") in (None, ""): - resp = ec2.create_launch_template_version( - LaunchTemplateId=template["LaunchTemplateId"], - LaunchTemplateData=lt_data, - ClientToken=uuid4().hex, - VersionDescription=str(module.params["version_description"]), - aws_retry=True, - ) - elif module.params.get("source_version") == "latest": - resp = ec2.create_launch_template_version( - LaunchTemplateId=template["LaunchTemplateId"], - LaunchTemplateData=lt_data, - ClientToken=uuid4().hex, - SourceVersion=str(most_recent["VersionNumber"]), - VersionDescription=str(module.params["version_description"]), - aws_retry=True, - ) - else: - try: - int(module.params.get("source_version")) - except ValueError: - module.fail_json( - msg=f"source_version param was not a valid integer, got \"{module.params.get('source_version')}\"" - ) - # get source template version - source_version = next( - (v for v in template_versions if v["VersionNumber"] == int(module.params.get("source_version"))), - None, - ) - if source_version is None: - module.fail_json( - msg=f"source_version does not exist, got \"{module.params.get('source_version')}\"" - ) - resp = ec2.create_launch_template_version( - LaunchTemplateId=template["LaunchTemplateId"], - LaunchTemplateData=lt_data, - ClientToken=uuid4().hex, - SourceVersion=str(source_version["VersionNumber"]), - VersionDescription=str(module.params["version_description"]), - aws_retry=True, - ) + return launch_template_version["VersionNumber"] - if module.params.get("default_version") in (None, ""): - # no need to do anything, leave the existing version as default - pass - elif module.params.get("default_version") == "latest": - set_default = ec2.modify_launch_template( - LaunchTemplateId=template["LaunchTemplateId"], - DefaultVersion=to_text(resp["LaunchTemplateVersion"]["VersionNumber"]), - ClientToken=uuid4().hex, - aws_retry=True, - ) - else: - try: - int(module.params.get("default_version")) - except ValueError: - module.fail_json( - msg=f"default_version param was not a valid integer, got \"{module.params.get('default_version')}\"" - ) - set_default = ec2.modify_launch_template( - LaunchTemplateId=template["LaunchTemplateId"], - DefaultVersion=to_text(int(module.params.get("default_version"))), + +def ensure_default_version( + client, + module: AnsibleAWSModule, + launch_template_id: str, + current_default_version_number: int, + most_recent_version_number: int, +) -> bool: + # Modify default version + default_version = module.params.get("default_version") + changed = False + if default_version not in (None, ""): + if default_version == "latest": + default_version = to_text(most_recent_version_number) + else: + default_version = to_text(validate_string_as_int(module, default_version, "default_version")) + if to_text(current_default_version_number) != default_version: + changed = True + if not module.check_mode: + modify_launch_template( + client, + LaunchTemplateId=launch_template_id, ClientToken=uuid4().hex, - aws_retry=True, + DefaultVersion=default_version, ) - except (ClientError, BotoCoreError) as e: - module.fail_json_aws(e, msg="Couldn't create subsequent launch template version") - template, template_versions = existing_templates(module) - out["changed"] = True - return out + return changed -def format_module_output(module): - output = {} - template, template_versions = existing_templates(module) - template = camel_dict_to_snake_dict(template) +def format_module_output(client, module: AnsibleAWSModule) -> Dict[str, Any]: + # Describe launch template + template, template_versions = find_existing(client, module) + template = camel_dict_to_snake_dict(template, ignore_list=["Tags"]) + if "tags" in template: + template["tags"] = boto3_tag_list_to_ansible_dict(template.get("tags")) template_versions = [camel_dict_to_snake_dict(v) for v in template_versions] - for v in template_versions: - for ts in v["launch_template_data"].get("tag_specifications") or []: - ts["tags"] = boto3_tag_list_to_ansible_dict(ts.pop("tags")) - output.update(dict(template=template, versions=template_versions)) - output["default_template"] = [v for v in template_versions if v.get("default_version")][0] - output["latest_template"] = [ - v - for v in template_versions - if (v.get("version_number") and int(v["version_number"]) == int(template["latest_version_number"])) - ][0] - if "version_number" in output["default_template"]: - output["default_version"] = output["default_template"]["version_number"] - if "version_number" in output["latest_template"]: - output["latest_version"] = output["latest_template"]["version_number"] - return output + result = { + "template": template, + "versions": template_versions, + "default_template": [v for v in template_versions if v.get("default_version")][0], + "latest_template": [ + v + for v in template_versions + if (v.get("version_number") and int(v["version_number"]) == int(template["latest_version_number"])) + ][0], + } + if "version_number" in result["default_template"]: + result["default_version"] = result["default_template"]["version_number"] + if "version_number" in result["latest_template"]: + result["latest_version"] = result["latest_template"]["version_number"] + return result + + +def ensure_present( + client, + module: AnsibleAWSModule, + template_options: Dict[str, Any], + existing: Optional[Dict[str, Any]], + existing_versions: List[Dict[str, Any]], +) -> None: + template_name = module.params["template_name"] + tags = module.params["tags"] + tag_specifications = module.params.get("tag_specifications") + version_description = module.params.get("version_description") + iam_instance_profile = module.params.get("iam_instance_profile") + # IAM instance profile + if iam_instance_profile: + iam_instance_profile = determine_iam_arn_from_name(module.client("iam"), iam_instance_profile) + # Convert Launch template data + launch_template_data = params_to_launch_data( + dict((k, v) for k, v in module.params.items() if k in template_options), iam_instance_profile + ) + # Tag specifications + if tag_specifications: + boto3_tag_specs = [] + for tag_spec in tag_specifications: + boto3_tag_specs.extend(boto3_tag_specifications(tag_spec["tags"], types=tag_spec["resource_type"])) + launch_template_data["TagSpecifications"] = boto3_tag_specs + launch_template_data = scrub_none_parameters(launch_template_data, descend_into_lists=True) + changed = False + + if not (existing or existing_versions): + # Create Launch template + if module.check_mode: + module.exit_json(changed=True, msg="Would have created launch template if not in check mode.") + create_launch_template( + client, + launch_template_name=template_name, + launch_template_data=launch_template_data, + tags=tags, + ClientToken=uuid4().hex, + VersionDescription=version_description, + ) + changed = True + else: + launch_template_id = existing["LaunchTemplateId"] + default_version_number = existing["DefaultVersionNumber"] + most_recent = sorted(existing_versions, key=lambda x: x["VersionNumber"])[-1] + most_recent_version_number = most_recent["VersionNumber"] + if not ( + launch_template_data == most_recent["LaunchTemplateData"] + and version_description == most_recent.get("VersionDescription", "") + ): + changed = True + most_recent_version_number = add_launch_template_version( + client, + module, + launch_template_id, + launch_template_data, + existing_versions, + str(most_recent["VersionNumber"]), + ) + + # Ensure default version + changed |= ensure_default_version( + client, module, launch_template_id, default_version_number, most_recent_version_number + ) + # Ensure tags + changed |= ensure_ec2_tags( + client, + module, + launch_template_id, + resource_type="launch-template", + tags=tags, + purge_tags=module.params["purge_tags"], + ) + + module.exit_json(changed=changed, **format_module_output(client, module)) def main(): @@ -712,6 +1481,7 @@ def main(): snapshot_id=dict(), volume_size=dict(type="int"), volume_type=dict(), + throughput=dict(type="int"), ), ), no_device=dict(), @@ -738,7 +1508,6 @@ def main(): type="list", elements="dict", ), - iam_instance_profile=dict(), image_id=dict(), instance_initiated_shutdown_behavior=dict(choices=["stop", "terminate"]), instance_market_options=dict( @@ -802,42 +1571,55 @@ def main(): ram_disk_id=dict(), security_group_ids=dict(type="list", elements="str"), security_groups=dict(type="list", elements="str"), - tags=dict(type="dict", aliases=["resource_tags"]), user_data=dict(), ) - arg_spec = dict( + argument_spec = dict( state=dict(choices=["present", "absent"], default="present"), template_name=dict(aliases=["name"]), template_id=dict(aliases=["id"]), default_version=dict(default="latest"), source_version=dict(default="latest"), version_description=dict(default=""), + iam_instance_profile=dict(), + tags=dict(type="dict", aliases=["resource_tags"]), + purge_tags=dict(type="bool", default=True), + versions_to_delete=dict(type="list", elements="int"), + tag_specifications=dict( + type="list", + elements="dict", + options=dict( + resource_type=dict( + type="str", + default="instance", + choices=["instance", "volume", "network-interface", "spot-instances-request"], + ), + tags=dict(type="dict"), + ), + ), ) - arg_spec.update(template_options) + argument_spec.update(template_options) module = AnsibleAWSModule( - argument_spec=arg_spec, + argument_spec=argument_spec, required_one_of=[ ("template_name", "template_id"), ], supports_check_mode=True, ) - for interface in module.params.get("network_interfaces") or []: - if interface.get("ipv6_addresses"): - interface["ipv6_addresses"] = [{"ipv6_address": x} for x in interface["ipv6_addresses"]] - - if module.params.get("state") == "present": - out = create_or_update(module, template_options) - out.update(format_module_output(module)) - elif module.params.get("state") == "absent": - out = delete_template(module) - else: - module.fail_json(msg=f"Unsupported value \"{module.params.get('state')}\" for `state` parameter") + state = module.params.get("state") + client = module.client("ec2") + launch_template, launch_template_versions = find_existing(client, module) - module.exit_json(**out) + try: + if state == "present": + ensure_present(client, module, template_options, launch_template, launch_template_versions) + else: + ensure_absent(client, module, launch_template, launch_template_versions) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) if __name__ == "__main__": diff --git a/tests/integration/targets/ec2_launch_template/aliases b/tests/integration/targets/ec2_launch_template/aliases index 4ef4b2067d0..42f0f3c880b 100644 --- a/tests/integration/targets/ec2_launch_template/aliases +++ b/tests/integration/targets/ec2_launch_template/aliases @@ -1 +1,3 @@ cloud/aws +time=3m +ec2_launch_template_info \ No newline at end of file diff --git a/tests/integration/targets/ec2_launch_template/tasks/cpu_options.yml b/tests/integration/targets/ec2_launch_template/tasks/cpu_options.yml deleted file mode 100644 index 92d7fac5fe1..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/cpu_options.yml +++ /dev/null @@ -1,38 +0,0 @@ -- block: - - name: delete a non-existent template - ec2_launch_template: - name: "{{ resource_prefix }}-not-a-real-template" - state: absent - register: del_fake_lt - ignore_errors: true - - assert: - that: - - del_fake_lt is not failed - - name: create c4.large instance with cpu_options - ec2_launch_template: - name: "{{ resource_prefix }}-c4large-1-threads-per-core" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: c4.large - cpu_options: - core_count: 1 - threads_per_core: 1 - register: lt - - - name: instance with cpu_options created with the right options - assert: - that: - - lt is success - - lt is changed - - "lt.latest_template.launch_template_data.cpu_options.core_count == 1" - - "lt.latest_template.launch_template_data.cpu_options.threads_per_core == 1" - always: - - name: delete the template - ec2_launch_template: - name: "{{ resource_prefix }}-c4large-1-threads-per-core" - state: absent - register: del_lt - retries: 10 - until: del_lt is not failed - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/deletion.yml b/tests/integration/targets/ec2_launch_template/tasks/deletion.yml new file mode 100644 index 00000000000..3936888dc53 --- /dev/null +++ b/tests/integration/targets/ec2_launch_template/tasks/deletion.yml @@ -0,0 +1,404 @@ +- name: Test deletion of launch template + vars: + deletion_launch_template_name: "{{ resource_prefix }}-deletion" + deletion_launch_template_name_2: "{{ resource_prefix }}-deletion-2" + test_ec2_instance_types: + - t2.micro + - t2.small + - t2.medium + - t2.large + - t2.xlarge + block: + - name: Create multiple versions of the launch template + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + instance_type: "{{ item }}" + with_items: "{{ test_ec2_instance_types }}" + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Validate Launch template details + ansible.builtin.assert: + that: + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 5 + - _templates.launch_templates[0].latest_version_number == 5 + - _templates.launch_templates[0].default_version_number == 5 + + #==================================================================== + # Validate deletion errors + #==================================================================== + - name: Delete a non-existent template + community.aws.ec2_launch_template: + name: "{{ resource_prefix }}-not-a-real-template" + state: absent + register: delete_fake_template + ignore_errors: true + + - name: Ensure module did not failed while trying to delete non-existent template + assert: + that: + - delete_fake_template is not failed + + - name: Trying to delete the default version + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: "{{ range(1, 6) }}" + ignore_errors: true + register: delete_default_v + + - name: Ensure the module failed with proper message + ansible.builtin.assert: + that: + - delete_default_v is failed + - 'delete_default_v.msg == "Cannot delete the launch template default version."' + + - name: Trying to delete a version and a non-existing version as default + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: "{{ range(3, 6) }}" + default_version: 6 + ignore_errors: true + register: delete_set_non_existing_v + + - name: Ensure the module failed with proper message + ansible.builtin.assert: + that: + - delete_set_non_existing_v is failed + - error_m in delete_set_non_existing_v.msg + vars: + error_m: "Could not set version '6' as default, the launch template version was not found" + + - name: Trying to delete non-existing version (should failed) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: 10 + ignore_errors: true + register: delete_non_existing_v + + - name: Ensure the module failed with proper message + ansible.builtin.assert: + that: + - delete_non_existing_v is failed + - error_m in delete_non_existing_v.msg + vars: + error_m: "The following versions [10] do not exist for launch template id" + + #==================================================================== + # Delete default version and set latest version as new default + #==================================================================== + - name: Delete default version and set a new default version (check mode) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: 5 + check_mode: true + register: delete_default_v_check_mode + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_default_v_check_mode is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 5 + - _templates.launch_templates[0].latest_version_number == 5 + - _templates.launch_templates[0].default_version_number == 5 + + - name: Delete default version and set a new default version + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: 5 + register: delete_default_v + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Validate deletion result + ansible.builtin.assert: + that: + - delete_default_v is changed + - delete_default_v.deleted_template == {} + - delete_default_v.deleted_versions | length == 1 + - delete_default_v.deleted_versions.0.version_number == 5 + - delete_default_v.deleted_versions.0.launch_template_name == deletion_launch_template_name + - delete_default_v.deleted_versions.0.launch_template_id == _templates.launch_templates[0].launch_template_id + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 4 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 4 + + #==================================================================== + # Delete a single version and set a new default version different from the latest + #==================================================================== + - name: Delete a single version and set a new default version different from the latest (check mode) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: 3 + default_version: 1 + check_mode: true + register: delete_single_v_check_mode + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_default_v_check_mode is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 4 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 4 + + - name: Delete a single version and set a new default version different from the latest + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: 3 + default_version: 1 + register: delete_single_v + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Validate deletion result + ansible.builtin.assert: + that: + - delete_single_v is changed + - delete_single_v.deleted_template == {} + - delete_single_v.deleted_versions | length == 1 + - delete_single_v.deleted_versions.0.version_number == 3 + - delete_single_v.deleted_versions.0.launch_template_name == deletion_launch_template_name + - delete_single_v.deleted_versions.0.launch_template_id == _templates.launch_templates[0].launch_template_id + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 3 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 1 + + #==================================================================== + # Delete multiple versions + #==================================================================== + - name: Delete multiple versions (check mode) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: [1, 2] + check_mode: true + register: delete_multiple_v_check_mode + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_multiple_v_check_mode is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 3 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 1 + + - name: Delete multiple versions + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + versions_to_delete: [1, 2] + register: delete_multiple_v + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_multiple_v is changed + - delete_multiple_v.deleted_template == {} + - delete_multiple_v.deleted_versions | length == 2 + - delete_multiple_v.deleted_versions | map(attribute='launch_template_name') | unique | list == [deletion_launch_template_name] + - delete_multiple_v.deleted_versions | map(attribute='launch_template_id') | unique | list == [_templates.launch_templates[0].launch_template_id] + - delete_multiple_v.deleted_versions | map(attribute='version_number') | sort | list == [1, 2] + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 4 + + #==================================================================== + # Delete launch template + #==================================================================== + - name: Delete launch template (check mode) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + check_mode: true + register: delete_template_check_mode + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_template_check_mode is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].latest_version_number == 4 + - _templates.launch_templates[0].default_version_number == 4 + + - name: Delete launch template + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + register: delete_template + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name }}" + register: _templates_v + + - name: Ensure the launch template was deleted + ansible.builtin.assert: + that: + - delete_template is changed + - delete_template.deleted_template.launch_template_id == _templates.launch_templates[0].launch_template_id + - delete_template.deleted_template.latest_version_number == _templates.launch_templates[0].latest_version_number + - delete_template.deleted_template.default_version_number == _templates.launch_templates[0].default_version_number + - delete_template.deleted_versions | length == 0 + - _templates_v.launch_templates | length == 0 + + - name: Delete launch template once again (idempotency) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name }}" + state: absent + register: delete_template_idempotency + + - name: Ensure module idempotency + ansible.builtin.assert: + that: + - delete_template_idempotency is not changed + - delete_template_idempotency.deleted_template == {} + - delete_template_idempotency.deleted_versions == [] + + #==================================================================== + # Delete launch template with multiple versions + #==================================================================== + - name: Create multiple versions of the launch template + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name_2 }}" + instance_type: "{{ item }}" + with_items: "{{ test_ec2_instance_types }}" + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name_2 }}" + register: _templates + + - name: Validate Launch template details + ansible.builtin.assert: + that: + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 5 + - _templates.launch_templates[0].latest_version_number == 5 + - _templates.launch_templates[0].default_version_number == 5 + + - name: Delete launch template with multiple versions (check mode) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name_2 }}" + state: absent + check_mode: true + register: delete_template_check_mode + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name_2 }}" + register: _templates + + - name: Ensure module reported change while no change was made + ansible.builtin.assert: + that: + - delete_template_check_mode is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 5 + + - name: Delete launch template with multiple versions + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name_2 }}" + state: absent + register: delete_template + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ deletion_launch_template_name_2 }}" + register: _templates_v + + - name: Ensure the launch template was deleted + ansible.builtin.assert: + that: + - delete_template is changed + - delete_template.deleted_template.launch_template_id == _templates.launch_templates[0].launch_template_id + - delete_template.deleted_template.latest_version_number == _templates.launch_templates[0].latest_version_number + - delete_template.deleted_template.default_version_number == _templates.launch_templates[0].default_version_number + - delete_template.deleted_versions | length == 4 + - delete_template.deleted_versions | map(attribute='launch_template_name') | unique | list == [deletion_launch_template_name_2] + - delete_template.deleted_versions | map(attribute='launch_template_id') | unique | list == [_templates.launch_templates[0].launch_template_id] + - delete_template.deleted_versions | map(attribute='version_number') | sort | list == [1, 2, 3, 4] + - _templates_v.launch_templates | length == 0 + + - name: Delete launch template with multiple versions once again (idempotency) + community.aws.ec2_launch_template: + name: "{{ deletion_launch_template_name_2 }}" + state: absent + register: delete_template_idempotency + + - name: Ensure module idempotency + ansible.builtin.assert: + that: + - delete_template_idempotency is not changed + - delete_template_idempotency.deleted_template == {} + - delete_template_idempotency.deleted_versions == [] + + always: + - name: Delete the launch template + community.aws.ec2_launch_template: + name: "{{ item }}" + state: absent + with_items: + - "{{ deletion_launch_template_name }}" + - "{{ deletion_launch_template_name_2 }}" + ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml b/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml index ad797fabb79..08a39dff855 100644 --- a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml +++ b/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml @@ -1,6 +1,9 @@ -- block: +- name: Test using IAM instance profile + vars: + test_launch_template_name: "{{ resource_prefix }}-test-instance-role" + block: - name: Create IAM role for test - iam_role: + amazon.aws.iam_role: name: "{{ test_role_name }}-1" assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" state: present @@ -10,7 +13,7 @@ register: iam_role - name: Create second IAM role for test - iam_role: + amazon.aws.iam_role: name: "{{ test_role_name }}-2" assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" state: present @@ -20,115 +23,181 @@ register: iam_role_2 - name: Make instance with an instance_role - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro iam_instance_profile: "{{ test_role_name }}-1" register: template_with_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the launch template was created with IAM instance profile + ansible.builtin.assert: that: - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 1 + - _template_info.launch_templates[0].versions[0].launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") + - _template_info.launch_templates[0].versions[0].launch_template_data.instance_type == "t2.micro" + - _template_info.launch_templates[0].versions[0].launch_template_data.image_id == ec2_ami_id - name: Create template again, with no change to instance_role - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro iam_instance_profile: "{{ test_role_name }}-1" register: template_with_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Validate idempotency + ansible.builtin.assert: that: - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role is not changed' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 1 + - _template_info.launch_templates[0].versions[0].launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") + - _template_info.launch_templates[0].versions[0].launch_template_data.instance_type == "t2.micro" + - _template_info.launch_templates[0].versions[0].launch_template_data.image_id == ec2_ami_id - name: Update instance with new instance_role - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro iam_instance_profile: "{{ test_role_name }}-2" register: template_with_updated_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure that the launch template was updated with new IAM instance profile + ansible.builtin.assert: that: - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - 'template_with_updated_role is changed' - 'template_with_updated_role is not failed' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 2 + - template_version.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/") + - template_version.launch_template_data.instance_type == "t2.micro" + - template_version.launch_template_data.image_id == ec2_ami_id + vars: + template_version: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | list | first }}" - name: Re-set with same new instance_role - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro iam_instance_profile: "{{ test_role_name }}-2" register: template_with_updated_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure that module did not reported change + ansible.builtin.assert: that: - 'template_with_updated_role is not changed' - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 2 - name: Update instance with original instance_role (pass profile ARN) - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro # By default an instance profile will be created with the same name as the role iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' register: template_with_updated_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Validate that the launch template was updated + ansible.builtin.assert: that: - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - 'template_with_updated_role is changed' - 'template_with_updated_role is not failed' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 3 + - template_version.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") + - template_version.launch_template_data.instance_type == "t2.micro" + - template_version.launch_template_data.image_id == ec2_ami_id + vars: + template_version: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 3) | list | first }}" - name: Re-set with same new instance_role (pass profile ARN) - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" instance_type: t2.micro iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' register: template_with_updated_role - - assert: + - name: Get launch template details + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Assert that the template was not updated + ansible.builtin.assert: that: - 'template_with_updated_role is not changed' - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].versions | length == 3 always: - - name: delete launch template - ec2_launch_template: - name: "{{ resource_prefix }}-test-instance-role" + - name: Delete launch template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" state: absent register: lt_removed - until: lt_removed is not failed - ignore_errors: yes - retries: 10 + ignore_errors: true + - name: Delete IAM role for test - iam_role: + amazon.aws.iam_role: name: "{{ test_role_name }}-1" assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" state: absent - delete_instance_profile: yes + delete_instance_profile: true register: iam_removed - until: iam_removed is not failed - ignore_errors: yes - retries: 10 + ignore_errors: true + - name: Delete IAM role for test iam_role: name: "{{ test_role_name }}-2" assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" state: absent - delete_instance_profile: yes + delete_instance_profile: true register: iam_2_removed - until: iam_2_removed is not failed - ignore_errors: yes - retries: 10 + ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/instance-metadata.yml b/tests/integration/targets/ec2_launch_template/tasks/instance-metadata.yml deleted file mode 100644 index 7648f00efb8..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/instance-metadata.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: instance_metadata_tags - block: - - name: metadata_options - ec2_launch_template: - name: "{{ resource_prefix }}-test-metadata" - metadata_options: - http_put_response_hop_limit: 1 - http_tokens: required - http_protocol_ipv6: enabled - instance_metadata_tags: enabled - state: present - register: metadata_options_launch_template - - name: instance with metadata_options created with the right options - assert: - that: - - metadata_options_launch_template is changed - - "metadata_options_launch_template.latest_template.launch_template_data.metadata_options.http_put_response_hop_limit == 1" - - "metadata_options_launch_template.latest_template.launch_template_data.metadata_options.http_tokens == 'required'" - - "metadata_options_launch_template.latest_template.launch_template_data.metadata_options.http_protocol_ipv6 == 'enabled'" - - "metadata_options_launch_template.latest_template.launch_template_data.metadata_options.instance_metadata_tags == 'enabled'" - always: - - name: delete the template - ec2_launch_template: - name: "{{ resource_prefix }}-test-metadata" - state: absent - register: del_lt - retries: 10 - until: del_lt is not failed - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/main.yml b/tests/integration/targets/ec2_launch_template/tasks/main.yml index e89dfceb557..c8ea5f055da 100644 --- a/tests/integration/targets/ec2_launch_template/tasks/main.yml +++ b/tests/integration/targets/ec2_launch_template/tasks/main.yml @@ -6,8 +6,8 @@ session_token: "{{ security_token | default(omit) }}" region: "{{ aws_region }}" block: - - include_tasks: cpu_options.yml + - include_tasks: template_data.yml + - include_tasks: tagging.yml - include_tasks: iam_instance_role.yml - include_tasks: versions.yml - - include_tasks: instance-metadata.yml - - include_tasks: network_interfaces.yml + - include_tasks: deletion.yml diff --git a/tests/integration/targets/ec2_launch_template/tasks/network_interfaces.yml b/tests/integration/targets/ec2_launch_template/tasks/network_interfaces.yml deleted file mode 100644 index a2ca0e5f6b9..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/network_interfaces.yml +++ /dev/null @@ -1,53 +0,0 @@ -- block: - - name: network_interfaces - ec2_launch_template: - name: "{{ resource_prefix }}-test-nic" - state: present - network_interfaces: - - device_index: 0 - associate_public_ip_address: false - delete_on_termination: true - - device_index: 1 - associate_public_ip_address: true - delete_on_termination: false - ipv6_address_count: 1 - register: nic_template - - name: instance with network_interfaces created with the right settings - assert: - that: - - nic_template is changed - - nic_template.default_template.launch_template_data.network_interfaces[0].associate_public_ip_address == False - - nic_template.default_template.launch_template_data.network_interfaces[0].delete_on_termination == True - - nic_template.default_template.launch_template_data.network_interfaces[0].device_index == 0 - - nic_template.default_template.launch_template_data.network_interfaces[1].associate_public_ip_address == True - - nic_template.default_template.launch_template_data.network_interfaces[1].delete_on_termination == False - - nic_template.default_template.launch_template_data.network_interfaces[1].device_index == 1 - - nic_template.default_template.launch_template_data.network_interfaces[1].ipv6_address_count == 1 - - - name: network_interfaces - ec2_launch_template: - name: "{{ resource_prefix }}-test-nic" - state: present - network_interfaces: - - device_index: 0 - associate_public_ip_address: false - delete_on_termination: true - - device_index: 1 - associate_public_ip_address: true - delete_on_termination: false - ipv6_address_count: 1 - register: nic_template - - name: instance with network_interfaces created with the right settings - assert: - that: - - nic_template is not changed - - always: - - name: delete the template - ec2_launch_template: - name: "{{ resource_prefix }}-test-nic" - state: absent - register: del_lt - retries: 10 - until: del_lt is not failed - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/tagging.yml b/tests/integration/targets/ec2_launch_template/tasks/tagging.yml new file mode 100644 index 00000000000..b4d38da70c9 --- /dev/null +++ b/tests/integration/targets/ec2_launch_template/tasks/tagging.yml @@ -0,0 +1,210 @@ +--- +- name: Test tagging + vars: + test_launch_template_name: "{{ resource_prefix }}-tagging" + launch_template_instance_tags: + - key: foo + value: bar + - key: environment + value: test + launch_template_network_tags: + - key: owner + value: ansible + ansible_instance_tags: + foo: bar + environment: test + ansible_network_tags: + owner: ansible + block: + # Create launch template with tags + - name: Create Launch template with tags + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + instance_type: t2.micro + network_interfaces: + - associate_public_ip_address: false + delete_on_termination: true + device_index: 0 + tag_specifications: + - resource_type: instance + tags: "{{ ansible_instance_tags }}" + - resource_type: network-interface + tags: "{{ ansible_network_tags }}" + tags: + ResourcePrefix: "{{ resource_prefix }}" + InstanceType: "t2.micro" + register: _create_with_tags + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure the launch template was created with tags + ansible.builtin.assert: + that: + - _create_with_tags is changed + - '"tags" in _create_with_tags.template' + - _create_with_tags.template.tags.InstanceType == "t2.micro" + - _create_with_tags.template.tags.ResourcePrefix == resource_prefix + - _templates.launch_templates[0].tags.InstanceType == "t2.micro" + - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 + - instance_tags.tags == launch_template_instance_tags + - network_interface_tags.tags == launch_template_network_tags + vars: + instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" + network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" + + # Create launch template once again with same tags (expected no change) + - name: Create launch template once again with same tags (expected no change) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + instance_type: t2.micro + network_interfaces: + - associate_public_ip_address: false + delete_on_termination: true + device_index: 0 + tag_specifications: + - resource_type: instance + tags: "{{ ansible_instance_tags }}" + - resource_type: network-interface + tags: "{{ ansible_network_tags }}" + tags: + ResourcePrefix: "{{ resource_prefix }}" + InstanceType: "t2.micro" + register: _create_with_tags_idempotency + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure the launch template was created with tags + ansible.builtin.assert: + that: + - _create_with_tags_idempotency is not changed + - '"tags" in _create_with_tags_idempotency.template' + - _create_with_tags_idempotency.template.tags.InstanceType == "t2.micro" + - _create_with_tags_idempotency.template.tags.ResourcePrefix == resource_prefix + - _templates.launch_templates[0].tags.InstanceType == "t2.micro" + - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 + - instance_tags.tags == launch_template_instance_tags + - network_interface_tags.tags == launch_template_network_tags + vars: + instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" + network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" + + # Add new tag + - name: Add new tag with purge_tags=false + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + instance_type: t2.micro + network_interfaces: + - associate_public_ip_address: false + delete_on_termination: true + device_index: 0 + tag_specifications: + - resource_type: instance + tags: "{{ ansible_instance_tags }}" + - resource_type: network-interface + tags: "{{ ansible_network_tags }}" + tags: + Phase: integration + purge_tags: false + register: _add_tag + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure the launch template was created with tags + ansible.builtin.assert: + that: + - _add_tag is changed + - '"tags" in _add_tag.template' + - _add_tag.template.tags.InstanceType == "t2.micro" + - _add_tag.template.tags.ResourcePrefix == resource_prefix + - _add_tag.template.tags.Phase == "integration" + - _templates.launch_templates[0].tags.InstanceType == "t2.micro" + - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix + - _templates.launch_templates[0].tags.Phase == "integration" + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 + - instance_tags.tags == launch_template_instance_tags + - network_interface_tags.tags == launch_template_network_tags + vars: + instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" + network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" + + # Add new launch template version and update tags + - name: Add new launch template version and update tags + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + instance_type: t3.micro + tags: + Team: Ansible + purge_tags: true + source_version: "" + register: _add_tag_and_version + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure the launch template was created with tags + ansible.builtin.assert: + that: + - _add_tag_and_version is changed + - '"tags" in _add_tag.template' + - '"InstanceType" not in _add_tag_and_version.template.tags' + - '"ResourcePrefix" not in _add_tag_and_version.template.tags' + - '"Phase" not in _add_tag_and_version.template.tags' + - _add_tag_and_version.template.tags.Team == "Ansible" + - '"InstanceType" not in _templates.launch_templates[0].tags' + - '"ResourcePrefix" not in _templates.launch_templates[0].tags' + - '"Phase" not in _templates.launch_templates[0].tags' + - _templates.launch_templates[0].tags.Team == "Ansible" + - _templates.launch_templates[0].versions | length == 2 + - '"tag_specifications" not in latest_version_template_data.launch_template_data' + vars: + latest_version_template_data: '{{ _templates.launch_templates[0].versions | selectattr("version_number", "equalto", 2) | list | first }}' + + # Purge tags + - name: Purge all tags from launch template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + instance_type: t3.micro + tags: {} + purge_tags: true + register: _purge_tags + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure the launch template was created with tags + ansible.builtin.assert: + that: + - _purge_tags is changed + - '"tags" not in _purge_tags.template' + - _templates.launch_templates[0].tags == {} + - _templates.launch_templates[0].versions | length == 2 + + always: + - name: Delete launch template + community.aws.ec2_launch_template: + state: absent + name: "{{ test_launch_template_name }}" + ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/tags_and_vpc_settings.yml b/tests/integration/targets/ec2_launch_template/tasks/tags_and_vpc_settings.yml deleted file mode 100644 index 41ff9082b76..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/tags_and_vpc_settings.yml +++ /dev/null @@ -1,208 +0,0 @@ -- block: - # ============================================================ - # set up VPC - - name: Create VPC for use in testing - ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - cidr_block: 10.99.0.0/16 - tags: - Name: Ansible ec2_instance Testing VPC - tenancy: default - register: testing_vpc - - - name: Create default subnet in zone A - ec2_vpc_subnet: - state: present - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.99.0.0/24 - az: "{{ aws_region }}a" - resource_tags: - Name: "{{ resource_prefix }}-subnet-a" - register: testing_subnet_a - - - name: Create secondary subnet in zone B - ec2_vpc_subnet: - state: present - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.99.1.0/24 - az: "{{ aws_region }}b" - resource_tags: - Name: "{{ resource_prefix }}-subnet-b" - register: testing_subnet_b - - - name: create a security group with the vpc - ec2_security_group: - name: "{{ resource_prefix }}-sg" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - rules: - - proto: tcp - ports: [22, 80] - cidr_ip: 0.0.0.0/0 - register: sg - # TODO: switch these tests from instances - - assert: - that: - - 1 == 0 - # ============================================================ - # start subnet/sg testing - - name: Make instance in the testing subnet created in the test VPC - ec2_instance: - name: "{{ resource_prefix }}-test-basic-vpc-create" - image_id: "{{ ec2_ami_id }}" - user_data: | - #cloud-config - package_upgrade: true - package_update: true - tags: - TestId: "{{ resource_prefix }}" - Something: else - security_groups: "{{ sg.group_id }}" - network: - source_dest_check: false - vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}" - instance_type: t2.micro - volumes: - - device_name: /dev/sda1 - ebs: - delete_on_termination: true - register: in_test_vpc - - - name: Try to re-make the instance, hopefully this shows changed=False - ec2_instance: - name: "{{ resource_prefix }}-test-basic-vpc-create" - image_id: "{{ ec2_ami_id }}" - user_data: | - #cloud-config - package_upgrade: true - package_update: true - tags: - TestId: "{{ resource_prefix }}" - Something: else - security_groups: "{{ sg.group_id }}" - vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}" - instance_type: t2.micro - register: remake_in_test_vpc - - name: "Remaking the same instance resulted in no changes" - assert: - that: not remake_in_test_vpc.changed - - name: check that instance IDs match anyway - assert: - that: 'remake_in_test_vpc.instance_ids[0] == in_test_vpc.instance_ids[0]' - - name: check that source_dest_check was set to false - assert: - that: 'not remake_in_test_vpc.instances[0].source_dest_check' - - - name: Alter it by adding tags - ec2_instance: - name: "{{ resource_prefix }}-test-basic-vpc-create" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - Another: thing - security_groups: "{{ sg.group_id }}" - vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}" - instance_type: t2.micro - register: add_another_tag - - - ec2_instance_info: - instance_ids: "{{ add_another_tag.instance_ids }}" - register: check_tags - - name: "Remaking the same instance resulted in no changes" - assert: - that: - - check_tags.instances[0].tags.Another == 'thing' - - check_tags.instances[0].tags.Something == 'else' - - - name: Purge a tag - ec2_instance: - name: "{{ resource_prefix }}-test-basic-vpc-create" - image_id: "{{ ec2_ami_id }}" - purge_tags: true - tags: - TestId: "{{ resource_prefix }}" - Another: thing - security_groups: "{{ sg.group_id }}" - vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}" - instance_type: t2.micro - - ec2_instance_info: - instance_ids: "{{ add_another_tag.instance_ids }}" - register: check_tags - - name: "Remaking the same instance resulted in no changes" - assert: - that: - - "'Something' not in check_tags.instances[0].tags" - - - name: Terminate instance - ec2_instance: - filters: - tag:TestId: "{{ resource_prefix }}" - state: absent - register: result - - assert: - that: result.changed - - - name: Terminate instance - ec2_instance: - instance_ids: "{{ in_test_vpc.instance_ids }}" - state: absent - register: result - - assert: - that: not result.changed - - - name: check that subnet-default public IP rule was followed - assert: - that: - - in_test_vpc.instances[0].public_dns_name == "" - - in_test_vpc.instances[0].private_ip_address.startswith("10.22.33") - - in_test_vpc.instances[0].subnet_id == testing_subnet_b.subnet.id - - name: check that tags were applied - assert: - that: - - in_test_vpc.instances[0].tags.Name.startswith(resource_prefix) - - in_test_vpc.instances[0].state.name == 'running' - - always: - - name: remove the security group - ec2_security_group: - name: "{{ resource_prefix }}-sg" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - - - name: remove subnet A - ec2_vpc_subnet: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.99.0.0/24 - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - - - name: remove subnet B - ec2_vpc_subnet: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.99.1.0/24 - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - - - name: remove the VPC - ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - cidr_block: 10.99.0.0/16 - state: absent - tags: - Name: Ansible Testing VPC - tenancy: default - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 diff --git a/tests/integration/targets/ec2_launch_template/tasks/template_data.yml b/tests/integration/targets/ec2_launch_template/tasks/template_data.yml new file mode 100644 index 00000000000..cc9a4962f62 --- /dev/null +++ b/tests/integration/targets/ec2_launch_template/tasks/template_data.yml @@ -0,0 +1,145 @@ +- name: Test launch template data + vars: + test_launch_template_name: "{{ resource_prefix }}-template-data" + block: + # Launch template meta data + - name: Create launch template (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + instance_type: c4.large + cpu_options: + core_count: 1 + threads_per_core: 1 + network_interfaces: + - device_index: 0 + associate_public_ip_address: false + delete_on_termination: true + - device_index: 1 + associate_public_ip_address: true + delete_on_termination: false + ipv6_address_count: 1 + metadata_options: + http_put_response_hop_limit: 1 + http_tokens: required + http_protocol_ipv6: enabled + instance_metadata_tags: enabled + register: _create_check + check_mode: true + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while the template was not created + ansible.builtin.assert: + that: + - _create_check is changed + - _templates.launch_templates | length == 0 + + - name: Create launch template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + instance_type: c4.large + cpu_options: + core_count: 1 + threads_per_core: 3 + network_interfaces: + - device_index: 0 + associate_public_ip_address: false + delete_on_termination: true + - device_index: 1 + associate_public_ip_address: true + delete_on_termination: false + ipv6_address_count: 1 + metadata_options: + http_put_response_hop_limit: 1 + http_tokens: required + http_protocol_ipv6: enabled + instance_metadata_tags: enabled + register: _create + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while the template was not created + ansible.builtin.assert: + that: + - _create is changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.core_count == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.threads_per_core == 3 + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_put_response_hop_limit == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_tokens == 'required' + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_protocol_ipv6 == 'enabled' + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.instance_metadata_tags == 'enabled' + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].associate_public_ip_address == False + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].delete_on_termination == True + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].device_index == 0 + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].associate_public_ip_address == True + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].delete_on_termination == False + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].device_index == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].ipv6_address_count == 1 + + - name: Create launch template once again with same parameters (idempotency) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + instance_type: c4.large + cpu_options: + core_count: 1 + threads_per_core: 3 + network_interfaces: + - device_index: 0 + associate_public_ip_address: false + delete_on_termination: true + - device_index: 1 + associate_public_ip_address: true + delete_on_termination: false + ipv6_address_count: 1 + metadata_options: + http_put_response_hop_limit: 1 + http_tokens: required + http_protocol_ipv6: enabled + instance_metadata_tags: enabled + register: _create_idempotency + + - name: Retrieve Launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _templates + + - name: Ensure module reported change while the template was not created + ansible.builtin.assert: + that: + - _create_idempotency is not changed + - _templates.launch_templates | length == 1 + - _templates.launch_templates[0].versions | length == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.core_count == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.threads_per_core == 3 + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_put_response_hop_limit == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_tokens == 'required' + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_protocol_ipv6 == 'enabled' + - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.instance_metadata_tags == 'enabled' + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].associate_public_ip_address == False + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].delete_on_termination == True + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].device_index == 0 + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].associate_public_ip_address == True + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].delete_on_termination == False + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].device_index == 1 + - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].ipv6_address_count == 1 + + always: + - name: delete the template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + state: absent + ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/versions.yml b/tests/integration/targets/ec2_launch_template/tasks/versions.yml index a9e40cd0843..666c5653836 100644 --- a/tests/integration/targets/ec2_launch_template/tasks/versions.yml +++ b/tests/integration/targets/ec2_launch_template/tasks/versions.yml @@ -1,95 +1,462 @@ -- block: - - name: create simple instance template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" +- name: Test launch template versioning + vars: + test_launch_template_name: "{{ resource_prefix }}-versioning" + block: + #===================================================================== + # Create the launch template + #===================================================================== + - name: Create a launch template (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" tags: TestId: "{{ resource_prefix }}" instance_type: c4.large - register: lt + register: _create_check + check_mode: true - - name: instance with cpu_options created with the right options - assert: + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure module reported changed while the template was not created + ansible.builtin.assert: + that: + - _create_check is changed + - '"default_version" not in _create_check' + - '"latest_version" not in _create_check' + - _template_info.launch_templates | length == 0 + + - name: Create a launch template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: c4.large + register: _create + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info + + - name: Ensure the launch template was created with the right version + ansible.builtin.assert: that: - - lt is success - - lt is changed - - lt.default_version == 1 - - lt.latest_version == 1 + - _create is changed + - _create.default_version == 1 + - _create.latest_version == 1 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 1 + - _template_info.launch_templates[0].versions | length == 1 + - _template_info.launch_templates[0].versions.0.launch_template_data.image_id == ec2_ami_id + - _template_info.launch_templates[0].versions.0.launch_template_data.instance_type == "c4.large" - - name: update simple instance template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" + - name: Create the same launch template once again + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: c4.large + register: _create_idempotency + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the module did not reported change (idempotency) + ansible.builtin.assert: + that: + - _create_idempotency is not changed + - _create.default_version == 1 + - _create.latest_version == 1 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 1 + - _template_info.launch_templates[0].versions | length == 1 + - _template_info.launch_templates[0].versions.0.launch_template_data.image_id == ec2_ami_id + - _template_info.launch_templates[0].versions.0.launch_template_data.instance_type == "c4.large" + + #===================================================================== + # Create a new version of the launch template (set first version as default) + #===================================================================== + - name: Create a new version of the launch template (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" default_version: 1 image_id: "{{ ec2_ami_id }}" tags: TestId: "{{ resource_prefix }}" instance_type: m5.large - register: lt + register: _update_check + check_mode: true + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info - - name: instance with cpu_options created with the right options - assert: + - name: Ensure the module reported change in check mode + ansible.builtin.assert: that: - - lt is success - - lt is changed - - lt.default_version == 1 - - lt.latest_version == 2 + - _update_check is changed + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 1 + - _template_info.launch_templates[0].versions | length == 1 - - name: update simple instance template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" + - name: Create a new version of the launch template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + default_version: 1 + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: m5.large + register: _update + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the launch template latest version has changed + ansible.builtin.assert: + that: + - _update is changed + - _update.default_version == 1 + - _update.latest_version == 2 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + - created_template.launch_template_data.image_id == ec2_ami_id + - created_template.launch_template_data.instance_type == "m5.large" + vars: + created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | first }}" + + - name: Create a new version of the launch template (idempotency) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + default_version: 1 + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: m5.large + register: _update_idempotency + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the module did not reported change (idempotency) + ansible.builtin.assert: + that: + - _update_idempotency is not changed + - _update_idempotency.default_version == 1 + - _update_idempotency.latest_version == 2 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + + #===================================================================== + # Set the latest version of the launch template as default + #===================================================================== + - name: Set the latest version of the launch template as default (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + default_version: latest + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: m5.large + register: _set_version_check + check_mode: true + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the module reported change in check mode + ansible.builtin.assert: + that: + - _set_version_check is changed + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 1 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + + - name: Set the latest version of the launch template as default + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + default_version: latest + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: m5.large + register: _set_version + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the launch template latest version has changed + ansible.builtin.assert: + that: + - _set_version is changed + - _set_version.default_version == 2 + - _set_version.latest_version == 2 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 2 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + - created_template.launch_template_data.image_id == ec2_ami_id + - created_template.launch_template_data.instance_type == "m5.large" + vars: + created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | first }}" + + - name: Set the latest version of the launch template as default (idempotency) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + default_version: latest + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: m5.large + register: _set_version_idempotency + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + filters: + launch-template-name: "{{ test_launch_template_name }}" + register: _template_info + + - name: Ensure the module did not reported change (idempotency) + ansible.builtin.assert: + that: + - _set_version_idempotency is not changed + - _set_version_idempotency.default_version == 2 + - _set_version_idempotency.latest_version == 2 + - _template_info.launch_templates[0].default_version_number == 2 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + + #===================================================================== + # Create another version + #===================================================================== + - name: Create a new launch template version (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: t3.medium + register: _another_version_check + check_mode: true + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info + + - name: Ensure the module reported change in check_mode + ansible.builtin.assert: + that: + - _another_version_check is changed + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 2 + - _template_info.launch_templates[0].latest_version_number == 2 + - _template_info.launch_templates[0].versions | length == 2 + + - name: Create a new launch template version + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" image_id: "{{ ec2_ami_id }}" tags: TestId: "{{ resource_prefix }}" instance_type: t3.medium - register: lt + register: _another_version + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info - - name: instance with cpu_options created with the right options - assert: + - name: Ensure the launch template latest version has changed + ansible.builtin.assert: that: - - lt is success - - lt is changed - - lt.default_version == 3 - - lt.latest_version == 3 + - _another_version is changed + - _another_version.default_version == 3 + - _another_version.latest_version == 3 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 3 + - _template_info.launch_templates[0].latest_version_number == 3 + - _template_info.launch_templates[0].versions | length == 3 + - created_template.launch_template_data.image_id == ec2_ami_id + - created_template.launch_template_data.instance_type == "t3.medium" + vars: + created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 3) | first }}" - - name: create new template version based on an old version - ec2_launch_template: - name: "{{ resource_prefix }}-simple" + - name: Create a new launch template version (idempotency) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + image_id: "{{ ec2_ami_id }}" + tags: + TestId: "{{ resource_prefix }}" + instance_type: t3.medium + register: _another_version_idempotency + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info + + - name: Ensure the module did not reported change (idempotency) + ansible.builtin.assert: + that: + - _another_version_idempotency is not changed + - _another_version_idempotency.default_version == 3 + - _another_version_idempotency.latest_version == 3 + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 3 + - _template_info.launch_templates[0].latest_version_number == 3 + - _template_info.launch_templates[0].versions | length == 3 + + #===================================================================== + # Create another version based on an old version + #===================================================================== + - name: Create new template version based on an old version (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + cpu_options: + core_count: 1 + threads_per_core: 1 + source_version: 1 + register: _version_based_on_old_version_check + check_mode: true + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info + + - name: Ensure module reported change in check mode + ansible.builtin.assert: + that: + - _version_based_on_old_version_check is changed + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 3 + - _template_info.launch_templates[0].latest_version_number == 3 + - _template_info.launch_templates[0].versions | length == 3 + + - name: Create new template version based on an old version + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" cpu_options: core_count: 1 threads_per_core: 1 source_version: 1 - register: lt + register: _version_based_on_old_version + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info - - name: instance with cpu_options created with the right options - assert: + - name: Ensure the new launch template has been created with the right options + ansible.builtin.assert: that: - - lt is success - - lt is changed - - lt.default_version == 4 - - lt.latest_version == 4 - - lt.latest_template.launch_template_data.instance_type == "c4.large" + - _version_based_on_old_version is changed + - _version_based_on_old_version.default_version == 4 + - _version_based_on_old_version.latest_version == 4 + - _version_based_on_old_version.latest_template.launch_template_data.instance_type == "c4.large" + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 4 + - _template_info.launch_templates[0].latest_version_number == 4 + - _template_info.launch_templates[0].versions | length == 4 + - created_template.launch_template_data.image_id == ec2_ami_id + - created_template.launch_template_data.cpu_options.core_count == 1 + - created_template.launch_template_data.cpu_options.threads_per_core == 1 + vars: + created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 4) | first }}" - - name: update simple instance template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" + #===================================================================== + # Create another version with updated description + #===================================================================== + - name: Create a launch template version with another description (check mode) + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" version_description: "Fix something." - register: lt + register: _version_description_check + check_mode: true + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info + + - name: Ensure module reported change in check mode + ansible.builtin.assert: + that: + - _version_description_check is changed + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 4 + - _template_info.launch_templates[0].latest_version_number == 4 + - _template_info.launch_templates[0].versions | length == 4 + + - name: Create a launch template version with another description + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" + version_description: "Fix something." + register: _version_description + + - name: Read launch template information + amazon.aws.ec2_launch_template_info: + launch_template_ids: + - "{{ _create.template.launch_template_id }}" + register: _template_info - - name: instance with cpu_options created with the right options - assert: + - name: Ensure module reported change + ansible.builtin.assert: that: - - lt is success - - lt is changed - - lt.default_version == 5 - - lt.latest_version == 5 - - lt.latest_template.version_description == "Fix something." + - _version_description is changed + - _version_description.default_version == 5 + - _version_description.latest_version == 5 + - _version_description.latest_template.version_description == "Fix something." + - _template_info.launch_templates | length == 1 + - _template_info.launch_templates[0].default_version_number == 5 + - _template_info.launch_templates[0].latest_version_number == 5 + - _template_info.launch_templates[0].versions | length == 5 + - created_template.version_description == "Fix something." + vars: + created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 5) | first }}" always: - - name: delete the template - ec2_launch_template: - name: "{{ resource_prefix }}-simple" + - name: Delete the template + community.aws.ec2_launch_template: + name: "{{ test_launch_template_name }}" state: absent - register: del_lt - retries: 10 - until: del_lt is not failed ignore_errors: true From b78cba1556271d404bc434cbef7f58a107f5545c Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 23 Oct 2024 06:49:29 -0700 Subject: [PATCH 58/77] Prepare ec2_vpc_vgw_* modules for promotion (#2171) SUMMARY Depends-On: ansible-collections/amazon.aws#2331 Prepare ec2_vpc_vgw_* modules for promotion ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_vpc_vgw ec2_vpc_vgw_info ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni Reviewed-by: Bikouo Aubin Reviewed-by: GomathiselviS --- .../refactor-ec2_vpc_vgw-modules.yml | 3 + plugins/modules/ec2_vpc_vgw.py | 414 +++++++++--------- plugins/modules/ec2_vpc_vgw_info.py | 70 ++- .../targets/ec2_vpc_vgw/tasks/main.yml | 175 ++++++-- .../targets/ec2_vpc_vgw/tasks/tags.yml | 331 +++++++------- 5 files changed, 539 insertions(+), 454 deletions(-) create mode 100644 changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml diff --git a/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml b/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml new file mode 100644 index 00000000000..917d10ade72 --- /dev/null +++ b/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml @@ -0,0 +1,3 @@ +minor_changes: + - ec2_vpc_vgw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). + - ec2_vpc_vgw_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). diff --git a/plugins/modules/ec2_vpc_vgw.py b/plugins/modules/ec2_vpc_vgw.py index b6f91e5dfc1..c82236e0570 100644 --- a/plugins/modules/ec2_vpc_vgw.py +++ b/plugins/modules/ec2_vpc_vgw.py @@ -9,15 +9,15 @@ short_description: Create and delete AWS VPN Virtual Gateways version_added: 1.0.0 description: - - Creates AWS VPN Virtual Gateways - - Deletes AWS VPN Virtual Gateways - - Attaches Virtual Gateways to VPCs - - Detaches Virtual Gateways from VPCs + - Creates AWS VPN Virtual Gateways. + - Deletes AWS VPN Virtual Gateways. + - Attaches Virtual Gateways to VPCs. + - Detaches Virtual Gateways from VPCs. options: state: description: - - C(present) to ensure resource is created. - - C(absent) to remove resource. + - V(present) to ensure resource is created. + - V(absent) to remove resource. default: present choices: [ "present", "absent"] type: str @@ -49,7 +49,7 @@ default: 320 type: int notes: - - Support for I(purge_tags) was added in release 4.0.0. + - Support for O(purge_tags) was added in release 4.0.0. author: - Nick Aslanidis (@naslanidis) extends_documentation_fragment: @@ -68,7 +68,6 @@ vpc_id: vpc-12345678 name: personal-testing type: ipsec.1 - register: created_vgw - name: Create a new unattached VGW community.aws.ec2_vpc_vgw: @@ -80,7 +79,6 @@ tags: environment: production owner: ABC - register: created_vgw - name: Remove a new VGW using the name community.aws.ec2_vpc_vgw: @@ -89,7 +87,6 @@ profile: personal name: personal-testing type: ipsec.1 - register: deleted_vgw - name: Remove a new VGW using the vpn_gateway_id community.aws.ec2_vpc_vgw: @@ -97,55 +94,81 @@ region: ap-southeast-2 profile: personal vpn_gateway_id: vgw-3a9aa123 - register: deleted_vgw + +- name: Detach vpn gateway from VPC + community.aws.ec2_vpc_vgw: + state: present + name: "{{ vgw_name }}" + register: vgw + +- name: Delete vpn gateway + community.aws.ec2_vpc_vgw: + state: absent + vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}' + ignore_errors: true """ RETURN = r""" vgw: - description: A description of the VGW + description: Information about the virtual private gateway. returned: success type: dict contains: id: - description: The ID of the VGW. + description: The ID of the virtual private gateway. type: str returned: success - example: "vgw-0123456789abcdef0" + sample: "vgw-0123456789abcdef0" state: - description: The state of the VGW. + description: The current state of the virtual private gateway. type: str returned: success - example: "available" + sample: "available" tags: - description: A dictionary representing the tags attached to the VGW + description: A dictionary representing the tags attached to the virtual private gateway. type: dict returned: success - example: { "Name": "ansible-test-ec2-vpc-vgw" } + sample: { + "Name": "ansible-test-ec2-vpc-vgw", + "Env": "Dev_Test_001" + } type: description: The type of VPN connection the virtual private gateway supports. type: str returned: success - example: "ipsec.1" + sample: "ipsec.1" vpc_id: - description: The ID of the VPC to which the VGW is attached. + description: The ID of the VPC. type: str returned: success - example: vpc-123456789abcdef01 + sample: "vpc-123456789abcdef01" """ -import time - try: import botocore except ImportError: pass # Handled by AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code +from typing import Any +from typing import Dict +from typing import List +from typing import Optional +from typing import Tuple +from typing import Union + +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import attach_vpn_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpcs +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_gateways +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import detach_vpn_gateway from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications from ansible_collections.amazon.aws.plugins.module_utils.waiters import get_waiter +from ansible_collections.amazon.aws.plugins.module_utils.waiters import wait_for_resource_state from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule @@ -154,14 +177,14 @@ # we need to look at the mesage to tell the difference. class VGWRetry(AWSRetry): @staticmethod - def status_code_from_exception(error): + def status_code_from_exception(error: Any) -> Tuple[str, str]: return ( error.response["Error"]["Code"], error.response["Error"]["Message"], ) @staticmethod - def found(response_code, catch_extra_error_codes=None): + def found(response_code: Union[str, Tuple[str, ...]], catch_extra_error_codes: Optional[List[str]] = None) -> bool: retry_on = ["The maximum number of mutating objects has been reached."] if catch_extra_error_codes: @@ -176,147 +199,131 @@ def found(response_code, catch_extra_error_codes=None): return False -def get_vgw_info(vgws): - if not isinstance(vgws, list): +def format_vgw_info(vgw: Dict) -> Optional[Dict[str, Any]]: + # to handle check mode case where vgw passed to this function is {} + if not vgw: return - for vgw in vgws: - vgw_info = { - "id": vgw["VpnGatewayId"], - "type": vgw["Type"], - "state": vgw["State"], - "vpc_id": None, - "tags": dict(), - } + vgw_info = { + "id": vgw["VpnGatewayId"], + "type": vgw["Type"], + "state": vgw["State"], + "vpc_id": None, + "tags": dict(), + } - if vgw["Tags"]: - vgw_info["tags"] = boto3_tag_list_to_ansible_dict(vgw["Tags"]) + if vgw["Tags"]: + vgw_info["tags"] = boto3_tag_list_to_ansible_dict(vgw["Tags"]) - if len(vgw["VpcAttachments"]) != 0 and vgw["VpcAttachments"][0]["State"] == "attached": - vgw_info["vpc_id"] = vgw["VpcAttachments"][0]["VpcId"] + if len(vgw["VpcAttachments"]) != 0 and vgw["VpcAttachments"][0]["State"] == "attached": + vgw_info["vpc_id"] = vgw["VpcAttachments"][0]["VpcId"] - return vgw_info + return vgw_info -def wait_for_status(client, module, vpn_gateway_id, status): +def wait_for_status(client, module: AnsibleAWSModule, vpn_gateway_id: str, desired_status: str) -> Tuple[bool, Any]: polling_increment_secs = 15 max_retries = module.params.get("wait_timeout") // polling_increment_secs - status_achieved = False - - for x in range(0, max_retries): - try: - response = find_vgw(client, module, vpn_gateway_id) - if response[0]["VpcAttachments"][0]["State"] == status: - status_achieved = True - break - else: - time.sleep(polling_increment_secs) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failure while waiting for status update") + try: + wait_for_resource_state(client, module, "vpn_gateway_exists", VpnGatewayIds=[vpn_gateway_id]) + if desired_status not in ("attached", "detached"): + module.fail_json(msg=f"Unsupported status: {desired_status}") + wait_for_resource_state( + client, + module, + f"vpn_gateway_{desired_status}", + VpnGatewayIds=[vpn_gateway_id], + delay=polling_increment_secs, + max_attempts=max_retries, + ) - result = response - return status_achieved, result + response = find_vgw(client, module, vpn_gateway_id) + status_achieved = response[0]["VpcAttachments"][0]["State"] == desired_status + except AnsibleEC2Error as e: + module.fail_json_aws(e) -def attach_vgw(client, module, vpn_gateway_id): - params = dict() - params["VpcId"] = module.params.get("vpc_id") + return status_achieved, response + + +def attach_vgw_to_vpc(client, module: AnsibleAWSModule, vpn_gateway_id: str) -> bool: + if module.check_mode: + return True + response = None + vpc_id = module.params.get("vpc_id") + response = attach_vpn_gateway(client, vpc_id, vpn_gateway_id) + status_achieved, vgw = wait_for_status(client, module, vpn_gateway_id, "attached") - try: - # Immediately after a detachment, the EC2 API sometimes will report the VpnGateways[0].State - # as available several seconds before actually permitting a new attachment. - # So we catch and retry that error. See https://github.com/ansible/ansible/issues/53185 - response = VGWRetry.jittered_backoff(retries=5, catch_extra_error_codes=["InvalidParameterValue"])( - client.attach_vpn_gateway - )(VpnGatewayId=vpn_gateway_id, VpcId=params["VpcId"]) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to attach VPC") - - status_achieved, vgw = wait_for_status(client, module, [vpn_gateway_id], "attached") if not status_achieved: - module.fail_json(msg="Error waiting for vpc to attach to vgw - please check the AWS console") + module.fail_json(msg="Error waiting for VPC to attach to VGW - please check the AWS console") - result = response - return result + return response -def detach_vgw(client, module, vpn_gateway_id, vpc_id=None): - params = dict() - params["VpcId"] = module.params.get("vpc_id") +def detach_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: str, vpc_id: Optional[str] = None) -> bool: + if module.check_mode: + return True + response = None + vpc_id = vpc_id or module.params.get("vpc_id") - try: - if vpc_id: - response = client.detach_vpn_gateway(VpnGatewayId=vpn_gateway_id, VpcId=vpc_id, aws_retry=True) - else: - response = client.detach_vpn_gateway(VpnGatewayId=vpn_gateway_id, VpcId=params["VpcId"], aws_retry=True) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, "Failed to detach gateway") + response = detach_vpn_gateway(client, vpc_id, vpn_gateway_id) - status_achieved, vgw = wait_for_status(client, module, [vpn_gateway_id], "detached") + status_achieved, vgw = wait_for_status(client, module, vpn_gateway_id, "detached") if not status_achieved: module.fail_json(msg="Error waiting for vpc to detach from vgw - please check the AWS console") - result = response - return result + return response -def create_vgw(client, module): - params = dict() - params["Type"] = module.params.get("type") - tags = module.params.get("tags") or {} - tags["Name"] = module.params.get("name") - params["TagSpecifications"] = boto3_tag_specifications(tags, ["vpn-gateway"]) +def create_vgw(client, module: AnsibleAWSModule) -> Dict: + if module.check_mode: + return {} + + params = { + "Type": module.params.get("type"), + "TagSpecifications": boto3_tag_specifications( + {**(module.params.get("tags") or {}), "Name": module.params.get("name")}, ["vpn-gateway"] + ), + } + if module.params.get("asn"): params["AmazonSideAsn"] = module.params.get("asn") try: - response = client.create_vpn_gateway(aws_retry=True, **params) - get_waiter(client, "vpn_gateway_exists").wait(VpnGatewayIds=[response["VpnGateway"]["VpnGatewayId"]]) + create_vgw_result = create_vpn_gateway(client, **params) + get_waiter(client, "vpn_gateway_exists").wait(VpnGatewayIds=[create_vgw_result["VpnGatewayId"]]) except botocore.exceptions.WaiterError as e: module.fail_json_aws( - e, msg=f"Failed to wait for Vpn Gateway {response['VpnGateway']['VpnGatewayId']} to be available" + e, msg=f"Failed to wait for Vpn Gateway {create_vgw_result['VpnGatewayId']} to be available" ) - except is_boto3_error_code("VpnGatewayLimitExceeded") as e: - module.fail_json_aws(e, msg="Too many VPN gateways exist in this account.") - except ( - botocore.exceptions.ClientError, - botocore.exceptions.BotoCoreError, - ) as e: # pylint: disable=duplicate-except - module.fail_json_aws(e, msg="Failed to create gateway") - - result = response - return result + return create_vgw_result -def delete_vgw(client, module, vpn_gateway_id): - try: - response = client.delete_vpn_gateway(VpnGatewayId=vpn_gateway_id, aws_retry=True) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to delete gateway") + +def delete_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: str) -> Optional[str]: + delete_vpn_gateway(client, vpn_gateway_id) # return the deleted VpnGatewayId as this is not included in the above response result = vpn_gateway_id return result -def find_vpc(client, module): +def find_vpc(client, module: AnsibleAWSModule) -> Optional[Any]: + response = None params = dict() - params["vpc_id"] = module.params.get("vpc_id") + vpc_id = module.params.get("vpc_id") - if params["vpc_id"]: - try: - response = client.describe_vpcs(VpcIds=[params["vpc_id"]], aws_retry=True) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to describe VPC") + if vpc_id: + params["VpcIds"] = [vpc_id] + response = describe_vpcs(client, **params) - result = response - return result + return response -def find_vgw(client, module, vpn_gateway_id=None): +def find_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: Optional[str] = None) -> List[Dict[str, Any]]: params = dict() if vpn_gateway_id: - params["VpnGatewayIds"] = vpn_gateway_id + params["VpnGatewayIds"] = [vpn_gateway_id] else: params["Filters"] = [ {"Name": "type", "Values": [module.params.get("type")]}, @@ -324,96 +331,87 @@ def find_vgw(client, module, vpn_gateway_id=None): ] if module.params.get("state") == "present": params["Filters"].append({"Name": "state", "Values": ["pending", "available"]}) - try: - response = client.describe_vpn_gateways(aws_retry=True, **params) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to describe gateway using filters") - return sorted(response["VpnGateways"], key=lambda k: k["VpnGatewayId"]) + response = describe_vpn_gateways(client, **params) + return sorted(response, key=lambda k: k["VpnGatewayId"]) -def ensure_vgw_present(client, module): - # If an existing vgw name and type matches our args, then a match is considered to have been - # found and we will not create another vgw. +def ensure_vgw_present(client, module: AnsibleAWSModule) -> Tuple[bool, Dict[str, Any]]: changed = False - params = dict() - result = dict() - params["Name"] = module.params.get("name") - params["VpcId"] = module.params.get("vpc_id") - params["Type"] = module.params.get("type") - params["Tags"] = module.params.get("tags") - params["VpnGatewayIds"] = module.params.get("vpn_gateway_id") + vgw = {} + + # Check if provided vgw already exists + existing_vgw = find_vgw(client, module, module.params.get("vpn_gateway_id")) + + # if existing vgw, handle changes as required + if existing_vgw: + changed |= handle_existing_vgw(client, module, existing_vgw[0]) + vgw = find_vgw(client, module, existing_vgw[0]["VpnGatewayId"])[ + 0 + ] # [0] as find_vgw returns list[dict] i.e. [{vgw_info}] as it is possible to have multiple vgw with same names + # if not existing vgw, create new and return + else: + changed = True + if not module.check_mode: + vgw = create_vgw(client, module) + # if vpc_id provided, attach vgw to vpc + if module.params.get("vpc_id"): + attach_vgw_to_vpc(client, module, vgw["VpnGatewayId"]) + vgw = find_vgw(client, module, vgw["VpnGatewayId"])[0] - # check that the vpc_id exists. If not, an exception is thrown - if params["VpcId"]: - vpc = find_vpc(client, module) + return changed, format_vgw_info(vgw) - # check if a gateway matching our module args already exists - existing_vgw = find_vgw(client, module) - - if existing_vgw != []: - vpn_gateway_id = existing_vgw[0]["VpnGatewayId"] - desired_tags = module.params.get("tags") - purge_tags = module.params.get("purge_tags") - if desired_tags is None: - desired_tags = dict() - purge_tags = False - tags = dict(Name=module.params.get("name")) - tags.update(desired_tags) - changed = ensure_ec2_tags( - client, module, vpn_gateway_id, resource_type="vpn-gateway", tags=tags, purge_tags=purge_tags - ) - # if a vpc_id was provided, check if it exists and if it's attached - if params["VpcId"]: - current_vpc_attachments = existing_vgw[0]["VpcAttachments"] - - if current_vpc_attachments != [] and current_vpc_attachments[0]["State"] == "attached": - if ( - current_vpc_attachments[0]["VpcId"] != params["VpcId"] - or current_vpc_attachments[0]["State"] != "attached" - ): - # detach the existing vpc from the virtual gateway - vpc_to_detach = current_vpc_attachments[0]["VpcId"] - detach_vgw(client, module, vpn_gateway_id, vpc_to_detach) - get_waiter(client, "vpn_gateway_detached").wait(VpnGatewayIds=[vpn_gateway_id]) - attached_vgw = attach_vgw(client, module, vpn_gateway_id) - changed = True - else: - # attach the vgw to the supplied vpc - attached_vgw = attach_vgw(client, module, vpn_gateway_id) - changed = True +def handle_existing_vgw(client, module: AnsibleAWSModule, existing_vgw: dict) -> bool: + changed = False + vpn_gateway_id = existing_vgw["VpnGatewayId"] + provided_vpc_id = module.params.get("vpc_id") + + # Update tags + desired_tags = module.params.get("tags") + purge_tags = module.params.get("purge_tags") + if desired_tags is None: + desired_tags = dict() + purge_tags = False + tags = dict(Name=module.params.get("name")) + tags.update(desired_tags) + # check_mode is handled by esure_ec2_tags() + changed |= ensure_ec2_tags( + client, module, vpn_gateway_id, resource_type="vpn-gateway", tags=tags, purge_tags=purge_tags + ) - # if params['VpcId'] is not provided, check the vgw is attached to a vpc. if so, detach it. + # Manage VPC attachments + current_vpc_attachments = existing_vgw["VpcAttachments"] + if provided_vpc_id: + # if vgw is attached to a vpc + if current_vpc_attachments and current_vpc_attachments[0]["State"] == "attached": + # if provided vpc is differenct than current vpc, then detach current vpc, attach new vpc + if provided_vpc_id != current_vpc_attachments[0]["VpcId"]: + if module.check_mode: + return True + detach_vgw(client, module, vpn_gateway_id, current_vpc_attachments[0]["VpcId"]) + get_waiter(client, "vpn_gateway_detached").wait(VpnGatewayIds=[vpn_gateway_id]) + attach_vgw_to_vpc(client, module, vpn_gateway_id) + changed = True + # if vgw is not currently attached to a vpc, attach it to provided vpc else: - existing_vgw = find_vgw(client, module, [vpn_gateway_id]) - - if existing_vgw[0]["VpcAttachments"] != []: - if existing_vgw[0]["VpcAttachments"][0]["State"] == "attached": - # detach the vpc from the vgw - vpc_to_detach = existing_vgw[0]["VpcAttachments"][0]["VpcId"] - detach_vgw(client, module, vpn_gateway_id, vpc_to_detach) - changed = True - + if module.check_mode: + return True + attach_vgw_to_vpc(client, module, vpn_gateway_id) + changed = True + # if vpc_id not provided, then detach vgw from vpc else: - # create a new vgw - new_vgw = create_vgw(client, module) - changed = True - vpn_gateway_id = new_vgw["VpnGateway"]["VpnGatewayId"] - - # if a vpc-id was supplied, attempt to attach it to the vgw - if params["VpcId"]: - attached_vgw = attach_vgw(client, module, vpn_gateway_id) + if current_vpc_attachments and current_vpc_attachments[0]["State"] == "attached": + if module.check_mode: + return True + detach_vgw(client, module, vpn_gateway_id, current_vpc_attachments[0]["VpcId"]) changed = True - # return current state of the vgw - vgw = find_vgw(client, module, [vpn_gateway_id]) - result = get_vgw_info(vgw) - return changed, result + return changed -def ensure_vgw_absent(client, module): +def ensure_vgw_absent(client, module: AnsibleAWSModule) -> Tuple[bool, Optional[str]]: # If an existing vgw name and type matches our args, then a match is considered to have been # found and we will take steps to delete it. @@ -426,11 +424,14 @@ def ensure_vgw_absent(client, module): params["Type"] = module.params.get("type") params["Tags"] = module.params.get("tags") params["VpnGatewayIds"] = module.params.get("vpn_gateway_id") + vpn_gateway_id = module.params.get("vpn_gateway_id") # check if a gateway matching our module args already exists if params["VpnGatewayIds"]: - existing_vgw_with_id = find_vgw(client, module, [params["VpnGatewayIds"]]) + existing_vgw_with_id = find_vgw(client, module, module.params.get("vpn_gateway_id")) if existing_vgw_with_id != [] and existing_vgw_with_id[0]["State"] != "deleted": + if module.check_mode: + return True, existing_vgw_with_id[0]["VpnGatewayId"] existing_vgw = existing_vgw_with_id if existing_vgw[0]["VpcAttachments"] != [] and existing_vgw[0]["VpcAttachments"][0]["State"] == "attached": if params["VpcId"]: @@ -447,8 +448,8 @@ def ensure_vgw_absent(client, module): else: # attempt to detach any attached vpcs - vpc_to_detach = existing_vgw[0]["VpcAttachments"][0]["VpcId"] - detach_vgw(client, module, params["VpnGatewayIds"], vpc_to_detach) + for vpc in existing_vgw[0]["VpcAttachments"]: + detach_vgw(client, module, vpn_gateway_id, vpc["VpcId"]) deleted_vgw = delete_vgw(client, module, params["VpnGatewayIds"]) changed = True @@ -477,6 +478,8 @@ def ensure_vgw_absent(client, module): ) else: + if module.check_mode: + return True, None # detach the vpc from the vgw detach_vgw(client, module, vpn_gateway_id, params["VpcId"]) @@ -485,6 +488,8 @@ def ensure_vgw_absent(client, module): changed = True else: + if module.check_mode: + return True, vpn_gateway_id # attempt to detach any attached vpcs vpc_to_detach = existing_vgw[0]["VpcAttachments"][0]["VpcId"] detach_vgw(client, module, vpn_gateway_id, vpc_to_detach) @@ -494,6 +499,8 @@ def ensure_vgw_absent(client, module): deleted_vgw = delete_vgw(client, module, vpn_gateway_id) else: + if module.check_mode: + return True, vpn_gateway_id # no vpc's are attached so attempt to delete the vgw deleted_vgw = delete_vgw(client, module, vpn_gateway_id) changed = True @@ -518,11 +525,14 @@ def main(): tags=dict(default=None, required=False, type="dict", aliases=["resource_tags"]), purge_tags=dict(default=True, type="bool"), ) - module = AnsibleAWSModule(argument_spec=argument_spec, required_if=[["state", "present", ["name"]]]) - + module = AnsibleAWSModule( + argument_spec=argument_spec, + required_if=[["state", "present", ["name"]]], + supports_check_mode=True, + ) state = module.params.get("state").lower() - client = module.client("ec2", retry_decorator=VGWRetry.jittered_backoff(retries=10)) + client = module.client("ec2") if state == "present": (changed, results) = ensure_vgw_present(client, module) diff --git a/plugins/modules/ec2_vpc_vgw_info.py b/plugins/modules/ec2_vpc_vgw_info.py index 6ab311c038f..79576acf288 100644 --- a/plugins/modules/ec2_vpc_vgw_info.py +++ b/plugins/modules/ec2_vpc_vgw_info.py @@ -19,8 +19,7 @@ type: dict default: {} vpn_gateway_ids: - description: - - Get details of a specific Virtual Gateway ID. + description: One or more virtual private gateway IDs. type: list elements: str author: @@ -32,13 +31,11 @@ """ EXAMPLES = r""" -# # Note: These examples do not set authentication details, see the AWS Guide for details. +# Note: These examples do not set authentication details, see the AWS Guide for details. - name: Gather information about all virtual gateways for an account or profile community.aws.ec2_vpc_vgw_info: region: ap-southeast-2 - profile: production - register: vgw_info - name: Gather information about a filtered list of Virtual Gateways community.aws.ec2_vpc_vgw_info: @@ -46,40 +43,38 @@ profile: production filters: "tag:Name": "main-virt-gateway" - register: vgw_info - name: Gather information about a specific virtual gateway by VpnGatewayIds community.aws.ec2_vpc_vgw_info: region: ap-southeast-2 profile: production vpn_gateway_ids: vgw-c432f6a7 - register: vgw_info """ RETURN = r""" virtual_gateways: - description: The virtual gateways for the account. + description: Information about one or more virtual private gateways. returned: always type: list elements: dict contains: vpn_gateway_id: - description: The ID of the VGW. + description: The ID of the virtual private gateway. type: str returned: success example: "vgw-0123456789abcdef0" state: - description: The current state of the VGW. + description: Informtion about the current state of the virtual private gateway. type: str returned: success example: "available" type: - description: The type of VPN connection the VGW supports. + description: Information about type of VPN connection the virtual private gateway supports. type: str returned: success example: "ipsec.1" vpc_attachments: - description: A description of the attachment of VPCs to the VGW. + description: Information about the VPCs attached to the virtual private gateway. type: list elements: dict returned: success @@ -88,16 +83,16 @@ description: The current state of the attachment. type: str returned: success - example: available + example: "available" vpc_id: description: The ID of the VPC. type: str returned: success - example: vpc-12345678901234567 + example: "vpc-12345678901234567" tags: description: - - A list of dictionaries representing the tags attached to the VGW. - - Represents the same details as I(resource_tags). + - A list of dictionaries representing the tags attached to the virtual private gateway. + - Represents the same details as RV(virtual_gateways.resource_tags). type: list elements: dict returned: success @@ -106,28 +101,28 @@ description: The key of the tag. type: str returned: success - example: MyKey + example: "MyKey" value: description: The value of the tag. type: str returned: success - example: MyValue + example: "MyValue" resource_tags: description: - A dictionary representing the tags attached to the VGW. - - Represents the same details as I(tags). + - Represents the same details as RV(virtual_gateways.tags). type: dict returned: success - example: {"MyKey": "MyValue"} + example: { + "MyKey": "MyValue", + "Env": "Dev_Test_01" + } """ -try: - import botocore -except ImportError: - pass # Handled by AnsibleAWSModule - from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_gateways from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list @@ -150,20 +145,22 @@ def get_virtual_gateway_info(virtual_gateway): def list_virtual_gateways(client, module): params = dict() + vpn_gateway_ids = module.params.get("vpn_gateway_ids") + filters = module.params.get("filters") - params["Filters"] = ansible_dict_to_boto3_filter_list(module.params.get("filters")) - - if module.params.get("vpn_gateway_ids"): - params["VpnGatewayIds"] = module.params.get("vpn_gateway_ids") + if filters: + params["Filters"] = ansible_dict_to_boto3_filter_list(filters) + if vpn_gateway_ids: + params["VpnGatewayIds"] = vpn_gateway_ids try: - all_virtual_gateways = client.describe_vpn_gateways(**params) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to list gateways") + all_virtual_gateways = describe_vpn_gateways(client, **params) + except AnsibleEC2Error as e: + module.fail_json_aws_error(e) return [ camel_dict_to_snake_dict(get_virtual_gateway_info(vgw), ignore_list=["ResourceTags"]) - for vgw in all_virtual_gateways["VpnGateways"] + for vgw in all_virtual_gateways ] @@ -175,12 +172,7 @@ def main(): module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) - try: - connection = module.client("ec2") - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to connect to AWS") - - # call your function here + connection = module.client("ec2") results = list_virtual_gateways(connection, module) module.exit_json(virtual_gateways=results) diff --git a/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml b/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml index f5a850a7140..fefc4b18861 100644 --- a/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml @@ -11,10 +11,8 @@ block: # ============================================================ - - debug: msg="Setting up test dependencies" - - - name: create a VPC - ec2_vpc_net: + - name: Create a VPC + amazon.aws.ec2_vpc_net: name: "{{ vpc_name }}-{{ item }}" state: present cidr_block: "{{ vpc_cidr }}" @@ -23,66 +21,116 @@ register: vpc_result loop: [1, 2] - - name: use set fact for vpc ids - set_fact: + - name: Use set fact for vpc ids + ansible.builtin.set_fact: vpc_id_1: '{{ vpc_result.results.0.vpc.id }}' vpc_id_2: '{{ vpc_result.results.1.vpc.id }}' # ============================================================ - - debug: msg="Running tests" + - name: Create vpn gateway and attach it to vpc - check_mode + community.aws.ec2_vpc_vgw: + state: present + vpc_id: '{{ vpc_id_1 }}' + name: "{{ vgw_name }}" + register: vgw_check_mode + check_mode: true - - name: create vpn gateway and attach it to vpc - ec2_vpc_vgw: + - name: Assert check_mode result - no vgw creation + ansible.builtin.assert: + that: + - vgw_check_mode.changed + - not vgw_check_mode.failed + - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" + - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" + + - name: Create vpn gateway and attach it to vpc + community.aws.ec2_vpc_vgw: state: present vpc_id: '{{ vpc_id_1 }}' name: "{{ vgw_name }}" register: vgw - - name: use set fact for vgw ids - set_fact: + - name: Use set fact for vgw ids + ansible.builtin.set_fact: vgw_id: '{{ vgw.vgw.id }}' - - assert: + - name: Assert result - vgw creation + ansible.builtin.assert: that: - vgw.changed - vgw.vgw.vpc_id == vpc_id_1 - vgw.vgw.tags.Name == vgw_name - - name: test idempotence - ec2_vpc_vgw: + - name: Test idempotence + community.aws.ec2_vpc_vgw: state: present vpc_id: '{{ vpc_id_1 }}' name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert idempotence result - no change + ansible.builtin.assert: that: - not vgw.changed - vgw.vgw.id == vgw_id # ============================================================ - - name: attach vpn gateway to the other VPC - ec2_vpc_vgw: + - name: Attach vpn gateway to the other VPC - check_mode + community.aws.ec2_vpc_vgw: + state: present + vpc_id: '{{ vpc_id_2 }}' + name: "{{ vgw_name }}" + register: vgw_check_mode + check_mode: true + + - name: Assert check_mode result - no create/attach/detach + ansible.builtin.assert: + that: + - vgw_check_mode.changed + - not vgw_check_mode.failed + - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" + - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" + - "'ec2:DetachVpnGateway' not in vgw_check_mode.resource_actions" + + - name: Attach vpn gateway to the other VPC + community.aws.ec2_vpc_vgw: state: present vpc_id: '{{ vpc_id_2 }}' name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert attach result + ansible.builtin.assert: that: - vgw.changed - vgw.vgw.id == vgw_id - vgw.vgw.vpc_id == vpc_id_2 + - name: Attach vpn gateway to the other VPC - idempotency + community.aws.ec2_vpc_vgw: + state: present + vpc_id: '{{ vpc_id_2 }}' + name: "{{ vgw_name }}" + register: vgw + + - name: Assert idempotency result - no change + ansible.builtin.assert: + that: + - not vgw.changed + - not vgw.failed + - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" + - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" + - "'ec2:DetachVpnGateway' not in vgw_check_mode.resource_actions" + # ============================================================ - - name: get VPC VGW facts by ID (CHECK) - ec2_vpc_vgw_info: + - name: Get VPC VGW facts by ID (CHECK) + community.aws.ec2_vpc_vgw_info: vpn_gateway_ids: ['{{ vgw_id }}'] register: vgw_info check_mode: True - - name: verify expected facts + - name: Verify expected facts vars: vgw_details: '{{ vgw_info.virtual_gateways[0] }}' attach_1_description: @@ -91,7 +139,7 @@ attach_2_description: state: 'attached' vpc_id: '{{ vpc_id_2 }}' - assert: + ansible.builtin.assert: that: - vgw_info.virtual_gateways | length == 1 - '"resource_tags" in vgw_details' @@ -112,13 +160,13 @@ ) or ( vgw_details.vpc_attachments | length == 1 ) - attach_2_description in vgw_details.vpc_attachments - - name: get VPC VGW facts by Tag - ec2_vpc_vgw_info: + - name: Get VPC VGW facts by Tag + community.aws.ec2_vpc_vgw_info: filters: "tag:Name": "{{ vgw_name }}" register: vgw_info - - name: verify expected facts + - name: Verify expected facts vars: vgw_details: '{{ vgw_info.virtual_gateways[0] }}' attach_1_description: @@ -127,7 +175,7 @@ attach_2_description: state: 'attached' vpc_id: '{{ vpc_id_2 }}' - assert: + ansible.builtin.assert: that: - vgw_info.virtual_gateways | length == 1 - '"resource_tags" in vgw_details' @@ -150,37 +198,52 @@ # ============================================================ - - name: get all VGWs - ec2_vpc_vgw_info: + - name: Get all VGWs + community.aws.ec2_vpc_vgw_info: register: vgw_info - - name: verify test VGW is in the results + - name: Verify test VGW is in the results vars: vgw_id_list: '{{ vgw_info.virtual_gateways | map(attribute="vpn_gateway_id") | list }}' - assert: + ansible.builtin.assert: that: - vgw_id in vgw_id_list # ============================================================ + - name: Detach vpn gateway - check_mode + community.aws.ec2_vpc_vgw: + state: present + name: "{{ vgw_name }}" + register: vgw_check_mode + check_mode: true + + - name: Assert check_mode results - no detach action + ansible.builtin.assert: + that: + - vgw_check_mode.changed + - not vgw_check_mode.failed + - "'ec2:DetachVpcGateway' not in vgw_check_mode.resource_actions" - - name: detach vpn gateway - ec2_vpc_vgw: + - name: Detach vpn gateway + community.aws.ec2_vpc_vgw: state: present name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert results + ansible.builtin.assert: that: - vgw.changed - not vgw.vgw.vpc_id - - name: test idempotence - ec2_vpc_vgw: + - name: Test idempotence + community.aws.ec2_vpc_vgw: state: present name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert idempotency result - no change + ansible.builtin.assert: that: - not vgw.changed @@ -190,38 +253,54 @@ # ============================================================ - - name: delete vpn gateway - ec2_vpc_vgw: + - name: Delete vpn gateway - check_mode + community.aws.ec2_vpc_vgw: + state: absent + name: "{{ vgw_name }}" + register: vgw_check_mode + check_mode: true + + - name: Assert check_mode result - no delete action + ansible.builtin.assert: + that: + - vgw_check_mode.changed + - not vgw_check_mode.failed + - "'ec2:DeleteVpnGateway' not in vgw_check_mode.resource_actions" + + - name: Delete vpn gateway + community.aws.ec2_vpc_vgw: state: absent name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert result + ansible.builtin.assert: that: - vgw.changed - - name: test idempotence - ec2_vpc_vgw: + - name: Test idempotence + community.aws.ec2_vpc_vgw: state: absent name: "{{ vgw_name }}" register: vgw - - assert: + - name: Assert idempotency result - no change + ansible.builtin.assert: that: - not vgw.changed always: - - debug: msg="Removing test dependencies" + - ansible.builtin.debug: msg="Removing test dependencies" - - name: delete vpn gateway - ec2_vpc_vgw: + - name: Delete vpn gateway + community.aws.ec2_vpc_vgw: state: absent vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}' - ignore_errors: yes + ignore_errors: true - - name: delete vpc - ec2_vpc_net: + - name: Delete vpc + amazon.aws.ec2_vpc_net: name: "{{ vpc_name }}-{{ item }}" state: absent cidr_block: "{{ vpc_cidr }}" diff --git a/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml b/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml index a80521313fb..816e9216813 100644 --- a/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml +++ b/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml @@ -27,7 +27,7 @@ name_tags: Name: '{{ vgw_name }}' module_defaults: - ec2_vpc_vgw: + community.aws.ec2_vpc_vgw: name: '{{ vgw_name }}' ec2_vpc_vgw_info: vpn_gateway_ids: ['{{ vgw_id }}'] @@ -35,61 +35,62 @@ # ============================================================ -# - name: (check) add tags -# ec2_vpc_vgw: -# tags: '{{ first_tags }}' -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would change -# assert: -# that: -# - tag_vgw is changed -# - tag_vgw.vgw.id == vgw_id - - - name: add tags - ec2_vpc_vgw: + - name: Add tags - check_mode + community.aws.ec2_vpc_vgw: tags: '{{ first_tags }}' state: 'present' register: tag_vgw + check_mode: True - - name: get VPC VGW facts + - name: Assert would change + ansible.builtin.assert: + that: + - tag_vgw is changed + - tag_vgw is not failed + - "'ec2:CreateTags' not in tag_vgw.resource_actions" + + - name: Add tags + community.aws.ec2_vpc_vgw: + tags: '{{ first_tags }}' + state: 'present' + register: tag_vgw + + - name: Get VPC VGW facts ec2_vpc_vgw_info: {} register: tag_vgw_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vgw is changed - tag_vgw.vgw.id == vgw_id - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - tag_vgw_info.virtual_gateways[0].resource_tags == ( first_tags | combine(name_tags) ) -# - name: (check) add tags - IDEMPOTENCY -# ec2_vpc_vgw: -# tags: '{{ first_tags }}' -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would not change -# assert: -# that: -# - tag_vgw is not changed -# - tag_vgw.vgw.id == vgw_id - - - name: add tags - IDEMPOTENCY - ec2_vpc_vgw: + - name: Add tags - IDEMPOTENCY - check_mode + community.aws.ec2_vpc_vgw: + tags: '{{ first_tags }}' + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would not change + ansible.builtin.assert: + that: + - tag_vgw is not changed + - tag_vgw.vgw.id == vgw_id + + - name: Add tags - IDEMPOTENCY + community.aws.ec2_vpc_vgw: tags: '{{ first_tags }}' state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: {} register: tag_vgw_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vgw is not changed - tag_vgw.vgw.id == vgw_id @@ -98,15 +99,15 @@ # ============================================================ - - name: get VPC VGW facts by filter + - name: Get VPC VGW facts by filter ec2_vpc_vgw_info: filters: 'tag:Name': '{{ vgw_name }}' vpn_gateway_ids: '{{ omit }}' register: tag_vgw_info - - name: assert the facts are the same as before - assert: + - name: Assert the facts are the same as before + ansible.builtin.assert: that: - tag_vgw_info.virtual_gateways | length == 1 - tag_vgw.vgw.id == vgw_id @@ -114,60 +115,60 @@ # ============================================================ -# - name: (check) modify tags with purge -# ec2_vpc_vgw: -# tags: '{{ second_tags }}' -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would change -# assert: -# that: -# - tag_vgw is changed -# - tag_vgw.vgw.id == vgw_id - - - name: modify tags with purge - ec2_vpc_vgw: + - name: Modify tags with purge - check_mode + community.aws.ec2_vpc_vgw: + tags: '{{ second_tags }}' + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would change + ansible.builtin.assert: + that: + - tag_vgw is changed + - tag_vgw.vgw.id == vgw_id + + - name: Modify tags with purge + community.aws.ec2_vpc_vgw: tags: '{{ second_tags }}' state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vgw is changed - tag_vgw.vgw.id == vgw_id - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - tag_vgw_info.virtual_gateways[0].resource_tags == ( second_tags | combine(name_tags) ) -# - name: (check) modify tags with purge - IDEMPOTENCY -# ec2_vpc_vgw: -# tags: '{{ second_tags }}' -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would not change -# assert: -# that: -# - tag_vgw is not changed -# - tag_vgw.vgw.id == vgw_id - - - name: modify tags with purge - IDEMPOTENCY - ec2_vpc_vgw: + - name: Modify tags with purge - IDEMPOTENCY - check_mode + community.aws.ec2_vpc_vgw: + tags: '{{ second_tags }}' + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would not change + ansible.builtin.assert: + that: + - tag_vgw is not changed + - tag_vgw.vgw.id == vgw_id + + - name: Modify tags with purge - IDEMPOTENCY + community.aws.ec2_vpc_vgw: tags: '{{ second_tags }}' state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vgw is not changed - tag_vgw.vgw.id == vgw_id @@ -176,64 +177,64 @@ # ============================================================ -# - name: (check) modify tags without purge -# ec2_vpc_vgw: -# tags: '{{ third_tags }}' -# state: 'present' -# purge_tags: False -# register: tag_vgw -# check_mode: True -# -# - name: assert would change -# assert: -# that: -# - tag_vgw is changed -# - tag_vgw.vgw.id == vgw_id - - - name: modify tags without purge - ec2_vpc_vgw: + - name: Modify tags without purge - check_mode + community.aws.ec2_vpc_vgw: tags: '{{ third_tags }}' state: 'present' purge_tags: False register: tag_vgw - - name: get VPC VGW facts + check_mode: True + + - name: Assert would change + ansible.builtin.assert: + that: + - tag_vgw is changed + - tag_vgw.vgw.id == vgw_id + + - name: Modify tags without purge + community.aws.ec2_vpc_vgw: + tags: '{{ third_tags }}' + state: 'present' + purge_tags: False + register: tag_vgw + - name: et VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vgw is changed - tag_vgw.vgw.id == vgw_id - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - tag_vgw_info.virtual_gateways[0].resource_tags == ( final_tags | combine(name_tags) ) -# - name: (check) modify tags without purge - IDEMPOTENCY -# ec2_vpc_vgw: -# tags: '{{ third_tags }}' -# state: 'present' -# purge_tags: False -# register: tag_vgw -# check_mode: True -# -# - name: assert would not change -# assert: -# that: -# - tag_vgw is not changed -# - tag_vgw.vgw.id == vgw_id - - - name: modify tags without purge - IDEMPOTENCY - ec2_vpc_vgw: + - name: Modify tags without purge - IDEMPOTENCY - check_mode + community.aws.ec2_vpc_vgw: + tags: '{{ third_tags }}' + state: 'present' + purge_tags: False + register: tag_vgw + check_mode: True + + - name: Assert would not change + ansible.builtin.assert: + that: + - tag_vgw is not changed + - tag_vgw.vgw.id == vgw_id + + - name: Modify tags without purge - IDEMPOTENCY + community.aws.ec2_vpc_vgw: tags: '{{ third_tags }}' state: 'present' purge_tags: False register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vgw is not changed - tag_vgw.vgw.id == vgw_id @@ -242,28 +243,28 @@ # ============================================================ -# - name: (check) No change to tags without setting tags -# ec2_vpc_vgw: -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would change -# assert: -# that: -# - tag_vgw is not changed -# - tag_vgw.vgw.id == vgw_id + - name: No change to tags without setting tags - check_mode + community.aws.ec2_vpc_vgw: + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would change + ansible.builtin.assert: + that: + - tag_vgw is not changed + - tag_vgw.vgw.id == vgw_id - name: No change to tags without setting tags - ec2_vpc_vgw: + community.aws.ec2_vpc_vgw: state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vgw is not changed - tag_vgw.vgw.id == vgw_id @@ -272,60 +273,60 @@ # ============================================================ -# - name: (check) remove non name tags -# ec2_vpc_vgw: -# tags: {} -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would change -# assert: -# that: -# - tag_vgw is changed -# - tag_vgw.vgw.id == vgw_id - - - name: remove non name tags - ec2_vpc_vgw: + - name: Remove non name tags - check_mode + community.aws.ec2_vpc_vgw: + tags: {} + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would change + ansible.builtin.assert: + that: + - tag_vgw is changed + - tag_vgw.vgw.id == vgw_id + + - name: Remove non name tags + community.aws.ec2_vpc_vgw: tags: {} state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify the tags were added - assert: + - name: Verify the tags were added + ansible.builtin.assert: that: - tag_vgw is changed - tag_vgw.vgw.id == vgw_id - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - tag_vgw_info.virtual_gateways[0].resource_tags == name_tags -# - name: (check) remove non name tags - IDEMPOTENCY -# ec2_vpc_vgw: -# tags: {} -# state: 'present' -# register: tag_vgw -# check_mode: True -# -# - name: assert would not change -# assert: -# that: -# - tag_vgw is not changed -# - tag_vgw.vgw.id == vgw_id - - - name: remove non name tags - IDEMPOTENCY - ec2_vpc_vgw: + - name: Remove non name tags - IDEMPOTENCY - check_mode + community.aws.ec2_vpc_vgw: + tags: {} + state: 'present' + register: tag_vgw + check_mode: True + + - name: Assert would not change + ansible.builtin.assert: + that: + - tag_vgw is not changed + - tag_vgw.vgw.id == vgw_id + + - name: Remove non name tags - IDEMPOTENCY + community.aws.ec2_vpc_vgw: tags: {} state: 'present' register: tag_vgw - - name: get VPC VGW facts + - name: Get VPC VGW facts ec2_vpc_vgw_info: register: tag_vgw_info - - name: verify no change - assert: + - name: Verify no change + ansible.builtin.assert: that: - tag_vgw is not changed - tag_vgw.vgw.id == vgw_id From fc782d210a577f04c97f4937e068b6f415c78e1b Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Wed, 23 Oct 2024 10:47:13 -0700 Subject: [PATCH 59/77] Refactor ec2_transit_gateway_* modules (#2158) SUMMARY Refactor ec2_transit_gateway and ec2_transit_gateway_info modules common code moved to module_utils ansible-collections/amazon.aws#2325 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ec2_transit_gateway ec2_transit_gateway_info ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Alina Buzachis Reviewed-by: Mandar Kulkarni Reviewed-by: Bikouo Aubin --- .../refactor-ec2_transit_gateway-modules.yml | 3 + plugins/modules/ec2_transit_gateway.py | 266 ++++++++---------- plugins/modules/ec2_transit_gateway_info.py | 158 +++++------ .../ec2_transit_gateway/tasks/main.yml | 258 ++++++++++++----- .../tasks/setup.yml | 2 +- 5 files changed, 386 insertions(+), 301 deletions(-) create mode 100644 changelogs/fragments/refactor-ec2_transit_gateway-modules.yml diff --git a/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml b/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml new file mode 100644 index 00000000000..cfcfe6476e0 --- /dev/null +++ b/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml @@ -0,0 +1,3 @@ +minor_changes: + - ec2_transit_gateway - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). + - ec2_transit_gateway_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py index c3a1079e5c9..160d37f4bd6 100644 --- a/plugins/modules/ec2_transit_gateway.py +++ b/plugins/modules/ec2_transit_gateway.py @@ -24,53 +24,44 @@ default: true type: bool auto_attach: - description: - - Enable or disable automatic acceptance of attachment requests. + description: Enable or disable automatic acceptance of attachment requests. default: false type: bool auto_propagate: - description: - - Enable or disable automatic propagation of routes to the default propagation route table. + description: Enable or disable automatic propagation of routes to the default propagation route table. default: true type: bool description: - description: - - The description of the transit gateway. + description: The description of the transit gateway. type: str dns_support: - description: - - Whether to enable AWS DNS support. + description: Whether to enable AWS DNS support. default: true type: bool multicast_support: - description: - - Whether to enable AWS Multicast support. Valid only at the time of creation of the Transit Gateway. + description: Whether to enable AWS Multicast support. Valid only at the time of creation of the Transit Gateway. type: bool version_added: 8.1.0 state: description: - - C(present) to ensure resource is created. - - C(absent) to remove resource. + - V(present) to ensure resource is created. + - V(absent) to remove resource. default: present choices: [ "present", "absent"] type: str transit_gateway_id: - description: - - The ID of the transit gateway. + description: The ID of the transit gateway. type: str vpn_ecmp_support: - description: - - Enable or disable Equal Cost Multipath Protocol support. + description: Enable or disable Equal Cost Multipath Protocol support. default: true type: bool wait: - description: - - Whether to wait for status + description: Whether to wait for status. default: true type: bool wait_timeout: - description: - - number of seconds to wait for status + description: Number of seconds to wait for status. default: 300 type: int @@ -123,7 +114,7 @@ RETURN = r""" transit_gateway: description: The attributes of the transit gateway. - type: complex + type: dict returned: I(state=present) contains: creation_time: @@ -135,11 +126,11 @@ description: The description of the transit gateway. returned: always type: str - sample: my test tgw + sample: "my test tgw" options: - description: The options attributes of the transit gateway + description: The options attributes of the transit gateway. returned: always - type: complex + type: dict contains: amazon_side_asn: description: @@ -147,64 +138,64 @@ The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. returned: always type: str - sample: 64512 + sample: "64512" auto_accept_shared_attachements: description: Indicates whether attachment requests are automatically accepted. returned: always type: str - sample: disable + sample: "disable" default_route_table_association: description: - Indicates whether resource attachments are automatically associated with the default association route table. returned: always type: str - sample: enable + sample: "enable" association_default_route_table_id: description: The ID of the default association route table. returned: Iwhen exists type: str - sample: tgw-rtb-abc123444 + sample: "tgw-rtb-abc123444" default_route_table_propagation: description: - Indicates whether resource attachments automatically propagate routes to the default propagation route table. returned: always type: str - sample: disable + sample: "disable" propagation_default_route_table_id: description: The ID of the default propagation route table. returned: when exists type: str - sample: tgw-rtb-def456777 + sample: "tgw-rtb-def456777" vpn_ecmp_support: description: Indicates whether Equal Cost Multipath Protocol support is enabled. returned: always type: str - sample: enable + sample: "enable" dns_support: description: Indicates whether DNS support is enabled. returned: always type: str - sample: enable + sample: "enable" multicast_support: description: Indicates whether Multicast support is enabled. returned: always type: str - sample: enable + sample: "enable" version_added: 7.3.0 owner_id: description: The account that owns the transit gateway. returned: always type: str - sample: '123456789012' + sample: "123456789012" state: description: The state of the transit gateway. returned: always type: str - sample: pending + sample: "pending" tags: - description: A dictionary of resource tags + description: A dictionary of resource tags. returned: always type: dict sample: @@ -214,52 +205,44 @@ description: The ID of the transit_gateway. returned: always type: str - sample: tgw-3a9aa123 + sample: "tgw-3a9aa123" transit_gateway_id: description: The ID of the transit_gateway. returned: always type: str - sample: tgw-3a9aa123 + sample: "tgw-3a9aa123" """ -from time import sleep -from time import time - -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass # handled by imported AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import Optional from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_ec2_transit_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_ec2_transit_gateway +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_transit_gateways from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list +from ansible_collections.amazon.aws.plugins.module_utils.waiters import wait_for_resource_state from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -class AnsibleEc2Tgw(object): - def __init__(self, module, results): +class AnsibleEc2Tgw: + def __init__(self, module: AnsibleAWSModule, results: Dict[str, Any]) -> None: self._module = module self._results = results retry_decorator = AWSRetry.jittered_backoff( catch_extra_error_codes=["IncorrectState"], ) - connection = module.client("ec2", retry_decorator=retry_decorator) - self._connection = connection + self._connection = module.client("ec2") self._check_mode = self._module.check_mode - def process(self): - """Process the request based on state parameter . - state = present will search for an existing tgw based and return the object data. - if no object is found it will be created - - state = absent will attempt to remove the tgw however will fail if it still has - attachments or associations - """ + def process(self) -> None: + """Process the request based on state parameter.""" description = self._module.params.get("description") state = self._module.params.get("state", "present") tgw_id = self._module.params.get("transit_gateway_id") @@ -269,71 +252,60 @@ def process(self): elif state == "absent": self.ensure_tgw_absent(tgw_id, description) - def wait_for_status(self, wait_timeout, tgw_id, status, skip_deleted=True): + def wait_for_status(self, wait_timeout: int, tgw_id: str, status: str, skip_deleted: bool = True) -> Dict[str, Any]: """ - Wait for the Transit Gateway to reach the specified status + Wait for the Transit Gateway to reach the specified status. :param wait_timeout: Number of seconds to wait, until this timeout is reached. - :param tgw_id: The Amazon nat id. + :param tgw_id: The Amazon NAT ID. :param status: The status to wait for. - examples. status=available, status=deleted - :param skip_deleted: ignore deleted transit gateways - :return dict: transit gateway object + :param skip_deleted: Ignore deleted transit gateways. + :return: Transit gateway object. """ polling_increment_secs = 5 - wait_timeout = time() + wait_timeout - status_achieved = False - transit_gateway = dict() - - while wait_timeout > time(): - try: - transit_gateway = self.get_matching_tgw(tgw_id=tgw_id, skip_deleted=skip_deleted) - - if transit_gateway: - if self._check_mode: - transit_gateway["state"] = status - - if transit_gateway.get("state") == status: - status_achieved = True - break + max_attempts = wait_timeout // polling_increment_secs - elif transit_gateway.get("state") == "failed": - break + waiter_method = f"transit_gateway_{status}" - else: - sleep(polling_increment_secs) - - except ClientError as e: - self._module.fail_json_aws(e) + wait_for_resource_state( + self._connection, + self._module, + waiter_method, + TransitGatewayIds=[tgw_id], + delay=polling_increment_secs, + max_attempts=max_attempts, + ) - if not status_achieved: - self._module.fail_json(msg="Wait time out reached, while waiting for results") + transit_gateway = self.get_matching_tgw(tgw_id=tgw_id, skip_deleted=skip_deleted) + if transit_gateway is None: + self._module.fail_json(msg="Transit Gateway not found after waiting.") return transit_gateway - def get_matching_tgw(self, tgw_id, description=None, skip_deleted=True): - """search for an existing tgw by either tgw_id or description - :param tgw_id: The AWS id of the transit gateway - :param description: The description of the transit gateway. - :param skip_deleted: ignore deleted transit gateways - :return dict: transit gateway object + def get_matching_tgw( + self, tgw_id: Optional[str], description: Optional[str] = None, skip_deleted: bool = True + ) -> Optional[Dict[str, Any]]: + """Search for an existing tgw by either tgw_id or description. + :param tgw_id: The AWS id of the transit gateway. + :param description: The description of the transit gateway. + :param skip_deleted: Ignore deleted transit gateways. + :return: Transit gateway object. """ filters = [] + params = {} if tgw_id: filters = ansible_dict_to_boto3_filter_list({"transit-gateway-id": tgw_id}) - try: - response = AWSRetry.exponential_backoff()(self._connection.describe_transit_gateways)(Filters=filters) - except (ClientError, BotoCoreError) as e: - self._module.fail_json_aws(e) + params["Filters"] = filters + response = describe_ec2_transit_gateways(self._connection, **params) tgw = None tgws = [] - if len(response.get("TransitGateways", [])) == 1 and tgw_id: - if (response["TransitGateways"][0]["State"] != "deleted") or not skip_deleted: - tgws.extend(response["TransitGateways"]) + if len(response) == 1 and tgw_id: + if (response[0]["State"] != "deleted") or not skip_deleted: + tgws.extend(response) - for gateway in response.get("TransitGateways", []): + for gateway in response: if description == gateway["Description"] and gateway["State"] != "deleted": tgws.append(gateway) @@ -348,21 +320,18 @@ def get_matching_tgw(self, tgw_id, description=None, skip_deleted=True): return tgw @staticmethod - def enable_option_flag(flag): + def enable_option_flag(flag: Optional[bool]) -> str: disabled = "disable" enabled = "enable" - if flag: - return enabled - return disabled + return enabled if flag else disabled - def create_tgw(self, description): + def create_tgw(self, description: str) -> Dict[str, Any]: """ Create a transit gateway and optionally wait for status to become available. - :param description: The description of the transit gateway. - :return dict: transit gateway object + :return: Transit gateway object. """ - options = dict() + options: Dict[str, Any] = {} wait = self._module.params.get("wait") wait_timeout = self._module.params.get("wait_timeout") @@ -376,36 +345,31 @@ def create_tgw(self, description): options["DnsSupport"] = self.enable_option_flag(self._module.params.get("dns_support")) options["MulticastSupport"] = self.enable_option_flag(self._module.params.get("multicast_support")) - try: - response = self._connection.create_transit_gateway(Description=description, Options=options) - except (ClientError, BotoCoreError) as e: - self._module.fail_json_aws(e) + params = {"Description": description, "Options": options} - tgw_id = response["TransitGateway"]["TransitGatewayId"] + response = create_ec2_transit_gateway(self._connection, **params) + + tgw_id = response["TransitGatewayId"] if wait: result = self.wait_for_status(wait_timeout=wait_timeout, tgw_id=tgw_id, status="available") else: result = self.get_matching_tgw(tgw_id=tgw_id) - self._results["msg"] = f" Transit gateway {result['transit_gateway_id']} created" + self._results["msg"] = f"Transit gateway {result['transit_gateway_id']} created" return result - def delete_tgw(self, tgw_id): + def delete_tgw(self, tgw_id: str) -> Dict[str, Any]: """ - De;lete the transit gateway and optionally wait for status to become deleted - - :param tgw_id: The id of the transit gateway - :return dict: transit gateway object + Delete the transit gateway and optionally wait for status to become deleted. + :param tgw_id: The id of the transit gateway. + :return: Transit gateway object. """ wait = self._module.params.get("wait") wait_timeout = self._module.params.get("wait_timeout") - try: - response = self._connection.delete_transit_gateway(TransitGatewayId=tgw_id) - except (ClientError, BotoCoreError) as e: - self._module.fail_json_aws(e) + delete_ec2_transit_gateway(self._connection, tgw_id) if wait: result = self.wait_for_status( @@ -414,18 +378,17 @@ def delete_tgw(self, tgw_id): else: result = self.get_matching_tgw(tgw_id=tgw_id, skip_deleted=False) - self._results["msg"] = f" Transit gateway {tgw_id} deleted" + self._results["msg"] = f"Transit gateway {tgw_id} deleted" return result - def ensure_tgw_present(self, tgw_id=None, description=None): + def ensure_tgw_present(self, tgw_id: Optional[str] = None, description: Optional[str] = None) -> Dict[str, Any]: """ - Will create a tgw if no match to the tgw_id or description are found - Will update the tgw tags if matching one found but tags are not synced - - :param tgw_id: The AWS id of the transit gateway - :param description: The description of the transit gateway. - :return dict: transit gateway object + Will create a tgw if no match to the tgw_id or description are found. + Will update the tgw tags if matching one found but tags are not synced. + :param tgw_id: The AWS id of the transit gateway. + :param description: The description of the transit gateway. + :return: Transit gateway object. """ tgw = self.get_matching_tgw(tgw_id, description) @@ -435,13 +398,10 @@ def ensure_tgw_present(self, tgw_id=None, description=None): self._results["transit_gateway_id"] = None return self._results - try: - if not description: - self._module.fail_json(msg="Failed to create Transit Gateway: description argument required") - tgw = self.create_tgw(description) - self._results["changed"] = True - except (BotoCoreError, ClientError) as e: - self._module.fail_json_aws(e, msg="Unable to create Transit Gateway") + if not description: + self._module.fail_json(msg="Failed to create Transit Gateway: description argument required") + tgw = self.create_tgw(description) + self._results["changed"] = True self._results["changed"] |= ensure_ec2_tags( self._connection, @@ -455,13 +415,12 @@ def ensure_tgw_present(self, tgw_id=None, description=None): return self._results - def ensure_tgw_absent(self, tgw_id=None, description=None): + def ensure_tgw_absent(self, tgw_id: Optional[str] = None, description: Optional[str] = None) -> Dict[str, Any]: """ - Will delete the tgw if a single tgw is found not yet in deleted status - - :param tgw_id: The AWS id of the transit gateway - :param description: The description of the transit gateway. - :return doct: transit gateway object + Will delete the tgw if a single tgw is found not yet in deleted status. + :param tgw_id: The AWS id of the transit gateway. + :param description: The description of the transit gateway. + :return: Transit gateway object. """ self._results["transit_gateway_id"] = None tgw = self.get_matching_tgw(tgw_id, description) @@ -471,19 +430,16 @@ def ensure_tgw_absent(self, tgw_id=None, description=None): self._results["changed"] = True return self._results - try: - tgw = self.delete_tgw(tgw_id=tgw["transit_gateway_id"]) - self._results["changed"] = True - self._results["transit_gateway"] = self.get_matching_tgw( - tgw_id=tgw["transit_gateway_id"], skip_deleted=False - ) - except (BotoCoreError, ClientError) as e: - self._module.fail_json_aws(e, msg="Unable to delete Transit Gateway") + tgw = self.delete_tgw(tgw_id=tgw["transit_gateway_id"]) + self._results["changed"] = True + self._results["transit_gateway"] = self.get_matching_tgw( + tgw_id=tgw["transit_gateway_id"], skip_deleted=False + ) return self._results -def setup_module_object(): +def setup_module_object() -> AnsibleAWSModule: """ merge argument spec and create Ansible module object :return: Ansible module object diff --git a/plugins/modules/ec2_transit_gateway_info.py b/plugins/modules/ec2_transit_gateway_info.py index 014c875b6a0..f07be7ae941 100644 --- a/plugins/modules/ec2_transit_gateway_info.py +++ b/plugins/modules/ec2_transit_gateway_info.py @@ -6,24 +6,25 @@ DOCUMENTATION = r""" module: ec2_transit_gateway_info -short_description: Gather information about ec2 transit gateways in AWS +short_description: Retrieve information about EC2 Transit Gateways in AWS version_added: 1.0.0 description: - - Gather information about ec2 transit gateways in AWS + - Gather information about EC2 Transit Gateways in AWS. author: - "Bob Boldin (@BobBoldin)" options: transit_gateway_ids: description: - - A list of transit gateway IDs to gather information for. + - A list of Transit Gateway IDs for which to gather information. aliases: [transit_gateway_id] type: list elements: str default: [] filters: description: - - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGateways.html) for filters. + - A dictionary of filters to apply to the query. Each key-value pair represents a filter key and its corresponding value. + - For a complete list of available filters, + refer to the AWS documentation U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGateways.html). type: dict default: {} extends_documentation_fragment: @@ -58,11 +59,12 @@ RETURN = r""" transit_gateways: - description: > - Transit gateways that match the provided filters. Each element consists of a dict with all the information - related to that transit gateway. + description: + - Transit gateways that match the provided filters. + - Each element consists of a dict with all the information related to that transit gateway. returned: on success - type: complex + type: list + elements: dict contains: creation_time: description: The creation time. @@ -77,65 +79,53 @@ options: description: A dictionary of the transit gateway options. returned: always - type: complex + type: dict contains: amazon_side_asn: description: - - A private Autonomous System Number (ASN) for the Amazon - side of a BGP session. The range is 64512 to 65534 for - 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. + - A private Autonomous System Number (ASN) for the Amazon ide of a BGP session. + - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. returned: always type: int sample: 64512 auto_accept_shared_attachments: - description: - - Indicates whether attachment requests are automatically accepted. + description: Indicates whether attachment requests are automatically accepted. returned: always type: str sample: "enable" default_route_table_association: - description: - - Indicates whether resource attachments are automatically - associated with the default association route table. + description: Indicates whether resource attachments are automatically associated with the default association route table. returned: always type: str sample: "disable" association_default_route_table_id: - description: - - The ID of the default association route table. + description: The ID of the default association route table. returned: when present type: str - sample: "rtb-11223344" + sample: "tgw-rtb-0fd332c911223344" default_route_table_propagation: - description: - - Indicates whether resource attachments automatically - propagate routes to the default propagation route table. + description: Indicates whether resource attachments automatically propagate routes to the default propagation route table. returned: always type: str sample: "disable" dns_support: - description: - - Indicates whether DNS support is enabled. + description: Indicates whether DNS support is enabled. returned: always type: str sample: "enable" multicast_support: - description: - - Indicates whether Multicast support is enabled. + description: Indicates whether Multicast support is enabled. returned: always type: str sample: "enable" version_added: 7.3.0 propagation_default_route_table_id: - description: - - The ID of the default propagation route table. + description: The ID of the default propagation route table. returned: when present type: str sample: "rtb-11223344" vpn_ecmp_support: - description: - - Indicates whether Equal Cost Multipath Protocol support - is enabled. + description: Indicates whether Equal Cost Multipath Protocol support is enabled. returned: always type: str sample: "enable" @@ -153,9 +143,10 @@ description: A dict of tags associated with the transit gateway. returned: always type: dict - sample: '{ - "Name": "A sample TGW" - }' + sample: { + "Name": "A sample TGW", + "Env": "Dev" + } transit_gateway_arn: description: The Amazon Resource Name (ARN) of the transit gateway. returned: always @@ -168,67 +159,70 @@ sample: "tgw-02c42332e6b7da829" """ -try: - import botocore -except ImportError: - pass # handled by imported AnsibleAWSModule +from typing import Any +from typing import Dict +from typing import List from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_transit_gateways from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -class AnsibleEc2TgwInfo(object): - def __init__(self, module, results): - self._module = module - self._results = results - self._connection = self._module.client("ec2") - self._check_mode = self._module.check_mode +def get_transit_gateway_response(module: AnsibleAWSModule, connection) -> Dict[str, Any]: + """ + Get transit gateway response from AWS. - @AWSRetry.exponential_backoff() - def describe_transit_gateways(self): - """ - Describe transit gateways. + module : AnsibleAWSModule object + connection : boto3 client connection object + :return: Response from describe_transit_gateways call + """ + filters = ansible_dict_to_boto3_filter_list(module.params["filters"]) + transit_gateway_ids = module.params["transit_gateway_ids"] - module : AnsibleAWSModule object - connection : boto3 client connection object - """ - # collect parameters - filters = ansible_dict_to_boto3_filter_list(self._module.params["filters"]) - transit_gateway_ids = self._module.params["transit_gateway_ids"] + params = {} + if transit_gateway_ids: + params["TransitGatewayIds"] = transit_gateway_ids + if filters: + params["Filters"] = filters - # init empty list for return vars - transit_gateway_info = list() + result = describe_ec2_transit_gateways(connection, **params) + return result - # Get the basic transit gateway info - try: - response = self._connection.describe_transit_gateways( - TransitGatewayIds=transit_gateway_ids, Filters=filters - ) - except is_boto3_error_code("InvalidTransitGatewayID.NotFound"): - self._results["transit_gateways"] = [] - return - for transit_gateway in response["TransitGateways"]: - transit_gateway_info.append(camel_dict_to_snake_dict(transit_gateway, ignore_list=["Tags"])) - # convert tag list to ansible dict - transit_gateway_info[-1]["tags"] = boto3_tag_list_to_ansible_dict(transit_gateway.get("Tags", [])) +def extract_transit_gateway_info(transit_gateway: Dict[str, Any]) -> Dict[str, Any]: + """ + Extract and transform transit gateway information. - self._results["transit_gateways"] = transit_gateway_info - return + transit_gateway : The transit gateway data from AWS + :return: Transformed transit gateway information + """ + tgw_data = camel_dict_to_snake_dict(transit_gateway, ignore_list=["Tags"]) + tgw_data["tags"] = boto3_tag_list_to_ansible_dict(transit_gateway.get("Tags", [])) + return tgw_data -def setup_module_object(): +def describe_transit_gateways(module: AnsibleAWSModule, connection) -> List[Dict[str, Any]]: """ - merge argument spec and create Ansible module object - :return: Ansible module object + Describe transit gateways. + + module : AnsibleAWSModule object + connection : boto3 client connection object + :return: List of transit gateways """ + response = get_transit_gateway_response(module, connection) + return [extract_transit_gateway_info(tgw) for tgw in response] + +def setup_module_object() -> AnsibleAWSModule: + """ + Merge argument spec and create Ansible module object. + :return: Ansible module object + """ argument_spec = dict( transit_gateway_ids=dict(type="list", default=[], elements="str", aliases=["transit_gateway_id"]), filters=dict(type="dict", default={}), @@ -244,13 +238,13 @@ def setup_module_object(): def main(): module = setup_module_object() + results = {"changed": False} - results = dict(changed=False) - - tgwf_manager = AnsibleEc2TgwInfo(module=module, results=results) + connection = module.client("ec2") try: - tgwf_manager.describe_transit_gateways() - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: + transit_gateways = describe_transit_gateways(module, connection) + results["transit_gateways"] = transit_gateways + except AnsibleEC2Error as e: module.fail_json_aws(e) module.exit_json(**results) diff --git a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml index 241c9c2c324..fe542b1e1ec 100644 --- a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml +++ b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: 'ec2_transit_gateway integration tests' +- name: Run 'ec2_transit_gateway integration tests' collections: - amazon.aws module_defaults: @@ -10,159 +10,291 @@ region: '{{ aws_region }}' block: - - name: generate unique value for testing - set_fact: + - name: Generate unique value for testing + ansible.builtin.set_fact: tgw_description: "{{ resource_prefix }}-tgw" - - name: test create transit gateway without tags - ec2_transit_gateway: + - name: Test create transit gateway without tags - check_mode + community.aws.ec2_transit_gateway: description: "{{ tgw_description }}" register: create_result - - name: assert changed is True - assert: + check_mode: true + + - name: Assert changed is True - check_mode + ansible.builtin.assert: + that: + - create_result.changed == True + - '"ec2:CreateTransitGateway" not in create_result.resource_actions' + + - name: Test create transit gateway without tags + community.aws.ec2_transit_gateway: + description: "{{ tgw_description }}" + register: create_result + + - name: Assert changed is True + ansible.builtin.assert: that: - create_result.changed == True - - - name: test update transit gateway with tags by description - ec2_transit_gateway: + + - name: Test create transit gateway without tags - idempotency + community.aws.ec2_transit_gateway: + description: "{{ tgw_description }}" + register: create_result + + - name: Assert changed is True + ansible.builtin.assert: + that: + - create_result.changed == False + - '"ec2:CreateTransitGateway" not in create_result.resource_actions' + + - name: Test update transit gateway with tags by description - check_mode + community.aws.ec2_transit_gateway: description: "{{ tgw_description }}" tags: Name: Ansible Test TGW register: result - - name: assert changed is True - assert: + check_mode: true + + - name: Assert changed is True - check_mode + ansible.builtin.assert: + that: + - result.changed == True + - '"ec2:CreateTags" not in result.resource_actions' + + - name: Test update transit gateway with tags by description + community.aws.ec2_transit_gateway: + description: "{{ tgw_description }}" + tags: + Name: Ansible Test TGW + register: result + + - name: Assert changed is True + ansible.builtin.assert: that: - result.changed == True - result.transit_gateway.tags | length == 1 - "'Name' in result.transit_gateway.tags" - - name: test update transit gateway with new tag and purge_tags false - ec2_transit_gateway: + - name: Test update transit gateway with tags by description - idempotency + community.aws.ec2_transit_gateway: + description: "{{ tgw_description }}" + tags: + Name: Ansible Test TGW + register: result + + - name: Assert changed is False - idempotency + ansible.builtin.assert: + that: + - result.changed == False + - result.transit_gateway.tags | length == 1 + - "'Name' in result.transit_gateway.tags" + + - name: Test update transit gateway with new tag and purge_tags false - check_mode + community.aws.ec2_transit_gateway: + transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' + purge_tags: False + tags: + status: ok to delete + register: result + check_mode: true + + - name: Assert changed is True and have 2 tags - check_mode + ansible.builtin.assert: + that: + - result.changed == True + - result.transit_gateway.tags | length != 2 + - "'Name' in result.transit_gateway.tags" + - '"ec2:CreateTags" not in result.resource_actions' + + - name: Test update transit gateway with new tag and purge_tags false + community.aws.ec2_transit_gateway: transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' purge_tags: False tags: status: ok to delete register: result - - name: assert changed is True and have 2 tags - assert: + + - name: Assert changed is True and have 2 tags + ansible.builtin.assert: that: - result.changed == True - result.transit_gateway.tags | length == 2 - "'Name' in result.transit_gateway.tags" - - name: test update transit gateway with purge_tags true - ec2_transit_gateway: + - name: Test update transit gateway with new tag and purge_tags false - idempotency + community.aws.ec2_transit_gateway: + transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' + purge_tags: False + tags: + status: ok to delete + register: result + + - name: Assert changed is True and have 2 tags - idempotency + ansible.builtin.assert: + that: + - result.changed == False + - result.transit_gateway.tags | length == 2 + - "'Name' in result.transit_gateway.tags" + + - name: Test update transit gateway with purge_tags true - check_mode + community.aws.ec2_transit_gateway: + transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' + purge_tags: True + tags: + status: ok to delete + register: result + check_mode: true + + - name: Assert changed is True and TGW tag is absent - check_mode + ansible.builtin.assert: + that: + - result.changed == True + - result.transit_gateway.tags | length == 2 + - '"ec2:DeleteTags" not in result.resource_actions' + + - name: Test update transit gateway with purge_tags true + community.aws.ec2_transit_gateway: transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' purge_tags: True tags: status: ok to delete register: result - - name: assert changed is True and TGW tag is absent - assert: + + - name: Assert changed is True and TGW tag is absent + ansible.builtin.assert: that: - result.changed == True - result.transit_gateway.tags | length == 1 - "'Name' not in result.transit_gateway.tags" - - name: test idempotence - ec2_transit_gateway: + - name: Test idempotence + community.aws.ec2_transit_gateway: description: "{{ tgw_description }}" purge_tags: True tags: status: ok to delete register: result - - name: assert changed is False - assert: + + - name: Assert changed is False + ansible.builtin.assert: that: - result.changed == False - - - name: generate unique value for testing - set_fact: + + - name: Generate unique value for testing + ansible.builtin.set_fact: tgw_description_multicast: "{{ resource_prefix }}-tgw-multicast" - - - name: test create transit gateway with multicast enabled - ec2_transit_gateway: + + - name: Test create transit gateway with multicast enabled - check_mode + community.aws.ec2_transit_gateway: description: "{{ tgw_description_multicast }}" multicast_support: true register: create_result - - - name: assert changed is True - assert: + check_mode: true + + - name: Assert changed is True - check_mode + ansible.builtin.assert: that: - create_result.changed == True - - - name: test success with filter - ec2_transit_gateway_info: + - '"ec2:CreateTransitGateway" not in create_result.resource_actions' + + - name: Test create transit gateway with multicast enabled + community.aws.ec2_transit_gateway: + description: "{{ tgw_description_multicast }}" + multicast_support: true + register: create_result + + - name: Assert changed is True + ansible.builtin.assert: + that: + - create_result.changed == True + + - name: Test create transit gateway with multicast enabled - idempotency + community.aws.ec2_transit_gateway: + description: "{{ tgw_description_multicast }}" + multicast_support: true + register: create_result + + - name: Assert changed is True - idempotency + ansible.builtin.assert: + that: + - create_result.changed == False + + - name: Test success with filter + community.aws.ec2_transit_gateway_info: filters: options.multicast-support: enable register: result - - - name: assert success with multicast-support filter - assert: + + - name: Assert success with multicast-support filter + ansible.builtin.assert: that: - 'result.transit_gateways != []' # ==== Combine ec2_transit_gateway_info ====================== - - name: test success with no parameters - ec2_transit_gateway_info: + - name: Test success with no parameters + community.aws.ec2_transit_gateway_info: register: result - - name: assert success with no parameters - assert: + - name: Assert success with no parameters + ansible.builtin.assert: that: - 'result.changed == false' - 'result.transit_gateways != []' - - name: test success with single filter - ec2_transit_gateway_info: + - name: Test success with single filter + community.aws.ec2_transit_gateway_info: filters: transit-gateway-id: "{{ create_result.transit_gateway.transit_gateway_id }}" register: result - - name: assert success with transit_gateway_id filter - assert: + + - name: Assert success with transit_gateway_id filter + ansible.builtin.assert: that: - 'result.changed == false' - 'result.transit_gateways != []' - - name: test empty result set for non-existent tgw id via filter - ec2_transit_gateway_info: + - name: Test empty result set for non-existent tgw id via filter + community.aws.ec2_transit_gateway_info: filters: transit-gateway-id: tgw-00000011111111122 register: result - - name: assert success with transit_gateway_id filter - assert: + + - name: Assert success with transit_gateway_id filter + ansible.builtin.assert: that: - 'result.changed == false' - 'result.transit_gateways == []' - - name: test NotFound exception caught and returned empty result set - ec2_transit_gateway_info: + - name: Test NotFound exception caught and returned empty result set + community.aws.ec2_transit_gateway_info: transit_gateway_id: tgw-00000011111111122 register: result - - name: assert success with transit_gateway_id filter - assert: + + - name: Assert success with transit_gateway_id filter + ansible.builtin.assert: that: - 'result.changed == false' - 'result.transit_gateways == []' - - name: test success with multiple filters - ec2_transit_gateway_info: + - name: Test success with multiple filters + community.aws.ec2_transit_gateway_info: filters: options.dns-support: enable options.vpn-ecmp-support: enable register: result - - name: assert success with transit_gateway_id filter - assert: + + - name: Assert success with transit_gateway_id filter + ansible.builtin.assert: that: - 'result.changed == false' - 'result.transit_gateways != []' - + always: ###### TEARDOWN STARTS HERE ###### - - name: delete transit gateway - ec2_transit_gateway: + - name: Delete transit gateway + community.aws.ec2_transit_gateway: description: "{{ item }}" state: absent - ignore_errors: yes + ignore_errors: true loop: - "{{ tgw_description }}" - "{{ tgw_description_multicast }}" diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml index f3b3e86f387..9dddd46c634 100644 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml +++ b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/setup.yml @@ -8,7 +8,7 @@ subnet_az_b_1: '{{ ec2_availability_zone_names[0] }}' subnet_az_b_2: '{{ ec2_availability_zone_names[1] }}' -- name: Create Transit Gateways +- name: 'Create Transit Gateways' community.aws.ec2_transit_gateway: description: '{{ item.description }}' tags: From e2faf120672150659c57374e7744e1d13781b3d2 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 24 Oct 2024 13:54:28 +0200 Subject: [PATCH 60/77] Use `ansible-ref: devel` for docs build workflows (#2187) * Use ansible-ref: devel for docs build workflows Signed-off-by: Alina Buzachis --- .github/workflows/docs-pr.yml | 2 ++ .github/workflows/docs-push.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml index e1f6ac1f69b..be826cba8d2 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yml @@ -17,6 +17,7 @@ jobs: with: init-lenient: false init-fail-on-error: true + ansible-ref: devel extra-collections: 'git+https://github.com/ansible-collections/amazon.aws.git,main' intersphinx-links: | amazon_aws:https://ansible-collections.github.io/amazon.aws/branch/main/ @@ -32,6 +33,7 @@ jobs: with: init-lenient: true init-fail-on-error: false + ansible-ref: devel extra-collections: 'git+https://github.com/ansible-collections/amazon.aws.git,main' intersphinx-links: | amazon_aws:https://ansible-collections.github.io/amazon.aws/branch/main/ diff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.yml index 79168f97dc0..9df3fbc6e42 100644 --- a/.github/workflows/docs-push.yml +++ b/.github/workflows/docs-push.yml @@ -21,6 +21,7 @@ jobs: with: init-lenient: true init-fail-on-error: true + ansible-ref: devel extra-collections: 'git+https://github.com/ansible-collections/amazon.aws.git,main' intersphinx-links: | amazon_aws:https://ansible-collections.github.io/amazon.aws/branch/main/ From a079e4eed78291a77810aa68a81f92a03c4f85db Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:37:26 +0200 Subject: [PATCH 61/77] DNM - Migrate modules ec2_vpc_egress_igw and tests (#2169) Depends-On: ansible-collections/amazon.aws#2327 Remove ec2_vpc_egress_igw,ec2_vpc_egress_igw modules and tests, these modules have been migrated to amazon.aws collection. Update runtime.yml with redirects to that collection Update ignore files Reviewed-by: GomathiselviS Reviewed-by: Alina Buzachis --- .../fragments/migrate_ec2_vpc_egress_igw.yml | 5 + meta/runtime.yml | 3 +- plugins/modules/ec2_vpc_egress_igw.py | 232 ------------------ .../targets/ec2_vpc_egress_igw/aliases | 1 - .../targets/ec2_vpc_egress_igw/tasks/main.yml | 181 -------------- 5 files changed, 7 insertions(+), 415 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_vpc_egress_igw.yml delete mode 100644 plugins/modules/ec2_vpc_egress_igw.py delete mode 100644 tests/integration/targets/ec2_vpc_egress_igw/aliases delete mode 100644 tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml diff --git a/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml b/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml new file mode 100644 index 00000000000..e98eb6dbd53 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - ec2_vpc_egress_igw - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_egress_igw`` (https://api.github.com/repos/ansible-collections/community.aws/pulls/2169). \ No newline at end of file diff --git a/meta/runtime.yml b/meta/runtime.yml index ea50b016258..3e3f8d67779 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -114,7 +114,6 @@ action_groups: - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - - ec2_vpc_egress_igw - ec2_vpc_nacl - ec2_vpc_nacl_info - ec2_vpc_peer @@ -520,6 +519,8 @@ plugin_routing: redirect: amazon.aws.s3_bucket_info sts_assume_role: redirect: amazon.aws.sts_assume_role + ec2_vpc_egress_igw: + redirect: amazon.aws.ec2_vpc_egress_igw module_utils: route53: redirect: amazon.aws.route53 \ No newline at end of file diff --git a/plugins/modules/ec2_vpc_egress_igw.py b/plugins/modules/ec2_vpc_egress_igw.py deleted file mode 100644 index 8a1a520b7aa..00000000000 --- a/plugins/modules/ec2_vpc_egress_igw.py +++ /dev/null @@ -1,232 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_vpc_egress_igw -version_added: 1.0.0 -short_description: Manage an AWS VPC Egress Only Internet gateway -description: - - Manage an AWS VPC Egress Only Internet gateway -author: - - Daniel Shepherd (@shepdelacreme) -options: - vpc_id: - description: - - The VPC ID for the VPC that this Egress Only Internet Gateway should be attached. - required: true - type: str - state: - description: - - Create or delete the EIGW. - default: present - choices: [ 'present', 'absent' ] - type: str -notes: - - Support for O(tags) and O(purge_tags) was added in release 9.0.0. -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 - - amazon.aws.tags.modules -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -# Ensure that the VPC has an Internet Gateway. -# The Internet Gateway ID is can be accessed via {{eigw.gateway_id}} for use in setting up NATs etc. -- name: Create Egress internet only gateway - community.aws.ec2_vpc_egress_igw: - vpc_id: vpc-abcdefgh - state: present - -- name: Delete Egress internet only gateway - community.aws.ec2_vpc_egress_igw: - vpc_id: vpc-abcdefgh - state: absent -""" - -RETURN = r""" -gateway_id: - description: The ID of the Egress Only Internet Gateway or Null. - returned: always - type: str - sample: eigw-0e00cf111ba5bc11e -vpc_id: - description: The ID of the VPC to attach or detach gateway from. - returned: always - type: str - sample: vpc-012345678 -tags: - description: Any tags assigned to the internet gateway. - returned: always - type: dict -""" - -from typing import Any -from typing import Dict -from typing import Optional -from typing import Union - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_egress_only_internet_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_egress_only_internet_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_egress_only_internet_gateways -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def delete_eigw(module: AnsibleAWSModule, connection, eigw_id: str) -> Dict[str, Union[str, bool]]: - """ - Delete EIGW. - - module : AnsibleAWSModule object - connection : boto3 client connection object - eigw_id : ID of the EIGW to delete - """ - - vpc_id = module.params.get("vpc_id") - - if module.check_mode: - return dict( - changed=True, msg=f"Would have deleted Egress internet only Gateway id '{eigw_id}' if not in check mode." - ) - - try: - changed = delete_egress_only_internet_gateway(connection, egress_only_internet_gateway_id=eigw_id) - except AnsibleEC2Error as e: - module.fail_json_aws(e) - - return dict(changed=changed) - - -def create_eigw(module: AnsibleAWSModule, connection, vpc_id: str) -> Dict[str, Union[str, bool]]: - """ - Create EIGW. - - module : AnsibleAWSModule object - connection : boto3 client connection object - vpc_id : ID of the VPC we are operating on - """ - - if module.check_mode: - return dict(changed=True, msg="Would have created Egress internet only Gateway if not in check mode.") - - gateway_id = None - changed = False - - try: - response = create_egress_only_internet_gateway(connection, vpc_id=vpc_id, tags=module.params.get("tags")) - changed = True - except AnsibleEC2Error as e: - module.fail_json_aws(e) - - gateway = response.get("EgressOnlyInternetGateway", {}) - state = gateway.get("Attachments", [{}])[0].get("State") - gateway_id = gateway.get("EgressOnlyInternetGatewayId") - tags = boto3_tag_list_to_ansible_dict(gateway.get("Tags", [])) - - if not gateway_id or state not in ("attached", "attaching"): - # EIGW gave back a bad attachment state or an invalid response so we error out - module.fail_json( - msg=f"Unable to create and attach Egress Only Internet Gateway to VPCId: {vpc_id}. Bad or no state in response", - **camel_dict_to_snake_dict(response), - ) - - return dict(changed=changed, gateway_id=gateway_id, tags=tags) - - -def find_egress_only_igw(module: AnsibleAWSModule, connection, vpc_id: str) -> Optional[Dict[str, Any]]: - """ - Describe EIGWs. - - module : AnsibleAWSModule object - connection : boto3 client connection object - vpc_id : ID of the VPC we are operating on - """ - result = None - - try: - for eigw in describe_egress_only_internet_gateways(connection): - for attachment in eigw.get("Attachments", []): - if attachment.get("VpcId") == vpc_id and attachment.get("State") in ("attached", "attaching"): - return { - "gateway_id": eigw.get("EgressOnlyInternetGatewayId"), - "tags": boto3_tag_list_to_ansible_dict(eigw.get("Tags", [])), - } - except AnsibleEC2Error as e: - module.fail_json_aws(e) - - return result - - -def ensure_present(connection, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]]) -> None: - vpc_id = module.params.get("vpc_id") - result = dict(vpc_id=vpc_id, changed=False) - - if not existing: - result.update(create_eigw(module, connection, vpc_id)) - else: - egress_only_igw_id = existing.get("gateway_id") - changed = False - result = existing - tags = module.params.get("tags") - purge_tags = module.params.get("purge_tags") - if tags is not None: - changed = ensure_ec2_tags( - connection, - module, - egress_only_igw_id, - resource_type="egress-only-internet-gateway", - tags=tags, - purge_tags=purge_tags, - ) - result.update(dict(changed=changed, vpc_id=vpc_id)) - - module.exit_json(**result) - - -def ensure_absent(connection, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]]) -> None: - vpc_id = module.params.get("vpc_id") - if not existing: - module.exit_json(changed=False, msg=f"No Egress only internet gateway attached to the VPC id '{vpc_id}'") - - egress_only_igw_id = existing.get("gateway_id") - result = dict(gateway_id=egress_only_igw_id, vpc_id=vpc_id, changed=False) - result.update(delete_eigw(module, connection, egress_only_igw_id)) - module.exit_json(**result) - - -def main(): - argument_spec = dict( - vpc_id=dict(required=True), - state=dict(default="present", choices=["present", "absent"]), - tags=dict(type="dict", aliases=["resource_tags"]), - purge_tags=dict(type="bool", default=True), - ) - - module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) - - connection = module.client("ec2") - - vpc_id = module.params.get("vpc_id") - state = module.params.get("state") - - existing_egress_only_igw = find_egress_only_igw(module, connection, vpc_id) - - if state == "present": - ensure_present(connection, module, existing_egress_only_igw) - else: - ensure_absent(connection, module, existing_egress_only_igw) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_vpc_egress_igw/aliases b/tests/integration/targets/ec2_vpc_egress_igw/aliases deleted file mode 100644 index 4ef4b2067d0..00000000000 --- a/tests/integration/targets/ec2_vpc_egress_igw/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/aws diff --git a/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml b/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml deleted file mode 100644 index 56bb89decaf..00000000000 --- a/tests/integration/targets/ec2_vpc_egress_igw/tasks/main.yml +++ /dev/null @@ -1,181 +0,0 @@ ---- -- name: Run ec2_vpc_egress_igw integration tests - module_defaults: - group/aws: - access_key: '{{ aws_access_key }}' - secret_key: '{{ aws_secret_key }}' - session_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - block: - - # ============================================================ - - name: Test failure with no parameters - community.aws.ec2_vpc_egress_igw: - register: result - ignore_errors: true - - - name: Assert failure with no parameters - ansible.builtin.assert: - that: - - result is failed - - 'result.msg == "missing required arguments: vpc_id"' - - # ============================================================ - - name: Test failure with non-existent VPC ID - community.aws.ec2_vpc_egress_igw: - state: present - vpc_id: vpc-02394e50abc1807e8 - register: result - ignore_errors: true - - - name: Assert failure with non-existent VPC ID - ansible.builtin.assert: - that: - - result is failed - - e_msg in result.exception - vars: - e_msg: "The vpc ID 'vpc-02394e50abc1807e8' does not exist" - - # ============================================================ - - name: Create a VPC - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - state: present - cidr_block: "10.232.232.128/26" - tags: - Name: "{{ resource_prefix }}-vpc" - Description: "Created by ansible-test" - register: vpc_result - - # ============================================================ - - name: Create egress-only internet gateway using check_mode=true - community.aws.ec2_vpc_egress_igw: - state: present - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_create_check_mode - check_mode: true - - - name: Assert module returned changed and the Egress IGW was not created - ansible.builtin.assert: - that: - - vpc_eigw_create_check_mode is changed - - # # ============================================================ - - name: Create egress-only internet gateway (expected changed=true) - community.aws.ec2_vpc_egress_igw: - state: present - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_create - - - name: Assert module returned changed and the Egress IGW was not created - ansible.builtin.assert: - that: - - vpc_eigw_create is changed - - # # ============================================================ - - name: Create egress-only internet gateway once again (idempotency) - community.aws.ec2_vpc_egress_igw: - state: present - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_create_idempotency - - - name: Assert module returned changed and the Egress IGW was not created - assert: - that: - - vpc_eigw_create_idempotency is not changed - - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_create.gateway_id - - # # ============================================================ - - name: Delete egress-only internet gateway (check_mode) - ec2_vpc_egress_igw: - state: absent - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_delete_check_mode - check_mode: true - - - name: Assert module returned changed and the Egress IGW was not created - ansible.builtin.assert: - that: - - vpc_eigw_delete_check_mode is changed - - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_delete_check_mode.gateway_id - - # # ============================================================ - - name: Delete egress-only internet gateway once again (idempotency) - community.aws.ec2_vpc_egress_igw: - state: absent - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_delete - - - name: Assert module returned changed and the Egress IGW was not created - ansible.builtin.assert: - that: - - vpc_eigw_delete is changed - - vpc_eigw_create_idempotency.gateway_id == vpc_eigw_delete.gateway_id - - # # ============================================================ - - name: Delete egress-only internet gateway - ec2_vpc_egress_igw: - state: absent - vpc_id: "{{ vpc_result.vpc.id }}" - register: vpc_eigw_delete_idempotency - - - name: Assert module returned changed and the Egress IGW was not created - ansible.builtin.assert: - that: - - vpc_eigw_delete_idempotency is not changed - - ## ============================================================ - ## Tagging - - name: Create Egress only internet gateway with tags - community.aws.ec2_vpc_egress_igw: - vpc_id: "{{ vpc_result.vpc.id }}" - tags: - ResourcePrefix: "{{ resource_prefix }}" - VpcId: "{{ vpc_result.vpc.id }}" - register: create_with_tags - - - name: Assert that the Egress IGW was created with tags - ansible.builtin.assert: - that: - - create_with_tags is changed - - - name: Trying to update tags (no change) - community.aws.ec2_vpc_egress_igw: - vpc_id: "{{ vpc_result.vpc.id }}" - tags: - ResourcePrefix: "{{ resource_prefix }}" - VpcId: "{{ vpc_result.vpc.id }}" - register: update_tags - - - name: Assert that the Egress IGW was not updated - ansible.builtin.assert: - that: - - update_tags is not changed - - - name: Add tag to existing tags - community.aws.ec2_vpc_egress_igw: - vpc_id: "{{ vpc_result.vpc.id }}" - tags: - Phase: integration - purge_tags: false - register: add_tag - - - name: Assert that the Egress IGW was created with tags - ansible.builtin.assert: - that: - - add_tag is changed - - always: - # ============================================================ - - name: Tidy up EIGW - community.aws.ec2_vpc_egress_igw: - state: absent - vpc_id: "{{ vpc_result.vpc.id }}" - ignore_errors: true - - - name: Tidy up VPC - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - state: absent - cidr_block: "10.232.232.128/26" - ignore_errors: true From cbeb2e14a56f07241e59604d6813fb031366a1de Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 24 Oct 2024 18:28:38 +0200 Subject: [PATCH 62/77] DNM Promote ec2_transit_gateway_vpc_attachment and ec2_transit_gateway_vpc_attachment_info modules and tests (#2184) SUMMARY Promote ec2_transit_gateway_vpc_attachment and ec2_transit_gateway_vpc_attachment_info modules and tests ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mandar Kulkarni --- ...ate_ec2_transit_gateway_vpc_attachment.yml | 8 + meta/runtime.yml | 4 + plugins/module_utils/transitgateway.py | 512 --- .../ec2_transit_gateway_vpc_attachment.py | 327 -- ...ec2_transit_gateway_vpc_attachment_info.py | 223 - .../aliases | 3 - .../defaults/main.yml | 26 - .../meta/main.yml | 2 - .../tasks/cleanup.yml | 70 - .../tasks/complex.yml | 451 -- .../tasks/main.yml | 24 - .../tasks/simple.yml | 3706 ----------------- 12 files changed, 12 insertions(+), 5344 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml delete mode 100644 plugins/module_utils/transitgateway.py delete mode 100644 plugins/modules/ec2_transit_gateway_vpc_attachment.py delete mode 100644 plugins/modules/ec2_transit_gateway_vpc_attachment_info.py delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/aliases delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/meta/main.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml diff --git a/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml b/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml new file mode 100644 index 00000000000..ea94dcc1cd4 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_transit_gateway_vpc_attachment - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment``. + - ec2_transit_gateway_vpc_attachment_info - The module has been migrated from the + ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name + for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 3e3f8d67779..fea1d1ead6f 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -521,6 +521,10 @@ plugin_routing: redirect: amazon.aws.sts_assume_role ec2_vpc_egress_igw: redirect: amazon.aws.ec2_vpc_egress_igw + ec2_transit_gateway_vpc_attachment: + redirect: amazon.aws.ec2_transit_gateway_vpc_attachment + ec2_transit_gateway_vpc_attachment_info: + redirect: amazon.aws.ec2_transit_gateway_vpc_attachment_info module_utils: route53: redirect: amazon.aws.route53 \ No newline at end of file diff --git a/plugins/module_utils/transitgateway.py b/plugins/module_utils/transitgateway.py deleted file mode 100644 index a3454931205..00000000000 --- a/plugins/module_utils/transitgateway.py +++ /dev/null @@ -1,512 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from copy import deepcopy - -try: - from botocore.exceptions import BotoCoreError - from botocore.exceptions import ClientError -except ImportError: - pass - -from typing import Any -from typing import Dict -from typing import List -from typing import Optional -from typing import Tuple - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_transit_gateway_vpc_attachment -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_transit_gateway_vpc_attachment -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_subnets -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_transit_gateway_vpc_attachments -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import modify_transit_gateway_vpc_attachment -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list -from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.waiters import get_waiter - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def get_states() -> List[str]: - return [ - "available", - "deleting", - "failed", - "failing", - "initiatingRequest", - "modifying", - "pendingAcceptance", - "pending", - "rollingBack", - "rejected", - "rejecting", - ] - - -def subnets_to_vpc( - client, module: AnsibleAWSModule, subnets: List[str], subnet_details: Optional[List[Dict[str, Any]]] = None -) -> Optional[str]: - if not subnets: - return None - - if subnet_details is None: - try: - subnet_details = describe_subnets(client, SubnetIds=list(subnets)) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - vpcs = [s.get("VpcId") for s in subnet_details] - if len(set(vpcs)) > 1: - module.fail_json( - msg="Attachment subnets may only be in one VPC, multiple VPCs found", - vpcs=list(set(vpcs)), - subnets=subnet_details, - ) - - return vpcs[0] - - -def find_existing_attachment( - client, module: AnsibleAWSModule, filters: Optional[Dict[str, Any]] = None, attachment_id: Optional[str] = None -) -> Optional[Dict[str, Any]]: - """Find an existing transit gateway attachment based on filters or attachment ID. - - Args: - client: The AWS client used to interact with the EC2 service. - module: The Ansible module instance used for error handling. - filters (Optional[Dict[str, Any]]): A dictionary of filters to apply when searching for attachments. - attachment_id (Optional[str]): The ID of a specific attachment to find. - - Returns: - Optional[Dict[str, Any]]: The found attachment details or None if not found. - - Raises: - ValueError: If multiple attachments match the criteria. - """ - # Find an existing attachment based on filters - params = {} - - if attachment_id: - params["TransitGatewayAttachmentIds"] = [attachment_id] - elif filters: - params["Filters"] = ansible_dict_to_boto3_filter_list(filters) - - try: - attachments = describe_transit_gateway_vpc_attachments(client, **params) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - if len(attachments) > 1: - raise ValueError("Multiple matching attachments found, provide an ID.") - - return attachments[0] if attachments else None - - -class TransitGatewayAttachmentStateManager: - def __init__(self, client, module: AnsibleAWSModule, attachment_id: str) -> None: - self.client = client - self.module = module - self.attachment_id = attachment_id - - @property - def waiter_config(self) -> Dict[str, Any]: - params: Dict[str, Any] = {} - - delay = min(5, self.module.params.get("wait_timeout")) - max_attempts = self.module.params.get("wait_timeout") // delay - config = dict(Delay=delay, MaxAttempts=max_attempts) - params["WaiterConfig"] = config - - return params - - def create_attachment(self, params: Dict[str, Any]) -> str: - """ - Create a new transit gateway attachment. - - Args: - params (Dict[str, Any]): A dictionary containing the parameters needed to - create the transit gateway attachment. - - Returns: - str: The ID of the newly created transit gateway attachment. - - Raises: - AnsibleEC2Error: If there is an error while creating the VPC attachment, - it will fail the module and provide an error message. - """ - try: - tags = params.pop("Tags") - except KeyError: - tags = None - - if tags: - params["TagSpecifications"] = boto3_tag_specifications(tags, types=["transit-gateway-attachment"]) - - try: - response = create_transit_gateway_vpc_attachment(self.client, **params) - except AnsibleEC2Error as e: - self.module.fail_json_aws_error(e) - - self.attachment_id = response["TransitGatewayAttachmentId"] - - return response["TransitGatewayAttachmentId"] - - def delete_attachment(self) -> bool: - # Delete the transit gateway attachment - - if not self.attachment_id: - return False - - if not self.module.check_mode: - try: - delete_transit_gateway_vpc_attachment(self.client, self.attachment_id) - except AnsibleEC2Error as e: - self.module.fail_json_aws_error(e) - - return True - - def wait_for_state_change(self, desired_state: str) -> None: - # Wait until attachment reaches the desired state - params = {"TransitGatewayAttachmentIds": [self.attachment_id]} - params.update(self.waiter_config) - try: - waiter = get_waiter(self.client, f"transit_gateway_vpc_attachment_{desired_state}") - waiter.wait(**params) - except (BotoCoreError, ClientError) as e: - self.module.fail_json_aws_error(e) - - -class AttachmentConfigurationManager: - def __init__(self, client, module: AnsibleAWSModule, attachment_id: str, existing: Dict[str, Any]) -> None: - self.client = client - self.module = module - self.attachment_id = attachment_id - - self.existing = existing or {} - self._resource_updates = {} - self._subnets_to_add = [] - self._subnets_to_remove = [] - - @property - def resource_updates(self) -> Dict[str, Any]: - return self._resource_updates - - @property - def subnets_to_add(self) -> List[str]: - return self._subnets_to_add - - @property - def subnets_to_remove(self) -> List[str]: - return self._subnets_to_remove - - def set_subnets(self, subnets: Optional[List[str]] = None, purge: bool = True) -> None: - """ - Set or update the subnets associated with the transit gateway attachment. - - Args: - subnets (Optional[List[str]]): A list of subnet IDs to associate with - the attachment. - purge (bool): If True, the existing subnets will be replaced with the - specified subnets. - """ - # Set or update the subnets associated with the attachment - if subnets is None: - return - - current_subnets = set(self.existing.get("SubnetIds", [])) - desired_subnets = set(subnets) - if not purge: - desired_subnets = desired_subnets.union(current_subnets) - - # We'll pull the VPC ID from the subnets, no point asking for - # information we 'know'. - try: - subnet_details = describe_subnets(self.client, SubnetIds=list(desired_subnets)) - except AnsibleEC2Error as e: - self.module.fail_json_aws_error(e) - vpc_id = subnets_to_vpc(self.client, self.module, desired_subnets, subnet_details) - self._set_resource_value("VpcId", vpc_id, immutable=True) - - # Only one subnet per-AZ is permitted - azs = [s.get("AvailabilityZoneId") for s in subnet_details] - if len(azs) != len(set(azs)): - self.module.fail_json( - msg="Only one attachment subnet per availability zone may be set.", - availability_zones=azs, - subnets=subnet_details, - ) - - self._subnets_to_add = list(desired_subnets.difference(current_subnets)) - self._subnets_to_remove = list(current_subnets.difference(desired_subnets)) - self._set_resource_value("SubnetIds", list(desired_subnets)) - - def set_dns_support(self, value): - return self._set_option("DnsSupport", value) - - def set_ipv6_support(self, value): - return self._set_option("Ipv6Support", value) - - def set_appliance_mode_support(self, value): - return self._set_option("ApplianceModeSupport", value) - - def set_transit_gateway(self, tgw_id: str): - return self._set_resource_value("TransitGatewayId", tgw_id) - - def set_vpc(self, vpc_id: str): - return self._set_resource_value("VpcId", vpc_id) - - def set_tags(self, tags, purge_tags): - current_tags = boto3_tag_list_to_ansible_dict(self.existing.get("Tags", None)) - - if purge_tags: - desired_tags = deepcopy(tags) - else: - desired_tags = {**current_tags, **tags} - - self._set_resource_value("Tags", desired_tags) - - def _get_resource_value(self, key, default=None): - default_value = self.existing.get(key, default) - return self._resource_updates.get(key, default_value) - - def _set_option(self, name: str, value: Optional[bool]) -> bool: - """ - Set a VPC attachment option to either enable or disable. - - Args: - name (str): The name of the option to be updated. - value (Optional[bool]): A boolean indicating whether to enable (True) - or disable (False) the specified option. If None, no action is - taken. - - Returns: - bool: Returns True if the option was successfully set, or False if - no update was made (because the value was None). - """ - if value is None: - return False - - # For now VPC Attachment options are all enable/disable - value = "enable" if value else "disable" - - options = deepcopy(self.existing.get("Options", dict())) - options.update(self._resource_updates.get("Options", dict())) - options[name] = value - - return self._set_resource_value("Options", options) - - def _set_resource_value(self, key, value, description: Optional[str] = None, immutable: bool = False) -> bool: - """ - Set a value for a resource attribute and track changes. - - Args: - key (str): The attribute key to be updated. - value (Any): The new value to set for the specified key. - description (Optional[str], optional): A human-readable description of the - resource attribute. - immutable (bool, optional): A flag indicating whether the attribute is - immutable. If True, and the resource exists, an error will be raised - if attempting to change the value. Defaults to False. - - Returns: - bool: Returns True if the value was successfully set, or False if no - update was made. - """ - if value is None or value == self._get_resource_value(key): - return False - - if immutable and self.existing: - description = description or key - self.module.fail_json(msg=f"{description} can not be updated after creation") - - self.resource_updates[key] = value - - return True - - def filter_immutable_resource_attributes(self, resource: Dict[str, Any]) -> Dict[str, Any]: - """ - Filter out immutable resource attributes from the given resource dictionary. - - Args: - resource (Dict[str, Any]): A dictionary representing the resource, which - may contain various attributes, including both mutable and immutable ones. - - Returns: - Dict[str, Any]: A new dictionary containing only the mutable attributes - of the resource. - """ - immutable_options = ["TransitGatewayId", "VpcId", "VpcOwnerId", "State", "SubnetIds", "CreationTime", "Tags"] - return {key: value for key, value in resource.items() if key not in immutable_options} - - -class TransitGatewayVpcAttachmentManager: - def __init__( - self, client, module: AnsibleAWSModule, existing: Dict[str, Any], attachment_id: Optional[str] = None - ) -> None: - self.client = client - self.module = module - self.attachment_id = attachment_id - self.existing = existing or {} - self.updated = {} - self.changed = False - - self.state_manager = TransitGatewayAttachmentStateManager(client, module, attachment_id) - self.config_manager = AttachmentConfigurationManager(client, module, attachment_id, existing) - - def merge_resource_changes(self, filter_immutable: bool = True) -> Dict[str, Any]: - """Merge existing resource attributes with updates, optionally filtering out immutable attributes. - - Args: - filter_immutable (bool): Whether to filter out immutable resource attributes. Defaults to True. - - Returns: - Dict[str, Any]: The merged resource attributes. - """ - resource = deepcopy(self.existing) - resource.update(self.config_manager.resource_updates) - - if filter_immutable: - resource = self.config_manager.filter_immutable_resource_attributes(resource) - - return resource - - def apply_configuration(self): - """Apply configuration changes to the transit gateway attachment. - - Returns: - bool: True if configuration changes were applied, False otherwise. - """ - # Apply any configuration changes to the attachment - if not self.attachment_id: - return False - - updates = self.config_manager.filter_immutable_resource_attributes(self.config_manager.resource_updates) - - subnets_to_add = self.config_manager.subnets_to_add - subnets_to_remove = self.config_manager.subnets_to_remove - - # Check if there are no changes to apply - if not updates and not subnets_to_add and not subnets_to_remove: - return False - - if subnets_to_add: - updates["AddSubnetIds"] = subnets_to_add - if subnets_to_remove: - updates["RemoveSubnetIds"] = subnets_to_remove - - updates["TransitGatewayAttachmentId"] = self.attachment_id - - if not self.module.check_mode: - try: - modify_transit_gateway_vpc_attachment(self.client, **updates) - except AnsibleEC2Error as e: - self.module.fail_json_aws_error(e) - return True - - def _set_configuration_parameters(self) -> None: - """Set configuration parameters for the transit gateway attachment.""" - self.config_manager.set_transit_gateway(self.module.params.get("transit_gateway")) - self.config_manager.set_subnets(self.module.params["subnets"], self.module.params.get("purge_subnets", True)) - self.config_manager.set_dns_support(self.module.params.get("dns_support")) - self.config_manager.set_ipv6_support(self.module.params.get("ipv6_support")) - self.config_manager.set_appliance_mode_support(self.module.params.get("appliance_mode_support")) - - def _prepare_tags(self) -> Tuple[Optional[Dict[str, str]], bool]: - """Prepare and return the tags and purge flag. - - Returns: - Tuple[Optional[Dict[str, str]], bool]: A tuple containing the tags dictionary and the purge flag. - """ - tags = self.module.params.get("tags") - purge_tags = self.module.params.get("purge_tags") - - if self.module.params.get("name"): - new_tags = {"Name": self.module.params["name"]} - if tags is None: - purge_tags = False - else: - new_tags.update(tags) - tags = new_tags - - return {} if tags is None else tags, purge_tags - - def _create_attachment(self) -> None: - """Create a new transit gateway attachment.""" - if not self.module.check_mode: - params = self.merge_resource_changes(filter_immutable=False) - self.attachment_id = self.state_manager.create_attachment(params) - - if self.module.params.get("wait"): - self.state_manager.wait_for_state_change("available") - - self.changed = True - - def _update_attachment(self, tags: Dict[str, Any], purge_tags: bool) -> None: - """Update an existing transit gateway attachment.""" - if self.existing.get("State") == "pending": - # Wait for resources to finish creating before updating - self.state_manager.wait_for_state_change("available") - elif self.existing.get("State") == "deleting": - self.module.fail_json(msg="Deletion in progress, unable to update", route_tables=[self.original_resource]) - - # Apply the configuration - if self.apply_configuration(): - self.changed = True - if self.module.params.get("wait"): - self.state_manager.wait_for_state_change("available") - - # Ensure tags are applied - self.changed |= ensure_ec2_tags( - self.client, - self.module, - self.attachment_id, - resource_type="transit-gateway-attachment", - tags=tags, - purge_tags=purge_tags, - ) - - def create_or_modify_attachment(self): - """Create or modify a transit gateway attachment based on the provided parameters.""" - - # Set the configuration parameters - self._set_configuration_parameters() - - # Handle tags - tags, purge_tags = self._prepare_tags() - - # Set tags in the configuration manager - self.config_manager.set_tags(tags, purge_tags) - - if not self.existing: - self._create_attachment() - else: - self._update_attachment(tags, purge_tags) - - # Handle check mode updates - if self.module.check_mode: - self.updated = camel_dict_to_snake_dict( - self.merge_resource_changes(filter_immutable=False), ignore_list=["Tags"] - ) - else: - self.updated = boto3_resource_to_ansible_dict( - find_existing_attachment(self.client, self.module, attachment_id=self.attachment_id) - ) - - def delete_attachment(self): - """Delete attachment""" - if self.existing.get("State") == "deleting": - if self.module.params.get("wait"): - self.state_manager.wait_for_state_change("deleted") - self.change = False - else: - self.changed |= self.state_manager.delete_attachment() - if self.module.params.get("wait"): - self.state_manager.wait_for_state_change("deleted") diff --git a/plugins/modules/ec2_transit_gateway_vpc_attachment.py b/plugins/modules/ec2_transit_gateway_vpc_attachment.py deleted file mode 100644 index 9ecdeb3b2bb..00000000000 --- a/plugins/modules/ec2_transit_gateway_vpc_attachment.py +++ /dev/null @@ -1,327 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_transit_gateway_vpc_attachment -short_description: Create and delete AWS Transit Gateway VPC attachments -version_added: 4.0.0 -description: - - Creates, Deletes and Updates AWS Transit Gateway VPC Attachments. -options: - transit_gateway: - description: - - The ID of the Transit Gateway that the attachment belongs to. - - When creating a new attachment, O(transit_gateway) must be provided. - - At least one of O(name), O(transit_gateway) and O(id) must be provided. - - O(transit_gateway) is an immutable setting and can not be updated on an - existing attachment. - type: str - required: false - aliases: ["transit_gateway_id"] - id: - description: - - The ID of the Transit Gateway Attachment. - - When O(id) is not set, a search using O(transit_gateway) and O(name) will be - performed. If multiple results are returned, the module will fail. - - At least one of O(name), O(transit_gateway) and O(id) must be provided. - type: str - required: false - aliases: ["attachment_id"] - name: - description: - - The V(Name) tag of the Transit Gateway attachment. - - Providing both O(id) and O(name) will set the V(Name) tag on an existing - attachment the matching O(id). - - Setting the V(Name) tag in O(tags) will also result in the V(Name) tag being - updated. - - At least one of O(name), O(transit_gateway) and O(id) must be provided. - type: str - required: false - state: - description: - - Create or remove the Transit Gateway attachment. - type: str - required: false - choices: ["present", "absent"] - default: 'present' - subnets: - description: - - The ID of the subnets in which to create the transit gateway VPC attachment. - - Required when creating a new attachment. - type: list - elements: str - required: false - purge_subnets: - description: - - If O(purge_subnets=true), existing subnets will be removed from the - attachment as necessary to match exactly what is defined by O(subnets). - type: bool - required: false - default: true - dns_support: - description: - - Whether DNS support is enabled. - type: bool - required: false - ipv6_support: - description: - - Whether IPv6 support is enabled. - type: bool - required: false - appliance_mode_support: - description: - - Whether the attachment is configured for appliance mode. - - When appliance mode is enabled, Transit Gateway, using 4-tuples of an - IP packet, selects a single Transit Gateway ENI in the Appliance VPC - for the life of a flow to send traffic to. - type: bool - required: false - wait: - description: - - Whether to wait for the Transit Gateway attachment to reach the - C(Available) or C(Deleted) state before the module returns. - type: bool - required: false - default: true - wait_timeout: - description: - - Maximum time, in seconds, to wait for the Transit Gateway attachment - to reach the expected state. - - Defaults to 600 seconds. - type: int - default: 600 - required: false -author: - - Mark Chappell (@tremble) - - Alina Buzachis (@alinabuzachis) -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.tags - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -- name: Create a Transit Gateway attachment - community.aws.ec2_transit_gateway_vpc_attachment: - state: "present" - transit_gateway: "tgw-123456789abcdef01" - name: "AnsibleTest-1" - subnets: - - "subnet-00000000000000000" - - "subnet-11111111111111111" - - "subnet-22222222222222222" - ipv6_support: true - purge_subnets: true - dns_support: true - appliance_mode_support: true - tags: - TestTag: "changed data in Test Tag" - -- name: Set sub options on a Transit Gateway attachment - community.aws.ec2_transit_gateway_vpc_attachment: - state: "present" - id: "tgw-attach-0c0c5fd0b0f01d1c9" - name: "AnsibleTest-1" - ipv6_support: true - purge_subnets: false - dns_support: false - appliance_mode_support: true - -- name: Delete the transit gateway - community.aws.ec2_transit_gateway_vpc_attachment: - state: "absent" - id: "tgw-attach-0c0c5fd0b0f01d1c9" -""" - -RETURN = r""" -attachments: - description: The attributes of the Transit Gateway attachments. - type: list - elements: dict - returned: success - contains: - creation_time: - description: - - An ISO 8601 date time stamp of when the attachment was created. - type: str - returned: success - sample: "2022-03-10T16:40:26+00:00" - options: - description: - - Additional VPC attachment options. - type: dict - returned: success - contains: - appliance_mode_support: - description: - - Indicates whether appliance mode support is enabled. - type: str - returned: success - sample: "enable" - dns_support: - description: - - Indicates whether DNS support is enabled. - type: str - returned: success - sample: "disable" - ipv6_support: - description: - - Indicates whether IPv6 support is disabled. - type: str - returned: success - sample: "disable" - security_group_referencing_support: - description: - - Indicated weather security group referencing support is disabled. - type: str - returned: success - sample: "enable" - state: - description: - - The state of the attachment. - type: str - returned: success - sample: "deleting" - subnet_ids: - description: - - The IDs of the subnets in use by the attachment. - type: list - elements: str - returned: success - sample: ["subnet-0123456789abcdef0", "subnet-11111111111111111"] - tags: - description: - - A dictionary representing the resource tags. - type: dict - returned: success - transit_gateway_attachment_id: - description: - - The ID of the attachment. - type: str - returned: success - sample: "tgw-attach-0c0c5fd0b0f01d1c9" - transit_gateway_id: - description: - - The ID of the transit gateway that the attachment is connected to. - type: str - returned: success - sample: "tgw-0123456789abcdef0" - vpc_id: - description: - - The ID of the VPC that the attachment is connected to. - type: str - returned: success - sample: "vpc-0123456789abcdef0" - vpc_owner_id: - description: - - The ID of the account that the VPC belongs to. - type: str - returned: success - sample: "1234567890122" -""" - -from typing import NoReturn - -from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -from ansible_collections.community.aws.plugins.module_utils.transitgateway import TransitGatewayVpcAttachmentManager -from ansible_collections.community.aws.plugins.module_utils.transitgateway import find_existing_attachment -from ansible_collections.community.aws.plugins.module_utils.transitgateway import get_states -from ansible_collections.community.aws.plugins.module_utils.transitgateway import subnets_to_vpc - - -def handle_vpc_attachments(client, module: AnsibleAWSModule) -> NoReturn: - """ - Handle the creation, modification, or deletion of VPC attachments - based on the parameters provided in the Ansible module. - - Args: - client: The AWS client to interact with EC2 services. - module: An instance of AnsibleAWSModule. - - Returns: - NoReturn: The function exits by calling module.exit_json() - with the results of the operation. - """ - attach_id = module.params.get("id", None) - attachment = None - - if not attach_id: - filters = {} - if module.params.get("transit_gateway"): - filters["transit-gateway-id"] = module.params["transit_gateway"] - if module.params.get("name"): - filters["tag:Name"] = module.params["name"] - if module.params.get("subnets"): - vpc_id = subnets_to_vpc(client, module, module.params["subnets"]) - filters["vpc-id"] = vpc_id - - # Attachments lurk in a 'deleted' state, for a while, ignore them so we - # can reuse the names - filters["state"] = get_states() - - attachment = find_existing_attachment(client, module, filters=filters) - if attachment: - attach_id = attachment["TransitGatewayAttachmentId"] - else: - attachment = find_existing_attachment(client, module, attachment_id=attach_id) - - manager = TransitGatewayVpcAttachmentManager(client, module, attachment, attachment_id=attach_id) - - if module.params["state"] == "absent": - manager.delete_attachment() - else: - manager.create_or_modify_attachment() - - results = dict( - changed=manager.changed, - attachments=[manager.updated], - ) - if manager.changed: - results["diff"] = dict( - before=boto3_resource_to_ansible_dict(manager.existing), - after=manager.updated, - ) - - module.exit_json(**results) - - -def main(): - argument_spec = dict( - state=dict(type="str", required=False, default="present", choices=["absent", "present"]), - transit_gateway=dict(type="str", required=False, aliases=["transit_gateway_id"]), - id=dict(type="str", required=False, aliases=["attachment_id"]), - name=dict(type="str", required=False), - subnets=dict(type="list", elements="str", required=False), - purge_subnets=dict(type="bool", required=False, default=True), - tags=dict(type="dict", required=False, aliases=["resource_tags"]), - purge_tags=dict(type="bool", required=False, default=True), - appliance_mode_support=dict(type="bool", required=False), - dns_support=dict(type="bool", required=False), - ipv6_support=dict(type="bool", required=False), - wait=dict(type="bool", required=False, default=True), - wait_timeout=dict(type="int", default=600, required=False), - ) - - one_of = [ - ["id", "transit_gateway", "name"], - ] - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_one_of=one_of, - ) - - client = module.client("ec2") - - handle_vpc_attachments(client, module) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py b/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py deleted file mode 100644 index 2ec87583a94..00000000000 --- a/plugins/modules/ec2_transit_gateway_vpc_attachment_info.py +++ /dev/null @@ -1,223 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_transit_gateway_vpc_attachment_info -short_description: describes AWS Transit Gateway VPC attachments -version_added: 4.0.0 -description: - - Describes AWS Transit Gateway VPC Attachments. -options: - id: - description: - - The ID of the Transit Gateway Attachment. - - Mutually exclusive with O(name) and O(filters). - type: str - required: false - aliases: ["attachment_id"] - name: - description: - - The V(Name) tag of the Transit Gateway attachment. - type: str - required: false - filters: - description: - - A dictionary of filters to apply. Each dict item consists of a filter key and a filter value. - - Setting a V(tag:Name) filter will override the O(name) parameter. - type: dict - required: false - include_deleted: - description: - - If O(include_deleted=True), then attachments in a deleted state will - also be returned. - - Setting a V(state) filter will override the O(include_deleted) parameter. - type: bool - required: false - default: false -author: - - Mark Chappell (@tremble) - - Alina Buzachis (@alinabuzachis) -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -- name: Describe a specific Transit Gateway attachment - community.aws.ec2_transit_gateway_vpc_attachment_info: - id: "tgw-attach-0123456789abcdef0" - -- name: Describe all attachments attached to a transit gateway - community.aws.ec2_transit_gateway_vpc_attachment_info: - filters: - transit-gateway-id: "tgw-0fedcba9876543210" - -- name: Describe all attachments in an account - community.aws.ec2_transit_gateway_vpc_attachment_info: -""" - -RETURN = r""" -attachments: - description: The attributes of the Transit Gateway attachments. - type: list - elements: dict - returned: success - contains: - creation_time: - description: - - An ISO 8601 date time stamp of when the attachment was created. - type: str - returned: success - sample: "2022-03-10T16:40:26+00:00" - options: - description: - - Additional VPC attachment options. - type: dict - returned: success - contains: - appliance_mode_support: - description: - - Indicates whether appliance mode support is enabled. - type: str - returned: success - sample: "enable" - dns_support: - description: - - Indicates whether DNS support is enabled. - type: str - returned: success - sample: "disable" - ipv6_support: - description: - - Indicates whether IPv6 support is disabled. - type: str - returned: success - sample: "disable" - security_group_referencing_support: - description: - - Indicated weather security group referencing support is disabled. - type: str - returned: success - sample: "enable" - state: - description: - - The state of the attachment. - type: str - returned: success - sample: "deleting" - subnet_ids: - description: - - The IDs of the subnets in use by the attachment. - type: list - elements: str - returned: success - sample: ["subnet-0123456789abcdef0", "subnet-11111111111111111"] - tags: - description: - - A dictionary representing the resource tags. - type: dict - returned: success - transit_gateway_attachment_id: - description: - - The ID of the attachment. - type: str - returned: success - sample: "tgw-attach-0c0c5fd0b0f01d1c9" - transit_gateway_id: - description: - - The ID of the transit gateway that the attachment is connected to. - type: str - returned: success - sample: "tgw-0123456789abcdef0" - vpc_id: - description: - - The ID of the VPC that the attachment is connected to. - type: str - returned: success - sample: "vpc-0123456789abcdef0" - vpc_owner_id: - description: - - The ID of the account that the VPC belongs to. - type: str - returned: success - sample: "123456789012" -""" - -from typing import Any -from typing import Dict -from typing import List - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_transit_gateway_vpc_attachments -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list -from ansible_collections.amazon.aws.plugins.module_utils.transformation import boto3_resource_to_ansible_dict - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule -from ansible_collections.community.aws.plugins.module_utils.transitgateway import get_states - - -def main(): - argument_spec = dict( - id=dict(type="str", required=False, aliases=["attachment_id"]), - name=dict(type="str", required=False), - filters=dict(type="dict", required=False), - include_deleted=dict(type="bool", required=False, default=False), - ) - - mutually_exclusive = [ - ["id", "name"], - ["id", "filters"], - ] - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - mutually_exclusive=mutually_exclusive, - ) - - name = module.params.get("name") - attachment_id = module.params.get("id") - opt_filters = module.params.get("filters") - include_deleted = module.params.get("include_deleted") - - client = module.client("ec2") - - params: Dict[str, Any] = {} - filters: Dict[str, Any] = {} - attachments: List[Dict[str, Any]] = [] - - if attachment_id: - params["TransitGatewayAttachmentIds"] = [attachment_id] - - # Add filter by name if provided - if name: - filters["tag:Name"] = name - - # Include only active states if "include_deleted" is False - if not include_deleted: - filters["state"] = get_states() - - # Include any additional filters provided by the user - if opt_filters: - filters.update(opt_filters) - - if filters: - params["Filters"] = ansible_dict_to_boto3_filter_list(filters) - - try: - result = describe_transit_gateway_vpc_attachments(client, **params) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - if result: - attachments = [boto3_resource_to_ansible_dict(attachment) for attachment in result] - - module.exit_json(changed=False, attachments=attachments, filters=filters) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/aliases b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/aliases deleted file mode 100644 index 94fa60d71f2..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws -time=35m -# ec2_transit_gateway_vpc_attachment_info diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/defaults/main.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/defaults/main.yml deleted file mode 100644 index c9727746555..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/defaults/main.yml +++ /dev/null @@ -1,26 +0,0 @@ -_resource_prefix: 'AnsibleTest' -#_resource_prefix: 'AnsibleTest-{{ tiny_prefix }}-TGW-Attach' -cidr_prefix: '10.{{ 255 | random(seed=_resource_prefix) }}' -tgw_name: '{{ _resource_prefix }}' -tgw_name_2: '{{ _resource_prefix }}-2' -vpc_name_a: '{{ _resource_prefix }}-1' -vpc_name_b: '{{ _resource_prefix }}-2' -vpc_cidr_a: '{{ cidr_prefix }}.1.0/24' -vpc_cidr_b: '{{ cidr_prefix }}.2.0/24' - -subnet_cidr_a_1: '{{ cidr_prefix }}.1.0/26' -subnet_cidr_a_2: '{{ cidr_prefix }}.1.64/26' -subnet_cidr_a_3: '{{ cidr_prefix }}.1.128/26' -subnet_cidr_a_1a: '{{ cidr_prefix }}.1.192/26' -subnet_cidr_b_1: '{{ cidr_prefix }}.2.0/26' -subnet_cidr_b_2: '{{ cidr_prefix }}.2.64/26' - -subnet_name_a_1: '{{ _resource_prefix }}-a-1' -subnet_name_a_1a: '{{ _resource_prefix }}-a-1a' -subnet_name_a_2: '{{ _resource_prefix }}-a-2' -subnet_name_a_3: '{{ _resource_prefix }}-a-3' -subnet_name_b_1: '{{ _resource_prefix }}-b-1' -subnet_name_b_2: '{{ _resource_prefix }}-b-2' - -attachment_name: '{{ _resource_prefix }}' -attachment_name_complex: '{{ _resource_prefix }}-complex' diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/meta/main.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/meta/main.yml deleted file mode 100644 index aef5ca0ee57..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - role: setup_ec2_facts diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml deleted file mode 100644 index b917be3907a..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/cleanup.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -- name: Describe all attachments on our VPC - community.aws.ec2_transit_gateway_vpc_attachment_info: - filters: - transit-gateway-id: '{{ tgw_id }}' - register: info - ignore_errors: true - -- name: Start deletion of all attachments - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ item.transit_gateway_attachment_id }}' - wait: false - loop: '{{ info.attachments }}' - ignore_errors: true - -- name: Wait for deletion of all attachments - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ item.transit_gateway_attachment_id }}' - wait: true - loop: '{{ info.attachments }}' - ignore_errors: true - -- name: Delete subnets - amazon.aws.ec2_vpc_subnet: - state: absent - cidr: '{{ item.cidr }}' - vpc_id: '{{ item.vpc_id }}' - loop: - - cidr: '{{ subnet_cidr_a_1 }}' - vpc_id: '{{ vpc_id_a }}' - - cidr: '{{ subnet_cidr_a_2 }}' - vpc_id: '{{ vpc_id_a }}' - - cidr: '{{ subnet_cidr_a_3 }}' - vpc_id: '{{ vpc_id_a }}' - - cidr: '{{ subnet_cidr_b_1 }}' - vpc_id: '{{ vpc_id_b }}' - - cidr: '{{ subnet_cidr_b_2 }}' - vpc_id: '{{ vpc_id_b }}' - - cidr: '{{ subnet_cidr_a_1a }}' - vpc_id: '{{ vpc_id_a }}' - ignore_errors: True - -- name: Delete VPCs to attach to TGW - amazon.aws.ec2_vpc_net: - state: absent - cidr_block: '{{ item.cidr }}' - name: '{{ item.name }}' - loop: - - cidr: '{{ vpc_cidr_a }}' - name: '{{ vpc_name_a }}' - - cidr: '{{ vpc_cidr_b }}' - name: '{{ vpc_name_b }}' - ignore_errors: true - -- name: Gather info about all transit gateways - community.aws.ec2_transit_gateway_info: - transit_gateway_ids: - - '{{ tgw_id }}' - - '{{ tgw_id_2 }}' - -- name: Delete Transit Gateways - community.aws.ec2_transit_gateway: - state: absent - transit_gateway_id: '{{ item.tgw_id }}' - loop: - - tgw_id: '{{ tgw_id }}' - - tgw_id: '{{ tgw_id_2 }}' - ignore_errors: true diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml deleted file mode 100644 index 2a234bb165f..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/complex.yml +++ /dev/null @@ -1,451 +0,0 @@ ---- -# Tests the setting of most parameters at the same time -# -# Note: Does not delete the attachment, so that there's a second VPC attached to -# the TGW when we run our _info tests in simple.yml -# -# ============================================================================= -# Creation - -- block: - - name: (CHECK_MODE) Create an attachment - complex parameters - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - - '{{ subnet_id_b_2 }}' - tags: - tagA: 'example Value' - Tag_B: 'second value' - appliance_mode_support: true - ipv6_support: true - register: complex_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - complex_attach is changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"options" in attachment' - - '"subnet_ids" in attachment' - - '"tags" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == "enable" - - attachment.options.ipv6_support == "enable" - - attachment.subnet_ids | length == 2 - - subnet_id_b_1 in attachment.subnet_ids - - subnet_id_b_2 in attachment.subnet_ids - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: Create an attachment - complex parameters - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - - '{{ subnet_id_b_2 }}' - tags: - tagA: 'example Value' - Tag_B: 'second value' - appliance_mode_support: true - ipv6_support: true - register: complex_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - complex_attach is changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_b_1 in attachment.subnet_ids - - subnet_id_b_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.transit_gateway_attachment_id.startswith('tgw-attach-') - - attachment.state == 'available' - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: Save Attachment ID - set_fact: - complex_attachment_id: '{{ complex_attach.attachments[0].transit_gateway_attachment_id }}' - - - name: (CHECK_MODE) Create an attachment - complex parameters -- IDEMPOTENCY - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - - '{{ subnet_id_b_2 }}' - tags: - tagA: 'example Value' - Tag_B: 'second value' - appliance_mode_support: true - ipv6_support: true - register: complex_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - complex_attach is not changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_b_1 in attachment.subnet_ids - - subnet_id_b_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: Create an attachment - complex parameters -- IDEMPOTENCY - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - - '{{ subnet_id_b_2 }}' - tags: - tagA: 'example Value' - Tag_B: 'second value' - appliance_mode_support: true - ipv6_support: true - register: complex_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - complex_attach is not changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_b_1 in attachment.subnet_ids - - subnet_id_b_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - -# ============================================================================= -# Update - - - name: (CHECK_MODE) Update an attachment - complex parameters - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - purge_subnets: true - tags: - tagC: '3' - Tag_D: 'Hello again dear world' - purge_tags: false - dns_support: false - ipv6_support: false - register: complex_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - complex_attach is changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_b_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - '"tagC" in attachment.tags' - - '"Tag_D" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.tags.tagC == "3" - - attachment.tags.Tag_D == "Hello again dear world" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: Update an attachment - complex parameters - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - purge_subnets: true - tags: - tagC: '3' - Tag_D: 'Hello again dear world' - purge_tags: false - dns_support: false - ipv6_support: false - register: complex_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - complex_attach is changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_b_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - '"tagC" in attachment.tags' - - '"Tag_D" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.tags.tagC == "3" - - attachment.tags.Tag_D == "Hello again dear world" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: (CHECK_MODE) Update an attachment - complex parameters -- IDEMPOTENCY - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - purge_subnets: true - tags: - tagC: '3' - Tag_D: 'Hello again dear world' - purge_tags: false - dns_support: false - ipv6_support: false - register: complex_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - complex_attach is not changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_b_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - '"tagC" in attachment.tags' - - '"Tag_D" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.tags.tagC == "3" - - attachment.tags.Tag_D == "Hello again dear world" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' - - - name: Update an attachment - complex parameters -- IDEMPOTENCY - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name_complex }}' - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_b_1 }}' - purge_subnets: true - tags: - tagC: '3' - Tag_D: 'Hello again dear world' - purge_tags: false - dns_support: false - ipv6_support: false - register: complex_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - complex_attach is not changed - - '"attachments" in complex_attach' - - complex_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_b_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_b - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.transit_gateway_attachment_id == complex_attachment_id - - attachment.state == 'available' - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"tagA" in attachment.tags' - - '"Tag_B" in attachment.tags' - - '"tagC" in attachment.tags' - - '"Tag_D" in attachment.tags' - - attachment.tags.Name == attachment_name_complex - - attachment.tags.tagA == "example Value" - - attachment.tags.Tag_B == "second value" - - attachment.tags.tagC == "3" - - attachment.tags.Tag_D == "Hello again dear world" - - attachment.vpc_owner_id == vpc_owner_b - vars: - attachment: '{{ complex_attach.attachments[0] }}' diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/main.yml deleted file mode 100644 index ce9659473f6..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/main.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: 'ec2_transit_gateway_vpc_attachment integration tests' - collections: - - amazon.aws - module_defaults: - group/aws: - access_key: '{{ aws_access_key }}' - secret_key: '{{ aws_secret_key }}' - session_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - - block: - # Prepares various resources - - include_tasks: 'setup.yml' - - # Tests create / update on parameters simulatniously - - include_tasks: 'complex.yml' - - # Tests create / update / delete on individual parameters - - include_tasks: 'simple.yml' - - always: - # Cleanup after ourselves - - include_tasks: 'cleanup.yml' diff --git a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml b/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml deleted file mode 100644 index 2cee6627e2c..00000000000 --- a/tests/integration/targets/ec2_transit_gateway_vpc_attachment/tasks/simple.yml +++ /dev/null @@ -1,3706 +0,0 @@ ---- -# ============================================================================= -# Creation -- block: - - name: (CHECK_MODE) Create an attachment - minimal parameters - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that attachment parameters are returned in CHECK_MODE - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: Create an attachment - minimal parameters - community.aws.ec2_transit_gateway_vpc_attachment: - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that the create attachment is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.transit_gateway_attachment_id.startswith('tgw-attach-') - - attachment.state == 'available' - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: Save Attachment ID - ansible.builtin.set_fact: - simple_attachment_id: '{{ simple_attach.attachments[0].transit_gateway_attachment_id }}' - - - name: (CHECK_MODE) Create an attachment - minimal parameters -- IDEMPOTENCY - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Create an attachment - minimal parameters -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - transit_gateway: '{{ tgw_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: (CHECK_MODE) By Id - minimal parameters -- IDEMPOTENCY - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'By Id - minimal parameters -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ============================================================================= -# Set a name - - - name: '(CHECK_MODE) Set name' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that the attachment parameters are returned in CHECK_MODE - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set name' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that 'Set name' is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Set name -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set name -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) By Name - minimal parameters -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'By Name - minimal parameters -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - subnets: - - '{{ subnet_id_a_1 }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ============================================================================= -# Describe - - - name: 'Describe all attachments' - community.aws.ec2_transit_gateway_vpc_attachment_info: - register: info - - - name: Assert that the transit_gateway_vpc_attachment_info is returned sucessfully - ansible.builtin.assert: - that: - - info is not changed - - '"attachments" in info' - - info.attachments | length >= 2 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length >= 1 - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - '"Name" in attachment.tags' - vars: - attachment: '{{ info.attachments[0] }}' - - - name: 'Describe attachments on a specific VPC' - community.aws.ec2_transit_gateway_vpc_attachment_info: - filters: - transit-gateway-id: '{{ tgw_id }}' - register: info - - - name: Assert that the returned info is correct - ansible.builtin.assert: - that: - - info is not changed - - '"attachments" in info' - - info.attachments | length == 2 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length >= 1 - - attachment.transit_gateway_id == tgw_id - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - '"Name" in attachment.tags' - vars: - attachment: '{{ info.attachments[0] }}' - - - name: 'Describe attachment with a specific name' - community.aws.ec2_transit_gateway_vpc_attachment_info: - name: '{{ attachment_name }}' - register: info - - - name: Assert that the returned info is correct - ansible.builtin.assert: - that: - - info is not changed - - '"attachments" in info' - - info.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ info.attachments[0] }}' - - - name: 'Describe attachment by ID' - community.aws.ec2_transit_gateway_vpc_attachment_info: - id: '{{ simple_attachment_id }}' - register: info - - - name: Assert that the returned info is correct - ansible.builtin.assert: - that: - - info is not changed - - '"attachments" in info' - - info.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ info.attachments[0] }}' - -# ============================================================================= -# Tag attachment - - - name: '(CHECK_MODE) Set tags' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - snake_case: snake_case_value - "Tag with Space": value with space - register: simple_attach - - - name: Assert that 'Set tags' is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set tags' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - snake_case: snake_case_value - "Tag with Space": value with space - register: simple_attach - - - name: Assert that 'Set tags' is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Set tags -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - snake_case: snake_case_value - "Tag with Space": value with space - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set tags -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - snake_case: snake_case_value - "Tag with Space": value with space - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Describe attachment with tags set' - community.aws.ec2_transit_gateway_vpc_attachment_info: - id: '{{ simple_attachment_id }}' - register: info - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - info is not changed - - '"attachments" in info' - - info.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ info.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) No change to tags with name set -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'No change to tags with name set -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value' - - attachment.tags['Tag with Space'] == 'value with space' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Update tags' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - snake_case: snake_case_value 2 - "Tag with Space": value with space 2 - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value 2' - - attachment.tags['Tag with Space'] == 'value with space 2' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update tags' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - snake_case: snake_case_value 2 - "Tag with Space": value with space 2 - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value 2' - - attachment.tags['Tag with Space'] == 'value with space 2' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Update tags -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - snake_case: snake_case_value 2 - "Tag with Space": value with space 2 - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value 2' - - attachment.tags['Tag with Space'] == 'value with space 2' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update tags -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - snake_case: snake_case_value 2 - "Tag with Space": value with space 2 - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 5 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"snake_case" in attachment.tags' - - '"Tag with Space" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.snake_case == 'snake_case_value 2' - - attachment.tags['Tag with Space'] == 'value with space 2' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Remove tags' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove tags' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Remove tags -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove tags -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: - CamelCase: CamelCaseValue - pascalCase: pascalCaseValue - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 3 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Add tags with no purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - AnotherTag: Another Value - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 4 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"AnotherTag" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.AnotherTag == 'Another Value' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add tags with no purge' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - AnotherTag: Another Value - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 4 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"AnotherTag" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.AnotherTag == 'Another Value' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Add tags with no purge -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - AnotherTag: Another Value - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 4 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"AnotherTag" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.AnotherTag == 'Another Value' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add tags with no purge -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - purge_tags: False - tags: - AnotherTag: Another Value - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 4 - - '"Name" in attachment.tags' - - '"CamelCase" in attachment.tags' - - '"pascalCase" in attachment.tags' - - '"AnotherTag" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.tags.CamelCase == 'CamelCaseValue' - - attachment.tags.pascalCase == 'pascalCaseValue' - - attachment.tags.AnotherTag == 'Another Value' - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Remove all tags with name set' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: {} - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove all tags with name set' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: {} - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Remove all tags with name set -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: {} - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove all tags with name set -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - name: '{{ attachment_name }}' - tags: {} - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 1 - - '"Name" in attachment.tags' - - attachment.tags.Name == attachment_name - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Remove all tags including name' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - tags: {} - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove all tags including name' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - tags: {} - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Remove all tags including name -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - tags: {} - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove all tags including name -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - tags: {} - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ============================================================================= -# Options - - - name: '(CHECK_MODE) Set IPv6 support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set IPv6 support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Set IPv6 support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set IPv6 support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Set DNS support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set DNS support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Set DNS support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set DNS support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Set Appliance Mode support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set Appliance Mode support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Set Appliance Mode support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Set Appliance Mode support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'enable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Update IPv6 support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update IPv6 support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Update IPv6 support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update IPv6 support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - ipv6_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'disable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Update DNS support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update DNS support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Update DNS support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update DNS support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - dns_support: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'enable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Update Appliance Mode support' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update Appliance Mode support' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Update Appliance Mode support -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Update Appliance Mode support -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - appliance_mode_support: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 1 - - subnet_id_a_1 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ============================================================================= -# Subnet Management - - - name: '(CHECK_MODE) Try to add subnet from a different VPC - no purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_b_2 }}' - purge_subnets: False - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - - - name: 'Try to add subnet from a different VPC - no purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_b_2 }}' - purge_subnets: False - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - -# ===== - - - name: '(CHECK_MODE) Try to add subnet from a different VPC - with purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_b_2 }}' - purge_subnets: true - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - - - name: 'Try to add subnet from a different VPC - with purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_b_2 }}' - purge_subnets: true - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - -# ===== - - - name: '(CHECK_MODE) Try to add subnet in the same AZ - no purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_b_1a }}' - purge_subnets: False - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - - - name: 'Try to add subnet in the same AZ - no purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1a }}' - purge_subnets: False - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - -# ===== - - - name: '(CHECK_MODE) Try to add subnet in the same AZ - with purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_1a }}' - purge_subnets: true - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - - - name: 'Try to add subnet in the same AZ - with purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_1a }}' - purge_subnets: true - register: simple_attach - ignore_errors: true - - - name: Assert that the test failed - ansible.builtin.assert: - that: - - simple_attach is failed - -# ===== - - - name: '(CHECK_MODE) Add subnet - without purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - purge_subnets: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add subnet - without purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - purge_subnets: False - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Add subnet - without purge -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - purge_subnets: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add subnet - without purge -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - purge_subnets: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Add subnet - with purge' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 3 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add subnet - with purge' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 3 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Add subnet - with purge -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 3 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Add subnet - with purge -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 3 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Remove subnet' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove subnet' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Remove subnet -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove subnet -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_2 }}' - - '{{ subnet_id_a_3 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_2 in attachment.subnet_ids - - subnet_id_a_3 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ===== - - - name: '(CHECK_MODE) Remove and add subnet' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove and add subnet' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: '(CHECK_MODE) Remove and add subnet -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - - - name: 'Remove and add subnet -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - id: '{{ simple_attachment_id }}' - subnets: - - '{{ subnet_id_a_1 }}' - - '{{ subnet_id_a_2 }}' - purge_subnets: true - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - '"attachments" in simple_attach' - - simple_attach.attachments | length == 1 - - '"subnet_ids" in attachment' - - '"transit_gateway_id" in attachment' - - '"vpc_id" in attachment' - - attachment.subnet_ids | length == 2 - - subnet_id_a_1 in attachment.subnet_ids - - subnet_id_a_2 in attachment.subnet_ids - - attachment.transit_gateway_id == tgw_id - - attachment.vpc_id == vpc_id_a - - '"creation_time" in attachment' - - '"options" in attachment' - - '"state" in attachment' - - '"tags" in attachment' - - '"transit_gateway_attachment_id" in attachment' - - '"vpc_owner_id" in attachment' - - '"appliance_mode_support" in attachment.options' - - '"dns_support" in attachment.options' - - '"ipv6_support" in attachment.options' - - attachment.options.appliance_mode_support == 'disable' - - attachment.options.dns_support == 'enable' - - attachment.options.ipv6_support == 'disable' - - attachment.state == 'available' - - attachment.transit_gateway_attachment_id == simple_attachment_id - - attachment.tags | length == 0 - - attachment.vpc_owner_id == vpc_owner_a - vars: - attachment: '{{ simple_attach.attachments[0] }}' - -# ============================================================================= -# Deletion - - - name: '(CHECK_MODE) Delete an attachment - minimal parameters' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ simple_attachment_id }}' - wait: false - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - - name: 'Delete an attachment - minimal parameters' - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ simple_attachment_id }}' - wait: false - register: simple_attach - - - name: Assert that the test is successful - ansible.builtin.assert: - that: - - simple_attach is changed - - - name: '(CHECK_MODE) Delete an attachment - minimal parameters -- IDEMPOTENCY' - check_mode: true - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ simple_attachment_id }}' - wait: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - - name: 'Delete an attachment - minimal parameters -- IDEMPOTENCY' - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ simple_attachment_id }}' - wait: False - register: simple_attach - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - simple_attach is not changed - - always: - - name: 'Delete attachment' - community.aws.ec2_transit_gateway_vpc_attachment: - state: absent - id: '{{ simple_attachment_id }}' - wait: False - ignore_errors: true From 3cc49c01f2ae2a5ba2875c478d180951b9b2e9ba Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 25 Oct 2024 03:12:08 -0700 Subject: [PATCH 63/77] DNM Promote elb_classic_lb_info to amazon.aws (#2186) SUMMARY This PR migrates elb_classic_lb_info module from community.aws to amazon.aws Refer : https://issues.redhat.com/browse/ACA-1179 elb_classic_lb is already in amazon.aws ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Alina Buzachis --- .../fragments/migrate_elb_classic_lb_info.yml | 5 + meta/runtime.yml | 5 +- plugins/modules/elb_classic_lb_info.py | 516 ------------------ .../targets/elb_classic_lb_info/aliases | 1 - .../elb_classic_lb_info/defaults/main.yml | 3 - .../targets/elb_classic_lb_info/meta/main.yml | 1 - .../elb_classic_lb_info/tasks/main.yml | 311 ----------- .../targets/elb_classic_lb_info/vars/main.yml | 2 - 8 files changed, 8 insertions(+), 836 deletions(-) create mode 100644 changelogs/fragments/migrate_elb_classic_lb_info.yml delete mode 100644 plugins/modules/elb_classic_lb_info.py delete mode 100644 tests/integration/targets/elb_classic_lb_info/aliases delete mode 100644 tests/integration/targets/elb_classic_lb_info/defaults/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/meta/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/tasks/main.yml delete mode 100644 tests/integration/targets/elb_classic_lb_info/vars/main.yml diff --git a/changelogs/fragments/migrate_elb_classic_lb_info.yml b/changelogs/fragments/migrate_elb_classic_lb_info.yml new file mode 100644 index 00000000000..f48c34ee3c4 --- /dev/null +++ b/changelogs/fragments/migrate_elb_classic_lb_info.yml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - elb_classic_lb_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.elb_classic_lb_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index fea1d1ead6f..662ded07df1 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -145,7 +145,6 @@ action_groups: - elasticache_subnet_group - elasticbeanstalk_app - elb_classic_lb - - elb_classic_lb_info - elb_instance - elb_network_lb - elb_target @@ -525,6 +524,8 @@ plugin_routing: redirect: amazon.aws.ec2_transit_gateway_vpc_attachment ec2_transit_gateway_vpc_attachment_info: redirect: amazon.aws.ec2_transit_gateway_vpc_attachment_info + elb_classic_lb_info: + redirect: amazon.aws.elb_classic_lb_info module_utils: route53: - redirect: amazon.aws.route53 \ No newline at end of file + redirect: amazon.aws.route53 diff --git a/plugins/modules/elb_classic_lb_info.py b/plugins/modules/elb_classic_lb_info.py deleted file mode 100644 index 2115ca70f1e..00000000000 --- a/plugins/modules/elb_classic_lb_info.py +++ /dev/null @@ -1,516 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Contributors to the Ansible project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: elb_classic_lb_info -version_added: 1.0.0 -short_description: Gather information about EC2 Classic Elastic Load Balancers in AWS -description: - - Gather information about EC2 Classic Elastic Load Balancers in AWS. -author: - - "Michael Schultz (@mjschultz)" - - "Fernando Jose Pando (@nand0p)" -options: - names: - description: - - List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned. - type: list - elements: str - default: [] -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. -# Output format tries to match amazon.aws.elb_classic_lb module input parameters - -- name: Gather information about all ELBs - community.aws.elb_classic_lb_info: - register: elb_info - -- ansible.builtin.debug: - msg: "{{ item.dns_name }}" - loop: "{{ elb_info.elbs }}" - -- name: Gather information about a particular ELB - community.aws.elb_classic_lb_info: - names: frontend-prod-elb - register: elb_info - -- ansible.builtin.debug: - msg: "{{ elb_info.elbs.0.dns_name }}" - -- name: Gather information about a set of ELBs - community.aws.elb_classic_lb_info: - names: - - frontend-prod-elb - - backend-prod-elb - register: elb_info - -- ansible.builtin.debug: - msg: "{{ item.dns_name }}" - loop: "{{ elb_info.elbs }}" -""" - -RETURN = r""" -elbs: - description: A list of load balancers. - returned: always - type: list - elements: dict - contains: - attributes: - description: Information about the load balancer attributes. - returned: always - type: dict - contains: - access_log: - description: Information on whether access logs are enabled or not. - type: dict - sample: { - "enabled": false - } - additional_attributes: - description: Information about additional load balancer attributes. - type: list - elements: dict - sample: [ - { - "key": "elb.http.desyncmitigationmode", - "value": "defensive" - } - ] - connection_draining: - description: - - Information on connection draining configuration of elastic load balancer. - type: dict - sample: { - "enabled": true, - "timeout": 300 - } - contains: - enabled: - description: Whether connection draining is enabled. - type: bool - returned: always - timeout: - description: The maximum time, in seconds, to keep the existing connections open before deregistering the instances. - type: int - returned: always - connection_settings: - description: Information on connection settings. - type: dict - sample: { - "idle_timeout": 60 - } - cross_zone_load_balancing: - description: Information on whether cross zone load balancing is enabled or not. - type: dict - sample: { - "enabled": true - } - availability_zones: - description: The Availability Zones for the load balancer. - type: list - elements: str - returned: always - sample: [ - "us-west-2a" - ] - backend_server_descriptions: - description: Information about your EC2 instances. - type: list - elements: dict - returned: always - sample: [ - { - instance_port: 8085, - policy_names: [ - 'MyPolicy1', - ] - }, - ] - canonical_hosted_zone_name: - description: The DNS name of the load balancer. - type: str - returned: always - sample: "test-123456789.us-west-2.elb.amazonaws.com" - canonical_hosted_zone_name_id: - description: The ID of the Amazon Route 53 hosted zone for the load balancer. - type: str - returned: always - sample: "Z1Z1ZZ5HABSF5" - created_time: - description: The date and time the load balancer was created. - type: str - returned: always - sample: "2024-09-04T17:52:22.270000+00:00" - dns_name: - description: The DNS name of the load balancer. - type: str - returned: "always" - sample: "test-123456789.us-west-2.elb.amazonaws.com" - health_check: - description: Information about the health checks conducted on the load balancer. - type: dict - returned: always - sample: { - "healthy_threshold": 10, - "interval": 5, - "target": "HTTP:80/index.html", - "timeout": 2, - "unhealthy_threshold": 2 - } - contains: - healthy_threshold: - description: The number of consecutive health checks successes required before moving the instance to the Healthy state. - type: int - returned: always - interval: - description: The approximate interval, in seconds, between health checks of an individual instance. - type: int - returned: always - target: - description: The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. - type: str - returned: always - timeout: - description: The amount of time, in seconds, during which no response means a failed health check. - type: int - returned: always - unhealthy_threshold: - description: The number of consecutive health checks successes required before moving the instance to the Unhealthy state. - type: int - returned: always - instances: - description: The IDs of the instances for the load balancer. - type: list - elements: dict - returned: always - sample: [ - { - "instance_id": "i-11d1f111ea111111b" - } - ] - instances_inservice: - description: Information about instances for load balancer in state "InService". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_inservice_count: - description: Total number of instances for load balancer with state "InService". - type: int - returned: always - sample: 1 - instances_outofservice: - description: Information about instances for load balancer in state "OutOfService". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_outofservice_count: - description: Total number of instances for load balancer with state "OutOfService". - type: int - returned: always - sample: 0 - instances_unknownservice: - description: Information about instances for load balancer in state "Unknown". - type: list - returned: always - sample: [ - "i-11d1f111ea111111b" - ] - instances_unknownservice_count: - description: Total number of instances for load balancer with state "Unknown". - type: int - returned: always - sample: 1 - listener_descriptions: - description: Information about the listeners for the load balancer. - type: list - elements: dict - returned: always - sample: [ - { - "listener": { - "instance_port": 80, - "instance_protocol": "HTTP", - "load_balancer_port": 80, - "protocol": "HTTP" - }, - "policy_names": [] - } - ] - load_balancer_name: - description: The name of the elastic load balancer. - type: str - returned: always - sample: "MyLoadBalancer" - policies: - description: Information about the policies defined for the load balancer. - type: dict - returned: always - sample: { - "app_cookie_stickiness_policies": [], - "lb_cookie_stickiness_policies": [], - "other_policies": [] - } - contains: - app_cookie_stickiness_policies: - description: The stickiness policies created using CreateAppCookieStickinessPolicy. - type: list - returned: always - lb_cookie_stickiness_policies: - description: The stickiness policies created using CreateLBCookieStickinessPolicy. - type: list - returned: always - other_policies: - description: The policies other than the stickiness policies. - type: list - returned: always - scheme: - description: The type of load balancer. - type: str - returned: always - sample: "internet-facing" - security_groups: - description: The security groups for the load balancer. - type: list - returned: always - sample: [ - "sg-111111af1111cb111" - ] - source_security_group: - description: - - The security group for the load balancer, - which are used as part of inbound rules for registered instances. - type: dict - returned: always - sample: { - "group_name": "default", - "owner_alias": "721111111111" - } - contains: - group_name: - description: The name of the security group. - type: str - returned: always - owner_alias: - description: The owner of the security group. - type: str - returned: always - subnets: - description: The IDs of the subnets for the load balancer. - type: list - returned: always - sample: [ - "subnet-111111af1111cb111" - ] - tags: - description: The tags associated with a load balancer. - type: dict - returned: always - sample: { - "Env": "Dev", - "Owner": "Dev001" - } - vpc_id: - description: The ID of the VPC for the load balancer. - type: str - returned: always - sample: "vpc-0cc28c9e20d111111" -""" - -from typing import Any -from typing import Dict -from typing import List -from typing import Tuple -from typing import Union - -try: - import botocore -except ImportError: - pass # caught by AnsibleAWSModule - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict - - -def list_elbs(connection: Any, load_balancer_names: List[str]) -> List[Dict]: - """ - List Elastic Load Balancers (ELBs) and their detailed information. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_names (List[str]): List of ELB names to gather information about. - - Returns: - A list of dictionaries where each dictionary contains informtion about one ELB. - """ - results = [] - - if not load_balancer_names: - for lb in get_all_lb(connection): - results.append(describe_elb(connection, lb)) - - for load_balancer_name in load_balancer_names: - lb = get_lb(connection, load_balancer_name) - if not lb: - continue - results.append(describe_elb(connection, lb)) - return results - - -def describe_elb(connection: Any, lb: Dict[str, Any]) -> Dict[str, Any]: - """ - Describes an Elastic Load Balancer (ELB). - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - lb (Dict): Dictionary containing ELB . - - Returns: - A dictionary with detailed information of the ELB. - """ - description = camel_dict_to_snake_dict(lb) - name = lb["LoadBalancerName"] - instances = lb.get("Instances", []) - description["tags"] = get_tags(connection, name) - description["instances_inservice"], description["instances_inservice_count"] = lb_instance_health( - connection, name, instances, "InService" - ) - description["instances_outofservice"], description["instances_outofservice_count"] = lb_instance_health( - connection, name, instances, "OutOfService" - ) - description["instances_unknownservice"], description["instances_unknownservice_count"] = lb_instance_health( - connection, name, instances, "Unknown" - ) - description["attributes"] = get_lb_attributes(connection, name) - return description - - -@AWSRetry.jittered_backoff() -def get_all_lb(connection: Any) -> List: - """ - Get paginated result for information of all Elastic Load Balancers. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - - Returns: - A list of dictionaries containing descriptions of all ELBs. - """ - paginator = connection.get_paginator("describe_load_balancers") - return paginator.paginate().build_full_result()["LoadBalancerDescriptions"] - - -def get_lb(connection: Any, load_balancer_name: str) -> Union[Dict[str, Any], List]: - """ - Describes a specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary with detailed information of the specified ELB. - """ - try: - return connection.describe_load_balancers(aws_retry=True, LoadBalancerNames=[load_balancer_name])[ - "LoadBalancerDescriptions" - ][0] - except is_boto3_error_code("LoadBalancerNotFound"): - return [] - - -def get_lb_attributes(connection: Any, load_balancer_name: str) -> Dict[str, Any]: - """ - Retrieves attributes of specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary with detailed information of the attributes of specified ELB. - """ - attributes = connection.describe_load_balancer_attributes(aws_retry=True, LoadBalancerName=load_balancer_name).get( - "LoadBalancerAttributes", {} - ) - return camel_dict_to_snake_dict(attributes) - - -def get_tags(connection: Any, load_balancer_name: str) -> Dict[str, Any]: - """ - Retrieves tags of specific Elastic Load Balancer (ELB) by name. - - Parameters: - connection (boto3.client): The Boto3 ELB client object. - load_balancer_name (str): Name of the ELB to gather information about. - - Returns: - A dictionary of tags associated with the specified ELB. - """ - tags = connection.describe_tags(aws_retry=True, LoadBalancerNames=[load_balancer_name])["TagDescriptions"] - if not tags: - return {} - return boto3_tag_list_to_ansible_dict(tags[0]["Tags"]) - - -def lb_instance_health( - connection: Any, load_balancer_name: str, instances: List[Dict[str, Any]], state: str -) -> Tuple[List[str], int]: - """ - Describes the health status of instances associated with a specific Elastic Load Balancer (ELB). - - Parameters: - connection (Any): The Boto3 client object for ELB. - load_balancer_name (str): The name of the ELB. - instances (List[Dict]): List of dictionaries containing instances associated with the ELB. - state (str): The health state to filter by (e.g., "InService", "OutOfService", "Unknown"). - - Returns: - Tuple[List, int]: A tuple containing a list of instance IDs matching state and the count of matching instances. - """ - instance_states = connection.describe_instance_health(LoadBalancerName=load_balancer_name, Instances=instances).get( - "InstanceStates", [] - ) - instate = [instance["InstanceId"] for instance in instance_states if instance["State"] == state] - return instate, len(instate) - - -def main(): - argument_spec = dict( - names=dict(default=[], type="list", elements="str"), - ) - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - connection = module.client("elb", retry_decorator=AWSRetry.jittered_backoff(retries=5, delay=5)) - - try: - elbs = list_elbs(connection, module.params.get("names")) - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, msg="Failed to get load balancer information.") - - module.exit_json(elbs=elbs) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/elb_classic_lb_info/aliases b/tests/integration/targets/elb_classic_lb_info/aliases deleted file mode 100644 index 4ef4b2067d0..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/aliases +++ /dev/null @@ -1 +0,0 @@ -cloud/aws diff --git a/tests/integration/targets/elb_classic_lb_info/defaults/main.yml b/tests/integration/targets/elb_classic_lb_info/defaults/main.yml deleted file mode 100644 index bd059e26ea7..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# defaults file for test_ec2_eip -elb_name: 'ansible-test-{{ tiny_prefix }}-ecli' diff --git a/tests/integration/targets/elb_classic_lb_info/meta/main.yml b/tests/integration/targets/elb_classic_lb_info/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml b/tests/integration/targets/elb_classic_lb_info/tasks/main.yml deleted file mode 100644 index b09e8807269..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/tasks/main.yml +++ /dev/null @@ -1,311 +0,0 @@ ---- -# __Test Info__ -# Create a self signed cert and upload it to AWS -# http://www.akadia.com/services/ssh_test_certificate.html -# http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/ssl-server-cert.html - -# __Test Outline__ -# -# __elb_classic_lb__ -# create test elb with listeners and certificate -# change AZ's -# change listeners -# remove listeners -# remove elb - -# __elb_classic_lb_info_ -# get nonexistent load balancer - -- module_defaults: - group/aws: - region: "{{ aws_region }}" - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - block: - - # ============================================================ - # create test elb with listeners, certificate, and health check - - - name: Create ELB - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - - protocol: http - load_balancer_port: 8080 - instance_port: 8080 - health_check: - ping_protocol: http - ping_port: 80 - ping_path: "/index.html" - response_timeout: 5 - interval: 30 - unhealthy_threshold: 2 - healthy_threshold: 10 - register: create - - - assert: - that: - - create is changed - # We rely on these for the info test, make sure they're what we expect - - aws_region ~ 'a' in create.elb.zones - - aws_region ~ 'b' in create.elb.zones - - create.elb.health_check.healthy_threshold == 10 - - create.elb.health_check.interval == 30 - - create.elb.health_check.target == "HTTP:80/index.html" - - create.elb.health_check.timeout == 5 - - create.elb.health_check.unhealthy_threshold == 2 - - '[80, 80, "HTTP", "HTTP"] in create.elb.listeners' - - '[8080, 8080, "HTTP", "HTTP"] in create.elb.listeners' - - - name: Get ELB info - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - info.elbs|length == 1 - - elb.availability_zones|length == 2 - - aws_region ~ 'a' in elb.availability_zones - - aws_region ~ 'b' in elb.availability_zones - - elb.health_check.healthy_threshold == 10 - - elb.health_check.interval == 30 - - elb.health_check.target == "HTTP:80/index.html" - - elb.health_check.timeout == 5 - - elb.health_check.unhealthy_threshold == 2 - - '{"instance_port": 80, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' - - '{"instance_port": 8080, "instance_protocol": "HTTP", "load_balancer_port": 8080, "protocol": "HTTP"} == listeners[1]' - vars: - elb: "{{ info.elbs[0] }}" - listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" - - # ============================================================ - - # check ports, would be cool, but we are at the mercy of AWS - # to start things in a timely manner - - #- name: check to make sure 80 is listening - # wait_for: host={{ info.elb.dns_name }} port=80 timeout=600 - # register: result - - #- name: assert can connect to port# - # assert: 'result.state == "started"' - - #- name: check to make sure 443 is listening - # wait_for: host={{ info.elb.dns_name }} port=443 timeout=600 - # register: result - - #- name: assert can connect to port# - # assert: 'result.state == "started"' - - # ============================================================ - - # Change AZ's - - - name: Change AZ's - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - purge_zones: yes - health_check: - ping_protocol: http - ping_port: 80 - ping_path: "/index.html" - response_timeout: 5 - interval: 30 - unhealthy_threshold: 2 - healthy_threshold: 10 - register: update_az - - - assert: - that: - - update_az is changed - - update_az.elb.zones[0] == aws_region ~ 'c' - - - name: Get ELB info after changing AZ's - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.availability_zones|length == 1 - - aws_region ~ 'c' in elb.availability_zones[0] - vars: - elb: "{{ info.elbs[0] }}" - - # ============================================================ - - # Update AZ's - - - name: Update AZ's - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - purge_zones: yes - register: update_az - - - assert: - that: - - update_az is changed - - aws_region ~ 'a' in update_az.elb.zones - - aws_region ~ 'b' in update_az.elb.zones - - aws_region ~ 'c' in update_az.elb.zones - - - name: Get ELB info after updating AZ's - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.availability_zones|length == 3 - - aws_region ~ 'a' in elb.availability_zones - - aws_region ~ 'b' in elb.availability_zones - - aws_region ~ 'c' in elb.availability_zones - vars: - elb: "{{ info.elbs[0] }}" - - # ============================================================ - - # Purge Listeners - - - name: Purge Listeners - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 81 - purge_listeners: yes - register: purge_listeners - - - assert: - that: - - purge_listeners is changed - - '[80, 81, "HTTP", "HTTP"] in purge_listeners.elb.listeners' - - purge_listeners.elb.listeners|length == 1 - - - name: Get ELB info after purging listeners - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.listener_descriptions|length == 1 - - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == elb.listener_descriptions[0].listener' - vars: - elb: "{{ info.elbs[0] }}" - - - # ============================================================ - - # add Listeners - - - name: Add Listeners - elb_classic_lb: - name: "{{ elb_name }}" - state: present - zones: - - "{{ aws_region }}a" - - "{{ aws_region }}b" - - "{{ aws_region }}c" - listeners: - - protocol: http - load_balancer_port: 8081 - instance_port: 8081 - purge_listeners: no - register: update_listeners - - - assert: - that: - - update_listeners is changed - - '[80, 81, "HTTP", "HTTP"] in update_listeners.elb.listeners' - - '[8081, 8081, "HTTP", "HTTP"] in update_listeners.elb.listeners' - - update_listeners.elb.listeners|length == 2 - - - name: Get ELB info after adding listeners - elb_classic_lb_info: - names: "{{ elb_name }}" - register: info - - - assert: - that: - - elb.listener_descriptions|length == 2 - - '{"instance_port": 81, "instance_protocol": "HTTP", "load_balancer_port": 80, "protocol": "HTTP"} == listeners[0]' - - '{"instance_port": 8081, "instance_protocol": "HTTP", "load_balancer_port": 8081, "protocol": "HTTP"} == listeners[1]' - vars: - elb: "{{ info.elbs[0] }}" - listeners: "{{ elb.listener_descriptions|map(attribute='listener')|sort(attribute='load_balancer_port') }}" - - # ============================================================ - - # Test getting nonexistent load balancer - - name: get nonexistent load balancer - elb_classic_lb_info: - names: "invalid-elb" - register: info - - - assert: - that: - - info.elbs|length==0 - - # Test getting a valid and nonexistent load balancer - - name: get nonexistent load balancer - elb_classic_lb_info: - names: ["{{ elb_name }}", "invalid-elb"] - register: info - - - assert: - that: - - info.elbs|length==1 - - info.elbs[0].load_balancer_name == elb_name - - # ============================================================ - - - name: get all load balancers - elb_classic_lb_info: - names: "{{ omit }}" - register: info - - - assert: - that: - - info.elbs|length>0 - - always: - - # ============================================================ - - name: remove the test load balancer completely - elb_classic_lb: - name: "{{ elb_name }}" - state: absent - register: result - ignore_errors: true diff --git a/tests/integration/targets/elb_classic_lb_info/vars/main.yml b/tests/integration/targets/elb_classic_lb_info/vars/main.yml deleted file mode 100644 index 79194af1ef5..00000000000 --- a/tests/integration/targets/elb_classic_lb_info/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for test_ec2_elb_lb From 6e3e99c4e55266ab71f6258d72ac0b1b09df5a92 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 25 Oct 2024 12:47:14 +0200 Subject: [PATCH 64/77] DNM - Migrate modules ec2_vpc_nacl,ec2_vpc_nacl_info and tests (#2178) Depends-On: ansible-collections/amazon.aws#2339 Remove ec2_vpc_nacl,ec2_vpc_nacl_info modules and tests, these modules have been migrated to amazon.aws collection. Update runtime.yml with redirects to that collection Update ignore files Reviewed-by: GomathiselviS Reviewed-by: Mandar Kulkarni --- ...igrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml | 8 + meta/runtime.yml | 6 +- plugins/modules/ec2_vpc_nacl.py | 536 ------------------ plugins/modules/ec2_vpc_nacl_info.py | 231 -------- .../integration/targets/ec2_vpc_nacl/aliases | 3 - .../targets/ec2_vpc_nacl/defaults/main.yml | 12 - .../targets/ec2_vpc_nacl/meta/main.yml | 1 - .../ec2_vpc_nacl/tasks/ingress_and_egress.yml | 159 ------ .../targets/ec2_vpc_nacl/tasks/ipv6.yml | 131 ----- .../targets/ec2_vpc_nacl/tasks/main.yml | 174 ------ .../targets/ec2_vpc_nacl/tasks/subnet_ids.yml | 163 ------ .../ec2_vpc_nacl/tasks/subnet_names.yml | 137 ----- .../targets/ec2_vpc_nacl/tasks/tags.yml | 455 --------------- 13 files changed, 12 insertions(+), 2004 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml delete mode 100644 plugins/modules/ec2_vpc_nacl.py delete mode 100644 plugins/modules/ec2_vpc_nacl_info.py delete mode 100644 tests/integration/targets/ec2_vpc_nacl/aliases delete mode 100644 tests/integration/targets/ec2_vpc_nacl/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/meta/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml delete mode 100644 tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml diff --git a/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml b/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml new file mode 100644 index 00000000000..15a0f626e45 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_vpc_nacl - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_nacl`` (https://github.com/ansible-collections/community.aws/pull/2178). + - ec2_vpc_nacl_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_nacl_info`` (https://github.com/ansible-collections/community.aws/pull/2178). diff --git a/meta/runtime.yml b/meta/runtime.yml index 662ded07df1..7340441a8f9 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -114,8 +114,6 @@ action_groups: - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - - ec2_vpc_nacl - - ec2_vpc_nacl_info - ec2_vpc_peer - ec2_vpc_peering_info - ec2_vpc_vgw @@ -526,6 +524,10 @@ plugin_routing: redirect: amazon.aws.ec2_transit_gateway_vpc_attachment_info elb_classic_lb_info: redirect: amazon.aws.elb_classic_lb_info + ec2_vpc_nacl: + redirect: amazon.aws.ec2_vpc_nacl + ec2_vpc_nacl_info: + redirect: amazon.aws.ec2_vpc_nacl_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_vpc_nacl.py b/plugins/modules/ec2_vpc_nacl.py deleted file mode 100644 index bc92003d17c..00000000000 --- a/plugins/modules/ec2_vpc_nacl.py +++ /dev/null @@ -1,536 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_vpc_nacl -short_description: create and delete Network ACLs -version_added: 1.0.0 -description: - - Read the AWS documentation for Network ACLS - U(https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ACLs.html) -options: - name: - description: - - Tagged name identifying a network ACL. - - One and only one of the O(name) or O(nacl_id) is required. - - Mutually exclusive with O(nacl_id). - required: false - type: str - nacl_id: - description: - - NACL id identifying a network ACL. - - One and only one of the O(name) or O(nacl_id) is required. - - Mutually exclusive with O(name). - required: false - type: str - vpc_id: - description: - - VPC id of the requesting VPC. - - Required when state present. - required: false - type: str - subnets: - description: - - The list of subnets that should be associated with the network ACL. - - Must be specified as a list - - Each subnet can be specified as subnet ID, or its tagged name. - required: false - type: list - elements: str - default: [] - egress: - description: - - A list of rules for outgoing traffic. Each rule must be specified as a list. - Each rule may contain the rule number (integer 1-32766), protocol (one of ['tcp', 'udp', 'icmp', 'ipv6-icmp', '-1', 'all']), - the rule action ('allow' or 'deny') the CIDR of the IPv4 or IPv6 network range to allow or deny, - the ICMP type (-1 means all types), the ICMP code (-1 means all codes), the last port in the range for - TCP or UDP protocols, and the first port in the range for TCP or UDP protocols. - See examples. - default: [] - required: false - type: list - elements: list - ingress: - description: - - List of rules for incoming traffic. Each rule must be specified as a list. - Each rule may contain the rule number (integer 1-32766), protocol (one of ['tcp', 'udp', 'icmp', 'ipv6-icmp', '-1', 'all']), - the rule action ('allow' or 'deny') the CIDR of the IPv4 or IPv6 network range to allow or deny, - the ICMP type (-1 means all types), the ICMP code (-1 means all codes), the last port in the range for - TCP or UDP protocols, and the first port in the range for TCP or UDP protocols. - See examples. - default: [] - required: false - type: list - elements: list - state: - description: - - Creates or modifies an existing NACL - - Deletes a NACL and reassociates subnets to the default NACL - required: false - type: str - choices: ['present', 'absent'] - default: present -author: - - Mike Mochan (@mmochan) -notes: - - Support for I(purge_tags) was added in release 4.0.0. -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 - - amazon.aws.tags -""" - -EXAMPLES = r""" -# Complete example to create and delete a network ACL -# that allows SSH, HTTP and ICMP in, and all traffic out. -- name: "Create and associate production DMZ network ACL with DMZ subnets" - community.aws.ec2_vpc_nacl: - vpc_id: vpc-12345678 - name: prod-dmz-nacl - region: ap-southeast-2 - subnets: ['prod-dmz-1', 'prod-dmz-2'] - tags: - CostCode: CC1234 - Project: phoenix - Description: production DMZ - ingress: - # rule no, protocol, allow/deny, cidr, icmp_type, icmp_code, - # port from, port to - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [205, 'tcp', 'allow', '::/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - - [305, 'ipv6-icmp', 'allow', '::/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - - [105, 'all', 'allow', '::/0', null, null, null, null] - state: 'present' - -- name: "Remove the ingress and egress rules - defaults to deny all" - community.aws.ec2_vpc_nacl: - vpc_id: vpc-12345678 - name: prod-dmz-nacl - region: ap-southeast-2 - subnets: - - prod-dmz-1 - - prod-dmz-2 - tags: - CostCode: CC1234 - Project: phoenix - Description: production DMZ - state: present - -- name: "Remove the NACL subnet associations and tags" - community.aws.ec2_vpc_nacl: - vpc_id: 'vpc-12345678' - name: prod-dmz-nacl - region: ap-southeast-2 - state: present - -- name: "Delete nacl and subnet associations" - community.aws.ec2_vpc_nacl: - vpc_id: vpc-12345678 - name: prod-dmz-nacl - state: absent - -- name: "Delete nacl by its id" - community.aws.ec2_vpc_nacl: - nacl_id: acl-33b4ee5b - state: absent -""" - -RETURN = r""" -nacl_id: - description: The id of the NACL (when creating or updating an ACL). - returned: success - type: str - sample: "acl-123456789abcdef01" -""" - -from typing import Any -from typing import Dict -from typing import List -from typing import Optional - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_network_acl -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_network_acl_entry -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_network_acl -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_network_acl_entry -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_network_acls -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_subnets -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import replace_network_acl_association - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - -# VPC-supported IANA protocol numbers -# http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml -PROTOCOL_NUMBERS = {"all": -1, "icmp": 1, "tcp": 6, "udp": 17, "ipv6-icmp": 58} - - -# Utility methods -def icmp_present(entry: List[str]) -> bool: - return len(entry) == 6 and entry[1] in ["icmp", "ipv6-icmp"] or entry[1] in [1, 58] - - -def subnets_changed(client, module: AnsibleAWSModule, nacl_id: str, subnets_ids: List[str]) -> bool: - changed = False - vpc_id = module.params.get("vpc_id") - - if not subnets_ids: - default_nacl_id = find_default_vpc_nacl(client, vpc_id) - # Find subnets by Network ACL ids - network_acls = describe_network_acls( - client, Filters=[{"Name": "association.network-acl-id", "Values": [nacl_id]}] - ) - subnets = [ - association["SubnetId"] - for nacl in network_acls - for association in nacl["Associations"] - if association["SubnetId"] - ] - changed = associate_nacl_to_subnets(client, module, default_nacl_id, subnets) - return changed - - network_acls = describe_network_acls(client, NetworkAclIds=[nacl_id]) - current_subnets = [ - association["SubnetId"] - for nacl in network_acls - for association in nacl["Associations"] - if association["SubnetId"] - ] - subnets_added = [subnet for subnet in subnets_ids if subnet not in current_subnets] - subnets_removed = [subnet for subnet in current_subnets if subnet not in subnets_ids] - - if subnets_added: - changed |= associate_nacl_to_subnets(client, module, nacl_id, subnets_added) - if subnets_removed: - default_nacl_id = find_default_vpc_nacl(client, vpc_id) - changed |= associate_nacl_to_subnets(client, module, default_nacl_id, subnets_removed) - - return changed - - -def nacls_changed(client, module: AnsibleAWSModule, nacl_info: Dict[str, Any]) -> bool: - changed = False - entries = nacl_info["Entries"] - nacl_id = nacl_info["NetworkAclId"] - aws_egress_rules = [rule for rule in entries if rule["Egress"] is True and rule["RuleNumber"] < 32767] - aws_ingress_rules = [rule for rule in entries if rule["Egress"] is False and rule["RuleNumber"] < 32767] - - # Egress Rules - changed |= rules_changed(client, nacl_id, module.params.get("egress"), aws_egress_rules, True, module.check_mode) - # Ingress Rules - changed |= rules_changed(client, nacl_id, module.params.get("ingress"), aws_ingress_rules, False, module.check_mode) - return changed - - -def tags_changed(client, module: AnsibleAWSModule, nacl_id: str) -> bool: - tags = module.params.get("tags") - name = module.params.get("name") - purge_tags = module.params.get("purge_tags") - - if name is None and tags is None: - return False - - if module.params.get("tags") is None: - # Only purge tags if tags is explicitly set to {} and purge_tags is True - purge_tags = False - - new_tags = dict() - if module.params.get("name") is not None: - new_tags["Name"] = module.params.get("name") - new_tags.update(module.params.get("tags") or {}) - - return ensure_ec2_tags( - client, module, nacl_id, tags=new_tags, purge_tags=purge_tags, retry_codes=["InvalidNetworkAclID.NotFound"] - ) - - -def ansible_to_boto3_dict_rule(ansible_rule: List[Any], egress: bool) -> Dict[str, Any]: - boto3_rule = {} - if isinstance(ansible_rule, list): - boto3_rule["RuleNumber"] = ansible_rule[0] - boto3_rule["Protocol"] = str(PROTOCOL_NUMBERS[ansible_rule[1]]) - boto3_rule["RuleAction"] = ansible_rule[2] - boto3_rule["Egress"] = egress - if is_ipv6(ansible_rule[3]): - boto3_rule["Ipv6CidrBlock"] = ansible_rule[3] - else: - boto3_rule["CidrBlock"] = ansible_rule[3] - if icmp_present(ansible_rule): - boto3_rule["IcmpTypeCode"] = {"Type": int(ansible_rule[4]), "Code": int(ansible_rule[5])} - else: - if ansible_rule[6] or ansible_rule[7]: - boto3_rule["PortRange"] = {"From": ansible_rule[6], "To": ansible_rule[7]} - return boto3_rule - - -def find_added_rules(rules_a: List[Dict[str, Any]], rules_b: List[Dict[str, Any]]) -> List[Dict[str, Any]]: - results = [] - # A rule is considered as a new rule if either the RuleNumber does exist in the list of - # current Rules stored in AWS or if the Rule differs with the Rule stored in AWS with the same RuleNumber - for a in rules_a: - if not any(a["RuleNumber"] == b["RuleNumber"] and a == b for b in rules_b): - results.append(a) - return results - - -def rules_changed( - client, - nacl_id: str, - ansible_rules: List[List[str]], - aws_rules: List[Dict[str, Any]], - egress: bool, - check_mode: bool, -) -> bool: - # transform rules: from ansible list to boto3 dict - ansible_rules = [ansible_to_boto3_dict_rule(r, egress) for r in ansible_rules] - - # find added rules - added_rules = find_added_rules(ansible_rules, aws_rules) - # find removed rules - removed_rules = find_added_rules(aws_rules, ansible_rules) - - changed = False - for rule in added_rules: - changed = True - if not check_mode: - rule_number = rule.pop("RuleNumber") - protocol = rule.pop("Protocol") - rule_action = rule.pop("RuleAction") - egress = rule.pop("Egress") - create_network_acl_entry( - client, - network_acl_id=nacl_id, - protocol=protocol, - egress=egress, - rule_action=rule_action, - rule_number=rule_number, - **rule, - ) - - # Removed Rules - for rule in removed_rules: - changed = True - if not check_mode: - delete_network_acl_entry(client, network_acl_id=nacl_id, rule_number=rule["RuleNumber"], egress=egress) - - return changed - - -def is_ipv6(cidr: str) -> bool: - return ":" in cidr - - -def process_rule_entry(entry: List[Any]) -> Dict[str, Any]: - params = {} - if is_ipv6(entry[3]): - params["Ipv6CidrBlock"] = entry[3] - else: - params["CidrBlock"] = entry[3] - if icmp_present(entry): - params["IcmpTypeCode"] = {"Type": int(entry[4]), "Code": int(entry[5])} - else: - if entry[6] or entry[7]: - params["PortRange"] = {"From": entry[6], "To": entry[7]} - - return params - - -def add_network_acl_entries( - client, nacl_id: str, ansible_entries: List[List[str]], egress: bool, check_mode: bool -) -> bool: - changed = False - for entry in ansible_entries: - changed = True - if not check_mode: - create_network_acl_entry( - client, - network_acl_id=nacl_id, - protocol=str(PROTOCOL_NUMBERS[entry[1]]), - egress=egress, - rule_action=entry[2], - rule_number=entry[0], - **process_rule_entry(entry), - ) - return changed - - -def associate_nacl_to_subnets(client, module: AnsibleAWSModule, nacl_id: str, subnets_ids: List[str]) -> bool: - changed = False - if subnets_ids: - network_acls = describe_network_acls(client, Filters=[{"Name": "association.subnet-id", "Values": subnets_ids}]) - associations = [ - association["NetworkAclAssociationId"] - for nacl in network_acls - for association in nacl["Associations"] - if association["SubnetId"] in subnets_ids - ] - for association_id in associations: - changed = True - if not module.check_mode: - replace_network_acl_association(client, network_acl_id=nacl_id, association_id=association_id) - return changed - - -def ensure_present(client, module: AnsibleAWSModule) -> None: - changed = False - nacl = describe_network_acl(client, module) - nacl_id = None - subnets_ids = [] - subnets = module.params.get("subnets") - if subnets: - subnets_ids = find_subnets_ids(client, module, subnets) - - if not nacl: - if module.check_mode: - module.exit_json(changed=True, msg="Would have created Network ACL if not in check mode.") - - # Create Network ACL - tags = {} - name = module.params.get("name") - vpc_id = module.params.get("vpc_id") - if name: - tags["Name"] = name - if module.params.get("tags"): - tags.update(module.params.get("tags")) - nacl = create_network_acl(client, vpc_id, tags) - changed = True - - # Associate Subnets to Network ACL - nacl_id = nacl["NetworkAclId"] - changed |= associate_nacl_to_subnets(client, module, nacl_id, subnets_ids) - - # Create Network ACL entries (ingress and egress) - changed |= add_network_acl_entries( - client, nacl_id, module.params.get("ingress"), egress=False, check_mode=module.check_mode - ) - changed |= add_network_acl_entries( - client, nacl_id, module.params.get("egress"), egress=True, check_mode=module.check_mode - ) - else: - nacl_id = nacl["NetworkAclId"] - changed |= subnets_changed(client, module, nacl_id, subnets_ids) - changed |= nacls_changed(client, module, nacl) - changed |= tags_changed(client, module, nacl_id) - - module.exit_json(changed=changed, nacl_id=nacl_id) - - -def ensure_absent(client, module: AnsibleAWSModule) -> None: - changed = False - result = {} - nacl = describe_network_acl(client, module) - if not nacl: - module.exit_json(changed=changed) - - nacl_id = nacl["NetworkAclId"] - vpc_id = nacl["VpcId"] - associations = nacl["Associations"] - assoc_ids = [a["NetworkAclAssociationId"] for a in associations] - - # Find default NACL associated to the VPC - default_nacl_id = find_default_vpc_nacl(client, vpc_id) - if not default_nacl_id: - module.exit_json(changed=changed, msg="Default NACL ID not found - Check the VPC ID") - - # Replace Network ACL association - for assoc_id in assoc_ids: - changed = True - if not module.check_mode: - replace_network_acl_association(client, network_acl_id=default_nacl_id, association_id=assoc_id) - - # Delete Network ACL - changed = True - if module.check_mode: - module.exit_json(changed=changed, msg=f"Would have deleted Network ACL id '{nacl_id}' if not in check mode.") - - changed = delete_network_acl(client, network_acl_id=nacl_id) - module.exit_json(changed=changed, msg=f"Network ACL id '{nacl_id}' successfully deleted.") - - -def describe_network_acl(client, module: AnsibleAWSModule) -> Optional[Dict[str, Any]]: - nacl_id = module.params.get("nacl_id") - name = module.params.get("name") - - if nacl_id: - filters = [{"Name": "network-acl-id", "Values": [nacl_id]}] - else: - filters = [{"Name": "tag:Name", "Values": [name]}] - network_acls = describe_network_acls(client, Filters=filters) - return None if not network_acls else network_acls[0] - - -def find_default_vpc_nacl(client, vpc_id: str) -> Optional[str]: - default_nacl_id = None - for nacl in describe_network_acls(client, Filters=[{"Name": "vpc-id", "Values": [vpc_id]}]): - if nacl.get("IsDefault", False): - default_nacl_id = nacl["NetworkAclId"] - break - return default_nacl_id - - -def find_subnets_ids(client, module: AnsibleAWSModule, subnets_ids_or_names: List[str]) -> List[str]: - subnets_ids = [] - subnets_names = [] - - # Find Subnets by ID - subnets = describe_subnets(client, Filters=[{"Name": "subnet-id", "Values": subnets_ids_or_names}]) - subnets_ids += [subnet["SubnetId"] for subnet in subnets] - subnets_names += [tag["Value"] for subnet in subnets for tag in subnet.get("Tags", []) if tag["Key"] == "Name"] - - # Find Subnets by Name - subnets = describe_subnets(client, Filters=[{"Name": "tag:Name", "Values": subnets_ids_or_names}]) - subnets_ids += [subnet["SubnetId"] for subnet in subnets] - subnets_names += [tag["Value"] for subnet in subnets for tag in subnet.get("Tags", []) if tag["Key"] == "Name"] - - unexisting_subnets = [s for s in subnets_ids_or_names if s not in subnets_names + subnets_ids] - if unexisting_subnets: - module.fail_json(msg=f"The following subnets do not exist: {unexisting_subnets}") - return subnets_ids - - -def main(): - argument_spec = dict( - vpc_id=dict(), - name=dict(), - nacl_id=dict(), - subnets=dict(required=False, type="list", default=[], elements="str"), - tags=dict(required=False, type="dict", aliases=["resource_tags"]), - purge_tags=dict(required=False, type="bool", default=True), - ingress=dict(required=False, type="list", default=list(), elements="list"), - egress=dict(required=False, type="list", default=list(), elements="list"), - state=dict(default="present", choices=["present", "absent"]), - ) - - mutually_exclusive = [ - ["name", "nacl_id"], - ] - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - required_one_of=[["name", "nacl_id"]], - required_if=[["state", "present", ["vpc_id"]]], - mutually_exclusive=mutually_exclusive, - ) - - client = module.client("ec2") - - try: - if module.params.get("state") == "present": - ensure_present(client, module) - else: - ensure_absent(client, module) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_vpc_nacl_info.py b/plugins/modules/ec2_vpc_nacl_info.py deleted file mode 100644 index 9e0bc4e7f05..00000000000 --- a/plugins/modules/ec2_vpc_nacl_info.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Contributors to the Ansible project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_vpc_nacl_info -version_added: 1.0.0 -short_description: Gather information about Network ACLs in an AWS VPC -description: - - Gather information about Network ACLs in an AWS VPC -author: - - "Brad Davidson (@brandond)" -options: - nacl_ids: - description: - - A list of Network ACL IDs to retrieve information about. - required: false - default: [] - aliases: [nacl_id] - type: list - elements: str - filters: - description: - - A dict of filters to apply. Each dict item consists of a filter key and a filter value. See - U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeNetworkAcls.html) for possible filters. Filter - names and values are case sensitive. - required: false - default: {} - type: dict -notes: - - By default, the module will return all Network ACLs. - -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -# Gather information about all Network ACLs: -- name: Get All NACLs - community.aws.ec2_vpc_nacl_info: - region: us-west-2 - register: all_nacls - -# Retrieve default Network ACLs: -- name: Get Default NACLs - community.aws.ec2_vpc_nacl_info: - region: us-west-2 - filters: - 'default': 'true' - register: default_nacls -""" - -RETURN = r""" -nacls: - description: Returns an array of complex objects as described below. - returned: success - type: complex - contains: - nacl_id: - description: The ID of the Network Access Control List. - returned: always - type: str - vpc_id: - description: The ID of the VPC that the NACL is attached to. - returned: always - type: str - is_default: - description: True if the NACL is the default for its VPC. - returned: always - type: bool - tags: - description: A dict of tags associated with the NACL. - returned: always - type: dict - subnets: - description: A list of subnet IDs that are associated with the NACL. - returned: always - type: list - elements: str - ingress: - description: - - A list of NACL ingress rules with the following format. - - "C([rule no, protocol, allow/deny, v4 or v6 cidr, icmp_type, icmp_code, port from, port to])" - returned: always - type: list - elements: list - sample: [[100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22]] - egress: - description: - - A list of NACL egress rules with the following format. - - "C([rule no, protocol, allow/deny, v4 or v6 cidr, icmp_type, icmp_code, port from, port to])" - returned: always - type: list - elements: list - sample: [[100, 'all', 'allow', '0.0.0.0/0', null, null, null, null]] -""" - -from typing import Any -from typing import Dict -from typing import List -from typing import Union - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_network_acls -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - -# VPC-supported IANA protocol numbers -# http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml -PROTOCOL_NAMES = {"-1": "all", "1": "icmp", "6": "tcp", "17": "udp"} - - -def format_nacl(nacl: Dict[str, Any]) -> Dict[str, Any]: - # Turn the boto3 result into ansible friendly snake cases - nacl = camel_dict_to_snake_dict(nacl) - - # convert boto3 tags list into ansible dict - if "tags" in nacl: - nacl["tags"] = boto3_tag_list_to_ansible_dict(nacl["tags"], "key", "value") - - # Convert NACL entries - if "entries" in nacl: - nacl["egress"] = [ - nacl_entry_to_list(entry) for entry in nacl["entries"] if entry["rule_number"] < 32767 and entry["egress"] - ] - nacl["ingress"] = [ - nacl_entry_to_list(entry) - for entry in nacl["entries"] - if entry["rule_number"] < 32767 and not entry["egress"] - ] - del nacl["entries"] - - # Read subnets from NACL Associations - if "associations" in nacl: - nacl["subnets"] = [a["subnet_id"] for a in nacl["associations"]] - del nacl["associations"] - - # Read Network ACL id - if "network_acl_id" in nacl: - nacl["nacl_id"] = nacl["network_acl_id"] - del nacl["network_acl_id"] - - return nacl - - -def list_ec2_vpc_nacls(connection, module: AnsibleAWSModule) -> None: - nacl_ids = module.params.get("nacl_ids") - filters = module.params.get("filters") - - params = {} - if filters: - params["Filters"] = ansible_dict_to_boto3_filter_list(filters) - if nacl_ids: - params["NetworkAclIds"] = nacl_ids - - try: - network_acls = describe_network_acls(connection, **params) - if not network_acls: - module.fail_json(msg="Unable to describe ACL. NetworkAcl does not exist") - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - module.exit_json(nacls=[format_nacl(nacl) for nacl in network_acls]) - - -def nacl_entry_to_list(entry: Dict[str, Any]) -> List[Union[str, int, None]]: - # entry list format - # [ rule_num, protocol name or number, allow or deny, ipv4/6 cidr, icmp type, icmp code, port from, port to] - elist = [] - - elist.append(entry["rule_number"]) - - if entry.get("protocol") in PROTOCOL_NAMES: - elist.append(PROTOCOL_NAMES[entry["protocol"]]) - else: - elist.append(entry.get("protocol")) - - elist.append(entry["rule_action"]) - - if entry.get("cidr_block"): - elist.append(entry["cidr_block"]) - elif entry.get("ipv6_cidr_block"): - elist.append(entry["ipv6_cidr_block"]) - else: - elist.append(None) - - elist = elist + [None, None, None, None] - - if entry["protocol"] in ("1", "58"): - elist[4] = entry.get("icmp_type_code", {}).get("type") - elist[5] = entry.get("icmp_type_code", {}).get("code") - - if entry["protocol"] not in ("1", "6", "17", "58"): - elist[6] = 0 - elist[7] = 65535 - elif "port_range" in entry: - elist[6] = entry["port_range"]["from"] - elist[7] = entry["port_range"]["to"] - - return elist - - -def main(): - argument_spec = dict( - nacl_ids=dict(default=[], type="list", aliases=["nacl_id"], elements="str"), - filters=dict(default={}, type="dict"), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - connection = module.client("ec2") - - list_ec2_vpc_nacls(connection, module) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_vpc_nacl/aliases b/tests/integration/targets/ec2_vpc_nacl/aliases deleted file mode 100644 index 04109c2687b..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_vpc_nacl_info diff --git a/tests/integration/targets/ec2_vpc_nacl/defaults/main.yml b/tests/integration/targets/ec2_vpc_nacl/defaults/main.yml deleted file mode 100644 index 5ac931209fb..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/defaults/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -vpc_name: '{{ resource_prefix }}-ec2-vpc-nacl' -nacl_name: '{{ resource_prefix }}-ec2-vpc-nacl' -subnet_name: '{{ resource_prefix }}-ec2-vpc-nacl' -vpc_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.0.0/16' -subnet_1: '10.{{ 256 | random(seed=resource_prefix) }}.1.0/24' -subnet_2: '10.{{ 256 | random(seed=resource_prefix) }}.2.0/24' -subnet_3: '10.{{ 256 | random(seed=resource_prefix) }}.3.0/24' -subnet_4: '10.{{ 256 | random(seed=resource_prefix) }}.4.0/24' - -vpc_ipv6_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.5.0/25' -vpc_ipv6_name: '{{ vpc_name }}-ipv6' diff --git a/tests/integration/targets/ec2_vpc_nacl/meta/main.yml b/tests/integration/targets/ec2_vpc_nacl/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml deleted file mode 100644 index 432aaf3ba99..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/ingress_and_egress.yml +++ /dev/null @@ -1,159 +0,0 @@ -# ============================================================ -- name: Test Ingress and Egress rules - block: - - name: Create ingress and egress rules using subnet IDs - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - - - name: Assert the network acl was created - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 3 - - nacl_facts.nacls[0].egress | length == 1 - - # ============================================================ - - - name: Remove an ingress rule - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - - - name: Assert the network acl changed - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 2 - - nacl_facts.nacls[0].egress | length == 1 - - # ============================================================ - - - name: Remove the egress rule - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - egress: [] - state: 'present' - register: nacl - - - name: Assert the network acl changed - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 2 - - nacl_facts.nacls[0].egress | length == 0 - - # ============================================================ - - - name: Add egress rules - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - egress: - - [100, 'tcp', 'allow', '10.0.0.0/24', null, null, 22, 22] - - [200, 'udp', 'allow', '10.0.0.0/24', null, null, 22, 22] - state: 'present' - register: nacl - - - name: Assert the network acl changed - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 2 - - nacl_facts.nacls[0].egress | length == 2 - - # ============================================================ - - - name: Remove the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: nacl - - - name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl.changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml deleted file mode 100644 index 2113fb4aa9c..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/ipv6.yml +++ /dev/null @@ -1,131 +0,0 @@ -- name: Test using IPv6 - block: - - # ============================================================ - - - name: Create ingress and egress rules using subnet names - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_ipv6_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_name }}-ipv6" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - - - name: Assert that module returned the Network ACL id - ansible.builtin.assert: - that: - - nacl.nacl_id - - - name: Set fact for Network ACL ID - ansible.builtin.set_fact: - nacl_id: "{{ nacl.nacl_id }}" - - - name: Add ipv6 entries - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_ipv6_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_name }}-ipv6" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [205, 'tcp', 'allow', '::/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - - [305, 'ipv6-icmp', 'allow', '::/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - - [105, 'all', 'allow', '::/0', null, null, null, null] - state: 'present' - register: nacl - - - name: Assert that module reported change while the Network ACL remained unchanged - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id == nacl_id - - - name: Get network ACL facts (test that it works with ipv6 entries) - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 5 - - nacl_facts.nacls[0].egress | length == 2 - - - name: Purge ingress entries - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_ipv6_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_name }}-ipv6" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: [] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - - [105, 'all', 'allow', '::/0', null, null, null, null] - state: 'present' - register: nacl - - - name: Assert that module reported change while the Network ACL remained unchanged - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id == nacl_id - - - name: Purge egress entries - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_ipv6_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_name }}-ipv6" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: [] - egress: [] - state: 'present' - register: nacl - - - name: Assert that module reported change - ansible.builtin.assert: - that: - - nacl.changed - - - name: Get network ACL facts (test that removed entries are gone) - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl_id }}" - register: nacl_facts - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].ingress | length == 0 - - nacl_facts.nacls[0].egress | length == 0 - - always: - - - name: Remove network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_ipv6_id }}" - name: "{{ nacl_name }}" - state: absent - register: removed_acl - ignore_errors: true diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml deleted file mode 100644 index 445161ccd82..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/main.yml +++ /dev/null @@ -1,174 +0,0 @@ ---- -- module_defaults: - group/aws: - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - region: "{{ aws_region }}" - - block: - - # ============================================================ - - - name: Test without any parameters - community.aws.ec2_vpc_nacl: - register: result - ignore_errors: true - - - name: Assert required parameters - ansible.builtin.assert: - that: - - result.failed - - "result.msg == 'one of the following is required: name, nacl_id'" - - - name: Get network ACL info without any parameters - community.aws.ec2_vpc_nacl_info: - register: nacl_facts - - - name: Assert we don't error - assert: - that: - - nacl_facts is succeeded - - - name: Get network ACL info with invalid ID - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - 'acl-000000000000' - register: nacl_facts - ignore_errors: true - - - name: Assert message mentions missing ACLs - assert: - that: - - nacl_facts is failed - - '"does not exist" in nacl_facts.msg' - - # ============================================================ - - - name: Fetch AZ availability - amazon.aws.aws_az_info: - register: az_info - - - name: Assert that we have multiple AZs available to us - ansible.builtin.assert: - that: az_info.availability_zones | length >= 2 - - - name: Pick AZs - ansible.builtin.set_fact: - az_one: '{{ az_info.availability_zones[0].zone_name }}' - az_two: '{{ az_info.availability_zones[1].zone_name }}' - - # ============================================================ - - - name: Create a VPC - amazon.aws.ec2_vpc_net: - cidr_block: "{{ vpc_cidr }}" - name: "{{ vpc_name }}" - state: present - register: vpc - - - name: Save VPC ID for later - ansible.builtin.set_fact: - vpc_id: "{{ vpc.vpc.id }}" - - - name: Create subnets - amazon.aws.ec2_vpc_subnet: - cidr: "{{ item.cidr }}" - az: "{{ item.az }}" - vpc_id: "{{ vpc_id }}" - state: present - tags: - Name: "{{ item.name }}" - with_items: - - cidr: "{{ subnet_1 }}" - az: "{{ az_one }}" - name: "{{ subnet_name }}-1" - - cidr: "{{ subnet_2 }}" - az: "{{ az_two }}" - name: "{{ subnet_name }}-2" - - cidr: "{{ subnet_3 }}" - az: "{{ az_one }}" - name: "{{ subnet_name }}-3" - - cidr: "{{ subnet_4 }}" - az: "{{ az_two }}" - name: "{{ subnet_name }}-4" - register: subnets - - - name: Set helpful facts about subnets - ansible.builtin.set_fact: - subnet_ids: "{{ subnets | community.general.json_query('results[*].subnet.id') }}" - subnet_names: "{{ subnets | community.general.json_query('results[*].subnet.tags.Name') }}" - - - name: Create VPC for IPv6 tests - amazon.aws.ec2_vpc_net: - cidr_block: "{{ vpc_ipv6_cidr }}" - name: "{{ vpc_ipv6_name }}" - state: present - ipv6_cidr: true - register: vpc_result - - - name: Set helpful IPv6 facts - ansible.builtin.set_fact: - vpc_ipv6_id: "{{ vpc_result.vpc.id }}" - vpc_ipv6_cidr_v6: "{{ _ipv6_cidr }}" - subnet_ipv6: "{{ _ipv6_cidr | regex_replace('::/56', '::/64') }}" - vars: - _ipv6_cidr: "{{ vpc_result.vpc.ipv6_cidr_block_association_set[0].ipv6_cidr_block }}" - - - name: Create subnet with IPv6 - amazon.aws.ec2_vpc_subnet: - cidr: "{{ vpc_ipv6_cidr }}" - vpc_id: "{{ vpc_ipv6_id }}" - ipv6_cidr: "{{ subnet_ipv6 }}" - state: present - tags: - Name: "{{ subnet_name }}-ipv6" - - # ============================================================ - - name: Run individual tasks - ansible.builtin.include_tasks: "tasks/{{ item }}.yml" - with_items: - - subnet_ids - - subnet_names - - tags - - ingress_and_egress - - ipv6 - - # ============================================================ - - always: - - - name: Remove network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: removed_acl - ignore_errors: true - - - name: Remove subnets - amazon.aws.ec2_vpc_subnet: - cidr: "{{ item.cidr }}" - vpc_id: "{{ item.vpc_id | default(vpc_id) }}" - state: absent - with_items: - - cidr: "{{ subnet_1 }}" - - cidr: "{{ subnet_2 }}" - - cidr: "{{ subnet_3 }}" - - cidr: "{{ subnet_4 }}" - - cidr: "{{ vpc_ipv6_cidr }}" - vpc_id: "{{ vpc_ipv6_id }}" - ignore_errors: true - register: removed_subnets - - - name: Remove the VPCs - amazon.aws.ec2_vpc_net: - vpc_id: "{{ item }}" - state: absent - ignore_errors: true - register: removed_vpc - with_items: - - '{{ vpc_id }}' - - '{{ vpc_ipv6_id }}' - - # ============================================================ diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml deleted file mode 100644 index 3a367e84f89..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_ids.yml +++ /dev/null @@ -1,163 +0,0 @@ -# ============================================================ - -- name: Create ingress and egress rules using subnet IDs - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Set helpful fact for Network ACL ID - ansible.builtin.set_fact: - nacl_id: "{{ nacl.nacl_id }}" - -- name: Assert the network acl was created - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl_id }}" - register: nacl_facts - -- name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].nacl_id == nacl_id - - nacl_facts.nacls[0].subnets | length == 4 - - nacl_facts.nacls[0].subnets | sort == subnet_ids | sort - - nacl_facts.nacls[0].ingress | length == 3 - - nacl_facts.nacls[0].egress | length == 1 - - nacl_facts.nacls[0].tags.Name == nacl_name - -# ============================================================ - -- name: Test idempotence - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Assert the network acl already existed - ansible.builtin.assert: - that: - - not nacl.changed - - nacl.nacl_id == nacl_id - - nacl.nacl_id.startswith('acl-') - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts_idem - -- name: Assert the facts are the same as before - ansible.builtin.assert: - that: - - nacl_facts_idem == nacl_facts - -# ============================================================ - -- name: Remove a subnet from the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_ids[0] }}" - - "{{ subnet_ids[1] }}" - - "{{ subnet_ids[2] }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Assert the network ACL changed - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - nacl.nacl_id == nacl_id - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_id: - - "{{ nacl.nacl_id }}" - register: nacl_facts - -- name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].nacl_id == nacl_id - - nacl_facts.nacls[0].subnets | length == 3 - - subnet_ids[3] not in nacl_facts.nacls[0].subnets - - nacl_facts.nacls[0].ingress | length == 3 - - nacl_facts.nacls[0].egress | length == 1 - - nacl_facts.nacls[0].tags.Name == nacl_name - -# ============================================================ - -- name: Remove the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: nacl - -- name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl.changed - -- name: Re-remove the network ACL by name (test idempotency) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: nacl - -- name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl is not changed - -- name: Re-remove the network ACL by id (test idempotency) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - nacl_id: "{{ nacl_id }}" - state: absent - register: nacl - -- name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl is not changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml deleted file mode 100644 index dc44fef804a..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/subnet_names.yml +++ /dev/null @@ -1,137 +0,0 @@ -# ============================================================ - -- name: Create ingress and egress rules using subnet names - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_names }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Set helpful fact for Network ACL ID - ansible.builtin.set_fact: - nacl_id: "{{ nacl.nacl_id }}" - -- name: Assert the network acl was created - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl_id }}" - register: nacl_facts - -- name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].nacl_id == nacl_id - - nacl_facts.nacls[0].subnets | length == 4 - - nacl_facts.nacls[0].ingress | length == 3 - - nacl_facts.nacls[0].egress | length == 1 - - nacl_facts.nacls[0].tags.Name == nacl_name - -# ============================================================ - -- name: Test idempotence - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_names }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Assert the network acl already existed - ansible.builtin.assert: - that: - - not nacl.changed - - nacl.nacl_id == nacl_id - - nacl.nacl_id.startswith('acl-') - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts_idem - -- name: Assert the facts are the same as before - ansible.builtin.assert: - that: - - nacl_facts_idem == nacl_facts - -# ============================================================ - -- name: Remove a subnet from the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: - - "{{ subnet_names[0] }}" - - "{{ subnet_names[1] }}" - - "{{ subnet_names[2] }}" - tags: - Created_by: "Ansible test {{ resource_prefix }}" - ingress: - - [100, 'tcp', 'allow', '0.0.0.0/0', null, null, 22, 22] - - [200, 'tcp', 'allow', '0.0.0.0/0', null, null, 80, 80] - - [300, 'icmp', 'allow', '0.0.0.0/0', 0, 8] - egress: - - [100, 'all', 'allow', '0.0.0.0/0', null, null, null, null] - state: 'present' - register: nacl - -- name: Assert the network ACL changed - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id == nacl_id - - nacl.nacl_id.startswith('acl-') - -- name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_facts - -- name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_facts.nacls | length == 1 - - nacl_facts.nacls[0].nacl_id == nacl_id - - nacl_facts.nacls[0].subnets | length == 3 - - nacl_facts.nacls[0].ingress | length == 3 - - nacl_facts.nacls[0].egress | length == 1 - - nacl_facts.nacls[0].tags.Name == nacl_name - -# ============================================================ - -- name: Remove the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: nacl - -- name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl.changed diff --git a/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml b/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml deleted file mode 100644 index 0e69ce760ac..00000000000 --- a/tests/integration/targets/ec2_vpc_nacl/tasks/tags.yml +++ /dev/null @@ -1,455 +0,0 @@ -- name: Run test from tags.yml - vars: - first_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - second_tags: - 'New Key with Spaces': Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - third_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - final_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - name_tags: - Name: '{{ nacl_name }}' - block: - - # ============================================================ - - - name: Create a network ACL using subnet IDs - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - state: 'present' - register: nacl - - - name: Assert the network acl was created - ansible.builtin.assert: - that: - - nacl.changed - - nacl.nacl_id.startswith('acl-') - - - name: Store NACL ID - ansible.builtin.set_fact: - nacl_id: '{{ nacl.nacl_id }}' - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl_id }}" - register: nacl_info - - - name: Assert the nacl has the correct attributes - ansible.builtin.assert: - that: - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == name_tags - - # ============================================================ - - - name: Add tags (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ first_tags }}" - state: 'present' - register: nacl - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - - name: Add tags - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ first_tags }}" - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( first_tags | combine(name_tags) ) - - - name: Add tags - IDEMPOTENCY (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ first_tags }}" - state: 'present' - register: nacl - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - - name: Add tags - IDEMPOTENCY - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ first_tags }}" - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify no change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( first_tags | combine(name_tags) ) - - # ============================================================ - - - name: Get network ACL facts by filter - community.aws.ec2_vpc_nacl_info: - filters: - "tag:Name": "{{ nacl_name }}" - register: nacl_info - - - name: Assert the facts are the same as before - ansible.builtin.assert: - that: - - nacl_info.nacls | length == 1 - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - # ============================================================ - - - name: Modify tags with purge (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ second_tags }}" - state: 'present' - register: nacl - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - - name: Modify tags with purge - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ second_tags }}" - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( second_tags | combine(name_tags) ) - - - name: Modify tags with purge - IDEMPOTENCY (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ second_tags }}" - state: 'present' - register: nacl - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - - name: Modify tags with purge - IDEMPOTENCY - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ second_tags }}" - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify no change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( second_tags | combine(name_tags) ) - - # ============================================================ - - - name: Modify tags without purge (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ third_tags }}" - state: 'present' - purge_tags: False - register: nacl - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - - name: Modify tags without purge - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ third_tags }}" - state: 'present' - purge_tags: False - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( final_tags | combine(name_tags) ) - - - name: Modify tags without purge - IDEMPOTENCY (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ third_tags }}" - state: 'present' - purge_tags: False - register: nacl - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - - name: Modify tags without purge - IDEMPOTENCY - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: "{{ third_tags }}" - state: 'present' - purge_tags: False - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify no change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( final_tags | combine(name_tags) ) - - # ============================================================ - - - name: No change to tags without setting tags (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - state: 'present' - register: nacl - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - - name: No change to tags without setting tags - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == ( final_tags | combine(name_tags) ) - - # ============================================================ - - - name: Remove non name tags (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: {} - state: 'present' - register: nacl - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - - name: Remove non name tags - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: {} - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - nacl is changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == name_tags - - - name: Remove non name tags - IDEMPOTENCY (check mode) - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: {} - state: 'present' - register: nacl - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - - name: Remove non name tags - IDEMPOTENCY - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - subnets: "{{ subnet_ids }}" - tags: {} - state: 'present' - register: nacl - - - name: Get network ACL facts - community.aws.ec2_vpc_nacl_info: - nacl_ids: - - "{{ nacl.nacl_id }}" - register: nacl_info - - - name: Verify no change - ansible.builtin.assert: - that: - - nacl is not changed - - nacl.nacl_id == nacl_id - - nacl_info.nacls[0].nacl_id == nacl_id - - nacl_info.nacls[0].tags == name_tags - - # ============================================================ - - always: - - name: Remove the network ACL - community.aws.ec2_vpc_nacl: - vpc_id: "{{ vpc_id }}" - name: "{{ nacl_name }}" - state: absent - register: nacl - - - name: Assert nacl was removed - ansible.builtin.assert: - that: - - nacl.changed From 4aa784d3cc388ef14436eaa4d668a9c289c2359f Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 25 Oct 2024 13:38:05 +0200 Subject: [PATCH 65/77] DNM Promote ec2_vpc_peer and ec2_vpc_peering_info modules (#2173) SUMMARY DNM Promote ec2_vpc_peer and ec2_vpc_peering_info modules ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mandar Kulkarni Reviewed-by: GomathiselviS --- changelogs/fragments/migrate_ec2_vpc_peer.yml | 8 + meta/runtime.yml | 6 +- plugins/modules/ec2_vpc_peer.py | 614 ---------------- plugins/modules/ec2_vpc_peering_info.py | 388 ----------- .../integration/targets/ec2_vpc_peer/aliases | 3 - .../targets/ec2_vpc_peer/defaults/main.yml | 6 - .../targets/ec2_vpc_peer/meta/main.yml | 1 - .../targets/ec2_vpc_peer/tasks/main.yml | 655 ------------------ 8 files changed, 12 insertions(+), 1669 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_vpc_peer.yml delete mode 100644 plugins/modules/ec2_vpc_peer.py delete mode 100644 plugins/modules/ec2_vpc_peering_info.py delete mode 100644 tests/integration/targets/ec2_vpc_peer/aliases delete mode 100644 tests/integration/targets/ec2_vpc_peer/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_peer/meta/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_peer/tasks/main.yml diff --git a/changelogs/fragments/migrate_ec2_vpc_peer.yml b/changelogs/fragments/migrate_ec2_vpc_peer.yml new file mode 100644 index 00000000000..2de2ee15863 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_vpc_peer.yml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_vpc_peer - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_peer``. + - ec2_vpc_peering_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_peering_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 7340441a8f9..306eee289fe 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -114,8 +114,6 @@ action_groups: - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - - ec2_vpc_peer - - ec2_vpc_peering_info - ec2_vpc_vgw - ec2_vpc_vgw_info - ec2_vpc_vpn @@ -528,6 +526,10 @@ plugin_routing: redirect: amazon.aws.ec2_vpc_nacl ec2_vpc_nacl_info: redirect: amazon.aws.ec2_vpc_nacl_info + ec2_vpc_peer: + redirect: amazon.aws.ec2_vpc_peer + ec2_vpc_peering_info: + redirect: amazon.aws.ec2_vpc_peering_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_vpc_peer.py b/plugins/modules/ec2_vpc_peer.py deleted file mode 100644 index 94f4b125219..00000000000 --- a/plugins/modules/ec2_vpc_peer.py +++ /dev/null @@ -1,614 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_vpc_peer -short_description: create, delete, accept, and reject VPC peering connections between two VPCs. -version_added: 1.0.0 -description: - - Read the AWS documentation for VPC Peering Connections - U(https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-peering.html). -options: - vpc_id: - description: - - VPC id of the requesting VPC. - required: false - type: str - peering_id: - description: - - Peering connection id. - required: false - type: str - peer_region: - description: - - Region of the accepting VPC. - required: false - type: str - peer_vpc_id: - description: - - VPC id of the accepting VPC. - required: false - type: str - peer_owner_id: - description: - - The AWS account number for cross account peering. - required: false - type: str - state: - description: - - Create, delete, accept, reject a peering connection. - required: false - default: present - choices: ['present', 'absent', 'accept', 'reject'] - type: str - wait: - description: - - Wait for peering state changes to complete. - required: false - default: false - type: bool -notes: - - Support for O(purge_tags) was added in release 2.0.0. -author: - - Mike Mochan (@mmochan) - - Alina Buzachis (@alinabuzachis) -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.tags - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Complete example to create and accept a local peering connection. -- name: Create local account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-87654321" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Accept local EC2 VPC Peering request - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - state: "accept" - register: action_peer - -# Complete example to delete a local peering connection. -- name: Create local account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-87654321" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Delete a local EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - state: "absent" - register: vpc_peer - - # Complete example to create and accept a cross account peering connection. -- name: Create cross account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-12345678" - peer_owner_id: "123456789012" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Accept EC2 VPC Peering Connection from remote account - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - profile: "bot03_profile_for_cross_account" - state: "accept" - register: vpc_peer - -# Complete example to create and accept an intra-region peering connection. -- name: Create intra-region EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "us-east-1" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-87654321" - peer_region: "us-west-2" - state: "present" - tags: - Name: "Peering connection for us-east-1 VPC to us-west-2 VPC" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Accept EC2 VPC Peering Connection from peer region - community.aws.ec2_vpc_peer: - region: "us-west-2" - peering_id: "{{ vpc_peer.peering_id }}" - state: "accept" - register: vpc_peer - -# Complete example to create and reject a local peering connection. -- name: Create local account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-87654321" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Reject a local EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - state: "reject" - -# Complete example to create and accept a cross account peering connection. -- name: Create cross account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-12345678" - peer_owner_id: "123456789012" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Accept a cross account EC2 VPC Peering Connection request - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - profile: "bot03_profile_for_cross_account" - state: "accept" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - -# Complete example to create and reject a cross account peering connection. -- name: Create cross account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - vpc_id: "vpc-12345678" - peer_vpc_id: "vpc-12345678" - peer_owner_id: "123456789012" - state: "present" - tags: - Name: "Peering connection for VPC 21 to VPC 22" - CostCode: "CC1234" - Project: "phoenix" - register: vpc_peer - -- name: Reject a cross account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - region: "ap-southeast-2" - peering_id: "{{ vpc_peer.peering_id }}" - profile: "bot03_profile_for_cross_account" - state: "reject" -""" - -RETURN = r""" -peering_id: - description: The id of the VPC peering connection created/deleted. - returned: always - type: str - sample: "pcx-034223d7c0aec3cde" -vpc_peering_connection: - description: The details of the VPC peering connection. - returned: success - type: dict - contains: - accepter_vpc_info: - description: Information about the VPC which accepted the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is in the accepted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is in the accepted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC. - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is in the accepted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - requester_vpc_info: - description: Information about the VPC which requested the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is not in the deleted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is not in the deleted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is not in the deleted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - status: - description: Details of the current status of the connection. - returned: success - type: complex - contains: - code: - description: A short code describing the status of the connection. - returned: success - type: str - sample: "active" - message: - description: Additional information about the status of the connection. - returned: success - type: str - sample: "Pending Acceptance by 123456789012" - tags: - description: Tags applied to the connection. - returned: success - type: dict - expiration_time: - description: The time that an unaccepted VPC peering connection will expire. - type: str - sample: "2024-10-01T12:11:12+00:00" - vpc_peering_connection_id: - description: The ID of the VPC peering connection. - returned: success - type: str - sample: "pcx-0123456789abcdef0" -""" - -try: - import botocore -except ImportError: - pass # Handled by AnsibleAWSModule - -from typing import Any -from typing import Dict -from typing import NoReturn -from typing import Tuple - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import accept_vpc_peering_connection -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpc_peering_connection -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpc_peering_connection -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import reject_vpc_peering_connection -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def wait_for_state(client, module: AnsibleAWSModule, state: str, peering_id: str) -> NoReturn: - waiter = client.get_waiter("vpc_peering_connection_exists") - filters = { - "vpc-peering-connection-id": peering_id, - "status-code": state, - } - try: - waiter.wait(Filters=ansible_dict_to_boto3_filter_list(filters)) - except botocore.exceptions.WaiterError as e: - module.fail_json_aws(e, "Failed to wait for state change") - except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: - module.fail_json_aws(e, "Unable to describe Peering Connection while waiting for state to change") - - -def describe_peering_connections(client, module: AnsibleAWSModule, params) -> Dict[str, Any]: - peering_connections: Dict = {} - - filters = { - "requester-vpc-info.vpc-id": params["VpcId"], - "accepter-vpc-info.vpc-id": params["PeerVpcId"], - } - - peering_connections = describe_vpc_peering_connections(client, Filters=ansible_dict_to_boto3_filter_list(filters)) - if peering_connections == []: - # Try again with the VPC/Peer relationship reversed - filters = { - "requester-vpc-info.vpc-id": params["PeerVpcId"], - "accepter-vpc-info.vpc-id": params["VpcId"], - } - peering_connections = describe_vpc_peering_connections( - client, Filters=ansible_dict_to_boto3_filter_list(filters) - ) - - return peering_connections - - -def is_active(peering_connection: Dict[str, Any]) -> bool: - return peering_connection["Status"]["Code"] == "active" - - -def is_rejected(peering_connection: Dict[str, Any]) -> bool: - return peering_connection["Status"]["Code"] == "rejected" - - -def is_pending(peering_connection: Dict[str, Any]) -> bool: - return peering_connection["Status"]["Code"] == "pending-acceptance" - - -def is_deleted(peering_connection: Dict[str, Any]) -> bool: - return peering_connection["Status"]["Code"] == "deleted" - - -def create_peering_connection(client, module: AnsibleAWSModule) -> Tuple[bool, Dict[str, Any]]: - changed: bool = False - params: Dict = {} - - params["VpcId"] = module.params.get("vpc_id") - params["PeerVpcId"] = module.params.get("peer_vpc_id") - - if module.params.get("peer_region"): - params["PeerRegion"] = module.params["peer_region"] - - if module.params.get("peer_owner_id"): - params["PeerOwnerId"] = module.params["peer_owner_id"] - - peering_connections = describe_peering_connections(client, module, params) - for peering_connection in peering_connections: - changed |= ensure_ec2_tags( - client, - module, - peering_connection["VpcPeeringConnectionId"], - purge_tags=module.params.get("purge_tags"), - tags=module.params.get("tags"), - ) - - if is_active(peering_connection): - return (changed, peering_connection) - - if is_pending(peering_connection): - return (changed, peering_connection) - - if module.params.get("tags"): - params["TagSpecifications"] = boto3_tag_specifications(module.params["tags"], types="vpc-peering-connection") - - if module.check_mode: - return (True, {"VpcPeeringConnectionId": ""}) - - peering_connection = create_vpc_peering_connection(client, **params) - if module.params.get("wait"): - wait_for_state(client, module, "pending-acceptance", peering_connection["VpcPeeringConnectionId"]) - changed = True - return (changed, peering_connection) - - -def delete_peering_connection(client, module: AnsibleAWSModule) -> NoReturn: - peering_id = module.params.get("peering_id") - if peering_id: - peering_connection = get_peering_connection_by_id(client, module, peering_id) - else: - params: Dict = {} - params["VpcId"] = module.params.get("vpc_id") - params["PeerVpcId"] = module.params.get("peer_vpc_id") - params["PeerRegion"] = module.params.get("peer_region") - - if module.params.get("peer_owner_id"): - params["PeerOwnerId"] = module.params["peer_owner_id"] - - peering_connection = describe_peering_connections(client, module, params)[0] - - if not peering_connection: - module.exit_json(changed=False) - else: - peering_id = peering_id or peering_connection["VpcPeeringConnectionId"] - - if is_deleted(peering_connection): - module.exit_json(msg="Connection in deleted state.", changed=False, peering_id=peering_id) - - if is_rejected(peering_connection): - module.exit_json( - msg="Connection has been rejected. State cannot be changed and will be removed automatically by AWS", - changed=False, - peering_id=peering_id, - ) - - if not module.check_mode: - delete_vpc_peering_connection(client, peering_id) - if module.params.get("wait"): - wait_for_state(client, module, "deleted", peering_id) - - module.exit_json(changed=True, peering_id=peering_id) - - -def get_peering_connection_by_id(client, module: AnsibleAWSModule, peering_id: str) -> Dict[str, Any]: - filters: Dict = {} - filters["VpcPeeringConnectionIds"] = [peering_id] - - try: - result = describe_vpc_peering_connections(client, VpcPeeringConnectionIds=[peering_id]) - return result[0] - except is_boto3_error_code("InvalidVpcPeeringConnectionId.Malformed") as e: - module.fail_json_aws(e, msg="Malformed connection ID") - - -def accept_reject_peering_connection(client, module: AnsibleAWSModule, state: str) -> Tuple[bool, Dict[str, Any]]: - changed: bool = False - - peering_id = module.params.get("peering_id") - vpc_peering_connection = get_peering_connection_by_id(client, module, peering_id) - - if not (is_active(vpc_peering_connection) or is_rejected(vpc_peering_connection)): - if not module.check_mode: - if state == "accept": - changed |= accept_vpc_peering_connection(client, peering_id) - target_state = "active" - else: - changed |= reject_vpc_peering_connection(client, peering_id) - target_state = "rejected" - - if module.params.get("wait"): - wait_for_state(client, module, target_state, peering_id) - - changed = True - - changed |= ensure_ec2_tags( - client, - module, - peering_id, - purge_tags=module.params.get("purge_tags"), - tags=module.params.get("tags"), - ) - - # Reload peering conection info to return latest state/params - vpc_peering_connection = get_peering_connection_by_id(client, module, peering_id) - - return (changed, vpc_peering_connection) - - -def main(): - argument_spec = dict( - vpc_id=dict(type="str"), - peer_vpc_id=dict(type="str"), - peer_region=dict(type="str"), - peering_id=dict(type="str"), - peer_owner_id=dict(type="str"), - tags=dict(required=False, type="dict", aliases=["resource_tags"]), - purge_tags=dict(default=True, type="bool"), - state=dict(default="present", type="str", choices=["present", "absent", "accept", "reject"]), - wait=dict(default=False, type="bool"), - ) - required_if = [ - ("state", "present", ["vpc_id", "peer_vpc_id"]), - ("state", "accept", ["peering_id"]), - ("state", "reject", ["peering_id"]), - ] - - module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True, required_if=required_if) - - state = module.params.get("state") - peering_id = module.params.get("peering_id") - vpc_id = module.params.get("vpc_id") - peer_vpc_id = module.params.get("peer_vpc_id") - - client = module.client("ec2") - - if state == "present": - (changed, results) = create_peering_connection(client, module) - elif state == "absent": - if not peering_id and (not vpc_id or not peer_vpc_id): - module.fail_json( - msg="state is absent but one of the following is missing: peering_id or [vpc_id, peer_vpc_id]" - ) - - delete_peering_connection(client, module) - else: - (changed, results) = accept_reject_peering_connection(client, module, state) - - formatted_results = camel_dict_to_snake_dict(results) - # Turn the resource tags from boto3 into an ansible friendly tag dictionary - formatted_results["tags"] = boto3_tag_list_to_ansible_dict(formatted_results.get("tags", [])) - - module.exit_json( - changed=changed, vpc_peering_connection=formatted_results, peering_id=results["VpcPeeringConnectionId"] - ) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_vpc_peering_info.py b/plugins/modules/ec2_vpc_peering_info.py deleted file mode 100644 index 066211ccbe5..00000000000 --- a/plugins/modules/ec2_vpc_peering_info.py +++ /dev/null @@ -1,388 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_vpc_peering_info -short_description: Retrieves AWS VPC Peering details using AWS methods -version_added: 1.0.0 -description: - - Gets various details related to AWS VPC Peers -options: - peer_connection_ids: - description: - - List of specific VPC peer IDs to get details for. - type: list - elements: str - filters: - description: - - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcPeeringConnections.html) - for possible filters. - type: dict - default: {} -author: - - Karen Cheng (@Etherdaemon) - - Alina Buzachis (@alinabuzachis) -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -- name: List all EC2 VPC Peering Connections - community.aws.ec2_vpc_peering_info: - region: ap-southeast-2 - register: all_vpc_peers - -- name: Debugging the result - ansible.builtin.debug: - msg: "{{ all_vpc_peers.result }}" - -- name: Get details on specific EC2 VPC Peering Connection - community.aws.ec2_vpc_peering_info: - peer_connection_ids: - - "pcx-12345678" - - "pcx-87654321" - region: "ap-southeast-2" - register: all_vpc_peers - -- name: Get all EC2 VPC Peering Connections with specific filters - community.aws.ec2_vpc_peering_info: - region: "ap-southeast-2" - filters: - status-code: ["pending-acceptance"] - register: pending_vpc_peers -""" - -RETURN = r""" -vpc_peering_connections: - description: Details of the matching VPC peering connections. - returned: success - type: list - elements: dict - contains: - accepter_vpc_info: - description: Information about the VPC which accepted the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is in the accepted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is in the accepted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC. - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is in the accepted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - requester_vpc_info: - description: Information about the VPC which requested the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is not in the deleted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is not in the deleted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is not in the deleted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - status: - description: Details of the current status of the connection. - returned: success - type: dict - contains: - code: - description: A short code describing the status of the connection. - returned: success - type: str - sample: "active" - message: - description: Additional information about the status of the connection. - returned: success - type: str - sample: "Pending Acceptance by 123456789012" - tags: - description: Tags applied to the connection. - returned: success - type: dict - vpc_peering_connection_id: - description: The ID of the VPC peering connection. - returned: success - type: str - sample: "pcx-0123456789abcdef0" - -result: - description: The result of the describe. - returned: success - type: list - elements: dict - contains: - accepter_vpc_info: - description: Information about the VPC which accepted the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is in the accepted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is in the accepted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC. - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is in the accepted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - requester_vpc_info: - description: Information about the VPC which requested the connection. - returned: success - type: dict - contains: - cidr_block: - description: The primary CIDR for the VPC. - returned: when connection is not in the deleted state. - type: str - sample: "10.10.10.0/23" - cidr_block_set: - description: A list of all CIDRs for the VPC. - returned: when connection is not in the deleted state. - type: list - elements: dict - contains: - cidr_block: - description: A CIDR block used by the VPC - returned: success - type: str - sample: "10.10.10.0/23" - owner_id: - description: The AWS account that owns the VPC. - returned: success - type: str - sample: "123456789012" - peering_options: - description: Additional peering configuration. - returned: when connection is not in the deleted state. - type: dict - contains: - allow_dns_resolution_from_remote_vpc: - description: Indicates whether a VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC. - returned: success - type: bool - allow_egress_from_local_classic_link_to_remote_vpc: - description: Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection. - returned: success - type: bool - allow_egress_from_local_vpc_to_remote_classic_link: - description: Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection. - returned: success - type: bool - region: - description: The AWS region that the VPC is in. - returned: success - type: str - sample: "us-east-1" - vpc_id: - description: The ID of the VPC - returned: success - type: str - sample: "vpc-0123456789abcdef0" - status: - description: Details of the current status of the connection. - returned: success - type: dict - contains: - code: - description: A short code describing the status of the connection. - returned: success - type: str - sample: "active" - message: - description: Additional information about the status of the connection. - returned: success - type: str - sample: "Pending Acceptance by 123456789012" - tags: - description: Tags applied to the connection. - returned: success - type: dict - vpc_peering_connection_id: - description: The ID of the VPC peering connection. - returned: success - type: str - sample: "pcx-0123456789abcdef0" -""" - - -from typing import Any -from typing import Dict -from typing import List - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpc_peering_connections -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def get_vpc_peers(client, module: AnsibleAWSModule) -> List[Dict[str, Any]]: - params: Dict = {} - params["Filters"] = ansible_dict_to_boto3_filter_list(module.params.get("filters")) - - if module.params.get("peer_connection_ids"): - params["VpcPeeringConnectionIds"] = module.params.get("peer_connection_ids") - - result = describe_vpc_peering_connections(client, **params) - - return normalize_boto3_result(result) - - -def main(): - argument_spec = dict( - filters=dict(default=dict(), type="dict"), - peer_connection_ids=dict(default=None, type="list", elements="str"), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - client = module.client("ec2") - - # Turn the boto3 result in to ansible friendly_snaked_names - results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(client, module)] - - # Turn the boto3 result in to ansible friendly tag dictionary - for peer in results: - peer["tags"] = boto3_tag_list_to_ansible_dict(peer.get("tags", [])) - - module.exit_json(result=results, vpc_peering_connections=results) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_vpc_peer/aliases b/tests/integration/targets/ec2_vpc_peer/aliases deleted file mode 100644 index 8807cb2514c..00000000000 --- a/tests/integration/targets/ec2_vpc_peer/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_vpc_peering_info diff --git a/tests/integration/targets/ec2_vpc_peer/defaults/main.yml b/tests/integration/targets/ec2_vpc_peer/defaults/main.yml deleted file mode 100644 index 0ff34455b45..00000000000 --- a/tests/integration/targets/ec2_vpc_peer/defaults/main.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -vpc_seed: '{{ resource_prefix }}' -vpc_1_name: '{{ resource_prefix }}-vpc-1' -vpc_1_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/23' -vpc_2_name: '{{ resource_prefix }}-vpc-1' -vpc_2_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.2.0/23' diff --git a/tests/integration/targets/ec2_vpc_peer/meta/main.yml b/tests/integration/targets/ec2_vpc_peer/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_vpc_peer/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml b/tests/integration/targets/ec2_vpc_peer/tasks/main.yml deleted file mode 100644 index 859e482b319..00000000000 --- a/tests/integration/targets/ec2_vpc_peer/tasks/main.yml +++ /dev/null @@ -1,655 +0,0 @@ ---- -- name: EC2 VPC Peering Connection integration tests - collections: - - amazon.aws - module_defaults: - group/aws: - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - region: "{{ aws_region }}" - block: - - name: Get ARN of calling user - aws_caller_info: - register: aws_caller_info - - - name: Store Account ID for later use - ansible.builtin.set_fact: - account_id: '{{ aws_caller_info.account }}' - - # ============================================================ - - name: Fetch EC2 VPC Peering Connections in check_mode - community.aws.ec2_vpc_peering_info: - register: peers_info - check_mode: True - - - name: Assert success - ansible.builtin.assert: - that: - - peers_info is successful - - '"result" in peers_info' - - # ============================================================ - - name: Create VPC 1 - amazon.aws.ec2_vpc_net: - name: "{{ vpc_1_name }}" - state: present - cidr_block: "{{ vpc_1_cidr }}" - tags: - Name: "{{ vpc_1_name }}" - TestPrefex: "{{ resource_prefix }}" - register: vpc_1_result - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_1_result is successful - - - name: Create VPC 2 - amazon.aws.ec2_vpc_net: - name: "{{ vpc_2_name }}" - state: present - cidr_block: "{{ vpc_2_cidr }}" - tags: - Name: "{{ vpc_2_name }}" - TestPrefex: "{{ resource_prefix }}" - register: vpc_2_result - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_2_result is successful - - - name: Store VPC IDs - set_fact: - vpc_1: '{{ vpc_1_result.vpc.id }}' - vpc_2: '{{ vpc_2_result.vpc.id }}' - - - name: Set a name to use with the connections - ansible.builtin.set_fact: - connection_name: 'Peering connection for VPC {{ vpc_1 }} to VPC {{ vpc_2 }}' - - - name: Create local account EC2 VPC Peering Connection request (check_mode) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - check_mode: true - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is changed - - - name: Create local account EC2 VPC Peering Connection request - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is changed - - vpc_peer is successful - - "'peering_id' in vpc_peer" - - vpc_peer.vpc_peering_connection.requester_vpc_info.cidr_block == vpc_1_cidr - - vpc_peer.peering_id.startswith('pcx-') - - - name: Store Connection ID - ansible.builtin.set_fact: - peer_id_1: '{{ vpc_peer.peering_id }}' - - - name: Re-create local account EC2 VPC Peering Connection request (idempotency check_mode) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - check_mode: true - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is not changed - - - name: Re-create local account EC2 VPC Peering Connection request (idempotency) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is not changed - - vpc_peer is successful - - vpc_peer.peering_id == peer_id_1 - - - name: Create local account EC2 VPC Peering Connection request with accepter/requester reversed (idempotency check_mode) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_2 }}' - peer_vpc_id: '{{ vpc_1 }}' - state: present - tags: - Name: '{{ connection_name }}' - check_mode: true - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is not changed - - - name: Create local account EC2 VPC Peering Connection request with accepter/requester reversed (idempotency) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_2 }}' - peer_vpc_id: '{{ vpc_1 }}' - state: present - tags: - Name: '{{ connection_name }}' - register: vpc_peer - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer is not changed - - vpc_peer is successful - - vpc_peer.peering_id == peer_id_1 - - - name: Get details on specific EC2 VPC Peering Connection - community.aws.ec2_vpc_peering_info: - peer_connection_ids: - - '{{ peer_id_1 }}' - register: peer_info - - - name: Assert expected values - ansible.builtin.assert: - that: - - peer_info is successful - - "'vpc_peering_connections' in peer_info" - - "'result' in peer_info" - - "'accepter_vpc_info' in peer_details" - - "'requester_vpc_info' in peer_details" - - "'status' in peer_details" - - "'code' in peer_details.status" - - peer_details.status.code == "pending-acceptance" - - "'message' in peer_details.status" - - "'tags' in peer_details" - - "'Name' in peer_details.tags" - - peer_details.tags.Name == connection_name - - "'vpc_peering_connection_id' in peer_details" - - peer_details.vpc_peering_connection_id == peer_id_1 - # Acceptor info isn't available until the connection has been accepted - - "'cidr_block' not in acceptor_details" - - "'cidr_block_set' not in acceptor_details" - - "'peering_options' not in acceptor_details" - - "'owner_id' in acceptor_details" - - acceptor_details.owner_id == account_id - - "'region' in acceptor_details" - - acceptor_details.region == aws_region - - "'vpc_id' in acceptor_details" - - acceptor_details.vpc_id == vpc_2 - # Information about the 'requesting' VPC - - "'cidr_block' in requester_details" - - requester_details.cidr_block == vpc_1_cidr - - "'cidr_block_set' in requester_details" - - requester_details.cidr_block_set | length == 1 - - "'cidr_block' in requester_details.cidr_block_set[0]" - - requester_details.cidr_block_set[0].cidr_block == vpc_1_cidr - - "'peering_options' in requester_details" - - "'owner_id' in requester_details" - - requester_details.owner_id == account_id - - "'region' in requester_details" - - requester_details.region == aws_region - - "'vpc_id' in requester_details" - - requester_details.vpc_id == vpc_1 - vars: - peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' - requester_details: '{{ peer_details["requester_vpc_info"] }}' - - - name: Get all EC2 VPC Peering Connections with specific filters - community.aws.ec2_vpc_peering_info: - filters: - status-code: ['pending-acceptance'] - register: pending_vpc_peers - - - name: Assert expected values - ansible.builtin.assert: - that: - # Not guaranteed to just be us, only assert the shape - - pending_vpc_peers is successful - - "'vpc_peering_connections' in peer_info" - - "'result' in peer_info" - - "'accepter_vpc_info' in peer_details" - - "'requester_vpc_info' in peer_details" - - "'status' in peer_details" - - "'code' in peer_details.status" - - peer_details.status.code == "pending-acceptance" - - "'message' in peer_details.status" - - "'tags' in peer_details" - - "'vpc_peering_connection_id' in peer_details" - # Acceptor info isn't available until the connection has been accepted - - "'cidr_block' not in acceptor_details" - - "'cidr_block_set' not in acceptor_details" - - "'peering_options' not in acceptor_details" - - "'owner_id' in acceptor_details" - - "'region' in acceptor_details" - - "'vpc_id' in acceptor_details" - # Information about the 'requesting' VPC - - "'cidr_block' in requester_details" - - "'cidr_block_set' in requester_details" - - "'cidr_block' in requester_details.cidr_block_set[0]" - - "'peering_options' in requester_details" - - "'owner_id' in requester_details" - - "'region' in requester_details" - - "'vpc_id' in requester_details" - vars: - peer_details: '{{ pending_vpc_peers.vpc_peering_connections[0] }}' - acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' - requester_details: '{{ peer_details["requester_vpc_info"] }}' - - - name: Update tags on the EC2 VPC Peering Connection (check_mode) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - testPrefix: '{{ resource_prefix }}' - check_mode: true - register: tag_peer - - - name: Assert success - ansible.builtin.assert: - that: - - tag_peer is changed - - - name: Update tags on the EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - testPrefix: '{{ resource_prefix }}' - register: tag_peer - - - name: Assert success - ansible.builtin.assert: - that: - - tag_peer is changed - - tag_peer is successful - - tag_peer.peering_id == peer_id_1 - - - name: Update tags on the EC2 VPC Peering Connection (idempotency check_mode) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - testPrefix: '{{ resource_prefix }}' - check_mode: true - register: tag_peer - - - name: Assert success - ansible.builtin.assert: - that: - - tag_peer is not changed - - - name: Update tags on the EC2 VPC Peering Connection (idempotency) - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: '{{ connection_name }}' - testPrefix: '{{ resource_prefix }}' - register: tag_peer - - - name: Assert success - ansible.builtin.assert: - that: - - tag_peer is not changed - - tag_peer is successful - - tag_peer.peering_id == peer_id_1 - - - name: Get details on specific EC2 VPC Peering Connection - community.aws.ec2_vpc_peering_info: - peer_connection_ids: - - '{{ peer_id_1 }}' - register: peer_info - - - name: Assert expected tags - ansible.builtin.assert: - that: - - peer_info is successful - - "'tags' in peer_details" - - "'Name' in peer_details.tags" - - "'testPrefix' in peer_details.tags" - - peer_details.tags.Name == connection_name - - peer_details.tags.testPrefix == resource_prefix - vars: - peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - - - name: Accept local EC2 VPC Peering request (check_mode) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: accept - wait: true - check_mode: true - register: action_peer - - - name: Assert success - ansible.builtin.assert: - that: - - action_peer is changed - - - name: Accept local EC2 VPC Peering request - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: accept - wait: true - register: action_peer - - - name: Assert success - ansible.builtin.assert: - that: - - action_peer is changed - - action_peer is successful - - action_peer.peering_id == peer_id_1 - - action_peer.vpc_peering_connection.accepter_vpc_info.cidr_block == vpc_2_cidr - - action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1 - - - name: Get details on specific EC2 VPC Peering Connection - community.aws.ec2_vpc_peering_info: - peer_connection_ids: - - '{{ peer_id_1 }}' - register: peer_info - - - name: Assert expected values - ansible.builtin.assert: - that: - - peer_info is successful - - "'vpc_peering_connections' in peer_info" - - "'result' in peer_info" - - "'accepter_vpc_info' in peer_details" - - "'requester_vpc_info' in peer_details" - - "'status' in peer_details" - - "'code' in peer_details.status" - - peer_details.status.code == "active" - - "'message' in peer_details.status" - - "'tags' in peer_details" - - "'Name' in peer_details.tags" - - peer_details.tags.Name == connection_name - - "'testPrefix' in peer_details.tags" - - peer_details.tags.testPrefix == resource_prefix - - "'vpc_peering_connection_id' in peer_details" - - peer_details.vpc_peering_connection_id == peer_id_1 - # Information about the 'accepting' VPC should be available now - - "'cidr_block' in acceptor_details" - - acceptor_details.cidr_block == vpc_2_cidr - - "'cidr_block_set' in acceptor_details" - - acceptor_details.cidr_block_set | length == 1 - - "'cidr_block' in acceptor_details.cidr_block_set[0]" - - acceptor_details.cidr_block_set[0].cidr_block == vpc_2_cidr - - "'peering_options' in acceptor_details" - - "'owner_id' in acceptor_details" - - acceptor_details.owner_id == account_id - - "'region' in acceptor_details" - - acceptor_details.region == aws_region - - "'vpc_id' in acceptor_details" - - acceptor_details.vpc_id == vpc_2 - # Information about the 'requesting' VPC - - "'cidr_block' in requester_details" - - requester_details.cidr_block == vpc_1_cidr - - "'cidr_block_set' in requester_details" - - requester_details.cidr_block_set | length == 1 - - "'cidr_block' in requester_details.cidr_block_set[0]" - - requester_details.cidr_block_set[0].cidr_block == vpc_1_cidr - - "'peering_options' in requester_details" - - "'owner_id' in requester_details" - - requester_details.owner_id == account_id - - "'region' in requester_details" - - requester_details.region == aws_region - - "'vpc_id' in requester_details" - - requester_details.vpc_id == vpc_1 - vars: - peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' - requester_details: '{{ peer_details["requester_vpc_info"] }}' - - - name: Accept local EC2 VPC Peering request (idempotency check_mode) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: accept - check_mode: true - register: action_peer - - - name: Assert success - ansible.builtin.assert: - that: - - action_peer is not changed - - - name: Accept local EC2 VPC Peering request (idempotency) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: accept - register: action_peer - - - name: Assert success - ansible.builtin.assert: - that: - - action_peer is not changed - - action_peer is successful - - action_peer.peering_id == peer_id_1 - - action_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_1 - - - name: Delete a local EC2 VPC Peering Connection (check_mode) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: absent - check_mode: true - register: delete_peer - - - name: Assert success - ansible.builtin.assert: - that: - - delete_peer is changed - - - name: Delete a local EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: absent - register: delete_peer - - - name: Assert success - ansible.builtin.assert: - that: - - delete_peer is changed - - delete_peer is successful - - "'peering_id' in delete_peer" - - - name: Get details on specific EC2 VPC Peering Connection - community.aws.ec2_vpc_peering_info: - peer_connection_ids: - - '{{ peer_id_1}}' - register: peer_info - - - name: Assert expected values - ansible.builtin.assert: - that: - - peer_info is successful - - "'vpc_peering_connections' in peer_info" - - "'result' in peer_info" - - "'accepter_vpc_info' in peer_details" - - "'requester_vpc_info' in peer_details" - - "'status' in peer_details" - - "'code' in peer_details.status" - - peer_details.status.code == "deleted" - - "'message' in peer_details.status" - - "'tags' in peer_details" - - "'Name' in peer_details.tags" - - peer_details.tags.Name == connection_name - - "'testPrefix' in peer_details.tags" - - peer_details.tags.testPrefix == resource_prefix - - "'vpc_peering_connection_id' in peer_details" - - peer_details.vpc_peering_connection_id == peer_id_1 - # Information about the 'accepting' VPC is reduced again - - "'cidr_block' not in acceptor_details" - - "'cidr_block_set' not in acceptor_details" - - "'peering_options' not in acceptor_details" - - "'owner_id' in acceptor_details" - - acceptor_details.owner_id == account_id - - "'region' in acceptor_details" - - acceptor_details.region == aws_region - - "'vpc_id' in acceptor_details" - - acceptor_details.vpc_id == vpc_2 - # Information about the 'requesting' VPC is reduced once the VPC's deleted - - "'cidr_block' not in requester_details" - - "'cidr_block_set' not in requester_details" - - "'peering_options' not in requester_details" - - "'owner_id' in requester_details" - - requester_details.owner_id == account_id - - "'region' in requester_details" - - requester_details.region == aws_region - - "'vpc_id' in requester_details" - - requester_details.vpc_id == vpc_1 - vars: - peer_details: '{{ peer_info.vpc_peering_connections[0] }}' - acceptor_details: '{{ peer_details["accepter_vpc_info"] }}' - requester_details: '{{ peer_details["requester_vpc_info"] }}' - - - name: Delete a local EC2 VPC Peering Connection (idempotency check_mode) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: absent - check_mode: true - register: delete_peer - - - name: Assert success - ansible.builtin.assert: - that: - - delete_peer is not changed - - - name: Delete a local EC2 VPC Peering Connection (idempotency) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer.peering_id }}" - state: absent - register: delete_peer - - - name: Assert success - ansible.builtin.assert: - that: - - delete_peer is not changed - - delete_peer is successful - - - name: Create local account EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - vpc_id: '{{ vpc_1 }}' - peer_vpc_id: '{{ vpc_2 }}' - state: present - tags: - Name: 'Peering connection for VPC {{ vpc_1 }} to VPC {{ vpc_2 }}' - register: vpc_peer2 - - - name: Assert success - ansible.builtin.assert: - that: - - vpc_peer2 is changed - - vpc_peer2 is successful - - "'peering_id' in vpc_peer2" - - vpc_peer2.peering_id.startswith('pcx-') - - - name: Store Connection ID - ansible.builtin.set_fact: - peer_id_2: '{{ vpc_peer2.peering_id }}' - - - name: Reject a local EC2 VPC Peering Connection - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer2.peering_id }}" - state: reject - wait: True - register: reject_peer - - - name: Assert success - ansible.builtin.assert: - that: - - reject_peer is changed - - reject_peer is successful - - reject_peer.peering_id == peer_id_2 - - - name: Reject a local EC2 VPC Peering Connection (idempotency) - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer2.peering_id }}" - state: reject - register: reject_peer - - - name: Assert success - ansible.builtin.assert: - that: - - reject_peer is not changed - - reject_peer is successful - - reject_peer.peering_id == peer_id_2 - - reject_peer.vpc_peering_connection.vpc_peering_connection_id == peer_id_2 - - - name: Delete a local EC2 VPC Peering Connections - community.aws.ec2_vpc_peer: - peering_id: "{{ vpc_peer2.peering_id }}" - state: absent - register: delete_peer - - - name: Assert success - ansible.builtin.assert: - that: - - delete_peer is not changed - - delete_peer is successful - - always: - - - name: Find all EC2 VPC Peering Connections for our VPCs - community.aws.ec2_vpc_peering_info: - filters: - accepter-vpc-info.vpc-id: '{{ item }}' - register: peering_info - loop: - - '{{ vpc_1 }}' - - '{{ vpc_2 }}' - - - ansible.builtin.set_fact: - vpc_peering_connection_ids: '{{ _vpc_peering_connections | map(attribute="vpc_peering_connection_id") | list }}' - vars: - _vpc_peering_connections: '{{ peering_info.results | map(attribute="vpc_peering_connections") | flatten }}' - ignore_errors: True - - # ============================================================ - - - name: Delete remaining EC2 VPC Peering Connections - community.aws.ec2_vpc_peer: - peering_id: "{{ item }}" - state: absent - ignore_errors: True - loop: '{{ vpc_peering_connection_ids }}' - - - name: Tidy up VPCs - amazon.aws.ec2_vpc_net: - name: "{{ item.name }}" - state: absent - cidr_block: "{{ item.cidr }}" - ignore_errors: true - loop: - - { name: "{{ vpc_2_name }}", cidr: "{{ vpc_2_cidr }}"} - - { name: "{{ vpc_1_name }}", cidr: "{{ vpc_1_cidr }}"} From dd5fd1d2a0efd2c533781444b5318771f1565800 Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 25 Oct 2024 08:43:08 -0400 Subject: [PATCH 66/77] DNM Promote ec2_placement_group* to amazon.aws (#2181) SUMMARY This PR migrates ec2_palcement_group* modules from community.aws to amazon.aws - ansible-collections/amazon.aws#2346 Refer : https://issues.redhat.com/browse/ACA-1889 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin Reviewed-by: Alina Buzachis --- .../fragments/migrate_ec2_placement_group.yml | 8 + meta/runtime.yml | 6 +- plugins/modules/ec2_placement_group.py | 247 -------- plugins/modules/ec2_placement_group_info.py | 131 ---- .../targets/ec2_placement_group/aliases | 3 - .../ec2_placement_group/defaults/main.yml | 1 - .../targets/ec2_placement_group/meta/main.yml | 1 - .../ec2_placement_group/tasks/env_cleanup.yml | 94 --- .../ec2_placement_group/tasks/env_setup.yml | 64 -- .../ec2_placement_group/tasks/main.yml | 566 ------------------ .../targets/ec2_placement_group/vars/main.yml | 1 - 11 files changed, 12 insertions(+), 1110 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_placement_group.yml delete mode 100644 plugins/modules/ec2_placement_group.py delete mode 100644 plugins/modules/ec2_placement_group_info.py delete mode 100644 tests/integration/targets/ec2_placement_group/aliases delete mode 100644 tests/integration/targets/ec2_placement_group/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_placement_group/meta/main.yml delete mode 100644 tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml delete mode 100644 tests/integration/targets/ec2_placement_group/tasks/env_setup.yml delete mode 100644 tests/integration/targets/ec2_placement_group/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_placement_group/vars/main.yml diff --git a/changelogs/fragments/migrate_ec2_placement_group.yml b/changelogs/fragments/migrate_ec2_placement_group.yml new file mode 100644 index 00000000000..3b273a98983 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_placement_group.yml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_placement_group - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_placement_group``. + - ec2_placement_group_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_placement_group_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 306eee289fe..23729367a4d 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -106,8 +106,6 @@ action_groups: - ec2_lc_find - ec2_lc_info - ec2_metric_alarm - - ec2_placement_group - - ec2_placement_group_info - ec2_scaling_policy - ec2_snapshot_copy - ec2_transit_gateway @@ -530,6 +528,10 @@ plugin_routing: redirect: amazon.aws.ec2_vpc_peer ec2_vpc_peering_info: redirect: amazon.aws.ec2_vpc_peering_info + ec2_placement_group: + redirect: amazon.aws.ec2_placement_group + ec2_placement_group_info: + redirect: amazon.aws.ec2_placement_group_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_placement_group.py b/plugins/modules/ec2_placement_group.py deleted file mode 100644 index 1a38252ac97..00000000000 --- a/plugins/modules/ec2_placement_group.py +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_placement_group -version_added: 1.0.0 -short_description: Create or delete an EC2 Placement Group -description: - - Create an EC2 Placement Group; if the placement group already exists, - nothing is done. Or, delete an existing placement group. If the placement - group is absent, do nothing. See also - U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) -author: - - "Brad Macpherson (@iiibrad)" -options: - name: - description: - - The name for the placement group. - required: true - type: str - partition_count: - description: - - The number of partitions. - - Valid only when O(strategy) is set to V(partition). - - Must be a value between V(1) and V(7). - type: int - version_added: 3.1.0 - state: - description: - - Create or delete placement group. - default: present - choices: [ 'present', 'absent' ] - type: str - strategy: - description: - - Placement group strategy. Cluster will cluster instances into a - low-latency group in a single Availability Zone, while Spread spreads - instances across underlying hardware. - default: cluster - choices: [ 'cluster', 'spread', 'partition' ] - type: str - tags: - description: - - A dict of key value pairs to associate with the placement group - type: dict - version_added: 8.1.0 -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide -# for details. - -- name: Create a placement group. - community.aws.ec2_placement_group: - name: my-cluster - state: present - -- name: Create a Spread placement group. - community.aws.ec2_placement_group: - name: my-cluster - state: present - strategy: spread - -- name: Create a Partition strategy placement group. - community.aws.ec2_placement_group: - name: my-cluster - state: present - strategy: partition - partition_count: 3 - -- name: Delete a placement group. - community.aws.ec2_placement_group: - name: my-cluster - state: absent -""" - -RETURN = r""" -placement_group: - description: Placement group attributes - returned: when state != absent - type: dict - contains: - group_arn: - description: Placement Group ARN. - type: str - returned: always - sample: "arn:aws:ec2:us-east-1:123456789012:placement-group" - group_id: - description: Placement Group Id. - type: str - returned: always - sample: "pg-123456789012" - name: - description: Placement Group name. - type: str - returned: always - sample: "my-cluster" - partition_count: - description: Partition Count. - type: str - returned: If applicable - sample: "my-cluster" - state: - description: Placement Groupt state. - type: str - returned: If applicable - sample: "available" - strategy: - description: Placement Group strategy. - type: str - returned: If applicable - sample: "cluster" - tags: - description: Tags associated with the placement group. - type: dict - returned: If applicable - version_added: 8.1.0 - sample: - tags: - some: value1 - other: value2 -""" - -from typing import Any -from typing import Dict - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_ec2_placement_group -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_ec2_placement_group -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_placement_groups -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def search_placement_group(connection, name: str) -> Dict[str, Any]: - """ - Check if a placement group exists. - """ - response = describe_ec2_placement_groups(connection, Filters=[{"Name": "group-name", "Values": [name]}]) - - if len(response) != 1: - return None - else: - return format_placement_group_information(response[0]) - - -def format_placement_group_information(response: Dict[str, Any]) -> Dict[str, Any]: - """ - Format placement group information - """ - - response = camel_dict_to_snake_dict(response, ignore_list=["Tags"]) - if "tags" in response: - response["tags"] = boto3_tag_list_to_ansible_dict(response.get("tags", [])) - response["name"] = response["group_name"] - return response - - -def create_placement_group(connection, module: AnsibleAWSModule) -> None: - name = module.params.get("name") - strategy = module.params.get("strategy") - tags = module.params.get("tags") - partition_count = module.params.get("partition_count") - - if strategy != "partition" and partition_count: - module.fail_json(msg="'partition_count' can only be set when strategy is set to 'partition'.") - - params = {} - params["GroupName"] = name - params["Strategy"] = strategy - if tags: - params["TagSpecifications"] = boto3_tag_specifications(tags, types=["placement-group"]) - if partition_count: - params["PartitionCount"] = partition_count - if module.check_mode: - module.exit_json( - changed=True, - placement_group={ - "name": name, - "strategy": strategy, - "tags": tags, - }, - msg="EC2 placement group would be created if not in check mode", - ) - - response = create_ec2_placement_group(connection, **params) - module.exit_json(changed=True, placement_group=format_placement_group_information(response)) - - -def delete_placement_group(connection, module: AnsibleAWSModule) -> None: - if module.check_mode: - module.exit_json(changed=True, msg="VPC would be deleted if not in check mode") - name = module.params.get("name") - delete_ec2_placement_group(connection, name) - module.exit_json(changed=True) - - -def main(): - argument_spec = dict( - name=dict(required=True, type="str"), - partition_count=dict(type="int"), - state=dict(default="present", choices=["present", "absent"]), - strategy=dict(default="cluster", choices=["cluster", "spread", "partition"]), - tags=dict(type="dict"), - ) - - module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) - - connection = module.client("ec2") - - state = module.params.get("state") - name = module.params.get("name") - placement_group = search_placement_group(connection, name) - - if state == "present": - if placement_group is None: - create_placement_group(connection, module) - else: - strategy = module.params.get("strategy") - if placement_group["strategy"] == strategy: - module.exit_json(changed=False, placement_group=placement_group) - else: - name = module.params.get("name") - module.fail_json( - msg=f"Placement group '{name}' exists, can't change strategy from '{placement_group['strategy']}' to '{strategy}'" - ) - - elif state == "absent": - if placement_group is None: - module.exit_json(changed=False) - else: - delete_placement_group(connection, module) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_placement_group_info.py b/plugins/modules/ec2_placement_group_info.py deleted file mode 100644 index 8c67e2b5fa4..00000000000 --- a/plugins/modules/ec2_placement_group_info.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_placement_group_info -version_added: 1.0.0 -short_description: List EC2 Placement Group(s) details -description: - - List details of EC2 Placement Group(s). -author: - - "Brad Macpherson (@iiibrad)" -options: - names: - description: - - A list of names to filter on. If a listed group does not exist, there - will be no corresponding entry in the result; no error will be raised. - type: list - elements: str - required: false - default: [] -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details or the AWS region, -# see the AWS Guide for details. - -- name: List all placement groups. - community.aws.ec2_placement_group_info: - register: all_ec2_placement_groups - -- name: List two placement groups. - community.aws.ec2_placement_group_info: - names: - - my-cluster - - my-other-cluster - register: specific_ec2_placement_groups - -- ansible.builtin.debug: - msg: > - {{ specific_ec2_placement_groups | json_query("[?name=='my-cluster']") }} -""" - - -RETURN = r""" -placement_groups: - description: Placement group attributes - returned: always - type: complex - contains: - name: - description: PG name - type: str - sample: "my-cluster" - state: - description: PG state - type: str - sample: "available" - strategy: - description: PG strategy - type: str - sample: "cluster" - tags: - description: Tags associated with the placement group - type: dict - version_added: 8.1.0 - sample: - tags: - some: value1 - other: value2 -""" - -from typing import Any -from typing import Dict -from typing import List - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_placement_groups -from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict - - -def get_placement_groups_details(connection, names: List) -> Dict[str, Any]: - params = {} - if len(names) > 0: - params["Filters"] = [ - { - "Name": "group-name", - "Values": names, - } - ] - response = describe_ec2_placement_groups(connection, **params) - - results = [] - for placement_group in response: - results.append( - { - "name": placement_group["GroupName"], - "state": placement_group["State"], - "strategy": placement_group["Strategy"], - "tags": boto3_tag_list_to_ansible_dict(placement_group.get("Tags")), - } - ) - return results - - -def main(): - argument_spec = dict( - names=dict(type="list", default=[], elements="str"), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - connection = module.client("ec2") - names = module.params.get("names") - - placement_groups = get_placement_groups_details(connection, names) - module.exit_json(changed=False, placement_groups=placement_groups) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_placement_group/aliases b/tests/integration/targets/ec2_placement_group/aliases deleted file mode 100644 index c6944e7b949..00000000000 --- a/tests/integration/targets/ec2_placement_group/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_placement_group_info diff --git a/tests/integration/targets/ec2_placement_group/defaults/main.yml b/tests/integration/targets/ec2_placement_group/defaults/main.yml deleted file mode 100644 index ed97d539c09..00000000000 --- a/tests/integration/targets/ec2_placement_group/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/tests/integration/targets/ec2_placement_group/meta/main.yml b/tests/integration/targets/ec2_placement_group/meta/main.yml deleted file mode 100644 index ed97d539c09..00000000000 --- a/tests/integration/targets/ec2_placement_group/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml b/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml deleted file mode 100644 index be84fe8f17a..00000000000 --- a/tests/integration/targets/ec2_placement_group/tasks/env_cleanup.yml +++ /dev/null @@ -1,94 +0,0 @@ -- name: Remove any instances in the test VPC - amazon.aws.ec2_instance: - filters: - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Get ENIs - amazon.aws.ec2_eni_info: - filters: - vpc-id: "{{ testing_vpc.vpc.id }}" - register: enis - -- name: Delete all ENIs - amazon.aws.ec2_eni: - eni_id: "{{ item.id }}" - state: absent - until: removed is not failed - with_items: "{{ enis.network_interfaces }}" - ignore_errors: yes - retries: 10 - -- name: Remove the security group - amazon.aws.ec2_security_group: - name: "{{ resource_prefix }}-sg" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Remove routing rules - amazon.aws.ec2_vpc_route_table: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - tags: - created: "{{ resource_prefix }}-route" - routes: - - dest: 0.0.0.0/0 - gateway_id: "{{ igw.gateway_id }}" - subnets: - - "{{ testing_subnet_a.subnet.id }}" - - "{{ testing_subnet_b.subnet.id }}" - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Remove internet gateway - amazon.aws.ec2_vpc_igw: - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Remove subnet A - amazon.aws.ec2_vpc_subnet: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.22.32.0/24 - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Remove subnet B - amazon.aws.ec2_vpc_subnet: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.22.33.0/24 - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 - -- name: Remove the VPC - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - cidr_block: 10.22.32.0/23 - state: absent - tags: - Name: Ansible Testing VPC - tenancy: default - register: removed - until: removed is not failed - ignore_errors: yes - retries: 10 diff --git a/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml b/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml deleted file mode 100644 index 54fa62a35db..00000000000 --- a/tests/integration/targets/ec2_placement_group/tasks/env_setup.yml +++ /dev/null @@ -1,64 +0,0 @@ -- name: Create VPC for use in testing - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - cidr_block: 10.22.32.0/23 - tags: - Name: Ansible ec2_lc Testing VPC - tenancy: default - register: testing_vpc - -- name: Create internet gateway for use in testing - amazon.aws.ec2_vpc_igw: - vpc_id: "{{ testing_vpc.vpc.id }}" - state: present - tags: - Name: Ansible ec2_lc Testing gateway - register: igw - -- name: Create default subnet in zone A - amazon.aws.ec2_vpc_subnet: - state: present - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.22.32.0/24 - az: "{{ aws_region }}a" - resource_tags: - Name: "{{ resource_prefix }}-subnet-a" - register: testing_subnet_a - -- name: Create secondary subnet in zone B - amazon.aws.ec2_vpc_subnet: - state: present - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: 10.22.33.0/24 - az: "{{ aws_region }}b" - resource_tags: - Name: "{{ resource_prefix }}-subnet-b" - register: testing_subnet_b - -- name: Create routing rules - amazon.aws.ec2_vpc_route_table: - vpc_id: "{{ testing_vpc.vpc.id }}" - tags: - created: "{{ resource_prefix }}-route" - routes: - - dest: 0.0.0.0/0 - gateway_id: "{{ igw.gateway_id }}" - subnets: - - "{{ testing_subnet_a.subnet.id }}" - - "{{ testing_subnet_b.subnet.id }}" - -- name: Create a security group with the vpc - amazon.aws.ec2_security_group: - name: "{{ resource_prefix }}-sg" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - rules: - - proto: tcp - from_port: 22 - to_port: 22 - cidr_ip: 0.0.0.0/0 - - proto: tcp - from_port: 80 - to_port: 80 - cidr_ip: 0.0.0.0/0 - register: sg diff --git a/tests/integration/targets/ec2_placement_group/tasks/main.yml b/tests/integration/targets/ec2_placement_group/tasks/main.yml deleted file mode 100644 index 130f347db97..00000000000 --- a/tests/integration/targets/ec2_placement_group/tasks/main.yml +++ /dev/null @@ -1,566 +0,0 @@ -- name: run ec2_placement_group tests - module_defaults: - group/aws: - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - region: "{{ aws_region }}" - collections: - - amazon.aws - vars: - placement_group_names: [] - - block: - - - name: Set up environment for testing. - include_tasks: env_setup.yml - - - name: Create a placement group 1 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: present - check_mode: true - register: pg_1_create_check_mode - - - name: Assert that placement group data is returned (check mode) - ansible.builtin.assert: - that: - - pg_1_create_check_mode is changed - - pg_1_create_check_mode.placement_group.name == resource_prefix ~ '-pg1' - - - name: Create a placement group 1 - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: present - register: pg_1_create - - - ansible.builtin.set_fact: - placement_group_names: "{{ placement_group_names + [pg_1_create.placement_group.name] }}" - - - name: Assert that placement group is created - ansible.builtin.assert: - that: - - pg_1_create is changed - - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' - - pg_1_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" in pg_1_create.resource_actions' - - - name: Gather information about placement group 1 - community.aws.ec2_placement_group_info: - names: - - '{{ resource_prefix }}-pg1' - register: pg_1_info_result - - - name: Assert that placement group is created - ansible.builtin.assert: - that: - - pg_1_info_result is not changed - - pg_1_info_result.placement_groups[0].name == resource_prefix ~ '-pg1' - - pg_1_info_result.placement_groups[0].state == "available" - - pg_1_info_result.placement_groups[0].strategy == "cluster" - - '"ec2:DescribePlacementGroups" in pg_1_info_result.resource_actions' - - - name: Create a placement group 1 - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: present - register: pg_1_create - - - name: Assert that placement group is not created (idempotent) - ansible.builtin.assert: - that: - - pg_1_create is not changed - - pg_1_create.placement_group.name == resource_prefix ~ '-pg1' - - pg_1_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_1_create.resource_actions' - - - name: Create a placement group 1 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: present - check_mode: true - register: pg_1_create_check_mode_idem - - - name: Assert that placement group is not created (idempotent - check_mode) - ansible.builtin.assert: - that: - - pg_1_create_check_mode_idem is not changed - - pg_1_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg1' - - pg_1_create_check_mode_idem.placement_group.state == "available" - - - name: Create a placement group 2 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: present - strategy: spread - check_mode: true - register: pg_2_create_check_mode - - - name: Assert that placement group is created - ansible.builtin.assert: - that: - - pg_2_create_check_mode is changed - - pg_2_create_check_mode.placement_group.name == resource_prefix ~ '-pg2' - - - name: Create a placement group 2 with spread strategy - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: present - strategy: spread - register: pg_2_create - - - name: Assert that placement group is created - ansible.builtin.assert: - that: - - pg_2_create is changed - - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' - - pg_2_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" in pg_2_create.resource_actions' - - - ansible.builtin.set_fact: - placement_group_names: "{{ placement_group_names + [pg_2_create.placement_group.name] }}" - - - name: Gather information about placement group 2 - community.aws.ec2_placement_group_info: - names: - - '{{ resource_prefix }}-pg2' - register: pg_2_info_result - - - name: Assert that placement group is created - ansible.builtin.assert: - that: - - pg_2_info_result is not changed - - pg_2_info_result.placement_groups[0].name == resource_prefix ~ '-pg2' - - pg_2_info_result.placement_groups[0].state == "available" - - pg_2_info_result.placement_groups[0].strategy == "spread" - - '"ec2:DescribePlacementGroups" in pg_2_info_result.resource_actions' - - - name: Create a placement group 2 with spread strategy - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: present - strategy: spread - register: pg_2_create - - - name: Assert that placement group exists (idempotent) - ansible.builtin.assert: - that: - - pg_2_create is not changed - - pg_2_create.placement_group.name == resource_prefix ~ '-pg2' - - pg_2_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_2_create.resource_actions' - - - name: Create a placement group 2 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: present - strategy: spread - check_mode: true - register: pg_2_create_check_mode_idem - - - name: Assert that placement group exists (idempotent - check_mode) - ansible.builtin.assert: - that: - - pg_2_create_check_mode_idem is not changed - - pg_2_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg2' - - pg_2_create_check_mode_idem.placement_group.state == "available" - - - name: Create a placement group 3 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: present - strategy: partition - partition_count: 4 - check_mode: true - register: pg_3_create_check_mode - - - name: Assert that placement group exists - ansible.builtin.assert: - that: - - pg_3_create_check_mode is changed - - pg_3_create_check_mode.placement_group.name == resource_prefix ~ '-pg3' - - - name: Create a placement group 3 with Partition strategy - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: present - strategy: partition - partition_count: 4 - register: pg_3_create - - - name: Assert that placement group exists - ansible.builtin.assert: - that: - - pg_3_create is changed - - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' - - pg_3_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" in pg_3_create.resource_actions' - - - ansible.builtin.set_fact: - placement_group_names: "{{ placement_group_names + [pg_3_create.placement_group.name] }}" - - - - name: Gather information about placement group 3 - community.aws.ec2_placement_group_info: - names: - - '{{ resource_prefix }}-pg3' - register: pg_3_info_result - - - name: Assert that placement group exists - ansible.builtin.assert: - that: - - pg_3_info_result is not changed - - pg_3_info_result.placement_groups[0].name == resource_prefix ~ '-pg3' - - pg_3_info_result.placement_groups[0].state == "available" - - pg_3_info_result.placement_groups[0].strategy == "partition" - - '"ec2:DescribePlacementGroups" in pg_3_info_result.resource_actions' - - - name: Create a placement group 3 with Partition strategy - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: present - strategy: partition - partition_count: 4 - register: pg_3_create - - - name: Assert that placement group exists (idempotent) - ansible.builtin.assert: - that: - - pg_3_create is not changed - - pg_3_create.placement_group.name == resource_prefix ~ '-pg3' - - pg_3_create.placement_group.state == "available" - - '"ec2:CreatePlacementGroup" not in pg_3_create.resource_actions' - - - name: Create a placement group 3 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: present - strategy: partition - partition_count: 4 - check_mode: true - register: pg_3_create_check_mode_idem - - - name: Assert that placement group exists (idempotent - check_mode) - ansible.builtin.assert: - that: - - pg_3_create_check_mode_idem is not changed - - pg_3_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg3' - - pg_3_create_check_mode_idem.placement_group.state == "available" - - - name: Create a placement group 4 with tags - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: present - strategy: cluster - tags: - foo: test1 - bar: test2 - check_mode: true - register: pg_4_create_check_mode - - - name: Assert that placement group exists (check-mode) - ansible.builtin.assert: - that: - - pg_4_create_check_mode is changed - - pg_4_create_check_mode.placement_group.name == resource_prefix ~ '-pg4' - - pg_4_create_check_mode.placement_group.tags.foo == "test1" - - pg_4_create_check_mode.placement_group.tags.bar == "test2" - - - name: Create a placement group 4 with tags - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: present - strategy: cluster - tags: - foo: test1 - bar: test2 - register: pg_4_create - - - name: Assert that placement group exists - ansible.builtin.assert: - that: - - pg_4_create is changed - - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' - - pg_4_create.placement_group.state == "available" - - pg_4_create.placement_group.tags.foo == "test1" - - pg_4_create.placement_group.tags.bar == "test2" - - '"ec2:CreatePlacementGroup" in pg_4_create.resource_actions' - - - ansible.builtin.set_fact: - placement_group_names: "{{ placement_group_names + [pg_4_create.placement_group.name] }}" - - - name: Gather information about placement group 4 - community.aws.ec2_placement_group_info: - names: - - '{{ resource_prefix }}-pg4' - register: pg_4_info_result - - - name: Assert that placement group exists - ansible.builtin.assert: - that: - - pg_4_info_result is not changed - - pg_4_info_result.placement_groups[0].name == resource_prefix ~ '-pg4' - - pg_4_info_result.placement_groups[0].state == "available" - - pg_4_info_result.placement_groups[0].strategy == "cluster" - - pg_4_info_result.placement_groups[0].tags.foo == "test1" - - pg_4_info_result.placement_groups[0].tags.bar == "test2" - - '"ec2:DescribePlacementGroups" in pg_4_info_result.resource_actions' - - - name: Create a placement group 4 with tags - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: present - strategy: cluster - tags: - foo: test1 - bar: test2 - register: pg_4_create - - - name: Assert that placement group exists (idempotent) - ansible.builtin.assert: - that: - - pg_4_create is not changed - - pg_4_create.placement_group.name == resource_prefix ~ '-pg4' - - pg_4_create.placement_group.state == "available" - - pg_4_create.placement_group.strategy == "cluster" - - pg_4_create.placement_group.tags.foo == "test1" - - pg_4_create.placement_group.tags.bar == "test2" - - '"ec2:CreatePlacementGroup" not in pg_4_create.resource_actions' - - - name: Create a placement group 4 with tags - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: present - strategy: cluster - tags: - foo: test1 - bar: test2 - check_mode: true - register: pg_4_create_check_mode_idem - - - name: Assert that placement group exists (idempotent - check-mode) - ansible.builtin.assert: - that: - - pg_4_create_check_mode_idem is not changed - - pg_4_create_check_mode_idem.placement_group.name == resource_prefix ~ '-pg4' - - pg_4_create_check_mode_idem.placement_group.state == "available" - - pg_4_create_check_mode_idem.placement_group.strategy == "cluster" - - pg_4_create_check_mode_idem.placement_group.tags.foo == "test1" - - pg_4_create_check_mode_idem.placement_group.tags.bar == "test2" - - - name: List all placement groups. - community.aws.ec2_placement_group_info: - register: all_ec2_placement_groups - -# Delete Placement Group ========================================== - - - name: Delete a placement group 1 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: absent - check_mode: true - register: pg_1_delete_check_mode - ignore_errors: true - - - name: Assert check mode (check mode) - ansible.builtin.assert: - that: - - pg_1_delete_check_mode is changed - - - name: Delete a placement group 1 - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: absent - register: pg_1_delete - - - name: Assert that deletion is successful - ansible.builtin.assert: - that: - - pg_1_delete is changed - - '"ec2:DeletePlacementGroup" in pg_1_delete.resource_actions' - - - name: Delete a placement group 1 - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: absent - register: pg_1_delete - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_1_delete is not changed - - '"ec2:DeletePlacementGroup" not in pg_1_delete.resource_actions' - - - name: Delete a placement group 1 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg1' - state: absent - check_mode: true - register: pg_1_delete_check_mode_idem - ignore_errors: true - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_1_delete_check_mode_idem is not changed - - - name: Delete a placement group 2 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: absent - check_mode: true - register: pg_2_delete_check_mode - ignore_errors: true - - - name: Assert that check mode is successful - ansible.builtin.assert: - that: - - pg_2_delete_check_mode is changed - - - name: Delete a placement group 2 - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: absent - register: pg_2_delete - - - name: Assert that there is change - ansible.builtin.assert: - that: - - pg_2_delete is changed - - '"ec2:DeletePlacementGroup" in pg_2_delete.resource_actions' - - - name: Delete a placement group 2 - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: absent - register: pg_2_delete - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_2_delete is not changed - - '"ec2:DeletePlacementGroup" not in pg_2_delete.resource_actions' - - - name: Delete a placement group 2 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg2' - state: absent - check_mode: true - register: pg_2_delete_check_mode_idem - ignore_errors: true - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_2_delete_check_mode_idem is not changed - - - name: Delete a placement group 3 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: absent - check_mode: true - register: pg_3_delete_check_mode - ignore_errors: true - - - name: Assert that there is change - check mode - ansible.builtin.assert: - that: - - pg_3_delete_check_mode is changed - - - name: Delete a placement group 3 - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: absent - register: pg_3_delete - - - name: Assert that there is change - ansible.builtin.assert: - that: - - pg_3_delete is changed - - '"ec2:DeletePlacementGroup" in pg_3_delete.resource_actions' - - - name: Delete a placement group 3 - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: absent - register: pg_3_delete - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_3_delete is not changed - - '"ec2:DeletePlacementGroup" not in pg_3_delete.resource_actions' - - - name: Delete a placement group 3 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg3' - state: absent - check_mode: true - register: pg_3_delete_check_mode_idem - ignore_errors: true - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_3_delete_check_mode_idem is not changed - - - name: Delete a placement group 4 - check_mode - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: absent - check_mode: true - register: pg_4_delete_check_mode - ignore_errors: true - - - name: Assert that there is change check mode - ansible.builtin.assert: - that: - - pg_4_delete_check_mode is changed - - - - name: Delete a placement group 4 - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: absent - register: pg_4_delete - - - name: Assert that there is change - ansible.builtin.assert: - that: - - pg_4_delete is changed - - '"ec2:DeletePlacementGroup" in pg_4_delete.resource_actions' - - - name: Delete a placement group 4 - Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: absent - register: pg_4_delete - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_4_delete is not changed - - '"ec2:DeletePlacementGroup" not in pg_4_delete.resource_actions' - - - name: Delete a placement group 4 - check_mode Idempotency - community.aws.ec2_placement_group: - name: '{{ resource_prefix }}-pg4' - state: absent - check_mode: true - register: pg_4_delete_check_mode_idem - ignore_errors: true - - - name: Assert that there is no change - ansible.builtin.assert: - that: - - pg_4_delete_check_mode_idem is not changed - - always: - - - name: Make sure placement groups created during test are deleted - community.aws.ec2_placement_group: - name: '{{ item }}' - state: absent - with_items: '{{ placement_group_names }}' - - - include_tasks: env_cleanup.yml diff --git a/tests/integration/targets/ec2_placement_group/vars/main.yml b/tests/integration/targets/ec2_placement_group/vars/main.yml deleted file mode 100644 index ed97d539c09..00000000000 --- a/tests/integration/targets/ec2_placement_group/vars/main.yml +++ /dev/null @@ -1 +0,0 @@ ---- From e39fd2b222c361f696362de1f96e8a98f292a615 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:24:25 +0200 Subject: [PATCH 67/77] DNM - Migrate modules ec2_launch_template and tests (#2185) Depends-On: ansible-collections/amazon.aws#2348 Remove ec2_launch_template modules and tests, these modules have been migrated to amazon.aws collection. Update runtime.yml with redirects to that collection Update ignore files Reviewed-by: Alina Buzachis --- .../migrate_ec2_launch_template.yaml | 5 + meta/runtime.yml | 3 +- plugins/modules/ec2_launch_template.py | 1626 ----------------- .../targets/ec2_launch_template/aliases | 3 - .../ec2_launch_template/defaults/main.yml | 2 - .../files/assume-role-policy.json | 13 - .../targets/ec2_launch_template/meta/main.yml | 2 - .../ec2_launch_template/tasks/deletion.yml | 404 ---- .../tasks/iam_instance_role.yml | 203 -- .../ec2_launch_template/tasks/main.yml | 13 - .../ec2_launch_template/tasks/tagging.yml | 210 --- .../tasks/template_data.yml | 145 -- .../ec2_launch_template/tasks/versions.yml | 462 ----- 13 files changed, 7 insertions(+), 3084 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_launch_template.yaml delete mode 100644 plugins/modules/ec2_launch_template.py delete mode 100644 tests/integration/targets/ec2_launch_template/aliases delete mode 100644 tests/integration/targets/ec2_launch_template/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_launch_template/files/assume-role-policy.json delete mode 100644 tests/integration/targets/ec2_launch_template/meta/main.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/deletion.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/tagging.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/template_data.yml delete mode 100644 tests/integration/targets/ec2_launch_template/tasks/versions.yml diff --git a/changelogs/fragments/migrate_ec2_launch_template.yaml b/changelogs/fragments/migrate_ec2_launch_template.yaml new file mode 100644 index 00000000000..898c0e3973a --- /dev/null +++ b/changelogs/fragments/migrate_ec2_launch_template.yaml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - ec2_launch_template - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_launch_template`` (https://github.com/ansible-collections/community.aws/pull/2185). diff --git a/meta/runtime.yml b/meta/runtime.yml index 23729367a4d..fec2385f295 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -101,7 +101,6 @@ action_groups: - ec2_customer_gateway - ec2_customer_gateway_info - ec2_elb - - ec2_launch_template - ec2_lc - ec2_lc_find - ec2_lc_info @@ -532,6 +531,8 @@ plugin_routing: redirect: amazon.aws.ec2_placement_group ec2_placement_group_info: redirect: amazon.aws.ec2_placement_group_info + ec2_launch_template: + redirect: amazon.aws.ec2_launch_template module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_launch_template.py b/plugins/modules/ec2_launch_template.py deleted file mode 100644 index aa055535a9a..00000000000 --- a/plugins/modules/ec2_launch_template.py +++ /dev/null @@ -1,1626 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (c) 2018 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_launch_template -version_added: 1.0.0 -short_description: Manage EC2 launch templates -description: -- Create, modify, and delete EC2 Launch Templates, which can be used to - create individual instances or with Autoscaling Groups. -- The M(amazon.aws.ec2_instance) and M(community.aws.autoscaling_group) modules can, instead of specifying all - parameters on those tasks, be passed a Launch Template which contains - settings like instance size, disk type, subnet, and more. -author: -- Ryan Scott Brown (@ryansb) -options: - template_id: - description: - - The ID for the launch template, can be used for all cases except creating a new Launch Template. - - At least one of O(template_id) and O(template_name) must be specified. - aliases: [id] - type: str - template_name: - description: - - The template name. This must be unique in the region-account combination you are using. - - If no launch template exists with the specified name, a new launch template is created. - - If a launch template with the specified name already exists and the configuration has not changed, - nothing happens. - - If a launch template with the specified name already exists and the configuration has changed, - a new version of the launch template is created. - - At least one of O(template_id) and O(template_name) must be specified. - aliases: [name] - type: str - default_version: - description: - - Which version should be the default when users spin up new instances based on this template? By default, the latest version will be made the default. - type: str - default: latest - version_description: - version_added: 5.5.0 - description: - - The description of a launch template version. - default: "" - type: str - versions_to_delete: - description: - - The version numbers of a launch template versions to delete. - - Use O(default_version) to specify a new default version when deleting the current default version. - - By default, the latest version will be made the default. - - Ignored when O(state=present). - type: list - elements: int - version_added: 9.0.0 - state: - description: - - Whether the launch template should exist or not. - - Deleting specific versions of a launch template is not supported at this time. - choices: [present, absent] - default: present - type: str - block_device_mappings: - description: - - The block device mapping. Supplying both a snapshot ID and an encryption - value as arguments for block-device mapping results in an error. This is - because only blank volumes can be encrypted on start, and these are not - created from a snapshot. If a snapshot is the basis for the volume, it - contains data by definition and its encryption status cannot be changed - using this action. - type: list - elements: dict - suboptions: - device_name: - description: The device name (for example, V(/dev/sdh) or V(xvdh)). - type: str - no_device: - description: Suppresses the specified device included in the block device mapping of the AMI. - type: str - virtual_name: - description: > - The virtual device name (ephemeralN). Instance store volumes are - numbered starting from 0. An instance type with 2 available instance - store volumes can specify mappings for ephemeral0 and ephemeral1. The - number of available instance store volumes depends on the instance - type. After you connect to the instance, you must mount the volume. - type: str - ebs: - description: Parameters used to automatically set up EBS volumes when the instance is launched. - type: dict - suboptions: - delete_on_termination: - description: Indicates whether the EBS volume is deleted on instance termination. - type: bool - encrypted: - description: > - Indicates whether the EBS volume is encrypted. Encrypted volumes - can only be attached to instances that support Amazon EBS - encryption. If you are creating a volume from a snapshot, you - can't specify an encryption value. - type: bool - iops: - description: - - The number of I/O operations per second (IOPS) that the volume - supports. For io1, this represents the number of IOPS that are - provisioned for the volume. For gp2, this represents the baseline - performance of the volume and the rate at which the volume - accumulates I/O credits for bursting. For more information about - General Purpose SSD baseline performance, I/O credits, and - bursting, see Amazon EBS Volume Types in the Amazon Elastic - Compute Cloud User Guide. - - > - Condition: This parameter is required for requests to create io1 - volumes; it is not used in requests to create gp2, st1, sc1, or - standard volumes. - type: int - kms_key_id: - description: The ARN of the AWS Key Management Service (AWS KMS) CMK used for encryption. - type: str - snapshot_id: - description: The ID of the snapshot to create the volume from. - type: str - volume_size: - description: - - The size of the volume, in GiB. - - "Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size." - type: int - volume_type: - description: The volume type - type: str - throughput: - description: > - The throughput to provision for a gp3 volume, with a maximum of 1,000 MiB/s. - Valid Range - Minimum value of V(125). Maximum value of V(1000). - type: int - version_added: 9.0.0 - cpu_options: - description: - - Choose CPU settings for the EC2 instances that will be created with this template. - - For more information, see U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) - type: dict - suboptions: - core_count: - description: The number of CPU cores for the instance. - type: int - threads_per_core: - description: > - The number of threads per CPU core. To disable Intel Hyper-Threading - Technology for the instance, specify a value of V(1). Otherwise, specify - the default value of V(2). - type: int - credit_specification: - description: The credit option for CPU usage of the instance. Valid for T2 or T3 instances only. - type: dict - suboptions: - cpu_credits: - description: - - The credit option for CPU usage of a T2 or T3 instance. Valid values are C(standard) and C(unlimited). - type: str - disable_api_termination: - description: - - This helps protect instances from accidental termination. - - If set to V(true), you can't terminate the instance using the Amazon EC2 console, CLI, or API. - type: bool - ebs_optimized: - description: > - Indicates whether the instance is optimized for Amazon EBS I/O. This - optimization provides dedicated throughput to Amazon EBS and an optimized - configuration stack to provide optimal Amazon EBS I/O performance. This - optimization isn't available with all instance types. Additional usage - charges apply when using an EBS-optimized instance. - type: bool - elastic_gpu_specifications: - type: list - elements: dict - description: Settings for Elastic GPU attachments. See U(https://aws.amazon.com/ec2/elastic-gpus/) for details. - suboptions: - type: - description: The type of Elastic GPU to attach - type: str - iam_instance_profile: - description: > - The name or ARN of an IAM instance profile. Requires permissions to - describe existing instance roles to confirm ARN is properly formed. - type: str - image_id: - description: > - The AMI ID to use for new instances launched with this template. This - value is region-dependent since AMIs are not global resources. - type: str - instance_initiated_shutdown_behavior: - description: > - Indicates whether an instance stops or terminates when you initiate - shutdown from the instance using the operating system shutdown command. - choices: [stop, terminate] - type: str - instance_market_options: - description: Options for alternative instance markets, currently only the spot market is supported. - type: dict - suboptions: - market_type: - description: The market type. This should always be V(spot). - type: str - spot_options: - description: Spot-market specific settings. - type: dict - suboptions: - block_duration_minutes: - description: - - The required duration for the Spot Instances (also known as Spot blocks), in minutes. - - This value must be a multiple of V(60) (V(60), V(120), V(180), V(240), V(300), or V(360)). - type: int - instance_interruption_behavior: - description: The behavior when a Spot Instance is interrupted. The default is V(terminate). - choices: [hibernate, stop, terminate] - type: str - max_price: - description: The highest hourly price you're willing to pay for this Spot Instance. - type: str - spot_instance_type: - description: The request type to send. - choices: [one-time, persistent] - type: str - instance_type: - description: - - The instance type, such as V(c5.2xlarge). For a full list of instance types, see - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html). - type: str - kernel_id: - description: - - The ID of the kernel. - - We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) - type: str - key_name: - description: - - The name of the key pair. You can create a key pair using M(amazon.aws.ec2_key). - - If you do not specify a key pair, you can't connect to the instance - unless you choose an AMI that is configured to allow users another way to log in. - type: str - monitoring: - description: Settings for instance monitoring. - type: dict - suboptions: - enabled: - type: bool - description: Whether to turn on detailed monitoring for new instances. This will incur extra charges. - network_interfaces: - description: One or more network interfaces. - type: list - elements: dict - suboptions: - associate_public_ip_address: - description: Associates a public IPv4 address with eth0 for a new network interface. - type: bool - delete_on_termination: - description: Indicates whether the network interface is deleted when the instance is terminated. - type: bool - description: - description: A description for the network interface. - type: str - device_index: - description: The device index for the network interface attachment. - type: int - groups: - description: List of security group IDs to include on this instance. - type: list - elements: str - ipv6_address_count: - description: - - The number of IPv6 addresses to assign to a network interface. - - Amazon EC2 automatically selects the IPv6 addresses from the subnet range. - - You can't use this option if specifying the O(network_interfaces.ipv6_addresses) option. - type: int - ipv6_addresses: - description: - - A list of one or more specific IPv6 addresses from the IPv6 CIDR block range of your subnet. - - You can't use this option if you're specifying the O(network_interfaces.ipv6_address_count) option. - type: list - elements: str - network_interface_id: - description: The eni ID of a network interface to attach. - type: str - private_ip_address: - description: The primary private IPv4 address of the network interface. - type: str - subnet_id: - description: The ID of the subnet for the network interface. - type: str - placement: - description: The placement group settings for the instance. - type: dict - suboptions: - affinity: - description: The affinity setting for an instance on a Dedicated Host. - type: str - availability_zone: - description: The Availability Zone for the instance. - type: str - group_name: - description: The name of the placement group for the instance. - type: str - host_id: - description: The ID of the Dedicated Host for the instance. - type: str - tenancy: - description: > - The tenancy of the instance (if the instance is running in a VPC). An - instance with a tenancy of dedicated runs on single-tenant hardware. - type: str - ram_disk_id: - description: > - The ID of the RAM disk to launch the instance with. We recommend that you - use PV-GRUB instead of kernels and RAM disks. For more information, see - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html) - type: str - security_group_ids: - description: A list of security group IDs (VPC or EC2-Classic) that the new instances will be added to. - type: list - elements: str - security_groups: - description: > - A list of security group names (Default VPC or EC2-Classic) that the new instances will be added to. - For any VPC other than Default, you must use O(security_group_ids). - type: list - elements: str - source_version: - description: - - The version number of the launch template version on which to base the new version. - - The new version inherits the same launch parameters as the source version, except for parameters that you explicity specify. - - Snapshots applied to the O(block_device_mappings) are ignored when creating a new version unless they are explicitly included. - type: str - default: latest - version_added: 4.1.0 - tag_specifications: - description: - - The tags to apply to the resources when this Launch template is used. - type: list - elements: dict - version_added: 9.0.0 - suboptions: - resource_type: - description: - - The type of resource to tag. - - If the instance does not include the resource type that you specify, the instance launch fails. - type: str - default: instance - choices: - - instance - - volume - - network-interface - - spot-instances-request - tags: - description: - - A set of key-value pairs to be applied to the resource type. - - "Tag key constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with I(aws:)" - - "Tag value constraints: Tag values are case-sensitive and accept a maximum of 255 Unicode characters." - type: dict - user_data: - description: > - The Base64-encoded user data to make available to the instance. For more information, see the Linux - U(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) and Windows - U(http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) - documentation on user-data. - type: str - metadata_options: - description: - - Configure EC2 Metadata options. - - For more information see the IMDS documentation - U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html). - type: dict - version_added: 1.5.0 - suboptions: - http_endpoint: - type: str - description: This parameter enables or disables the HTTP metadata endpoint on your instances. - choices: [enabled, disabled] - default: 'enabled' - http_put_response_hop_limit: - type: int - description: - - The desired HTTP PUT response hop limit for instance metadata requests. - - The larger the number, the further instance metadata requests can travel. - default: 1 - http_tokens: - type: str - description: The state of token usage for your instance metadata requests. - choices: [optional, required] - default: 'optional' - http_protocol_ipv6: - version_added: 3.1.0 - type: str - description: - - Whether the instance metadata endpoint is available via IPv6. - choices: [enabled, disabled] - default: 'disabled' - instance_metadata_tags: - version_added: 3.1.0 - type: str - description: - - Whether the instance tags are availble (V(enabled)) via metadata endpoint or not (V(disabled)). - choices: [enabled, disabled] - default: 'disabled' -notes: - - The O(tags) option used has been in release 9.0.0 to be applied to the launch template resource instead of launch template resource. - - Use O(tag_specifications) to define tags to be applied to resources when this Launch Template is used. - - Support for O(purge_tags) was added in release 9.0.0. -extends_documentation_fragment: -- amazon.aws.common.modules -- amazon.aws.region.modules -- amazon.aws.boto3 -- amazon.aws.tags -""" - -EXAMPLES = r""" -- name: Create an ec2 launch template - community.aws.ec2_launch_template: - name: "my_template" - image_id: "ami-04b762b4289fba92b" - key_name: my_ssh_key - instance_type: t2.micro - iam_instance_profile: myTestProfile - disable_api_termination: true - -- name: > - Create a new version of an existing ec2 launch template with a different instance type, - while leaving an older version as the default version - community.aws.ec2_launch_template: - name: "my_template" - default_version: 1 - instance_type: c5.4xlarge - -- name: Delete an ec2 launch template - community.aws.ec2_launch_template: - name: "my_template" - state: absent - -- name: Delete a specific version of an ec2 launch template - community.aws.ec2_launch_template: - name: "my_template" - versions_to_delete: - - 2 - state: absent - -- name: Delete a specific version of an ec2 launch template and change the default version - community.aws.ec2_launch_template: - name: "my_template" - versions_to_delete: - - 1 - default_version: 2 - state: absent - -- name: Create an ec2 launch template with specific tags - community.aws.ec2_launch_template: - name: "my_template" - image_id: "ami-04b762b4289fba92b" - instance_type: t2.micro - disable_api_termination: true - tags: - Some: tag - Another: tag - -- name: Create an ec2 launch template with different tag for volume and instance - community.aws.ec2_launch_template: - name: "my_template" - image_id: "ami-04b762b4289fba92b" - instance_type: t2.micro - block_device_mappings: - - device_name: /dev/sdb - ebs: - volume_size: 20 - delete_on_termination: true - volume_type: standard - tag_specifications: - - resource_type: instance - tags: - OsType: Linux - - resource_type: volume - tags: - foo: bar -""" - -RETURN = r""" -latest_version: - description: The latest available version number of the launch template. - returned: when RV(latest_template) has a version number. - type: int -default_version: - description: The version that will be used if only the template name is specified. Often this is the same as the latest version, but not always. - returned: when RV(default_template) has a version number. - type: int -template: - description: Latest available version of the launch template. - returned: when O(state=present) - type: complex - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - create_time: - description: The time launch template was created. - type: str - returned: always - created_by: - description: The principal that created the launch template. - type: str - returned: always - default_version_number: - description: The version number of the default version of the launch template. - type: int - returned: always - latest_version_number: - description: The version number of the latest version of the launch template. - type: int - returned: always - tags: - description: A dictionary of tags assigned to image. - returned: when AMI is created or already exists - type: dict - sample: { - "Env": "devel", - "Name": "nat-server" - } -versions: - description: All available versions of the launch template. - returned: when O(state=present) - type: list - elements: dict - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - create_time: - description: The time the version was created. - type: str - returned: always - created_by: - description: The principal that created the version. - type: str - returned: always - default_version: - description: Indicates whether the version is the default version. - type: bool - returned: always - version_number: - description: The version number. - type: int - returned: always - version_description: - description: The description for the version. - type: str - returned: always - launch_template_data: - description: Information about the launch template. - returned: always - type: dict - contains: - kernel_id: - description: - - The ID of the kernel. - returned: if applicable - type: str - image_id: - description: The ID of the AMI or a Systems Manager parameter. - type: str - returned: if applicable - instance_type: - description: The instance type. - type: str - returned: if applicable - key_name: - description: The name of the key pair. - type: str - returned: if applicable - monitoring: - description: The monitoring for the instance. - type: dict - returned: if applicable - contains: - enabled: - description: Indicates whether detailed monitoring is enabled. Otherwise, basic monitoring is enabled. - type: bool - returned: always - placement: - description: The placement of the instance. - type: dict - returned: if applicable - contains: - availability_zone: - description: The Availability Zone of the instance. - type: str - returned: if applicable - affinity: - description: The affinity setting for the instance on the Dedicated Host. - type: str - returned: if applicable - group_name: - description: The name of the placement group for the instance. - type: str - returned: if applicable - host_id: - description: The ID of the Dedicated Host for the instance. - type: str - returned: if applicable - tenancy: - description: The tenancy of the instance. - type: str - returned: if applicable - host_resource_group_arn: - description: The ARN of the host resource group in which to launch the instances. - type: str - returned: if applicable - partition_number: - description: The number of the partition the instance should launch in. - type: int - returned: if applicable - group_id: - description: The Group ID of the placement group. - type: str - returned: if applicable - ebs_optimized: - description: - - Indicates whether the instance is optimized for Amazon EBS I/O. - type: bool - returned: always - iam_instance_profile: - description: - - The IAM instance profile. - type: dict - returned: if application - contains: - arn: - description: The Amazon Resource Name (ARN) of the instance profile. - type: str - returned: always - name: - description: The name of the instance profile. - type: str - returned: always - block_device_mappings: - description: The block device mappings. - type: list - elements: dict - returned: if applicable - contains: - device_name: - description: The device name. - type: str - returned: always - virtual_name: - description: The virtual device name. - type: str - returned: always - ebs: - description: Information about the block device for an EBS volume. - type: str - returned: if applicable - contains: - encrypted: - description: Indicates whether the EBS volume is encrypted. - type: bool - returned: always - delete_on_termination: - description: Indicates whether the EBS volume is deleted on instance termination. - type: bool - returned: always - iops: - description: The number of I/O operations per second (IOPS) that the volume supports. - type: int - returned: always - kms_key_id: - description: The ARN of the Key Management Service (KMS) CMK used for encryption. - type: int - returned: always - snapshot_id: - description: The ID of the snapshot. - type: str - returned: always - volume_size: - description: The size of the volume, in GiB. - type: int - returned: always - volume_type: - description: The volume type. - type: str - returned: always - throughput: - description: The throughput that the volume supports, in MiB/s. - type: int - returned: always - no_device: - description: To omit the device from the block device mapping, specify an empty string. - type: str - network_interfaces: - description: The network interfaces. - type: list - elements: dict - returned: if applicable - contains: - associate_carrier_ip_address: - description: Indicates whether to associate a Carrier IP address with eth0 for a new network interface. - type: bool - returned: always - associate_public_ip_address: - description: Indicates whether to associate a public IPv4 address with eth0 for a new network interface. - type: bool - returned: always - delete_on_termination: - description: Indicates whether the network interface is deleted when the instance is terminated. - type: bool - returned: always - description: - description: A description for the network interface. - type: str - returned: always - device_index: - description: The device index for the network interface attachment. - type: int - returned: always - groups: - description: The IDs of one or more security groups. - type: list - elements: str - returned: if applicable - interface_type: - description: The type of network interface. - type: str - returned: always - ipv6_address_count: - description: The number of IPv6 addresses for the network interface. - type: int - returned: if applicable - ipv6_addresses: - description: The IPv6 addresses for the network interface. - returned: if applicable - type: list - elements: dict - contains: - ipv6_address: - description: The IPv6 address. - type: str - returned: always - is_primary_ipv6: - description: Determines if an IPv6 address associated with a network interface is the primary IPv6 address. - type: bool - returned: always - network_interface_id: - description: The ID of the network interface. - type: str - returned: always - private_ip_address: - description: The primary private IPv4 address of the network interface. - type: str - returned: if applicable - private_ip_addresses: - description: A list of private IPv4 addresses. - type: list - elements: str - returned: if applicable - contains: - primary: - description: Indicates whether the private IPv4 address is the primary private IPv4 address. - type: bool - returned: always - private_ip_address: - description: The private IPv4 address. - type: bool - returned: always - secondary_private_ip_address_count: - description: The number of secondary private IPv4 addresses for the network interface. - type: int - returned: if applicable - subnet_id: - description: The ID of the subnet for the network interface. - type: str - returned: always - network_card_index: - description: The index of the network card. - type: int - returned: if applicable - ipv4_prefixes: - description: A list of IPv4 prefixes assigned to the network interface. - type: list - elements: dict - returned: if applicable - contains: - ipv4_prefix: - description: The IPv4 delegated prefixes assigned to the network interface. - type: str - returned: always - ipv4_prefix_count: - description: The number of IPv4 prefixes that Amazon Web Services automatically assigned to the network interface. - type: int - returned: if applicable - ipv6_prefixes: - description: A list of IPv6 prefixes assigned to the network interface. - type: list - elements: dict - returned: if applicable - contains: - ipv6_prefix: - description: The IPv6 delegated prefixes assigned to the network interface. - type: str - returned: always - ipv6_prefix_count: - description: The number of IPv6 prefixes that Amazon Web Services automatically assigned to the network interface. - type: int - returned: if applicable - primary_ipv6: - description: The primary IPv6 address of the network interface. - type: str - returned: if applicable - ena_srd_specification: - description: Contains the ENA Express settings for instances launched from your launch template. - type: dict - returned: if applicable - contains: - ena_srd_enabled: - description: Indicates whether ENA Express is enabled for the network interface. - type: bool - returned: always - ena_srd_udp_specification: - description: Configures ENA Express for UDP network traffic. - type: dict - returned: always - contains: - ena_srd_udp_enabled: - description: Indicates whether UDP traffic to and from the instance uses ENA Express. - type: bool - returned: always - connection_tracking_specification: - description: - - A security group connection tracking specification that enables you to set the timeout - for connection tracking on an Elastic network interface. - type: dict - returned: if applicable - contains: - tcp_established_timeout: - description: Timeout (in seconds) for idle TCP connections in an established state. - type: int - returned: always - udp_timeout: - description: - - Timeout (in seconds) for idle UDP flows that have seen traffic only in a single direction - or a single request-response transaction. - type: int - returned: always - udp_stream_timeout: - description: - - Timeout (in seconds) for idle UDP flows classified as streams which have seen more - than one request-response transaction. - type: int - returned: always - ram_disk_id: - description: The ID of the RAM disk, if applicable. - type: str - returned: if applicable - disable_api_termination: - description: If set to true, indicates that the instance cannot be terminated using the Amazon EC2 console, command line tool, or API. - type: bool - returned: if applicable - instance_initiated_shutdown_behavior: - description: Indicates whether an instance stops or terminates when you initiate shutdown from the instance. - type: str - returned: if applicable - user_data: - description: The user data for the instance. - type: str - returned: if applicable - tag_specifications: - description: The tags that are applied to the resources that are created during instance launch. - type: list - elements: dict - returned: if applicable - contains: - resource_type: - description: The type of resource to tag. - type: str - returned: always - tags: - description: The tags for the resource. - type: list - elements: dict - contains: - key: - description: The key of the tag. - type: str - returned: always - value: - description: The value of the tag. - type: str - returned: always - enclave_options: - description: Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. - type: dict - returned: if applicable - contains: - enabled: - description: If this parameter is set to true, the instance is enabled for Amazon Web Services Nitro Enclaves. - type: bool - returned: always - metadata_options: - description: The metadata options for the instance. - type: dict - returned: if applicable - contains: - state: - description: The state of the metadata option changes. - type: str - returned: if applicable - http_tokens: - description: Indicates whether IMDSv2 is required. - type: str - returned: if applicable - http_put_response_hop_limit: - description: The desired HTTP PUT response hop limit for instance metadata requests. - type: int - returned: if applicable - http_endpoint: - description: Enables or disables the HTTP metadata endpoint on your instances. - type: str - returned: if applicable - http_protocol_ipv6: - description: Enables or disables the IPv6 endpoint for the instance metadata service. - type: str - returned: if applicable - instance_metadata_tags: - description: Set to enabled to allow access to instance tags from the instance metadata. - type: str - returned: if applicable - cpu_options: - description: The CPU options for the instance. - type: dict - returned: if applicable - contains: - core_count: - description: The number of CPU cores for the instance. - type: int - returned: if applicable - threads_per_core: - description: The number of threads per CPU core. - type: int - returned: if applicable - amd_sev_snp: - description: Indicates whether the instance is enabled for AMD SEV-SNP. - type: int - returned: if applicable - security_group_ids: - description: The security group IDs. - type: list - elements: str - returned: if applicable - security_groups: - description: The security group names. - type: list - elements: str - returned: if applicable - sample: { - "block_device_mappings": [ - { - "device_name": "/dev/sdb", - "ebs": { - "delete_on_termination": true, - "encrypted": true, - "volumeSize": 5 - } - } - ], - "ebs_optimized": false, - "image_id": "ami-0231217be14a6f3ba", - "instance_type": "t2.micro", - "network_interfaces": [ - { - "associate_public_ip_address": false, - "device_index": 0, - "ipv6_addresses": [ - { - "ipv6_address": "2001:0:130F:0:0:9C0:876A:130B" - } - ] - } - ] - } -latest_template: - description: The latest available version of the launch template. - returned: when O(state=present) - type: complex - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - create_time: - description: The time launch template was created. - type: str - returned: always - created_by: - description: The principal that created the launch template. - type: str - returned: always - default_version_number: - description: The version number of the default version of the launch template. - type: int - returned: always - latest_version_number: - description: The version number of the latest version of the launch template. - type: int - returned: always - tags: - description: A dictionary of tags assigned to image. - returned: when AMI is created or already exists - type: dict - sample: { - "Env": "devel", - "Name": "nat-server" - } -default_template: - description: - - The launch template version that will be used if only the template name is specified. - - Often this is the same as the latest version, but not always. - returned: when O(state=present) - type: complex - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - create_time: - description: The time launch template was created. - type: str - returned: always - created_by: - description: The principal that created the launch template. - type: str - returned: always - default_version_number: - description: The version number of the default version of the launch template. - type: int - returned: always - latest_version_number: - description: The version number of the latest version of the launch template. - type: int - returned: always - tags: - description: A dictionary of tags assigned to image. - returned: when AMI is created or already exists - type: dict - sample: { - "Env": "devel", - "Name": "nat-server" - } -deleted_template: - description: information about a launch template deleted. - returned: when O(state=absent) - type: complex - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - create_time: - description: The time launch template was created. - type: str - returned: always - created_by: - description: The principal that created the launch template. - type: str - returned: always - default_version_number: - description: The version number of the default version of the launch template. - type: int - returned: always - latest_version_number: - description: The version number of the latest version of the launch template. - type: int - returned: always - tags: - description: A dictionary of tags assigned to image. - returned: when AMI is created or already exists - type: dict - sample: { - "Env": "devel", - "Name": "nat-server" - } -deleted_versions: - description: Information about deleted launch template versions. - returned: when O(state=absent) - type: list - elements: dict - contains: - launch_template_id: - description: The ID of the launch template. - type: str - returned: always - launch_template_name: - description: The name of the launch template. - type: str - returned: always - version_number: - description: The version number of the launch template. - type: int - returned: always -""" - -from typing import Any -from typing import Dict -from typing import List -from typing import Optional -from typing import Tuple -from uuid import uuid4 - -from ansible.module_utils._text import to_text -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict - -from ansible_collections.amazon.aws.plugins.module_utils.botocore import normalize_boto3_result -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_launch_template -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_launch_template_version -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_launch_template -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_launch_template_versions -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_launch_template_versions -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_launch_templates -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import determine_iam_arn_from_name -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import modify_launch_template -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications -from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def find_existing(client, module: AnsibleAWSModule) -> Tuple[Optional[Dict[str, Any]], Optional[List[Dict[str, Any]]]]: - launch_template = None - launch_template_versions = [] - params = {} - template_id = module.params.get("template_id") - template_name = module.params.get("template_name") - if template_id: - params["launch_template_ids"] = [template_id] - else: - params["launch_template_names"] = [template_name] - launch_templates = describe_launch_templates(client, **params) - if launch_templates: - launch_template = launch_templates[0] - launch_template_versions = describe_launch_template_versions( - client, LaunchTemplateId=launch_template["LaunchTemplateId"] - ) - return normalize_boto3_result(launch_template), normalize_boto3_result(launch_template_versions) - - -def params_to_launch_data( - template_params: Dict[str, Any], iam_instance_profile_arn: Optional[str] = None -) -> Dict[str, Any]: - if iam_instance_profile_arn: - template_params["iam_instance_profile"] = {"arn": iam_instance_profile_arn} - for interface in template_params.get("network_interfaces") or []: - if interface.get("ipv6_addresses"): - interface["ipv6_addresses"] = [{"ipv6_address": x} for x in interface["ipv6_addresses"]] - params = snake_dict_to_camel_dict( - dict((k, v) for k, v in template_params.items() if v is not None), - capitalize_first=True, - ) - return params - - -def validate_string_as_int(module: AnsibleAWSModule, version: str, param_name: str) -> int: - try: - return int(version) - except ValueError: - module.fail_json(msg=f'{param_name} param was not a valid integer, got "{version}"') - - -def validate_version_deletion( - module: AnsibleAWSModule, launch_template_id: str, existing_versions: List[Dict[str, Any]] -) -> Tuple[List[str], Optional[int]]: - versions_to_delete = module.params.get("versions_to_delete") - launch_template_versions_to_delete = [] - default_version_to_set = None - if versions_to_delete: - unique_versions_to_delete = list(set(versions_to_delete)) - launch_template_versions_to_delete = [ - t["VersionNumber"] for t in existing_versions if t["VersionNumber"] in unique_versions_to_delete - ] - if len(launch_template_versions_to_delete) != len(unique_versions_to_delete): - missing = [m for m in unique_versions_to_delete if m not in launch_template_versions_to_delete] - module.fail_json( - msg=f"The following versions {missing} do not exist for launch template id '{launch_template_id}'." - ) - - remaining_versions = [ - t["VersionNumber"] - for t in existing_versions - if t["VersionNumber"] not in launch_template_versions_to_delete - ] - - # Find the default version - default_version = module.params.get("default_version") - if default_version in (None, ""): - default_version_int = [t["VersionNumber"] for t in existing_versions if t["DefaultVersion"]][0] - elif default_version == "latest": - default_version_int = max(remaining_versions, default=None) - default_version_to_set = default_version_int - else: - default_version_int = validate_string_as_int(module, default_version, "default_version") - default_version_to_set = default_version_int - - # Ensure we are not deleting the default version - if default_version_int in launch_template_versions_to_delete or not remaining_versions: - module.fail_json(msg="Cannot delete the launch template default version.") - - if default_version_to_set and default_version_to_set not in remaining_versions: - module.fail_json( - msg=f"Could not set version '{default_version_to_set}' as default, " - "the launch template version was not found for the specified launch template id '{launch_template_id}'." - ) - else: - # By default delete all non default version before the launch template deletion - launch_template_versions_to_delete = [t["VersionNumber"] for t in existing_versions if not t["DefaultVersion"]] - - return [to_text(v) for v in launch_template_versions_to_delete], default_version_to_set - - -def ensure_absent( - client, module: AnsibleAWSModule, existing: Optional[Dict[str, Any]], existing_versions: List[Dict[str, Any]] -) -> None: - deleted_versions = [] - deleted_template = {} - changed = False - - if existing: - launch_template_id = existing["LaunchTemplateId"] - v_to_delete, v_default = validate_version_deletion(module, launch_template_id, existing_versions) - - # Update default version - if v_default: - changed = True - if not module.check_mode: - modify_launch_template( - client, - LaunchTemplateId=launch_template_id, - ClientToken=uuid4().hex, - DefaultVersion=to_text(v_default), - ) - # Delete versions - if v_to_delete: - changed = True - if not module.check_mode: - response = delete_launch_template_versions( - client, launch_template_id=launch_template_id, versions=v_to_delete - ) - if response["UnsuccessfullyDeletedLaunchTemplateVersions"]: - module.warn( - f"Failed to delete template versions {response['UnsuccessfullyDeletedLaunchTemplateVersions']} on" - f" launch template {launch_template_id}" - ) - deleted_versions = [ - camel_dict_to_snake_dict(v) for v in response["SuccessfullyDeletedLaunchTemplateVersions"] - ] - - # Delete the launch template when a list of versions was not specified - if not module.params.get("versions_to_delete"): - changed = True - if not module.check_mode: - deleted_template = delete_launch_template(client, launch_template_id=launch_template_id) - deleted_template = camel_dict_to_snake_dict(deleted_template, ignore_list=["Tags"]) - if "tags" in deleted_template: - deleted_template["tags"] = boto3_tag_list_to_ansible_dict(deleted_template.get("tags")) - - module.exit_json(changed=changed, deleted_versions=deleted_versions, deleted_template=deleted_template) - - -def add_launch_template_version( - client, - module: AnsibleAWSModule, - launch_template_id: str, - launch_template_data: Dict[str, Any], - existing_versions: List[Dict[str, Any]], - most_recent_version_number: str, -) -> int: - source_version = module.params.get("source_version") - version_description = module.params.get("version_description") - - params = { - "LaunchTemplateId": launch_template_id, - "ClientToken": uuid4().hex, - "VersionDescription": version_description, - } - - if source_version == "latest": - params.update({"SourceVersion": most_recent_version_number}) - elif source_version not in (None, ""): - # Source version passed as int - source_version_int = validate_string_as_int(module, source_version, "source_version") - # get source template version - next_source_version = next( - (v for v in existing_versions if v["VersionNumber"] == source_version_int), - None, - ) - if next_source_version is None: - module.fail_json(msg=f'source_version does not exist, got "{source_version}"') - params.update({"SourceVersion": str(next_source_version["VersionNumber"])}) - - if module.check_mode: - module.exit_json(changed=True, msg="Would have created launch template version if not in check mode.") - - # Create Launch template version - launch_template_version = create_launch_template_version( - client, launch_template_data=launch_template_data, **params - ) - return launch_template_version["VersionNumber"] - - -def ensure_default_version( - client, - module: AnsibleAWSModule, - launch_template_id: str, - current_default_version_number: int, - most_recent_version_number: int, -) -> bool: - # Modify default version - default_version = module.params.get("default_version") - changed = False - if default_version not in (None, ""): - if default_version == "latest": - default_version = to_text(most_recent_version_number) - else: - default_version = to_text(validate_string_as_int(module, default_version, "default_version")) - if to_text(current_default_version_number) != default_version: - changed = True - if not module.check_mode: - modify_launch_template( - client, - LaunchTemplateId=launch_template_id, - ClientToken=uuid4().hex, - DefaultVersion=default_version, - ) - return changed - - -def format_module_output(client, module: AnsibleAWSModule) -> Dict[str, Any]: - # Describe launch template - template, template_versions = find_existing(client, module) - template = camel_dict_to_snake_dict(template, ignore_list=["Tags"]) - if "tags" in template: - template["tags"] = boto3_tag_list_to_ansible_dict(template.get("tags")) - template_versions = [camel_dict_to_snake_dict(v) for v in template_versions] - result = { - "template": template, - "versions": template_versions, - "default_template": [v for v in template_versions if v.get("default_version")][0], - "latest_template": [ - v - for v in template_versions - if (v.get("version_number") and int(v["version_number"]) == int(template["latest_version_number"])) - ][0], - } - if "version_number" in result["default_template"]: - result["default_version"] = result["default_template"]["version_number"] - if "version_number" in result["latest_template"]: - result["latest_version"] = result["latest_template"]["version_number"] - return result - - -def ensure_present( - client, - module: AnsibleAWSModule, - template_options: Dict[str, Any], - existing: Optional[Dict[str, Any]], - existing_versions: List[Dict[str, Any]], -) -> None: - template_name = module.params["template_name"] - tags = module.params["tags"] - tag_specifications = module.params.get("tag_specifications") - version_description = module.params.get("version_description") - iam_instance_profile = module.params.get("iam_instance_profile") - # IAM instance profile - if iam_instance_profile: - iam_instance_profile = determine_iam_arn_from_name(module.client("iam"), iam_instance_profile) - # Convert Launch template data - launch_template_data = params_to_launch_data( - dict((k, v) for k, v in module.params.items() if k in template_options), iam_instance_profile - ) - # Tag specifications - if tag_specifications: - boto3_tag_specs = [] - for tag_spec in tag_specifications: - boto3_tag_specs.extend(boto3_tag_specifications(tag_spec["tags"], types=tag_spec["resource_type"])) - launch_template_data["TagSpecifications"] = boto3_tag_specs - launch_template_data = scrub_none_parameters(launch_template_data, descend_into_lists=True) - changed = False - - if not (existing or existing_versions): - # Create Launch template - if module.check_mode: - module.exit_json(changed=True, msg="Would have created launch template if not in check mode.") - create_launch_template( - client, - launch_template_name=template_name, - launch_template_data=launch_template_data, - tags=tags, - ClientToken=uuid4().hex, - VersionDescription=version_description, - ) - changed = True - else: - launch_template_id = existing["LaunchTemplateId"] - default_version_number = existing["DefaultVersionNumber"] - most_recent = sorted(existing_versions, key=lambda x: x["VersionNumber"])[-1] - most_recent_version_number = most_recent["VersionNumber"] - if not ( - launch_template_data == most_recent["LaunchTemplateData"] - and version_description == most_recent.get("VersionDescription", "") - ): - changed = True - most_recent_version_number = add_launch_template_version( - client, - module, - launch_template_id, - launch_template_data, - existing_versions, - str(most_recent["VersionNumber"]), - ) - - # Ensure default version - changed |= ensure_default_version( - client, module, launch_template_id, default_version_number, most_recent_version_number - ) - # Ensure tags - changed |= ensure_ec2_tags( - client, - module, - launch_template_id, - resource_type="launch-template", - tags=tags, - purge_tags=module.params["purge_tags"], - ) - - module.exit_json(changed=changed, **format_module_output(client, module)) - - -def main(): - template_options = dict( - block_device_mappings=dict( - type="list", - elements="dict", - options=dict( - device_name=dict(), - ebs=dict( - type="dict", - options=dict( - delete_on_termination=dict(type="bool"), - encrypted=dict(type="bool"), - iops=dict(type="int"), - kms_key_id=dict(), - snapshot_id=dict(), - volume_size=dict(type="int"), - volume_type=dict(), - throughput=dict(type="int"), - ), - ), - no_device=dict(), - virtual_name=dict(), - ), - ), - cpu_options=dict( - type="dict", - options=dict( - core_count=dict(type="int"), - threads_per_core=dict(type="int"), - ), - ), - credit_specification=dict( - dict(type="dict"), - options=dict( - cpu_credits=dict(), - ), - ), - disable_api_termination=dict(type="bool"), - ebs_optimized=dict(type="bool"), - elastic_gpu_specifications=dict( - options=dict(type=dict()), - type="list", - elements="dict", - ), - image_id=dict(), - instance_initiated_shutdown_behavior=dict(choices=["stop", "terminate"]), - instance_market_options=dict( - type="dict", - options=dict( - market_type=dict(), - spot_options=dict( - type="dict", - options=dict( - block_duration_minutes=dict(type="int"), - instance_interruption_behavior=dict(choices=["hibernate", "stop", "terminate"]), - max_price=dict(), - spot_instance_type=dict(choices=["one-time", "persistent"]), - ), - ), - ), - ), - instance_type=dict(), - kernel_id=dict(), - key_name=dict(), - monitoring=dict( - type="dict", - options=dict(enabled=dict(type="bool")), - ), - metadata_options=dict( - type="dict", - options=dict( - http_endpoint=dict(choices=["enabled", "disabled"], default="enabled"), - http_put_response_hop_limit=dict(type="int", default=1), - http_tokens=dict(choices=["optional", "required"], default="optional"), - http_protocol_ipv6=dict(choices=["disabled", "enabled"], default="disabled"), - instance_metadata_tags=dict(choices=["disabled", "enabled"], default="disabled"), - ), - ), - network_interfaces=dict( - type="list", - elements="dict", - options=dict( - associate_public_ip_address=dict(type="bool"), - delete_on_termination=dict(type="bool"), - description=dict(), - device_index=dict(type="int"), - groups=dict(type="list", elements="str"), - ipv6_address_count=dict(type="int"), - ipv6_addresses=dict(type="list", elements="str"), - network_interface_id=dict(), - private_ip_address=dict(), - subnet_id=dict(), - ), - ), - placement=dict( - options=dict( - affinity=dict(), - availability_zone=dict(), - group_name=dict(), - host_id=dict(), - tenancy=dict(), - ), - type="dict", - ), - ram_disk_id=dict(), - security_group_ids=dict(type="list", elements="str"), - security_groups=dict(type="list", elements="str"), - user_data=dict(), - ) - - argument_spec = dict( - state=dict(choices=["present", "absent"], default="present"), - template_name=dict(aliases=["name"]), - template_id=dict(aliases=["id"]), - default_version=dict(default="latest"), - source_version=dict(default="latest"), - version_description=dict(default=""), - iam_instance_profile=dict(), - tags=dict(type="dict", aliases=["resource_tags"]), - purge_tags=dict(type="bool", default=True), - versions_to_delete=dict(type="list", elements="int"), - tag_specifications=dict( - type="list", - elements="dict", - options=dict( - resource_type=dict( - type="str", - default="instance", - choices=["instance", "volume", "network-interface", "spot-instances-request"], - ), - tags=dict(type="dict"), - ), - ), - ) - - argument_spec.update(template_options) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - required_one_of=[ - ("template_name", "template_id"), - ], - supports_check_mode=True, - ) - - state = module.params.get("state") - client = module.client("ec2") - launch_template, launch_template_versions = find_existing(client, module) - - try: - if state == "present": - ensure_present(client, module, template_options, launch_template, launch_template_versions) - else: - ensure_absent(client, module, launch_template, launch_template_versions) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_launch_template/aliases b/tests/integration/targets/ec2_launch_template/aliases deleted file mode 100644 index 42f0f3c880b..00000000000 --- a/tests/integration/targets/ec2_launch_template/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws -time=3m -ec2_launch_template_info \ No newline at end of file diff --git a/tests/integration/targets/ec2_launch_template/defaults/main.yml b/tests/integration/targets/ec2_launch_template/defaults/main.yml deleted file mode 100644 index 269083ee507..00000000000 --- a/tests/integration/targets/ec2_launch_template/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -test_role_name: ansible-test-{{ tiny_prefix }} diff --git a/tests/integration/targets/ec2_launch_template/files/assume-role-policy.json b/tests/integration/targets/ec2_launch_template/files/assume-role-policy.json deleted file mode 100644 index 72413abdd38..00000000000 --- a/tests/integration/targets/ec2_launch_template/files/assume-role-policy.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Version": "2008-10-17", - "Statement": [ - { - "Sid": "", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - }, - "Action": "sts:AssumeRole" - } - ] -} diff --git a/tests/integration/targets/ec2_launch_template/meta/main.yml b/tests/integration/targets/ec2_launch_template/meta/main.yml deleted file mode 100644 index 1471b11f658..00000000000 --- a/tests/integration/targets/ec2_launch_template/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - setup_ec2_facts diff --git a/tests/integration/targets/ec2_launch_template/tasks/deletion.yml b/tests/integration/targets/ec2_launch_template/tasks/deletion.yml deleted file mode 100644 index 3936888dc53..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/deletion.yml +++ /dev/null @@ -1,404 +0,0 @@ -- name: Test deletion of launch template - vars: - deletion_launch_template_name: "{{ resource_prefix }}-deletion" - deletion_launch_template_name_2: "{{ resource_prefix }}-deletion-2" - test_ec2_instance_types: - - t2.micro - - t2.small - - t2.medium - - t2.large - - t2.xlarge - block: - - name: Create multiple versions of the launch template - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - instance_type: "{{ item }}" - with_items: "{{ test_ec2_instance_types }}" - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Validate Launch template details - ansible.builtin.assert: - that: - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 5 - - _templates.launch_templates[0].latest_version_number == 5 - - _templates.launch_templates[0].default_version_number == 5 - - #==================================================================== - # Validate deletion errors - #==================================================================== - - name: Delete a non-existent template - community.aws.ec2_launch_template: - name: "{{ resource_prefix }}-not-a-real-template" - state: absent - register: delete_fake_template - ignore_errors: true - - - name: Ensure module did not failed while trying to delete non-existent template - assert: - that: - - delete_fake_template is not failed - - - name: Trying to delete the default version - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: "{{ range(1, 6) }}" - ignore_errors: true - register: delete_default_v - - - name: Ensure the module failed with proper message - ansible.builtin.assert: - that: - - delete_default_v is failed - - 'delete_default_v.msg == "Cannot delete the launch template default version."' - - - name: Trying to delete a version and a non-existing version as default - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: "{{ range(3, 6) }}" - default_version: 6 - ignore_errors: true - register: delete_set_non_existing_v - - - name: Ensure the module failed with proper message - ansible.builtin.assert: - that: - - delete_set_non_existing_v is failed - - error_m in delete_set_non_existing_v.msg - vars: - error_m: "Could not set version '6' as default, the launch template version was not found" - - - name: Trying to delete non-existing version (should failed) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: 10 - ignore_errors: true - register: delete_non_existing_v - - - name: Ensure the module failed with proper message - ansible.builtin.assert: - that: - - delete_non_existing_v is failed - - error_m in delete_non_existing_v.msg - vars: - error_m: "The following versions [10] do not exist for launch template id" - - #==================================================================== - # Delete default version and set latest version as new default - #==================================================================== - - name: Delete default version and set a new default version (check mode) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: 5 - check_mode: true - register: delete_default_v_check_mode - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_default_v_check_mode is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 5 - - _templates.launch_templates[0].latest_version_number == 5 - - _templates.launch_templates[0].default_version_number == 5 - - - name: Delete default version and set a new default version - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: 5 - register: delete_default_v - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Validate deletion result - ansible.builtin.assert: - that: - - delete_default_v is changed - - delete_default_v.deleted_template == {} - - delete_default_v.deleted_versions | length == 1 - - delete_default_v.deleted_versions.0.version_number == 5 - - delete_default_v.deleted_versions.0.launch_template_name == deletion_launch_template_name - - delete_default_v.deleted_versions.0.launch_template_id == _templates.launch_templates[0].launch_template_id - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 4 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 4 - - #==================================================================== - # Delete a single version and set a new default version different from the latest - #==================================================================== - - name: Delete a single version and set a new default version different from the latest (check mode) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: 3 - default_version: 1 - check_mode: true - register: delete_single_v_check_mode - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_default_v_check_mode is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 4 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 4 - - - name: Delete a single version and set a new default version different from the latest - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: 3 - default_version: 1 - register: delete_single_v - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Validate deletion result - ansible.builtin.assert: - that: - - delete_single_v is changed - - delete_single_v.deleted_template == {} - - delete_single_v.deleted_versions | length == 1 - - delete_single_v.deleted_versions.0.version_number == 3 - - delete_single_v.deleted_versions.0.launch_template_name == deletion_launch_template_name - - delete_single_v.deleted_versions.0.launch_template_id == _templates.launch_templates[0].launch_template_id - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 3 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 1 - - #==================================================================== - # Delete multiple versions - #==================================================================== - - name: Delete multiple versions (check mode) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: [1, 2] - check_mode: true - register: delete_multiple_v_check_mode - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_multiple_v_check_mode is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 3 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 1 - - - name: Delete multiple versions - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - versions_to_delete: [1, 2] - register: delete_multiple_v - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_multiple_v is changed - - delete_multiple_v.deleted_template == {} - - delete_multiple_v.deleted_versions | length == 2 - - delete_multiple_v.deleted_versions | map(attribute='launch_template_name') | unique | list == [deletion_launch_template_name] - - delete_multiple_v.deleted_versions | map(attribute='launch_template_id') | unique | list == [_templates.launch_templates[0].launch_template_id] - - delete_multiple_v.deleted_versions | map(attribute='version_number') | sort | list == [1, 2] - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 4 - - #==================================================================== - # Delete launch template - #==================================================================== - - name: Delete launch template (check mode) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - check_mode: true - register: delete_template_check_mode - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_template_check_mode is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].latest_version_number == 4 - - _templates.launch_templates[0].default_version_number == 4 - - - name: Delete launch template - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - register: delete_template - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name }}" - register: _templates_v - - - name: Ensure the launch template was deleted - ansible.builtin.assert: - that: - - delete_template is changed - - delete_template.deleted_template.launch_template_id == _templates.launch_templates[0].launch_template_id - - delete_template.deleted_template.latest_version_number == _templates.launch_templates[0].latest_version_number - - delete_template.deleted_template.default_version_number == _templates.launch_templates[0].default_version_number - - delete_template.deleted_versions | length == 0 - - _templates_v.launch_templates | length == 0 - - - name: Delete launch template once again (idempotency) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name }}" - state: absent - register: delete_template_idempotency - - - name: Ensure module idempotency - ansible.builtin.assert: - that: - - delete_template_idempotency is not changed - - delete_template_idempotency.deleted_template == {} - - delete_template_idempotency.deleted_versions == [] - - #==================================================================== - # Delete launch template with multiple versions - #==================================================================== - - name: Create multiple versions of the launch template - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name_2 }}" - instance_type: "{{ item }}" - with_items: "{{ test_ec2_instance_types }}" - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name_2 }}" - register: _templates - - - name: Validate Launch template details - ansible.builtin.assert: - that: - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 5 - - _templates.launch_templates[0].latest_version_number == 5 - - _templates.launch_templates[0].default_version_number == 5 - - - name: Delete launch template with multiple versions (check mode) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name_2 }}" - state: absent - check_mode: true - register: delete_template_check_mode - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name_2 }}" - register: _templates - - - name: Ensure module reported change while no change was made - ansible.builtin.assert: - that: - - delete_template_check_mode is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 5 - - - name: Delete launch template with multiple versions - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name_2 }}" - state: absent - register: delete_template - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ deletion_launch_template_name_2 }}" - register: _templates_v - - - name: Ensure the launch template was deleted - ansible.builtin.assert: - that: - - delete_template is changed - - delete_template.deleted_template.launch_template_id == _templates.launch_templates[0].launch_template_id - - delete_template.deleted_template.latest_version_number == _templates.launch_templates[0].latest_version_number - - delete_template.deleted_template.default_version_number == _templates.launch_templates[0].default_version_number - - delete_template.deleted_versions | length == 4 - - delete_template.deleted_versions | map(attribute='launch_template_name') | unique | list == [deletion_launch_template_name_2] - - delete_template.deleted_versions | map(attribute='launch_template_id') | unique | list == [_templates.launch_templates[0].launch_template_id] - - delete_template.deleted_versions | map(attribute='version_number') | sort | list == [1, 2, 3, 4] - - _templates_v.launch_templates | length == 0 - - - name: Delete launch template with multiple versions once again (idempotency) - community.aws.ec2_launch_template: - name: "{{ deletion_launch_template_name_2 }}" - state: absent - register: delete_template_idempotency - - - name: Ensure module idempotency - ansible.builtin.assert: - that: - - delete_template_idempotency is not changed - - delete_template_idempotency.deleted_template == {} - - delete_template_idempotency.deleted_versions == [] - - always: - - name: Delete the launch template - community.aws.ec2_launch_template: - name: "{{ item }}" - state: absent - with_items: - - "{{ deletion_launch_template_name }}" - - "{{ deletion_launch_template_name_2 }}" - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml b/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml deleted file mode 100644 index 08a39dff855..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/iam_instance_role.yml +++ /dev/null @@ -1,203 +0,0 @@ -- name: Test using IAM instance profile - vars: - test_launch_template_name: "{{ resource_prefix }}-test-instance-role" - block: - - name: Create IAM role for test - amazon.aws.iam_role: - name: "{{ test_role_name }}-1" - assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" - state: present - create_instance_profile: yes - managed_policy: - - AWSDenyAll - register: iam_role - - - name: Create second IAM role for test - amazon.aws.iam_role: - name: "{{ test_role_name }}-2" - assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" - state: present - create_instance_profile: yes - managed_policy: - - AWSDenyAll - register: iam_role_2 - - - name: Make instance with an instance_role - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - iam_instance_profile: "{{ test_role_name }}-1" - register: template_with_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the launch template was created with IAM instance profile - ansible.builtin.assert: - that: - - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 1 - - _template_info.launch_templates[0].versions[0].launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") - - _template_info.launch_templates[0].versions[0].launch_template_data.instance_type == "t2.micro" - - _template_info.launch_templates[0].versions[0].launch_template_data.image_id == ec2_ami_id - - - name: Create template again, with no change to instance_role - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - iam_instance_profile: "{{ test_role_name }}-1" - register: template_with_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Validate idempotency - ansible.builtin.assert: - that: - - 'template_with_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_role is not changed' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 1 - - _template_info.launch_templates[0].versions[0].launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") - - _template_info.launch_templates[0].versions[0].launch_template_data.instance_type == "t2.micro" - - _template_info.launch_templates[0].versions[0].launch_template_data.image_id == ec2_ami_id - - - name: Update instance with new instance_role - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - iam_instance_profile: "{{ test_role_name }}-2" - register: template_with_updated_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure that the launch template was updated with new IAM instance profile - ansible.builtin.assert: - that: - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - - 'template_with_updated_role is changed' - - 'template_with_updated_role is not failed' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 2 - - template_version.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/") - - template_version.launch_template_data.instance_type == "t2.micro" - - template_version.launch_template_data.image_id == ec2_ami_id - vars: - template_version: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | list | first }}" - - - name: Re-set with same new instance_role - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - iam_instance_profile: "{{ test_role_name }}-2" - register: template_with_updated_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure that module did not reported change - ansible.builtin.assert: - that: - - 'template_with_updated_role is not changed' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role_2.iam_role.arn.replace(":role/", ":instance-profile/")' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 2 - - - name: Update instance with original instance_role (pass profile ARN) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - # By default an instance profile will be created with the same name as the role - iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' - register: template_with_updated_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Validate that the launch template was updated - ansible.builtin.assert: - that: - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - - 'template_with_role.default_template.version_number < template_with_updated_role.default_template.version_number' - - 'template_with_updated_role is changed' - - 'template_with_updated_role is not failed' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 3 - - template_version.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/") - - template_version.launch_template_data.instance_type == "t2.micro" - - template_version.launch_template_data.image_id == ec2_ami_id - vars: - template_version: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 3) | list | first }}" - - - name: Re-set with same new instance_role (pass profile ARN) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: t2.micro - iam_instance_profile: '{{ iam_role.iam_role.arn.replace(":role/", ":instance-profile/") }}' - register: template_with_updated_role - - - name: Get launch template details - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Assert that the template was not updated - ansible.builtin.assert: - that: - - 'template_with_updated_role is not changed' - - 'template_with_updated_role.default_template.launch_template_data.iam_instance_profile.arn == iam_role.iam_role.arn.replace(":role/", ":instance-profile/")' - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].versions | length == 3 - - always: - - name: Delete launch template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - state: absent - register: lt_removed - ignore_errors: true - - - name: Delete IAM role for test - amazon.aws.iam_role: - name: "{{ test_role_name }}-1" - assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" - state: absent - delete_instance_profile: true - register: iam_removed - ignore_errors: true - - - name: Delete IAM role for test - iam_role: - name: "{{ test_role_name }}-2" - assume_role_policy_document: "{{ lookup('file','assume-role-policy.json') }}" - state: absent - delete_instance_profile: true - register: iam_2_removed - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/main.yml b/tests/integration/targets/ec2_launch_template/tasks/main.yml deleted file mode 100644 index c8ea5f055da..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/main.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- module_defaults: - group/aws: - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - region: "{{ aws_region }}" - block: - - include_tasks: template_data.yml - - include_tasks: tagging.yml - - include_tasks: iam_instance_role.yml - - include_tasks: versions.yml - - include_tasks: deletion.yml diff --git a/tests/integration/targets/ec2_launch_template/tasks/tagging.yml b/tests/integration/targets/ec2_launch_template/tasks/tagging.yml deleted file mode 100644 index b4d38da70c9..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/tagging.yml +++ /dev/null @@ -1,210 +0,0 @@ ---- -- name: Test tagging - vars: - test_launch_template_name: "{{ resource_prefix }}-tagging" - launch_template_instance_tags: - - key: foo - value: bar - - key: environment - value: test - launch_template_network_tags: - - key: owner - value: ansible - ansible_instance_tags: - foo: bar - environment: test - ansible_network_tags: - owner: ansible - block: - # Create launch template with tags - - name: Create Launch template with tags - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - instance_type: t2.micro - network_interfaces: - - associate_public_ip_address: false - delete_on_termination: true - device_index: 0 - tag_specifications: - - resource_type: instance - tags: "{{ ansible_instance_tags }}" - - resource_type: network-interface - tags: "{{ ansible_network_tags }}" - tags: - ResourcePrefix: "{{ resource_prefix }}" - InstanceType: "t2.micro" - register: _create_with_tags - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure the launch template was created with tags - ansible.builtin.assert: - that: - - _create_with_tags is changed - - '"tags" in _create_with_tags.template' - - _create_with_tags.template.tags.InstanceType == "t2.micro" - - _create_with_tags.template.tags.ResourcePrefix == resource_prefix - - _templates.launch_templates[0].tags.InstanceType == "t2.micro" - - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 - - instance_tags.tags == launch_template_instance_tags - - network_interface_tags.tags == launch_template_network_tags - vars: - instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" - network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" - - # Create launch template once again with same tags (expected no change) - - name: Create launch template once again with same tags (expected no change) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - instance_type: t2.micro - network_interfaces: - - associate_public_ip_address: false - delete_on_termination: true - device_index: 0 - tag_specifications: - - resource_type: instance - tags: "{{ ansible_instance_tags }}" - - resource_type: network-interface - tags: "{{ ansible_network_tags }}" - tags: - ResourcePrefix: "{{ resource_prefix }}" - InstanceType: "t2.micro" - register: _create_with_tags_idempotency - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure the launch template was created with tags - ansible.builtin.assert: - that: - - _create_with_tags_idempotency is not changed - - '"tags" in _create_with_tags_idempotency.template' - - _create_with_tags_idempotency.template.tags.InstanceType == "t2.micro" - - _create_with_tags_idempotency.template.tags.ResourcePrefix == resource_prefix - - _templates.launch_templates[0].tags.InstanceType == "t2.micro" - - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 - - instance_tags.tags == launch_template_instance_tags - - network_interface_tags.tags == launch_template_network_tags - vars: - instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" - network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" - - # Add new tag - - name: Add new tag with purge_tags=false - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - instance_type: t2.micro - network_interfaces: - - associate_public_ip_address: false - delete_on_termination: true - device_index: 0 - tag_specifications: - - resource_type: instance - tags: "{{ ansible_instance_tags }}" - - resource_type: network-interface - tags: "{{ ansible_network_tags }}" - tags: - Phase: integration - purge_tags: false - register: _add_tag - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure the launch template was created with tags - ansible.builtin.assert: - that: - - _add_tag is changed - - '"tags" in _add_tag.template' - - _add_tag.template.tags.InstanceType == "t2.micro" - - _add_tag.template.tags.ResourcePrefix == resource_prefix - - _add_tag.template.tags.Phase == "integration" - - _templates.launch_templates[0].tags.InstanceType == "t2.micro" - - _templates.launch_templates[0].tags.ResourcePrefix == resource_prefix - - _templates.launch_templates[0].tags.Phase == "integration" - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | length == 2 - - instance_tags.tags == launch_template_instance_tags - - network_interface_tags.tags == launch_template_network_tags - vars: - instance_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'instance') | list | first }}" - network_interface_tags: "{{ _templates.launch_templates[0].versions[0].launch_template_data.tag_specifications | selectattr('resource_type', 'equalto', 'network-interface') | list | first }}" - - # Add new launch template version and update tags - - name: Add new launch template version and update tags - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - instance_type: t3.micro - tags: - Team: Ansible - purge_tags: true - source_version: "" - register: _add_tag_and_version - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure the launch template was created with tags - ansible.builtin.assert: - that: - - _add_tag_and_version is changed - - '"tags" in _add_tag.template' - - '"InstanceType" not in _add_tag_and_version.template.tags' - - '"ResourcePrefix" not in _add_tag_and_version.template.tags' - - '"Phase" not in _add_tag_and_version.template.tags' - - _add_tag_and_version.template.tags.Team == "Ansible" - - '"InstanceType" not in _templates.launch_templates[0].tags' - - '"ResourcePrefix" not in _templates.launch_templates[0].tags' - - '"Phase" not in _templates.launch_templates[0].tags' - - _templates.launch_templates[0].tags.Team == "Ansible" - - _templates.launch_templates[0].versions | length == 2 - - '"tag_specifications" not in latest_version_template_data.launch_template_data' - vars: - latest_version_template_data: '{{ _templates.launch_templates[0].versions | selectattr("version_number", "equalto", 2) | list | first }}' - - # Purge tags - - name: Purge all tags from launch template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - instance_type: t3.micro - tags: {} - purge_tags: true - register: _purge_tags - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure the launch template was created with tags - ansible.builtin.assert: - that: - - _purge_tags is changed - - '"tags" not in _purge_tags.template' - - _templates.launch_templates[0].tags == {} - - _templates.launch_templates[0].versions | length == 2 - - always: - - name: Delete launch template - community.aws.ec2_launch_template: - state: absent - name: "{{ test_launch_template_name }}" - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/template_data.yml b/tests/integration/targets/ec2_launch_template/tasks/template_data.yml deleted file mode 100644 index cc9a4962f62..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/template_data.yml +++ /dev/null @@ -1,145 +0,0 @@ -- name: Test launch template data - vars: - test_launch_template_name: "{{ resource_prefix }}-template-data" - block: - # Launch template meta data - - name: Create launch template (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: c4.large - cpu_options: - core_count: 1 - threads_per_core: 1 - network_interfaces: - - device_index: 0 - associate_public_ip_address: false - delete_on_termination: true - - device_index: 1 - associate_public_ip_address: true - delete_on_termination: false - ipv6_address_count: 1 - metadata_options: - http_put_response_hop_limit: 1 - http_tokens: required - http_protocol_ipv6: enabled - instance_metadata_tags: enabled - register: _create_check - check_mode: true - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while the template was not created - ansible.builtin.assert: - that: - - _create_check is changed - - _templates.launch_templates | length == 0 - - - name: Create launch template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: c4.large - cpu_options: - core_count: 1 - threads_per_core: 3 - network_interfaces: - - device_index: 0 - associate_public_ip_address: false - delete_on_termination: true - - device_index: 1 - associate_public_ip_address: true - delete_on_termination: false - ipv6_address_count: 1 - metadata_options: - http_put_response_hop_limit: 1 - http_tokens: required - http_protocol_ipv6: enabled - instance_metadata_tags: enabled - register: _create - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while the template was not created - ansible.builtin.assert: - that: - - _create is changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.core_count == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.threads_per_core == 3 - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_put_response_hop_limit == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_tokens == 'required' - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_protocol_ipv6 == 'enabled' - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.instance_metadata_tags == 'enabled' - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].associate_public_ip_address == False - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].delete_on_termination == True - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].device_index == 0 - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].associate_public_ip_address == True - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].delete_on_termination == False - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].device_index == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].ipv6_address_count == 1 - - - name: Create launch template once again with same parameters (idempotency) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - instance_type: c4.large - cpu_options: - core_count: 1 - threads_per_core: 3 - network_interfaces: - - device_index: 0 - associate_public_ip_address: false - delete_on_termination: true - - device_index: 1 - associate_public_ip_address: true - delete_on_termination: false - ipv6_address_count: 1 - metadata_options: - http_put_response_hop_limit: 1 - http_tokens: required - http_protocol_ipv6: enabled - instance_metadata_tags: enabled - register: _create_idempotency - - - name: Retrieve Launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _templates - - - name: Ensure module reported change while the template was not created - ansible.builtin.assert: - that: - - _create_idempotency is not changed - - _templates.launch_templates | length == 1 - - _templates.launch_templates[0].versions | length == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.core_count == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.cpu_options.threads_per_core == 3 - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_put_response_hop_limit == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_tokens == 'required' - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.http_protocol_ipv6 == 'enabled' - - _templates.launch_templates[0].versions[0].launch_template_data.metadata_options.instance_metadata_tags == 'enabled' - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].associate_public_ip_address == False - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].delete_on_termination == True - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[0].device_index == 0 - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].associate_public_ip_address == True - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].delete_on_termination == False - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].device_index == 1 - - _templates.launch_templates[0].versions[0].launch_template_data.network_interfaces[1].ipv6_address_count == 1 - - always: - - name: delete the template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - state: absent - ignore_errors: true diff --git a/tests/integration/targets/ec2_launch_template/tasks/versions.yml b/tests/integration/targets/ec2_launch_template/tasks/versions.yml deleted file mode 100644 index 666c5653836..00000000000 --- a/tests/integration/targets/ec2_launch_template/tasks/versions.yml +++ /dev/null @@ -1,462 +0,0 @@ -- name: Test launch template versioning - vars: - test_launch_template_name: "{{ resource_prefix }}-versioning" - block: - #===================================================================== - # Create the launch template - #===================================================================== - - name: Create a launch template (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: c4.large - register: _create_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure module reported changed while the template was not created - ansible.builtin.assert: - that: - - _create_check is changed - - '"default_version" not in _create_check' - - '"latest_version" not in _create_check' - - _template_info.launch_templates | length == 0 - - - name: Create a launch template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: c4.large - register: _create - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure the launch template was created with the right version - ansible.builtin.assert: - that: - - _create is changed - - _create.default_version == 1 - - _create.latest_version == 1 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 1 - - _template_info.launch_templates[0].versions | length == 1 - - _template_info.launch_templates[0].versions.0.launch_template_data.image_id == ec2_ami_id - - _template_info.launch_templates[0].versions.0.launch_template_data.instance_type == "c4.large" - - - name: Create the same launch template once again - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: c4.large - register: _create_idempotency - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the module did not reported change (idempotency) - ansible.builtin.assert: - that: - - _create_idempotency is not changed - - _create.default_version == 1 - - _create.latest_version == 1 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 1 - - _template_info.launch_templates[0].versions | length == 1 - - _template_info.launch_templates[0].versions.0.launch_template_data.image_id == ec2_ami_id - - _template_info.launch_templates[0].versions.0.launch_template_data.instance_type == "c4.large" - - #===================================================================== - # Create a new version of the launch template (set first version as default) - #===================================================================== - - name: Create a new version of the launch template (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: 1 - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _update_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the module reported change in check mode - ansible.builtin.assert: - that: - - _update_check is changed - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 1 - - _template_info.launch_templates[0].versions | length == 1 - - - name: Create a new version of the launch template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: 1 - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _update - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the launch template latest version has changed - ansible.builtin.assert: - that: - - _update is changed - - _update.default_version == 1 - - _update.latest_version == 2 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - created_template.launch_template_data.image_id == ec2_ami_id - - created_template.launch_template_data.instance_type == "m5.large" - vars: - created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | first }}" - - - name: Create a new version of the launch template (idempotency) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: 1 - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _update_idempotency - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the module did not reported change (idempotency) - ansible.builtin.assert: - that: - - _update_idempotency is not changed - - _update_idempotency.default_version == 1 - - _update_idempotency.latest_version == 2 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - #===================================================================== - # Set the latest version of the launch template as default - #===================================================================== - - name: Set the latest version of the launch template as default (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: latest - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _set_version_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the module reported change in check mode - ansible.builtin.assert: - that: - - _set_version_check is changed - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 1 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - - name: Set the latest version of the launch template as default - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: latest - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _set_version - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the launch template latest version has changed - ansible.builtin.assert: - that: - - _set_version is changed - - _set_version.default_version == 2 - - _set_version.latest_version == 2 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 2 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - created_template.launch_template_data.image_id == ec2_ami_id - - created_template.launch_template_data.instance_type == "m5.large" - vars: - created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 2) | first }}" - - - name: Set the latest version of the launch template as default (idempotency) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - default_version: latest - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: m5.large - register: _set_version_idempotency - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - filters: - launch-template-name: "{{ test_launch_template_name }}" - register: _template_info - - - name: Ensure the module did not reported change (idempotency) - ansible.builtin.assert: - that: - - _set_version_idempotency is not changed - - _set_version_idempotency.default_version == 2 - - _set_version_idempotency.latest_version == 2 - - _template_info.launch_templates[0].default_version_number == 2 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - #===================================================================== - # Create another version - #===================================================================== - - name: Create a new launch template version (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: t3.medium - register: _another_version_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure the module reported change in check_mode - ansible.builtin.assert: - that: - - _another_version_check is changed - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 2 - - _template_info.launch_templates[0].latest_version_number == 2 - - _template_info.launch_templates[0].versions | length == 2 - - - name: Create a new launch template version - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: t3.medium - register: _another_version - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure the launch template latest version has changed - ansible.builtin.assert: - that: - - _another_version is changed - - _another_version.default_version == 3 - - _another_version.latest_version == 3 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 3 - - _template_info.launch_templates[0].latest_version_number == 3 - - _template_info.launch_templates[0].versions | length == 3 - - created_template.launch_template_data.image_id == ec2_ami_id - - created_template.launch_template_data.instance_type == "t3.medium" - vars: - created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 3) | first }}" - - - name: Create a new launch template version (idempotency) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - image_id: "{{ ec2_ami_id }}" - tags: - TestId: "{{ resource_prefix }}" - instance_type: t3.medium - register: _another_version_idempotency - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure the module did not reported change (idempotency) - ansible.builtin.assert: - that: - - _another_version_idempotency is not changed - - _another_version_idempotency.default_version == 3 - - _another_version_idempotency.latest_version == 3 - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 3 - - _template_info.launch_templates[0].latest_version_number == 3 - - _template_info.launch_templates[0].versions | length == 3 - - #===================================================================== - # Create another version based on an old version - #===================================================================== - - name: Create new template version based on an old version (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - cpu_options: - core_count: 1 - threads_per_core: 1 - source_version: 1 - register: _version_based_on_old_version_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure module reported change in check mode - ansible.builtin.assert: - that: - - _version_based_on_old_version_check is changed - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 3 - - _template_info.launch_templates[0].latest_version_number == 3 - - _template_info.launch_templates[0].versions | length == 3 - - - name: Create new template version based on an old version - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - cpu_options: - core_count: 1 - threads_per_core: 1 - source_version: 1 - register: _version_based_on_old_version - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure the new launch template has been created with the right options - ansible.builtin.assert: - that: - - _version_based_on_old_version is changed - - _version_based_on_old_version.default_version == 4 - - _version_based_on_old_version.latest_version == 4 - - _version_based_on_old_version.latest_template.launch_template_data.instance_type == "c4.large" - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 4 - - _template_info.launch_templates[0].latest_version_number == 4 - - _template_info.launch_templates[0].versions | length == 4 - - created_template.launch_template_data.image_id == ec2_ami_id - - created_template.launch_template_data.cpu_options.core_count == 1 - - created_template.launch_template_data.cpu_options.threads_per_core == 1 - vars: - created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 4) | first }}" - - #===================================================================== - # Create another version with updated description - #===================================================================== - - name: Create a launch template version with another description (check mode) - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - version_description: "Fix something." - register: _version_description_check - check_mode: true - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure module reported change in check mode - ansible.builtin.assert: - that: - - _version_description_check is changed - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 4 - - _template_info.launch_templates[0].latest_version_number == 4 - - _template_info.launch_templates[0].versions | length == 4 - - - name: Create a launch template version with another description - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - version_description: "Fix something." - register: _version_description - - - name: Read launch template information - amazon.aws.ec2_launch_template_info: - launch_template_ids: - - "{{ _create.template.launch_template_id }}" - register: _template_info - - - name: Ensure module reported change - ansible.builtin.assert: - that: - - _version_description is changed - - _version_description.default_version == 5 - - _version_description.latest_version == 5 - - _version_description.latest_template.version_description == "Fix something." - - _template_info.launch_templates | length == 1 - - _template_info.launch_templates[0].default_version_number == 5 - - _template_info.launch_templates[0].latest_version_number == 5 - - _template_info.launch_templates[0].versions | length == 5 - - created_template.version_description == "Fix something." - vars: - created_template: "{{ _template_info.launch_templates[0].versions | selectattr('version_number', 'equalto', 5) | first }}" - - always: - - name: Delete the template - community.aws.ec2_launch_template: - name: "{{ test_launch_template_name }}" - state: absent - ignore_errors: true From ab35c45c5d4ca308ec9328a3258567e50427c632 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 25 Oct 2024 16:07:24 +0200 Subject: [PATCH 68/77] DNM Promote ec2_vpc_vgw and ec2_vpc_vgw_info modules and tests (#2190) SUMMARY Promote ec2_vpc_vgw and ec2_vpc_vgw_info modules and tests ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- changelogs/fragments/migrate_ec2_vpc_vgw.yml | 8 + meta/runtime.yml | 6 +- plugins/modules/ec2_vpc_vgw.py | 545 ------------------ plugins/modules/ec2_vpc_vgw_info.py | 182 ------ tests/integration/targets/ec2_vpc_vgw/aliases | 3 - .../targets/ec2_vpc_vgw/defaults/main.yml | 12 - .../targets/ec2_vpc_vgw/meta/main.yml | 1 - .../targets/ec2_vpc_vgw/tasks/main.yml | 312 ---------- .../targets/ec2_vpc_vgw/tasks/tags.yml | 334 ----------- 9 files changed, 12 insertions(+), 1391 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_vpc_vgw.yml delete mode 100644 plugins/modules/ec2_vpc_vgw.py delete mode 100644 plugins/modules/ec2_vpc_vgw_info.py delete mode 100644 tests/integration/targets/ec2_vpc_vgw/aliases delete mode 100644 tests/integration/targets/ec2_vpc_vgw/defaults/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_vgw/meta/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_vgw/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml diff --git a/changelogs/fragments/migrate_ec2_vpc_vgw.yml b/changelogs/fragments/migrate_ec2_vpc_vgw.yml new file mode 100644 index 00000000000..1f2b0bcc972 --- /dev/null +++ b/changelogs/fragments/migrate_ec2_vpc_vgw.yml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_vpc_vgw - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_vgw``. + - ec2_vpc_vgw_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_vgw_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index fec2385f295..731f7870900 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -111,8 +111,6 @@ action_groups: - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - - ec2_vpc_vgw - - ec2_vpc_vgw_info - ec2_vpc_vpn - ec2_vpc_vpn_info - ec2_win_password @@ -533,6 +531,10 @@ plugin_routing: redirect: amazon.aws.ec2_placement_group_info ec2_launch_template: redirect: amazon.aws.ec2_launch_template + ec2_vpc_vgw: + redirect: amazon.aws.ec2_vpc_vgw + ec2_vpc_vgw_info: + redirect: amazon.aws.ec2_vpc_vgw_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_vpc_vgw.py b/plugins/modules/ec2_vpc_vgw.py deleted file mode 100644 index c82236e0570..00000000000 --- a/plugins/modules/ec2_vpc_vgw.py +++ /dev/null @@ -1,545 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_vpc_vgw -short_description: Create and delete AWS VPN Virtual Gateways -version_added: 1.0.0 -description: - - Creates AWS VPN Virtual Gateways. - - Deletes AWS VPN Virtual Gateways. - - Attaches Virtual Gateways to VPCs. - - Detaches Virtual Gateways from VPCs. -options: - state: - description: - - V(present) to ensure resource is created. - - V(absent) to remove resource. - default: present - choices: [ "present", "absent"] - type: str - name: - description: - - Name of the VGW to be created or deleted. - type: str - type: - description: - - Type of the virtual gateway to be created. - choices: [ "ipsec.1" ] - default: "ipsec.1" - type: str - vpn_gateway_id: - description: - - VPN gateway ID of an existing virtual gateway. - type: str - vpc_id: - description: - - The ID of a VPC to attach or detach to the VGW. - type: str - asn: - description: - - The BGP ASN on the Amazon side. - type: int - wait_timeout: - description: - - Number of seconds to wait for status during VPC attach and detach. - default: 320 - type: int -notes: - - Support for O(purge_tags) was added in release 4.0.0. -author: - - Nick Aslanidis (@naslanidis) -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.tags - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -- name: Create a new VGW attached to a specific VPC - community.aws.ec2_vpc_vgw: - state: present - region: ap-southeast-2 - profile: personal - vpc_id: vpc-12345678 - name: personal-testing - type: ipsec.1 - -- name: Create a new unattached VGW - community.aws.ec2_vpc_vgw: - state: present - region: ap-southeast-2 - profile: personal - name: personal-testing - type: ipsec.1 - tags: - environment: production - owner: ABC - -- name: Remove a new VGW using the name - community.aws.ec2_vpc_vgw: - state: absent - region: ap-southeast-2 - profile: personal - name: personal-testing - type: ipsec.1 - -- name: Remove a new VGW using the vpn_gateway_id - community.aws.ec2_vpc_vgw: - state: absent - region: ap-southeast-2 - profile: personal - vpn_gateway_id: vgw-3a9aa123 - -- name: Detach vpn gateway from VPC - community.aws.ec2_vpc_vgw: - state: present - name: "{{ vgw_name }}" - register: vgw - -- name: Delete vpn gateway - community.aws.ec2_vpc_vgw: - state: absent - vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}' - ignore_errors: true -""" - -RETURN = r""" -vgw: - description: Information about the virtual private gateway. - returned: success - type: dict - contains: - id: - description: The ID of the virtual private gateway. - type: str - returned: success - sample: "vgw-0123456789abcdef0" - state: - description: The current state of the virtual private gateway. - type: str - returned: success - sample: "available" - tags: - description: A dictionary representing the tags attached to the virtual private gateway. - type: dict - returned: success - sample: { - "Name": "ansible-test-ec2-vpc-vgw", - "Env": "Dev_Test_001" - } - type: - description: The type of VPN connection the virtual private gateway supports. - type: str - returned: success - sample: "ipsec.1" - vpc_id: - description: The ID of the VPC. - type: str - returned: success - sample: "vpc-123456789abcdef01" -""" - -try: - import botocore -except ImportError: - pass # Handled by AnsibleAWSModule - -from typing import Any -from typing import Dict -from typing import List -from typing import Optional -from typing import Tuple -from typing import Union - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import attach_vpn_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpcs -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_gateways -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import detach_vpn_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_specifications -from ansible_collections.amazon.aws.plugins.module_utils.waiters import get_waiter -from ansible_collections.amazon.aws.plugins.module_utils.waiters import wait_for_resource_state - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -# AWS uses VpnGatewayLimitExceeded for both 'Too many VGWs' and 'Too many concurrent changes' -# we need to look at the mesage to tell the difference. -class VGWRetry(AWSRetry): - @staticmethod - def status_code_from_exception(error: Any) -> Tuple[str, str]: - return ( - error.response["Error"]["Code"], - error.response["Error"]["Message"], - ) - - @staticmethod - def found(response_code: Union[str, Tuple[str, ...]], catch_extra_error_codes: Optional[List[str]] = None) -> bool: - retry_on = ["The maximum number of mutating objects has been reached."] - - if catch_extra_error_codes: - retry_on.extend(catch_extra_error_codes) - if not isinstance(response_code, tuple): - response_code = (response_code,) - - for code in response_code: - if super(VGWRetry, VGWRetry).found(response_code, catch_extra_error_codes): - return True - - return False - - -def format_vgw_info(vgw: Dict) -> Optional[Dict[str, Any]]: - # to handle check mode case where vgw passed to this function is {} - if not vgw: - return - - vgw_info = { - "id": vgw["VpnGatewayId"], - "type": vgw["Type"], - "state": vgw["State"], - "vpc_id": None, - "tags": dict(), - } - - if vgw["Tags"]: - vgw_info["tags"] = boto3_tag_list_to_ansible_dict(vgw["Tags"]) - - if len(vgw["VpcAttachments"]) != 0 and vgw["VpcAttachments"][0]["State"] == "attached": - vgw_info["vpc_id"] = vgw["VpcAttachments"][0]["VpcId"] - - return vgw_info - - -def wait_for_status(client, module: AnsibleAWSModule, vpn_gateway_id: str, desired_status: str) -> Tuple[bool, Any]: - polling_increment_secs = 15 - max_retries = module.params.get("wait_timeout") // polling_increment_secs - try: - wait_for_resource_state(client, module, "vpn_gateway_exists", VpnGatewayIds=[vpn_gateway_id]) - if desired_status not in ("attached", "detached"): - module.fail_json(msg=f"Unsupported status: {desired_status}") - wait_for_resource_state( - client, - module, - f"vpn_gateway_{desired_status}", - VpnGatewayIds=[vpn_gateway_id], - delay=polling_increment_secs, - max_attempts=max_retries, - ) - - response = find_vgw(client, module, vpn_gateway_id) - status_achieved = response[0]["VpcAttachments"][0]["State"] == desired_status - - except AnsibleEC2Error as e: - module.fail_json_aws(e) - - return status_achieved, response - - -def attach_vgw_to_vpc(client, module: AnsibleAWSModule, vpn_gateway_id: str) -> bool: - if module.check_mode: - return True - response = None - vpc_id = module.params.get("vpc_id") - response = attach_vpn_gateway(client, vpc_id, vpn_gateway_id) - status_achieved, vgw = wait_for_status(client, module, vpn_gateway_id, "attached") - - if not status_achieved: - module.fail_json(msg="Error waiting for VPC to attach to VGW - please check the AWS console") - - return response - - -def detach_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: str, vpc_id: Optional[str] = None) -> bool: - if module.check_mode: - return True - response = None - vpc_id = vpc_id or module.params.get("vpc_id") - - response = detach_vpn_gateway(client, vpc_id, vpn_gateway_id) - - status_achieved, vgw = wait_for_status(client, module, vpn_gateway_id, "detached") - if not status_achieved: - module.fail_json(msg="Error waiting for vpc to detach from vgw - please check the AWS console") - - return response - - -def create_vgw(client, module: AnsibleAWSModule) -> Dict: - if module.check_mode: - return {} - - params = { - "Type": module.params.get("type"), - "TagSpecifications": boto3_tag_specifications( - {**(module.params.get("tags") or {}), "Name": module.params.get("name")}, ["vpn-gateway"] - ), - } - - if module.params.get("asn"): - params["AmazonSideAsn"] = module.params.get("asn") - - try: - create_vgw_result = create_vpn_gateway(client, **params) - get_waiter(client, "vpn_gateway_exists").wait(VpnGatewayIds=[create_vgw_result["VpnGatewayId"]]) - except botocore.exceptions.WaiterError as e: - module.fail_json_aws( - e, msg=f"Failed to wait for Vpn Gateway {create_vgw_result['VpnGatewayId']} to be available" - ) - - return create_vgw_result - - -def delete_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: str) -> Optional[str]: - delete_vpn_gateway(client, vpn_gateway_id) - - # return the deleted VpnGatewayId as this is not included in the above response - result = vpn_gateway_id - return result - - -def find_vpc(client, module: AnsibleAWSModule) -> Optional[Any]: - response = None - params = dict() - vpc_id = module.params.get("vpc_id") - - if vpc_id: - params["VpcIds"] = [vpc_id] - response = describe_vpcs(client, **params) - - return response - - -def find_vgw(client, module: AnsibleAWSModule, vpn_gateway_id: Optional[str] = None) -> List[Dict[str, Any]]: - params = dict() - if vpn_gateway_id: - params["VpnGatewayIds"] = [vpn_gateway_id] - else: - params["Filters"] = [ - {"Name": "type", "Values": [module.params.get("type")]}, - {"Name": "tag:Name", "Values": [module.params.get("name")]}, - ] - if module.params.get("state") == "present": - params["Filters"].append({"Name": "state", "Values": ["pending", "available"]}) - - response = describe_vpn_gateways(client, **params) - - return sorted(response, key=lambda k: k["VpnGatewayId"]) - - -def ensure_vgw_present(client, module: AnsibleAWSModule) -> Tuple[bool, Dict[str, Any]]: - changed = False - vgw = {} - - # Check if provided vgw already exists - existing_vgw = find_vgw(client, module, module.params.get("vpn_gateway_id")) - - # if existing vgw, handle changes as required - if existing_vgw: - changed |= handle_existing_vgw(client, module, existing_vgw[0]) - vgw = find_vgw(client, module, existing_vgw[0]["VpnGatewayId"])[ - 0 - ] # [0] as find_vgw returns list[dict] i.e. [{vgw_info}] as it is possible to have multiple vgw with same names - # if not existing vgw, create new and return - else: - changed = True - if not module.check_mode: - vgw = create_vgw(client, module) - # if vpc_id provided, attach vgw to vpc - if module.params.get("vpc_id"): - attach_vgw_to_vpc(client, module, vgw["VpnGatewayId"]) - vgw = find_vgw(client, module, vgw["VpnGatewayId"])[0] - - return changed, format_vgw_info(vgw) - - -def handle_existing_vgw(client, module: AnsibleAWSModule, existing_vgw: dict) -> bool: - changed = False - vpn_gateway_id = existing_vgw["VpnGatewayId"] - provided_vpc_id = module.params.get("vpc_id") - - # Update tags - desired_tags = module.params.get("tags") - purge_tags = module.params.get("purge_tags") - if desired_tags is None: - desired_tags = dict() - purge_tags = False - tags = dict(Name=module.params.get("name")) - tags.update(desired_tags) - # check_mode is handled by esure_ec2_tags() - changed |= ensure_ec2_tags( - client, module, vpn_gateway_id, resource_type="vpn-gateway", tags=tags, purge_tags=purge_tags - ) - - # Manage VPC attachments - current_vpc_attachments = existing_vgw["VpcAttachments"] - if provided_vpc_id: - # if vgw is attached to a vpc - if current_vpc_attachments and current_vpc_attachments[0]["State"] == "attached": - # if provided vpc is differenct than current vpc, then detach current vpc, attach new vpc - if provided_vpc_id != current_vpc_attachments[0]["VpcId"]: - if module.check_mode: - return True - detach_vgw(client, module, vpn_gateway_id, current_vpc_attachments[0]["VpcId"]) - get_waiter(client, "vpn_gateway_detached").wait(VpnGatewayIds=[vpn_gateway_id]) - attach_vgw_to_vpc(client, module, vpn_gateway_id) - changed = True - # if vgw is not currently attached to a vpc, attach it to provided vpc - else: - if module.check_mode: - return True - attach_vgw_to_vpc(client, module, vpn_gateway_id) - changed = True - # if vpc_id not provided, then detach vgw from vpc - else: - if current_vpc_attachments and current_vpc_attachments[0]["State"] == "attached": - if module.check_mode: - return True - detach_vgw(client, module, vpn_gateway_id, current_vpc_attachments[0]["VpcId"]) - changed = True - - return changed - - -def ensure_vgw_absent(client, module: AnsibleAWSModule) -> Tuple[bool, Optional[str]]: - # If an existing vgw name and type matches our args, then a match is considered to have been - # found and we will take steps to delete it. - - changed = False - params = dict() - result = dict() - deleted_vgw = None - params["Name"] = module.params.get("name") - params["VpcId"] = module.params.get("vpc_id") - params["Type"] = module.params.get("type") - params["Tags"] = module.params.get("tags") - params["VpnGatewayIds"] = module.params.get("vpn_gateway_id") - vpn_gateway_id = module.params.get("vpn_gateway_id") - - # check if a gateway matching our module args already exists - if params["VpnGatewayIds"]: - existing_vgw_with_id = find_vgw(client, module, module.params.get("vpn_gateway_id")) - if existing_vgw_with_id != [] and existing_vgw_with_id[0]["State"] != "deleted": - if module.check_mode: - return True, existing_vgw_with_id[0]["VpnGatewayId"] - existing_vgw = existing_vgw_with_id - if existing_vgw[0]["VpcAttachments"] != [] and existing_vgw[0]["VpcAttachments"][0]["State"] == "attached": - if params["VpcId"]: - if params["VpcId"] != existing_vgw[0]["VpcAttachments"][0]["VpcId"]: - module.fail_json( - msg="The vpc-id provided does not match the vpc-id currently attached - please check the AWS console" - ) - - else: - # detach the vpc from the vgw - detach_vgw(client, module, params["VpnGatewayIds"], params["VpcId"]) - deleted_vgw = delete_vgw(client, module, params["VpnGatewayIds"]) - changed = True - - else: - # attempt to detach any attached vpcs - for vpc in existing_vgw[0]["VpcAttachments"]: - detach_vgw(client, module, vpn_gateway_id, vpc["VpcId"]) - deleted_vgw = delete_vgw(client, module, params["VpnGatewayIds"]) - changed = True - - else: - # no vpc's are attached so attempt to delete the vgw - deleted_vgw = delete_vgw(client, module, params["VpnGatewayIds"]) - changed = True - - else: - changed = False - deleted_vgw = "Nothing to do" - - else: - # Check that a name and type argument has been supplied if no vgw-id - if not module.params.get("name") or not module.params.get("type"): - module.fail_json(msg="A name and type is required when no vgw-id and a status of 'absent' is supplied") - - existing_vgw = find_vgw(client, module) - if existing_vgw != [] and existing_vgw[0]["State"] != "deleted": - vpn_gateway_id = existing_vgw[0]["VpnGatewayId"] - if existing_vgw[0]["VpcAttachments"] != [] and existing_vgw[0]["VpcAttachments"][0]["State"] == "attached": - if params["VpcId"]: - if params["VpcId"] != existing_vgw[0]["VpcAttachments"][0]["VpcId"]: - module.fail_json( - msg="The vpc-id provided does not match the vpc-id currently attached - please check the AWS console" - ) - - else: - if module.check_mode: - return True, None - # detach the vpc from the vgw - detach_vgw(client, module, vpn_gateway_id, params["VpcId"]) - - # now that the vpc has been detached, delete the vgw - deleted_vgw = delete_vgw(client, module, vpn_gateway_id) - changed = True - - else: - if module.check_mode: - return True, vpn_gateway_id - # attempt to detach any attached vpcs - vpc_to_detach = existing_vgw[0]["VpcAttachments"][0]["VpcId"] - detach_vgw(client, module, vpn_gateway_id, vpc_to_detach) - changed = True - - # now that the vpc has been detached, delete the vgw - deleted_vgw = delete_vgw(client, module, vpn_gateway_id) - - else: - if module.check_mode: - return True, vpn_gateway_id - # no vpc's are attached so attempt to delete the vgw - deleted_vgw = delete_vgw(client, module, vpn_gateway_id) - changed = True - - else: - changed = False - deleted_vgw = None - - result = deleted_vgw - return changed, result - - -def main(): - argument_spec = dict( - state=dict(default="present", choices=["present", "absent"]), - name=dict(), - vpn_gateway_id=dict(), - vpc_id=dict(), - asn=dict(type="int"), - wait_timeout=dict(type="int", default=320), - type=dict(default="ipsec.1", choices=["ipsec.1"]), - tags=dict(default=None, required=False, type="dict", aliases=["resource_tags"]), - purge_tags=dict(default=True, type="bool"), - ) - module = AnsibleAWSModule( - argument_spec=argument_spec, - required_if=[["state", "present", ["name"]]], - supports_check_mode=True, - ) - state = module.params.get("state").lower() - - client = module.client("ec2") - - if state == "present": - (changed, results) = ensure_vgw_present(client, module) - else: - (changed, results) = ensure_vgw_absent(client, module) - module.exit_json(changed=changed, vgw=results) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_vpc_vgw_info.py b/plugins/modules/ec2_vpc_vgw_info.py deleted file mode 100644 index 79576acf288..00000000000 --- a/plugins/modules/ec2_vpc_vgw_info.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_vpc_vgw_info -version_added: 1.0.0 -short_description: Gather information about virtual gateways in AWS -description: - - Gather information about virtual gateways (VGWs) in AWS. -options: - filters: - description: - - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpnGateways.html) for possible filters. - type: dict - default: {} - vpn_gateway_ids: - description: One or more virtual private gateway IDs. - type: list - elements: str -author: - - "Nick Aslanidis (@naslanidis)" -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -- name: Gather information about all virtual gateways for an account or profile - community.aws.ec2_vpc_vgw_info: - region: ap-southeast-2 - -- name: Gather information about a filtered list of Virtual Gateways - community.aws.ec2_vpc_vgw_info: - region: ap-southeast-2 - profile: production - filters: - "tag:Name": "main-virt-gateway" - -- name: Gather information about a specific virtual gateway by VpnGatewayIds - community.aws.ec2_vpc_vgw_info: - region: ap-southeast-2 - profile: production - vpn_gateway_ids: vgw-c432f6a7 -""" - -RETURN = r""" -virtual_gateways: - description: Information about one or more virtual private gateways. - returned: always - type: list - elements: dict - contains: - vpn_gateway_id: - description: The ID of the virtual private gateway. - type: str - returned: success - example: "vgw-0123456789abcdef0" - state: - description: Informtion about the current state of the virtual private gateway. - type: str - returned: success - example: "available" - type: - description: Information about type of VPN connection the virtual private gateway supports. - type: str - returned: success - example: "ipsec.1" - vpc_attachments: - description: Information about the VPCs attached to the virtual private gateway. - type: list - elements: dict - returned: success - contains: - state: - description: The current state of the attachment. - type: str - returned: success - example: "available" - vpc_id: - description: The ID of the VPC. - type: str - returned: success - example: "vpc-12345678901234567" - tags: - description: - - A list of dictionaries representing the tags attached to the virtual private gateway. - - Represents the same details as RV(virtual_gateways.resource_tags). - type: list - elements: dict - returned: success - contains: - key: - description: The key of the tag. - type: str - returned: success - example: "MyKey" - value: - description: The value of the tag. - type: str - returned: success - example: "MyValue" - resource_tags: - description: - - A dictionary representing the tags attached to the VGW. - - Represents the same details as RV(virtual_gateways.tags). - type: dict - returned: success - example: { - "MyKey": "MyValue", - "Env": "Dev_Test_01" - } -""" - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_gateways -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def get_virtual_gateway_info(virtual_gateway): - tags = virtual_gateway.get("Tags", []) - resource_tags = boto3_tag_list_to_ansible_dict(tags) - virtual_gateway_info = dict( - VpnGatewayId=virtual_gateway["VpnGatewayId"], - State=virtual_gateway["State"], - Type=virtual_gateway["Type"], - VpcAttachments=virtual_gateway["VpcAttachments"], - Tags=tags, - ResourceTags=resource_tags, - ) - return virtual_gateway_info - - -def list_virtual_gateways(client, module): - params = dict() - vpn_gateway_ids = module.params.get("vpn_gateway_ids") - filters = module.params.get("filters") - - if filters: - params["Filters"] = ansible_dict_to_boto3_filter_list(filters) - if vpn_gateway_ids: - params["VpnGatewayIds"] = vpn_gateway_ids - - try: - all_virtual_gateways = describe_vpn_gateways(client, **params) - except AnsibleEC2Error as e: - module.fail_json_aws_error(e) - - return [ - camel_dict_to_snake_dict(get_virtual_gateway_info(vgw), ignore_list=["ResourceTags"]) - for vgw in all_virtual_gateways - ] - - -def main(): - argument_spec = dict( - filters=dict(type="dict", default=dict()), - vpn_gateway_ids=dict(type="list", default=None, elements="str"), - ) - - module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) - - connection = module.client("ec2") - results = list_virtual_gateways(connection, module) - - module.exit_json(virtual_gateways=results) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_vpc_vgw/aliases b/tests/integration/targets/ec2_vpc_vgw/aliases deleted file mode 100644 index 9daebe59222..00000000000 --- a/tests/integration/targets/ec2_vpc_vgw/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_vpc_vgw_info diff --git a/tests/integration/targets/ec2_vpc_vgw/defaults/main.yml b/tests/integration/targets/ec2_vpc_vgw/defaults/main.yml deleted file mode 100644 index b10650336c4..00000000000 --- a/tests/integration/targets/ec2_vpc_vgw/defaults/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -vpc_name: '{{ resource_prefix }}-ec2-vpc-vgw' -vgw_name: '{{ resource_prefix }}-ec2-vpc-vgw' -subnet_name: '{{ resource_prefix }}-ec2-vpc-vgw' -vpc_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.0.0/16' -subnet_1: '10.{{ 256 | random(seed=resource_prefix) }}.1.0/24' -subnet_2: '10.{{ 256 | random(seed=resource_prefix) }}.2.0/24' -subnet_3: '10.{{ 256 | random(seed=resource_prefix) }}.3.0/24' -subnet_4: '10.{{ 256 | random(seed=resource_prefix) }}.4.0/24' - -vpc_ipv6_cidr: '10.{{ 256 | random(seed=resource_prefix) }}.5.0/25' -vpc_ipv6_name: '{{ vpc_name }}-ipv6' diff --git a/tests/integration/targets/ec2_vpc_vgw/meta/main.yml b/tests/integration/targets/ec2_vpc_vgw/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_vpc_vgw/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml b/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml deleted file mode 100644 index fefc4b18861..00000000000 --- a/tests/integration/targets/ec2_vpc_vgw/tasks/main.yml +++ /dev/null @@ -1,312 +0,0 @@ ---- -- name: 'ec2_vpc_vgw integration tests' - collections: - - amazon.aws - module_defaults: - group/aws: - access_key: '{{ aws_access_key }}' - secret_key: '{{ aws_secret_key }}' - session_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - block: - - # ============================================================ - - name: Create a VPC - amazon.aws.ec2_vpc_net: - name: "{{ vpc_name }}-{{ item }}" - state: present - cidr_block: "{{ vpc_cidr }}" - tags: - Description: "Created by ansible-test for IGW tests" - register: vpc_result - loop: [1, 2] - - - name: Use set fact for vpc ids - ansible.builtin.set_fact: - vpc_id_1: '{{ vpc_result.results.0.vpc.id }}' - vpc_id_2: '{{ vpc_result.results.1.vpc.id }}' - - # ============================================================ - - name: Create vpn gateway and attach it to vpc - check_mode - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_1 }}' - name: "{{ vgw_name }}" - register: vgw_check_mode - check_mode: true - - - name: Assert check_mode result - no vgw creation - ansible.builtin.assert: - that: - - vgw_check_mode.changed - - not vgw_check_mode.failed - - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" - - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" - - - name: Create vpn gateway and attach it to vpc - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_1 }}' - name: "{{ vgw_name }}" - register: vgw - - - name: Use set fact for vgw ids - ansible.builtin.set_fact: - vgw_id: '{{ vgw.vgw.id }}' - - - name: Assert result - vgw creation - ansible.builtin.assert: - that: - - vgw.changed - - vgw.vgw.vpc_id == vpc_id_1 - - vgw.vgw.tags.Name == vgw_name - - - name: Test idempotence - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_1 }}' - name: "{{ vgw_name }}" - register: vgw - - - name: Assert idempotence result - no change - ansible.builtin.assert: - that: - - not vgw.changed - - vgw.vgw.id == vgw_id - - # ============================================================ - - name: Attach vpn gateway to the other VPC - check_mode - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_2 }}' - name: "{{ vgw_name }}" - register: vgw_check_mode - check_mode: true - - - name: Assert check_mode result - no create/attach/detach - ansible.builtin.assert: - that: - - vgw_check_mode.changed - - not vgw_check_mode.failed - - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" - - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" - - "'ec2:DetachVpnGateway' not in vgw_check_mode.resource_actions" - - - name: Attach vpn gateway to the other VPC - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_2 }}' - name: "{{ vgw_name }}" - register: vgw - - - name: Assert attach result - ansible.builtin.assert: - that: - - vgw.changed - - vgw.vgw.id == vgw_id - - vgw.vgw.vpc_id == vpc_id_2 - - - name: Attach vpn gateway to the other VPC - idempotency - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_id_2 }}' - name: "{{ vgw_name }}" - register: vgw - - - name: Assert idempotency result - no change - ansible.builtin.assert: - that: - - not vgw.changed - - not vgw.failed - - "'ec2:CreateVpnGateway' not in vgw_check_mode.resource_actions" - - "'ec2:AttachVpnGateway' not in vgw_check_mode.resource_actions" - - "'ec2:DetachVpnGateway' not in vgw_check_mode.resource_actions" - - # ============================================================ - - - name: Get VPC VGW facts by ID (CHECK) - community.aws.ec2_vpc_vgw_info: - vpn_gateway_ids: ['{{ vgw_id }}'] - register: vgw_info - check_mode: True - - - name: Verify expected facts - vars: - vgw_details: '{{ vgw_info.virtual_gateways[0] }}' - attach_1_description: - state: 'detached' - vpc_id: '{{ vpc_id_1 }}' - attach_2_description: - state: 'attached' - vpc_id: '{{ vpc_id_2 }}' - ansible.builtin.assert: - that: - - vgw_info.virtual_gateways | length == 1 - - '"resource_tags" in vgw_details' - - '"state" in vgw_details' - - '"tags" in vgw_details' - - '"type" in vgw_details' - - '"vpc_attachments" in vgw_details' - - '"vpn_gateway_id" in vgw_details' - - vgw_details.vpn_gateway_id == vgw_id - - vgw_details.type == 'ipsec.1' - - vgw_details.state == 'available' - - '"Name" in vgw_details.resource_tags' - - vgw_details.resource_tags.Name == vgw_name - - ( - attach_1_description in vgw_details.vpc_attachments - and - vgw_details.vpc_attachments | length == 2 - ) or ( vgw_details.vpc_attachments | length == 1 ) - - attach_2_description in vgw_details.vpc_attachments - - - name: Get VPC VGW facts by Tag - community.aws.ec2_vpc_vgw_info: - filters: - "tag:Name": "{{ vgw_name }}" - register: vgw_info - - - name: Verify expected facts - vars: - vgw_details: '{{ vgw_info.virtual_gateways[0] }}' - attach_1_description: - state: 'detached' - vpc_id: '{{ vpc_id_1 }}' - attach_2_description: - state: 'attached' - vpc_id: '{{ vpc_id_2 }}' - ansible.builtin.assert: - that: - - vgw_info.virtual_gateways | length == 1 - - '"resource_tags" in vgw_details' - - '"state" in vgw_details' - - '"tags" in vgw_details' - - '"type" in vgw_details' - - '"vpc_attachments" in vgw_details' - - '"vpn_gateway_id" in vgw_details' - - vgw_details.vpn_gateway_id == vgw_id - - vgw_details.type == 'ipsec.1' - - vgw_details.state == 'available' - - '"Name" in vgw_details.resource_tags' - - vgw_details.resource_tags.Name == vgw_name - - ( - attach_1_description in vgw_details.vpc_attachments - and - vgw_details.vpc_attachments | length == 2 - ) or ( vgw_details.vpc_attachments | length == 1 ) - - attach_2_description in vgw_details.vpc_attachments - - # ============================================================ - - - name: Get all VGWs - community.aws.ec2_vpc_vgw_info: - register: vgw_info - - - name: Verify test VGW is in the results - vars: - vgw_id_list: '{{ vgw_info.virtual_gateways | map(attribute="vpn_gateway_id") | list }}' - ansible.builtin.assert: - that: - - vgw_id in vgw_id_list - - # ============================================================ - - name: Detach vpn gateway - check_mode - community.aws.ec2_vpc_vgw: - state: present - name: "{{ vgw_name }}" - register: vgw_check_mode - check_mode: true - - - name: Assert check_mode results - no detach action - ansible.builtin.assert: - that: - - vgw_check_mode.changed - - not vgw_check_mode.failed - - "'ec2:DetachVpcGateway' not in vgw_check_mode.resource_actions" - - - name: Detach vpn gateway - community.aws.ec2_vpc_vgw: - state: present - name: "{{ vgw_name }}" - register: vgw - - - name: Assert results - ansible.builtin.assert: - that: - - vgw.changed - - not vgw.vgw.vpc_id - - - name: Test idempotence - community.aws.ec2_vpc_vgw: - state: present - name: "{{ vgw_name }}" - register: vgw - - - name: Assert idempotency result - no change - ansible.builtin.assert: - that: - - not vgw.changed - - # ============================================================ - - - include_tasks: 'tags.yml' - - # ============================================================ - - - name: Delete vpn gateway - check_mode - community.aws.ec2_vpc_vgw: - state: absent - name: "{{ vgw_name }}" - register: vgw_check_mode - check_mode: true - - - name: Assert check_mode result - no delete action - ansible.builtin.assert: - that: - - vgw_check_mode.changed - - not vgw_check_mode.failed - - "'ec2:DeleteVpnGateway' not in vgw_check_mode.resource_actions" - - - name: Delete vpn gateway - community.aws.ec2_vpc_vgw: - state: absent - name: "{{ vgw_name }}" - register: vgw - - - name: Assert result - ansible.builtin.assert: - that: - - vgw.changed - - - name: Test idempotence - community.aws.ec2_vpc_vgw: - state: absent - name: "{{ vgw_name }}" - register: vgw - - - name: Assert idempotency result - no change - ansible.builtin.assert: - that: - - not vgw.changed - - always: - - - ansible.builtin.debug: msg="Removing test dependencies" - - - name: Delete vpn gateway - community.aws.ec2_vpc_vgw: - state: absent - vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}' - ignore_errors: true - - - name: Delete vpc - amazon.aws.ec2_vpc_net: - name: "{{ vpc_name }}-{{ item }}" - state: absent - cidr_block: "{{ vpc_cidr }}" - loop: [1, 2] - register: result - retries: 10 - delay: 5 - until: result is not failed - ignore_errors: true diff --git a/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml b/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml deleted file mode 100644 index 816e9216813..00000000000 --- a/tests/integration/targets/ec2_vpc_vgw/tasks/tags.yml +++ /dev/null @@ -1,334 +0,0 @@ -- vars: - first_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - second_tags: - 'New Key with Spaces': Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - third_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - final_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - name_tags: - Name: '{{ vgw_name }}' - module_defaults: - community.aws.ec2_vpc_vgw: - name: '{{ vgw_name }}' - ec2_vpc_vgw_info: - vpn_gateway_ids: ['{{ vgw_id }}'] - block: - - # ============================================================ - - - name: Add tags - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw is not failed - - "'ec2:CreateTags' not in tag_vgw.resource_actions" - - - name: Add tags - community.aws.ec2_vpc_vgw: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vgw - - - name: Get VPC VGW facts - ec2_vpc_vgw_info: {} - register: tag_vgw_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( first_tags | combine(name_tags) ) - - - name: Add tags - IDEMPOTENCY - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - - name: Add tags - IDEMPOTENCY - community.aws.ec2_vpc_vgw: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: {} - register: tag_vgw_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( first_tags | combine(name_tags) ) - - # ============================================================ - - - name: Get VPC VGW facts by filter - ec2_vpc_vgw_info: - filters: - 'tag:Name': '{{ vgw_name }}' - vpn_gateway_ids: '{{ omit }}' - register: tag_vgw_info - - - name: Assert the facts are the same as before - ansible.builtin.assert: - that: - - tag_vgw_info.virtual_gateways | length == 1 - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - # ============================================================ - - - name: Modify tags with purge - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ second_tags }}' - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - - name: Modify tags with purge - community.aws.ec2_vpc_vgw: - tags: '{{ second_tags }}' - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( second_tags | combine(name_tags) ) - - - name: Modify tags with purge - IDEMPOTENCY - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ second_tags }}' - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - - name: Modify tags with purge - IDEMPOTENCY - community.aws.ec2_vpc_vgw: - tags: '{{ second_tags }}' - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( second_tags | combine(name_tags) ) - - # ============================================================ - - - name: Modify tags without purge - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vgw - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - - name: Modify tags without purge - community.aws.ec2_vpc_vgw: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vgw - - name: et VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( final_tags | combine(name_tags) ) - - - name: Modify tags without purge - IDEMPOTENCY - check_mode - community.aws.ec2_vpc_vgw: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vgw - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - - name: Modify tags without purge - IDEMPOTENCY - community.aws.ec2_vpc_vgw: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( final_tags | combine(name_tags) ) - - # ============================================================ - - - name: No change to tags without setting tags - check_mode - community.aws.ec2_vpc_vgw: - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - - name: No change to tags without setting tags - community.aws.ec2_vpc_vgw: - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == ( final_tags | combine(name_tags) ) - - # ============================================================ - - - name: Remove non name tags - check_mode - community.aws.ec2_vpc_vgw: - tags: {} - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - - name: Remove non name tags - community.aws.ec2_vpc_vgw: - tags: {} - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vgw is changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == name_tags - - - name: Remove non name tags - IDEMPOTENCY - check_mode - community.aws.ec2_vpc_vgw: - tags: {} - state: 'present' - register: tag_vgw - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - - name: Remove non name tags - IDEMPOTENCY - community.aws.ec2_vpc_vgw: - tags: {} - state: 'present' - register: tag_vgw - - name: Get VPC VGW facts - ec2_vpc_vgw_info: - register: tag_vgw_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vgw is not changed - - tag_vgw.vgw.id == vgw_id - - tag_vgw_info.virtual_gateways[0].vpn_gateway_id == vgw_id - - tag_vgw_info.virtual_gateways[0].resource_tags == name_tags From 3657cd0a8871fded29d50d0a668c999630d5788a Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Fri, 25 Oct 2024 17:05:04 +0200 Subject: [PATCH 69/77] DNM Promote ec2_vpc_vpn and ec2_vpc_vpn_info modules and tests (#2180) SUMMARY Promote ec2_vpc_vpn and ec2_vpc_vpn_info modules and tests ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Mandar Kulkarni --- changelogs/fragments/migrate_ec2_vpc_vpn.yml | 8 + meta/runtime.yml | 6 +- plugins/modules/ec2_vpc_vpn.py | 944 ------------------ plugins/modules/ec2_vpc_vpn_info.py | 282 ------ tests/integration/targets/ec2_vpc_vpn/aliases | 3 - .../targets/ec2_vpc_vpn/meta/main.yml | 1 - .../targets/ec2_vpc_vpn/tasks/main.yml | 232 ----- .../targets/ec2_vpc_vpn/tasks/tags.yml | 330 ------ .../ec2_vpc_vpn/__init__.py | 0 .../ec2.CreateVpnConnectionRoute_1.json | 16 - .../ec2.CreateVpnConnectionRoute_2.json | 16 - .../add_routes/ec2.CreateVpnConnection_1.json | 29 - .../add_routes/ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 179 ---- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 66 -- .../ec2.DescribeVpnConnections_17.json | 66 -- .../ec2.DescribeVpnConnections_18.json | 66 -- .../ec2.DescribeVpnConnections_19.json | 235 ----- .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_20.json | 39 - .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../add_tags/ec2.CreateTags_1.json | 17 - .../add_tags/ec2.CreateVpnConnection_1.json | 29 - .../add_tags/ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 149 --- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 202 ---- .../ec2.DescribeVpnConnections_17.json | 36 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 137 --- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 30 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateTags_1.json | 17 - .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 115 --- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 162 --- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 76 -- .../ec2.DescribeVpnConnections_16.json | 76 -- .../ec2.DescribeVpnConnections_17.json | 40 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 66 -- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 30 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 79 -- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 66 -- .../ec2.DescribeVpnConnections_17.json | 126 --- .../ec2.DescribeVpnConnections_18.json | 66 -- .../ec2.DescribeVpnConnections_19.json | 66 -- .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_20.json | 30 - .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 103 -- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 150 --- .../ec2.DescribeVpnConnections_16.json | 30 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.DescribeVpnConnections_1.json | 17 - .../ec2.CreateTags_1.json | 17 - .../ec2.CreateTags_2.json | 17 - .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.CreateVpnConnection_2.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DeleteVpnConnection_2.json | 16 - .../ec2.DescribeVpnConnections_1.json | 30 - .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 30 - .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 66 -- .../ec2.DescribeVpnConnections_17.json | 66 -- .../ec2.DescribeVpnConnections_18.json | 66 -- .../ec2.DescribeVpnConnections_19.json | 66 -- .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_20.json | 66 -- .../ec2.DescribeVpnConnections_21.json | 66 -- .../ec2.DescribeVpnConnections_22.json | 66 -- .../ec2.DescribeVpnConnections_23.json | 66 -- .../ec2.DescribeVpnConnections_24.json | 66 -- .../ec2.DescribeVpnConnections_25.json | 66 -- .../ec2.DescribeVpnConnections_26.json | 66 -- .../ec2.DescribeVpnConnections_27.json | 66 -- .../ec2.DescribeVpnConnections_28.json | 78 -- .../ec2.DescribeVpnConnections_29.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_30.json | 72 -- .../ec2.DescribeVpnConnections_31.json | 78 -- .../ec2.DescribeVpnConnections_32.json | 66 -- .../ec2.DescribeVpnConnections_33.json | 72 -- .../ec2.DescribeVpnConnections_34.json | 72 -- .../ec2.DescribeVpnConnections_35.json | 36 - .../ec2.DescribeVpnConnections_36.json | 36 - .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateTags_1.json | 17 - .../ec2.CreateTags_2.json | 17 - .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.CreateVpnConnection_2.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DeleteVpnConnection_2.json | 16 - .../ec2.DescribeVpnConnections_1.json | 48 - .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 72 -- .../ec2.DescribeVpnConnections_14.json | 48 - .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 66 -- .../ec2.DescribeVpnConnections_17.json | 66 -- .../ec2.DescribeVpnConnections_18.json | 66 -- .../ec2.DescribeVpnConnections_19.json | 66 -- .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_20.json | 66 -- .../ec2.DescribeVpnConnections_21.json | 66 -- .../ec2.DescribeVpnConnections_22.json | 66 -- .../ec2.DescribeVpnConnections_23.json | 66 -- .../ec2.DescribeVpnConnections_24.json | 66 -- .../ec2.DescribeVpnConnections_25.json | 66 -- .../ec2.DescribeVpnConnections_26.json | 66 -- .../ec2.DescribeVpnConnections_27.json | 66 -- .../ec2.DescribeVpnConnections_28.json | 72 -- .../ec2.DescribeVpnConnections_29.json | 143 --- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_30.json | 36 - .../ec2.DescribeVpnConnections_31.json | 36 - .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.DescribeVpnConnections_1.json | 73 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.CreateVpnConnection_2.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DeleteVpnConnection_2.json | 16 - .../ec2.DescribeVpnConnections_1.json | 17 - .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 66 -- .../ec2.DescribeVpnConnections_16.json | 66 -- .../ec2.DescribeVpnConnections_17.json | 66 -- .../ec2.DescribeVpnConnections_18.json | 17 - .../ec2.DescribeVpnConnections_19.json | 66 -- .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_20.json | 66 -- .../ec2.DescribeVpnConnections_21.json | 66 -- .../ec2.DescribeVpnConnections_22.json | 66 -- .../ec2.DescribeVpnConnections_23.json | 66 -- .../ec2.DescribeVpnConnections_24.json | 66 -- .../ec2.DescribeVpnConnections_25.json | 66 -- .../ec2.DescribeVpnConnections_26.json | 66 -- .../ec2.DescribeVpnConnections_27.json | 66 -- .../ec2.DescribeVpnConnections_28.json | 66 -- .../ec2.DescribeVpnConnections_29.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_30.json | 66 -- .../ec2.DescribeVpnConnections_31.json | 66 -- .../ec2.DescribeVpnConnections_32.json | 30 - .../ec2.DescribeVpnConnections_33.json | 30 - .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 91 -- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 30 - .../ec2.DescribeVpnConnections_15.json | 30 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../ec2.CreateVpnConnection_1.json | 29 - .../remove_tags/ec2.DeleteTags_1.json | 17 - .../ec2.DeleteVpnConnection_1.json | 16 - .../ec2.DescribeVpnConnections_1.json | 167 ---- .../ec2.DescribeVpnConnections_10.json | 66 -- .../ec2.DescribeVpnConnections_11.json | 66 -- .../ec2.DescribeVpnConnections_12.json | 66 -- .../ec2.DescribeVpnConnections_13.json | 66 -- .../ec2.DescribeVpnConnections_14.json | 66 -- .../ec2.DescribeVpnConnections_15.json | 214 ---- .../ec2.DescribeVpnConnections_16.json | 30 - .../ec2.DescribeVpnConnections_2.json | 66 -- .../ec2.DescribeVpnConnections_3.json | 66 -- .../ec2.DescribeVpnConnections_4.json | 66 -- .../ec2.DescribeVpnConnections_5.json | 66 -- .../ec2.DescribeVpnConnections_6.json | 66 -- .../ec2.DescribeVpnConnections_7.json | 66 -- .../ec2.DescribeVpnConnections_8.json | 66 -- .../ec2.DescribeVpnConnections_9.json | 66 -- .../unit/plugins/modules/test_ec2_vpc_vpn.py | 263 ----- 303 files changed, 12 insertions(+), 20208 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_vpc_vpn.yml delete mode 100644 plugins/modules/ec2_vpc_vpn.py delete mode 100644 plugins/modules/ec2_vpc_vpn_info.py delete mode 100644 tests/integration/targets/ec2_vpc_vpn/aliases delete mode 100644 tests/integration/targets/ec2_vpc_vpn/meta/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_vpn/tasks/main.yml delete mode 100644 tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/__init__.py delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_18.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_19.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_20.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateTags_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateTags_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_18.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_19.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_20.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_nonexistent_connection/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_18.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_19.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_20.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_21.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_22.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_23.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_24.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_25.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_26.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_27.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_28.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_29.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_30.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_31.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_32.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_33.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_34.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_35.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_36.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_18.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_19.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_20.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_21.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_22.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_23.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_24.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_25.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_26.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_27.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_28.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_29.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_30.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_31.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_nonexistent/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_17.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_18.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_19.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_20.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_21.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_22.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_23.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_24.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_25.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_26.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_27.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_28.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_29.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_30.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_31.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_32.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_33.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.CreateVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteTags_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteVpnConnection_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_1.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_10.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_11.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_12.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_13.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_14.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_15.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_16.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_2.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_3.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_4.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_5.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_6.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_7.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_8.json delete mode 100644 tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_9.json delete mode 100644 tests/unit/plugins/modules/test_ec2_vpc_vpn.py diff --git a/changelogs/fragments/migrate_ec2_vpc_vpn.yml b/changelogs/fragments/migrate_ec2_vpc_vpn.yml new file mode 100644 index 00000000000..44b6cbc205f --- /dev/null +++ b/changelogs/fragments/migrate_ec2_vpc_vpn.yml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - ec2_vpc_vpn - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_vpn``. + - ec2_vpc_vpn_info - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should be + updated to use ``amazon.aws.ec2_vpc_vpn_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 731f7870900..d9324dea195 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -111,8 +111,6 @@ action_groups: - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - - ec2_vpc_vpn - - ec2_vpc_vpn_info - ec2_win_password - ecs_attribute - ecs_cluster @@ -535,6 +533,10 @@ plugin_routing: redirect: amazon.aws.ec2_vpc_vgw ec2_vpc_vgw_info: redirect: amazon.aws.ec2_vpc_vgw_info + ec2_vpc_vpn: + redirect: amazon.aws.ec2_vpc_vpn + ec2_vpc_vpn_info: + redirect: amazon.aws.ec2_vpc_vpn_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_vpc_vpn.py b/plugins/modules/ec2_vpc_vpn.py deleted file mode 100644 index 2555e4cc3a7..00000000000 --- a/plugins/modules/ec2_vpc_vpn.py +++ /dev/null @@ -1,944 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (c) 2017 Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_vpc_vpn -version_added: 1.0.0 -short_description: Create, modify, and delete EC2 VPN connections -description: - - This module creates, modifies, and deletes VPN connections. - - Idempotence is achieved by using the O(filters) option or specifying the VPN connection identifier. -author: - - Sloane Hertel (@s-hertel) -options: - state: - description: - - The desired state of the VPN connection. - choices: ["present", "absent"] - default: present - required: false - type: str - customer_gateway_id: - description: - - The ID of the customer gateway. - type: str - connection_type: - description: - - The type of VPN connection. - - At this time only V(ipsec.1) is supported. - default: "ipsec.1" - type: str - vpn_gateway_id: - description: - - The ID of the virtual private gateway. - - Mutually exclusive with O(transit_gateway_id). - type: str - vpn_connection_id: - description: - - The ID of the VPN connection. Required to modify or delete a connection if the filters option does not provide a unique match. - type: str - static_only: - description: - - Indicates whether the VPN connection uses static routes only. Static routes must be used for devices that don't support BGP. - default: false - type: bool - required: false - transit_gateway_id: - description: - - The ID of the transit gateway. - - Mutually exclusive with O(vpn_gateway_id). - type: str - version_added: 6.2.0 - local_ipv4_network_cidr: - description: - - The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. - required: false - type: str - default: "0.0.0.0/0" - version_added: 9.0.0 - tunnel_options: - description: - - An optional list object containing no more than two dict members, each of which may contain O(tunnel_options.TunnelInsideCidr) - and/or O(tunnel_options.PreSharedKey) keys with appropriate string values. - AWS defaults will apply in absence of either of the aforementioned keys. - required: false - type: list - elements: dict - default: [] - suboptions: - TunnelInsideCidr: - type: str - description: - - The range of inside IPv4 addresses for the tunnel. - TunnelInsideIpv6Cidr: - type: str - description: - - The range of inside IPv6 addresses for the tunnel. - version_added: 9.0.0 - PreSharedKey: - type: str - description: - - The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway. - filters: - description: - - An alternative to using O(vpn_connection_id). If multiple matches are found, O(vpn_connection_id) is required. - If one of the following suboptions is a list of items to filter by, only one item needs to match to find the VPN - that correlates. e.g. if the filter O(filters.cidr) is V(["194.168.2.0/24", "192.168.2.0/24"]) and the VPN route only has the - destination cidr block of V(192.168.2.0/24) it will be found with this filter (assuming there are not multiple - VPNs that are matched). Another example, if the filter O(filters.vpn) is equal to V(["vpn-ccf7e7ad", "vpn-cb0ae2a2"]) and one - of of the VPNs has the state deleted (exists but is unmodifiable) and the other exists and is not deleted, - it will be found via this filter. - suboptions: - cgw-config: - description: - - The customer gateway configuration of the VPN as a string (in the format of the return value) or a list of those strings. - static-routes-only: - description: - - The type of routing; V(true) or V(false). - type: bool - cidr: - description: - - The destination cidr of the VPN's route as a string or a list of those strings. - bgp: - description: - - The BGP ASN number associated with a BGP device. Only works if the connection is attached. - This filtering option is currently not working. - vpn: - description: - - The VPN connection id as a string or a list of those strings. - vgw: - description: - - The virtual private gateway as a string or a list of those strings. - tag-keys: - description: - - The key of a tag as a string or a list of those strings. - tag-values: - description: - - The value of a tag as a string or a list of those strings. - tags: - description: - - A dict of key value pairs. - type: dict - cgw: - description: - - The customer gateway id as a string or a list of those strings. - type: dict - default: {} - routes: - description: - - Routes to add to the connection. - type: list - elements: str - default: [] - purge_routes: - description: - - Whether or not to delete VPN connections routes that are not specified in the task. - type: bool - default: false - wait_timeout: - description: - - How long, in seconds, before wait gives up. - default: 600 - type: int - required: false - delay: - description: - - The time, in seconds, to wait before checking operation again. - required: false - type: int - default: 15 -extends_documentation_fragment: - - amazon.aws.region.modules - - amazon.aws.common.modules - - amazon.aws.tags - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -- name: Create a VPN connection with vpn_gateway_id - community.aws.ec2_vpc_vpn: - state: "present" - vpn_gateway_id: "vgw-XXXXXXXX" - customer_gateway_id: "cgw-XXXXXXXX" - -- name: Attach a vpn connection to transit gateway - community.aws.ec2_vpc_vpn: - state: "present" - transit_gateway_id: "tgw-XXXXXXXX" - customer_gateway_id: "cgw-XXXXXXXX" - -- name: Modify VPN connection tags - community.aws.ec2_vpc_vpn: - state: "present" - vpn_connection_id: "vpn-XXXXXXXX" - tags: - Name: "ansible-tag-1" - Other: "ansible-tag-2" - -- name: Delete a connection - community.aws.ec2_vpc_vpn: - vpn_connection_id: "vpn-XXXXXXXX" - state: "absent" - -- name: Modify VPN tags (identifying VPN by filters) - community.aws.ec2_vpc_vpn: - state: "present" - filters: - cidr: "194.168.1.0/24" - tag-keys: - - "Ansible" - - "Other" - tags: - New: "Tag" - purge_tags: true - static_only: true - -- name: Set up VPN with tunnel options utilizing 'TunnelInsideCidr' only - community.aws.ec2_vpc_vpn: - state: "present" - filters: - vpn: "vpn-XXXXXXXX" - static_only: true - tunnel_options: - - TunnelInsideCidr: "169.254.100.1/30" - - TunnelInsideCidr: "169.254.100.5/30" - -- name: Add routes and remove any preexisting ones - community.aws.ec2_vpc_vpn: - state: "present" - filters: - vpn: "vpn-XXXXXXXX" - routes: - - "195.168.2.0/24" - - "196.168.2.0/24" - purge_routes: true - -- name: Remove all routes - community.aws.ec2_vpc_vpn: - state: "present" - vpn_connection_id: "vpn-XXXXXXXX" - routes: [] - purge_routes: true - -- name: Delete a VPN identified by filters - community.aws.ec2_vpc_vpn: - state: "absent" - filters: - tags: - Ansible: "Tag" -""" - -RETURN = r""" -changed: - description: If the VPN connection has changed. - type: bool - returned: always - sample: true -customer_gateway_configuration: - description: The configuration of the VPN connection. - returned: O(state=present) - type: str -customer_gateway_id: - description: The customer gateway connected via the connection. - type: str - returned: O(state=present) - sample: "cgw-1220c87b" -gateway_association_state: - description: The current state of the gateway association. - type: str - returned: O(state=present) - sample: "associated" -vpn_gateway_id: - description: The virtual private gateway connected via the connection. - type: str - returned: O(state=present) - sample: "vgw-cb0ae2a2" -transit_gateway_id: - description: The transit gateway id to which the vpn connection can be attached. - type: str - returned: O(state=present) - sample: "tgw-cb0ae2a2" -options: - description: The VPN connection options. - type: list - elements: dict - returned: O(state=present) - contains: - static_routes_only: - description: If the VPN connection only allows static routes. - returned: O(state=present) - type: bool - sample: true - enable_acceleration: - description: Indicates whether acceleration is enabled for the VPN connection. - returned: O(state=present) - type: bool - sample: false - local_ipv4_network_cidr: - description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. - returned: O(state=present) - type: str - sample: "0.0.0.0/0" - outside_ip_address_type: - description: The external IP address of the VPN tunnel. - returned: O(state=present) - type: str - sample: "PublicIpv4" - remote_ipv4_network_cidr: - description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. - returned: O(state=present) - type: str - sample: "0.0.0.0/0" - tunnel_inside_ip_version: - description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. - returned: O(state=present) - type: str - sample: "ipv4" - tunnel_options: - description: Indicates the VPN tunnel options. - returned: O(state=present) - type: list - elements: dict - sample: [{ - "log_options": { - "cloud_watch_log_options": { - "log_enabled": false - } - }, - "outside_ip_address": "34.225.101.10", - "pre_shared_key": "8n7hnjNE8zhIt4VpMOIfcrw6XnUTHLW9", - "tunnel_inside_cidr": "169.254.31.8/30" - }] - contains: - log_options: - description: Options for logging VPN tunnel activity. - returned: O(state=present) - type: dict - contains: - cloud_watch_log_options: - description: Options for sending VPN tunnel logs to CloudWatch. - type: dict - returned: O(state=present) - outside_ip_address: - description: The external IP address of the VPN tunnel. - type: str - returned: O(state=present) - pre_shared_key: - description: - - The pre-shared key (PSK) to establish initial authentication between the - virtual private gateway and the customer gateway. - type: str - returned: O(state=present) - tunnel_inside_cidr: - description: The range of inside IPv4 addresses for the tunnel. - type: str - returned: O(state=present) -routes: - description: The routes of the VPN connection. - type: list - returned: O(state=present) - sample: [{ - "destination_cidr_block": "192.168.1.0/24", - "state": "available" - }] - contains: - destination_cidr_block: - description: - - The CIDR block associated with the local subnet of the customer data center. - type: str - returned: O(state=present) - source: - description: Indicates how the routes were provided. - type: str - returned: O(state=present) - state: - description: The current state of the static route. - type: str - returned: O(state=present) -state: - description: The status of the VPN connection. - type: str - returned: O(state=present) - sample: "available" -tags: - description: The tags associated with the connection. - type: dict - returned: O(state=present) - sample: { - "name": "ansible-test", - "other": "tag" - } -type: - description: The type of VPN connection (currently only ipsec.1 is available). - type: str - returned: O(state=present) - sample: "ipsec.1" -vgw_telemetry: - type: list - returned: O(state=present) - description: The telemetry for the VPN tunnel. - sample: [{ - "accepted_route_count": 0, - "last_status_change": "2024-09-30T13:12:33+00:00", - "outside_ip_address": "34.225.101.10", - "status": "DOWN", - "status_message": "IPSEC IS DOWN" - }] - contains: - accepted_route_count: - type: int - returned: O(state=present) - description: The number of accepted routes. - last_status_change: - type: str - returned: O(state=present) - description: The date and time of the last change in status. - outside_ip_address: - type: str - returned: O(state=present) - description: - - The Internet-routable IP address of the virtual private gateway's outside interface. - status: - type: str - returned: O(state=present) - description: The status of the VPN tunnel. - status_message: - type: str - returned: O(state=present) - description: If an error occurs, a description of the error. - certificate_arn: - description: The Amazon Resource Name of the virtual private gateway tunnel endpoint certificate. - returned: when a private certificate is used for authentication - type: str - sample: "arn:aws:acm:us-east-1:123456789012:certificate/c544d8ce-20b8-4fff-98b0-example" -vpn_connection_id: - description: The identifier for the VPN connection. - type: str - returned: O(state=present) - sample: "vpn-781e0e19" -""" - -try: - from botocore.exceptions import WaiterError -except ImportError: - pass # Handled by AnsibleAWSModule - -from typing import Any -from typing import Dict -from typing import List -from typing import NoReturn -from typing import Optional -from typing import Tuple -from typing import Union - -from ansible.module_utils._text import to_text -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_connection -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_vpn_connection_route -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_connection -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_vpn_connection_route -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_connections -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.tagging import compare_aws_tags - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def find_vpn_connection( - client, module: AnsibleAWSModule, vpn_connection_id: Optional[str] = None -) -> Union[None, Dict[str, Any]]: - """Looks for a unique VPN connection. Uses find_connection_response() to return the connection found, None, - or raise an error if there were multiple viable connections.""" - - filters = module.params.get("filters") - params: Dict[str, Any] = {} - - # vpn_connection_id may be provided via module option; takes precedence over any filter values - if not vpn_connection_id and module.params.get("vpn_connection_id"): - vpn_connection_id = module.params["vpn_connection_id"] - - if not isinstance(vpn_connection_id, list) and vpn_connection_id: - vpn_connection_id = [to_text(vpn_connection_id)] - elif isinstance(vpn_connection_id, list): - vpn_connection_id = [to_text(connection) for connection in vpn_connection_id] - - formatted_filter: List = [] - # if vpn_connection_id is provided it will take precedence over any filters since it is a unique identifier - if not vpn_connection_id: - formatted_filter = create_filter(module, filters) - - if vpn_connection_id: - params["VpnConnectionIds"] = vpn_connection_id - params["Filters"] = formatted_filter - - # see if there is a unique matching connection - try: - existing_conn = describe_vpn_connections(client, **params) - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg="Failed while describing VPN connection.") - - return find_connection_response(module, connections=existing_conn) - - -def add_routes(client, module: AnsibleAWSModule, vpn_connection_id: str, routes_to_add: List[Dict[str, Any]]) -> bool: - changed: bool = False - for route in routes_to_add: - try: - changed |= create_vpn_connection_route(client, vpn_connection_id, route) - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg=f"Failed while adding route {route} to the VPN connection {vpn_connection_id}.") - return changed - - -def remove_routes( - client, module: AnsibleAWSModule, vpn_connection_id: str, routes_to_remove: List[Dict[str, Any]] -) -> bool: - changed: bool = False - for route in routes_to_remove: - try: - changed |= delete_vpn_connection_route(client, vpn_connection_id, route) - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg=f"Failed to remove route {route} from the VPN connection {vpn_connection_id}.") - return changed - - -def create_filter(module, provided_filters: Dict[str, Any]) -> List[Dict[str, Any]]: - """Creates a filter using the user-specified parameters and unmodifiable options that may have been specified in the task""" - - boto3ify_filter = { - "cgw-config": "customer-gateway-configuration", - "static-routes-only": "option.static-routes-only", - "cidr": "route.destination-cidr-block", - "bgp": "bgp-asn", - "vpn": "vpn-connection-id", - "vgw": "vpn-gateway-id", - "tag-keys": "tag-key", - "tag-values": "tag-value", - "tags": "tag", - "cgw": "customer-gateway-id", - } - - # unmodifiable options and their filter name counterpart - param_to_filter = { - "customer_gateway_id": "customer-gateway-id", - "vpn_gateway_id": "vpn-gateway-id", - "transit_gateway_id": "transit-gateway-id", - "vpn_connection_id": "vpn-connection-id", - } - - flat_filter_dict = {} - formatted_filter: List = [] - - for raw_param in dict(provided_filters): - # fix filter names to be recognized by boto3 - if raw_param in boto3ify_filter: - param = boto3ify_filter[raw_param] - provided_filters[param] = provided_filters.pop(raw_param) - elif raw_param in list(boto3ify_filter.items()): - param = raw_param - else: - module.fail_json(msg=f"{raw_param} is not a valid filter.") - - # reformat filters with special formats - if param == "tag": - for key in provided_filters[param]: - formatted_key = "tag:" + key - if isinstance(provided_filters[param][key], list): - flat_filter_dict[formatted_key] = str(provided_filters[param][key]) - else: - flat_filter_dict[formatted_key] = [str(provided_filters[param][key])] - elif param == "option.static-routes-only": - flat_filter_dict[param] = [str(provided_filters[param]).lower()] - else: - if isinstance(provided_filters[param], list): - flat_filter_dict[param] = provided_filters[param] - else: - flat_filter_dict[param] = [str(provided_filters[param])] - - # if customer_gateway, vpn_gateway, or vpn_connection was specified in the task but not the filter, add it - for param in param_to_filter: - if param_to_filter[param] not in flat_filter_dict and module.params.get(param): - flat_filter_dict[param_to_filter[param]] = [module.params.get(param)] - - # change the flat dict into something boto3 will understand - formatted_filter = [{"Name": key, "Values": value} for key, value in flat_filter_dict.items()] - - return formatted_filter - - -def find_connection_response(module, connections: Optional[List[Dict[str, Any]]] = None) -> Optional[Dict[str, Any]]: - """Determine if there is a viable unique match in the connections described. Returns the unique VPN connection if one is found, - returns None if the connection does not exist, raise an error if multiple matches are found.""" - - # Found no connections - if not connections: - return None - - # Too many results - elif connections and len(connections) > 1: - viable = [] - for each in connections: - # deleted connections are not modifiable - if each["State"] not in ("deleted", "deleting"): - viable.append(each) - if len(viable) == 1: - # Found one viable result; return unique match - return viable[0] - elif len(viable) == 0: - # Found a result but it was deleted already; since there was only one viable result create a new one - return None - else: - module.fail_json( - msg=( - "More than one matching VPN connection was found. " - "To modify or delete a VPN please specify vpn_connection_id or add filters." - ) - ) - - # Found unique match - elif connections and len(connections) == 1: - # deleted connections are not modifiable - if connections[0]["State"] not in ("deleted", "deleting"): - return connections[0] - - -def create_connection( - client, - module: AnsibleAWSModule, - customer_gateway_id: Optional[str], - static_only: Optional[bool], - vpn_gateway_id: str, - transit_gateway_id: str, - connection_type: Optional[str], - max_attempts: Optional[int], - delay: Optional[int], - local_ipv4_network_cidr: Optional[str], - tunnel_options: Optional[List[Dict[str, Any]]] = None, -) -> Dict[str, Any]: - """Creates a VPN connection""" - - options = {"StaticRoutesOnly": static_only, "LocalIpv4NetworkCidr": local_ipv4_network_cidr} - - if tunnel_options and len(tunnel_options) <= 2: - t_opt = [] - for m in tunnel_options: - # See Boto3 docs regarding 'create_vpn_connection' - # tunnel options for allowed 'TunnelOptions' keys. - if not isinstance(m, dict): - raise TypeError("non-dict list member") - t_opt.append(m) - if t_opt: - options["TunnelOptions"] = t_opt - - if not (customer_gateway_id and (vpn_gateway_id or transit_gateway_id)): - module.fail_json( - msg=( - "No matching connection was found. To create a new connection you must provide " - "customer_gateway_id and one of either transit_gateway_id or vpn_gateway_id." - ) - ) - vpn_connection_params: Dict[str, Any] = { - "Type": connection_type, - "CustomerGatewayId": customer_gateway_id, - "Options": options, - } - - if vpn_gateway_id: - vpn_connection_params["VpnGatewayId"] = vpn_gateway_id - if transit_gateway_id: - vpn_connection_params["TransitGatewayId"] = transit_gateway_id - - try: - vpn = create_vpn_connection(client, **vpn_connection_params) - client.get_waiter("vpn_connection_available").wait( - VpnConnectionIds=[vpn["VpnConnectionId"]], - WaiterConfig={"Delay": delay, "MaxAttempts": max_attempts}, - ) - except WaiterError as e: - module.fail_json_aws( - e, msg=f"Failed to wait for VPN connection {vpn['VpnConnection']['VpnConnectionId']} to be available" - ) - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg="Failed to create VPN connection") - - return vpn - - -def delete_connection(client, module: AnsibleAWSModule, vpn_connection_id: str) -> NoReturn: - """Deletes a VPN connection""" - - delay = module.params.get("delay") - max_attempts = module.params.get("wait_timeout") // delay - - try: - delete_vpn_connection(client, vpn_connection_id) - client.get_waiter("vpn_connection_deleted").wait( - VpnConnectionIds=[vpn_connection_id], WaiterConfig={"Delay": delay, "MaxAttempts": max_attempts} - ) - except WaiterError as e: - module.fail_json_aws(e, msg=f"Failed to wait for VPN connection {vpn_connection_id} to be removed") - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg=f"Failed to delete the VPN connection: {vpn_connection_id}") - - -def check_for_routes_update(client, module: AnsibleAWSModule, vpn_connection_id: str) -> Dict[str, Any]: - """Determines if there are any routes that need to be updated. Ensures non-modifiable attributes aren't expected to change.""" - routes = module.params.get("routes") - purge_routes = module.params.get("purge_routes") - - vpn_connection = find_vpn_connection(client, module, vpn_connection_id) - current_attrs = camel_dict_to_snake_dict(vpn_connection) - - # Initialize changes dict - changes: Dict[str, Any] = {"routes_to_add": [], "routes_to_remove": []} - - # Get changes to routes - if "Routes" in vpn_connection: - current_routes = [route["DestinationCidrBlock"] for route in vpn_connection["Routes"]] - if purge_routes: - changes["routes_to_remove"] = [old_route for old_route in current_routes if old_route not in routes] - changes["routes_to_add"] = [new_route for new_route in routes if new_route not in current_routes] - - # Check if nonmodifiable attributes are attempted to be modified - for attribute in current_attrs: - if attribute in ("tags", "routes", "state"): - continue - elif attribute == "options": - will_be = module.params.get("static_only") - is_now = bool(current_attrs[attribute]["static_routes_only"]) - attribute = "static_only" - elif attribute == "type": - will_be = module.params.get("connection_type") - is_now = current_attrs[attribute] - else: - is_now = current_attrs[attribute] - will_be = module.params.get(attribute) - - if will_be is not None and to_text(will_be) != to_text(is_now): - module.fail_json( - msg=( - f"You cannot modify {attribute}, the current value of which is {is_now}. Modifiable VPN connection" - f" attributes are tags and routes. The value you tried to change it to is {will_be}." - ) - ) - - return changes - - -def make_changes(client, module: AnsibleAWSModule, vpn_connection_id: str, changes: Dict[str, Any]) -> bool: - """changes is a dict with the keys 'routes_to_add', 'routes_to_remove', - the values of which are lists (generated by check_for_routes_update()). - """ - changed: bool = False - - if module.params.get("tags") is not None: - changed |= ensure_ec2_tags( - client, - module, - vpn_connection_id, - resource_type="vpn-connection", - tags=module.params.get("tags"), - purge_tags=module.params.get("purge_tags"), - ) - - if changes["routes_to_add"]: - changed |= add_routes(client, module, vpn_connection_id, changes["routes_to_add"]) - - if changes["routes_to_remove"]: - changed |= remove_routes(client, module, vpn_connection_id, changes["routes_to_remove"]) - - return changed - - -def get_check_mode_results( - module_params: Dict[str, Any], vpn_connection_id: Optional[str] = None, current_state: Optional[str] = None -) -> Tuple[bool, Dict[str, Any]]: - """Returns the changes that would be made to a VPN Connection""" - changed: bool = False - results: Dict[str, Any] = { - "customer_gateway_configuration": "", - "customer_gateway_id": module_params.get("customer_gateway_id"), - "vpn_gateway_id": module_params.get("vpn_gateway_id"), - "transit_gateway_id": module_params.get("transit_gateway_id"), - "options": {"static_routes_only": module_params.get("static_only")}, - "routes": [module_params.get("routes")], - } - - present_tags = module_params.get("tags") - # get combined current tags and tags to set - if present_tags is None: - pass - elif current_state and "Tags" in current_state: - current_tags = boto3_tag_list_to_ansible_dict(current_state["Tags"]) - tags_to_add, tags_to_remove = compare_aws_tags(current_tags, present_tags, module_params.get("purge_tags")) - changed |= bool(tags_to_remove) or bool(tags_to_add) - if module_params.get("purge_tags"): - current_tags = {} - current_tags.update(present_tags) - results["tags"] = current_tags - elif module_params.get("tags"): - changed = True - - if present_tags: - results["tags"] = present_tags - - # get combined current routes and routes to add - present_routes = module_params.get("routes") - if current_state and "Routes" in current_state: - current_routes = [route["DestinationCidrBlock"] for route in current_state["Routes"]] - if module_params.get("purge_routes"): - if set(current_routes) != set(present_routes): - changed = True - elif set(present_routes) != set(current_routes): - if not set(present_routes) < set(current_routes): - changed = True - present_routes.extend([route for route in current_routes if route not in present_routes]) - elif module_params.get("routes"): - changed = True - results["routes"] = [{"destination_cidr_block": cidr, "state": "available"} for cidr in present_routes] - - # return the vpn_connection_id if it's known - if vpn_connection_id: - results["vpn_connection_id"] = vpn_connection_id - else: - changed = True - results["vpn_connection_id"] = "vpn-XXXXXXXX" - - return changed, results - - -def ensure_present( - client, module: AnsibleAWSModule, vpn_connection: Optional[Dict[str, Any]] -) -> Tuple[bool, Dict[str, Any]]: - """Creates and adds tags to a VPN connection. If the connection already exists update tags.""" - changed: bool = False - delay = module.params.get("delay") - max_attempts = module.params.get("wait_timeout") // delay - - # No match but vpn_connection_id was specified. - if not vpn_connection and module.params.get("vpn_connection_id"): - module.fail_json(msg="There is no VPN connection available or pending with that id. Did you delete it?") - - # Unique match was found. Check if attributes provided differ. - elif vpn_connection: - vpn_connection_id = vpn_connection["VpnConnectionId"] - # check_for_update returns a dict with the keys routes_to_add, routes_to_remove - changes = check_for_routes_update(client, module, vpn_connection_id) - - if module.check_mode: - return get_check_mode_results(module.params, vpn_connection_id, current_state=vpn_connection) - - changed |= make_changes(client, module, vpn_connection_id, changes) - - # No match was found. Create and tag a connection and add routes. - else: - changed = True - - if module.check_mode: - return get_check_mode_results(module.params) - - vpn_connection = create_connection( - client, - module, - customer_gateway_id=module.params.get("customer_gateway_id"), - static_only=module.params.get("static_only"), - vpn_gateway_id=module.params.get("vpn_gateway_id"), - transit_gateway_id=module.params.get("transit_gateway_id"), - connection_type=module.params.get("connection_type"), - local_ipv4_network_cidr=module.params.get("local_ipv4_network_cidr"), - tunnel_options=module.params.get("tunnel_options"), - max_attempts=max_attempts, - delay=delay, - ) - - changes = check_for_routes_update(client, module, vpn_connection["VpnConnectionId"]) - make_changes(client, module, vpn_connection["VpnConnectionId"], changes) - - # get latest version if a change has been made and make tags output nice before returning it - if vpn_connection: - vpn_connection = find_vpn_connection(client, module, vpn_connection["VpnConnectionId"]) - if "Tags" in vpn_connection: - vpn_connection["Tags"] = boto3_tag_list_to_ansible_dict(vpn_connection["Tags"]) - - return (changed, vpn_connection) - - -def ensure_absent(client, module: AnsibleAWSModule, vpn_connection: Dict[str, Any]) -> bool: - """Deletes a VPN connection if it exists.""" - changed: bool = False - - if vpn_connection: - changed = True - - if module.check_mode: - return changed - - delete_connection(client, module, vpn_connection["VpnConnectionId"]) - - return changed - - -def main(): - argument_spec = dict( - state=dict(type="str", default="present", choices=["present", "absent"]), - filters=dict(type="dict", default={}), - vpn_gateway_id=dict(type="str"), - tags=dict(type="dict", aliases=["resource_tags"]), - connection_type=dict(default="ipsec.1", type="str"), - transit_gateway_id=dict(type="str"), - local_ipv4_network_cidr=dict(type="str", default="0.0.0.0/0"), - tunnel_options=dict( - no_log=True, - type="list", - default=[], - elements="dict", - options=dict( - TunnelInsideCidr=dict(type="str"), - TunnelInsideIpv6Cidr=dict(type="str"), - PreSharedKey=dict(type="str", no_log=True), - ), - ), - static_only=dict(default=False, type="bool"), - customer_gateway_id=dict(type="str"), - vpn_connection_id=dict(type="str"), - purge_tags=dict(type="bool", default=True), - routes=dict(type="list", default=[], elements="str"), - purge_routes=dict(type="bool", default=False), - wait_timeout=dict(type="int", default=600), - delay=dict(type="int", default=15), - ) - mutually_exclusive = [ - ["vpn_gateway_id", "transit_gateway_id"], - ] - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - mutually_exclusive=mutually_exclusive, - ) - client = module.client("ec2") - - response: Dict[str, Any] = {} - state = module.params.get("state") - - vpn_connection = find_vpn_connection(client, module) - - if state == "present": - changed, response = ensure_present(client, module, vpn_connection) - elif state == "absent": - changed = ensure_absent(client, module, vpn_connection) - - module.exit_json(changed=changed, **camel_dict_to_snake_dict(response)) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/ec2_vpc_vpn_info.py b/plugins/modules/ec2_vpc_vpn_info.py deleted file mode 100644 index a5d3f65db7d..00000000000 --- a/plugins/modules/ec2_vpc_vpn_info.py +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: ec2_vpc_vpn_info -version_added: 1.0.0 -short_description: Gather information about EC2 VPN Connections in AWS -description: - - Gather information about EC2 VPN Connections in AWS. -author: - - Madhura Naniwadekar (@Madhura-CSI) -options: - filters: - description: - - A dict of filters to apply. Each dict item consists of a filter key and a filter value. - See U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpnConnections.html) for possible filters. - required: false - type: dict - default: {} - vpn_connection_ids: - description: - - Get details of specific EC2 VPN Connection(s) using vpn connection ID/IDs. This value should be provided as a list. - required: false - type: list - elements: str - default: [] -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# # Note: These examples do not set authentication details, see the AWS Guide for details. -- name: Gather information about all EC2 VPN Connections - community.aws.ec2_vpc_vpn_info: - -- name: Gather information about a filtered list of EC2 VPN Connections, based on tags - community.aws.ec2_vpc_vpn_info: - filters: - "tag:Name": "test-connection" - register: vpn_conn_info - -- name: Gather information about EC2 VPN Connections by specifying connection IDs - community.aws.ec2_vpc_vpn_info: - filters: - "vpn-gateway-id": "vgw-cbe66beb" - register: vpn_conn_info -""" - -RETURN = r""" -vpn_connections: - description: List of one or more EC2 VPN Connections. - type: list - elements: dict - returned: always - contains: - category: - description: The category of the VPN connection. - returned: always - type: str - sample: "VPN" - customer_gatway_configuration: - description: The configuration information for the VPN connection's customer gateway (in the native XML format). - returned: always - type: str - customer_gateway_id: - description: The ID of the customer gateway at your end of the VPN connection. - returned: always - type: str - sample: "cgw-17a53c37" - gateway_association_state: - description: The current state of the gateway association. - type: str - sample: "associated" - options: - description: The VPN connection options. - type: list - elements: dict - contains: - static_routes_only: - description: If the VPN connection only allows static routes. - type: bool - sample: true - enable_acceleration: - description: Indicates whether acceleration is enabled for the VPN connection. - type: bool - sample: false - local_ipv4_network_cidr: - description: The IPv4 CIDR on the customer gateway (on-premises) side of the VPN connection. - type: str - sample: "0.0.0.0/0" - outside_ip_address_type: - description: The external IP address of the VPN tunnel. - type: str - sample: "PublicIpv4" - remote_ipv4_network_cidr: - description: The IPv4 CIDR on the Amazon Web Services side of the VPN connection. - type: str - sample: "0.0.0.0/0" - tunnel_inside_ip_version: - description: Indicates whether the VPN tunnels process IPv4 or IPv6 traffic. - type: str - sample: "ipv4" - tunnel_options: - description: Indicates the VPN tunnel options. - type: list - elements: dict - sample: [ - { - "log_options": { - "cloud_watch_log_options": { - "log_enabled": false - } - }, - "outside_ip_address": "34.225.101.10", - "pre_shared_key": "8n7hnjNE8zhIt4VpMOIfcrw6XnUTHLW9", - "tunnel_inside_cidr": "169.254.31.8/30" - }, - ] - contains: - log_options: - description: Options for logging VPN tunnel activity. - type: dict - contains: - cloud_watch_log_options: - description: Options for sending VPN tunnel logs to CloudWatch. - type: dict - outside_ip_address: - description: The external IP address of the VPN tunnel. - type: str - pre_shared_key: - description: - - The pre-shared key (PSK) to establish initial authentication between the - virtual private gateway and the customer gateway. - type: str - tunnel_inside_cidr: - description: The range of inside IPv4 addresses for the tunnel. - type: str - routes: - description: List of static routes associated with the VPN connection. - returned: always - type: list - elements: dict - contains: - destination_cidr_block: - description: - - The CIDR block associated with the local subnet of the customer data center. - type: str - source: - description: Indicates how the routes were provided. - type: str - state: - description: The current state of the static route. - type: str - state: - description: The current state of the VPN connection. - returned: always - type: str - sample: "available" - tags: - description: Any tags assigned to the VPN connection. - returned: always - type: dict - sample: { - "Name": "test-conn" - } - type: - description: The type of VPN connection. - returned: always - type: str - sample: "ipsec.1" - vgw_telemetry: - description: Information about the VPN tunnel. - returned: always - type: dict - contains: - accepted_route_count: - description: The number of accepted routes. - returned: always - type: int - sample: 0 - last_status_change: - description: The date and time of the last change in status. - returned: always - type: str - sample: "2018-02-09T14:35:27+00:00" - outside_ip_address: - description: The Internet-routable IP address of the virtual private gateway's outside interface. - returned: always - type: str - sample: "13.127.79.191" - status: - description: The status of the VPN tunnel. - returned: always - type: str - sample: "DOWN" - status_message: - description: If an error occurs, a description of the error. - returned: always - type: str - sample: "IPSEC IS DOWN" - certificate_arn: - description: The Amazon Resource Name of the virtual private gateway tunnel endpoint certificate. - returned: when a private certificate is used for authentication - type: str - sample: "arn:aws:acm:us-east-1:123456789012:certificate/c544d8ce-20b8-4fff-98b0-example" - vpn_connection_id: - description: The ID of the VPN connection. - returned: always - type: str - sample: "vpn-f700d5c0" - vpn_gateway_id: - description: The ID of the virtual private gateway at the AWS side of the VPN connection. - returned: always - type: str - sample: "vgw-cbe56bfb" -""" - -import json -from typing import Any -from typing import Dict -from typing import NoReturn - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_vpn_connections -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def date_handler(obj: Dict[str, Any]) -> Dict[str, Any]: - return obj.isoformat() if hasattr(obj, "isoformat") else obj - - -def list_vpn_connections(client, module: AnsibleAWSModule) -> NoReturn: - params: Dict[str, Any] = {} - - params["Filters"] = ansible_dict_to_boto3_filter_list(module.params.get("filters")) - params["VpnConnectionIds"] = module.params.get("vpn_connection_ids") - - try: - result = json.loads(json.dumps(describe_vpn_connections(client, **params), default=date_handler)) - except ValueError as e: - module.fail_json(e, msg="Cannot validate JSON data") - except AnsibleEC2Error as e: - module.fail_json_aws(e, msg="Could not describe customer gateways") - - snaked_vpn_connections = [camel_dict_to_snake_dict(vpn_connection) for vpn_connection in result] - if snaked_vpn_connections: - for vpn_connection in snaked_vpn_connections: - vpn_connection["tags"] = boto3_tag_list_to_ansible_dict(vpn_connection.get("tags", [])) - - module.exit_json(changed=False, vpn_connections=snaked_vpn_connections) - - -def main(): - argument_spec = dict( - vpn_connection_ids=dict(default=[], type="list", elements="str"), - filters=dict(default={}, type="dict"), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - mutually_exclusive=[["vpn_connection_ids", "filters"]], - supports_check_mode=True, - ) - - connection = module.client("ec2") - - list_vpn_connections(connection, module) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_vpc_vpn/aliases b/tests/integration/targets/ec2_vpc_vpn/aliases deleted file mode 100644 index 28e84af91be..00000000000 --- a/tests/integration/targets/ec2_vpc_vpn/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_vpc_vpn_info diff --git a/tests/integration/targets/ec2_vpc_vpn/meta/main.yml b/tests/integration/targets/ec2_vpc_vpn/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_vpc_vpn/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml b/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml deleted file mode 100644 index 6a9f9125688..00000000000 --- a/tests/integration/targets/ec2_vpc_vpn/tasks/main.yml +++ /dev/null @@ -1,232 +0,0 @@ ---- -- name: EC2 VPN Connection integration tests - collections: - - amazon.aws - module_defaults: - group/aws: - access_key: '{{ aws_access_key }}' - secret_key: '{{ aws_secret_key }}' - session_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - block: - - # ============================================================ - - name: Create a VPC - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - state: present - cidr_block: "10.0.0.0/26" - tags: - Name: "{{ resource_prefix }}-vpc" - Description: "Created by ansible-test" - register: vpc_result - - - name: Create an EC2 VPC gateway and attach it to VPC - community.aws.ec2_vpc_vgw: - state: present - vpc_id: '{{ vpc_result.vpc.id }}' - name: "{{ resource_prefix }}-vgw" - register: vgw - - - name: Create customer gateway - community.aws.ec2_customer_gateway: - bgp_asn: 12345 - ip_address: 1.2.3.4 - name: testcgw - register: cgw - - - name: Create transit gateway - community.aws.ec2_transit_gateway: - description: "Transit Gateway for vpn attachment" - register: tgw - - - name: Create an EC2 VPN Connection, with customer gateway, vpn_gateway_id and transit_gateway - community.aws.ec2_vpc_vpn: - customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' - vpn_gateway_id: '{{ vgw.vgw.id }}' - transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' - state: present - register: result - ignore_errors: true - - - name: Assert creation of vpn failed - ansible.builtin.assert: - that: - - result is failed - - result.msg == "parameters are mutually exclusive: vpn_gateway_id|transit_gateway_id" - - - name: Create EC2 VPN Connection, with customer gateway and transit_gateway - community.aws.ec2_vpc_vpn: - customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' - transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' - state: present - wait_timeout: 1000 - register: tgw_vpn - - - name: Store ID of VPN - ansible.builtin.set_fact: - vpn_id: '{{ tgw_vpn.vpn_connection_id }}' - - # ============================================================ - - name: Test success with no parameters - community.aws.ec2_vpc_vpn_info: - register: result - - - name: Assert success with no parameters - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.vpn_connections != []' - # ============================================================ - - - name: Delete EC2 VPN Connection created with transit gateway - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn_id }}' - register: result - retries: 10 - delay: 3 - until: result is not failed - ignore_errors: true - - # ============================================================ - - - name: Create EC2 VPN Connection, with customer gateway and vpn gateway - community.aws.ec2_vpc_vpn: - customer_gateway_id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' - vpn_gateway_id: '{{ vgw.vgw.id }}' - state: present - register: vpn - - - name: Store ID of the EC2 VPN Connection - ansible.builtin.set_fact: - vpn_id: '{{ vpn.vpn_connection_id }}' - - # ============================================================ - - - name: Test success with no parameters - community.aws.ec2_vpc_vpn_info: - register: result - - - name: Assert success with no parameters - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.vpn_connections != []' - - - name: Test success with customer gateway id as a filter - community.aws.ec2_vpc_vpn_info: - filters: - customer-gateway-id: '{{ cgw.gateway.customer_gateway.customer_gateway_id }}' - vpn-connection-id: '{{ vpn.vpn_connection_id }}' - register: result - - - name: Assert success with customer gateway id as filter - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.vpn_connections != []' - - # ============================================================ - - - include_tasks: 'tags.yml' - - # ============================================================ - - - name: Delete EC2 VPN Connection (check_mode) - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn_id }}' - register: result - check_mode: true - - - name: Assert EC2 VPN Connection is deleted (check_mode) - ansible.builtin.assert: - that: - - result is changed - - - name: Delete EC2 VPN Connection - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn_id }}' - register: result - - - name: Assert EC2 VPN Connection is deleted - ansible.builtin.assert: - that: - - result is changed - - - name: Delete EC2 VPN Connection - idempotency (check) - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn_id }}' - register: result - check_mode: true - - - name: Assert result has not changed (idempotency check_mode) - ansible.builtin.assert: - that: - - result is not changed - - - name: Delete EC2 VPN Connection - idempotency - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn_id }}' - register: result - - - name: Assert result has not changed (idempotency) - ansible.builtin.assert: - that: - - result is not changed - - # ============================================================ - always: - - - name: Delete EC2 VPN Connection - community.aws.ec2_vpc_vpn: - state: absent - vpn_connection_id: '{{ vpn.vpn_connection_id }}' - register: result - retries: 10 - delay: 3 - until: result is not failed - ignore_errors: true - - - name: Delete customer gateway - community.aws.ec2_customer_gateway: - state: absent - ip_address: 1.2.3.4 - name: testcgw - bgp_asn: 12345 - register: result - retries: 10 - delay: 3 - until: result is not failed - ignore_errors: true - - - name: Delete VPN gateway - community.aws.ec2_vpc_vgw: - state: absent - vpn_gateway_id: '{{ vgw.vgw.id }}' - register: result - retries: 10 - delay: 3 - until: result is not failed - ignore_errors: true - - - name: Delete VPC - amazon.aws.ec2_vpc_net: - name: "{{ resource_prefix }}-vpc" - state: absent - cidr_block: "10.0.0.0/26" - register: result - retries: 10 - delay: 3 - until: result is not failed - ignore_errors: true - - - name: Delete transit gateway - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ tgw.transit_gateway.transit_gateway_id }}' - state: absent - ignore_errors: true diff --git a/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml b/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml deleted file mode 100644 index 21ea2cfd618..00000000000 --- a/tests/integration/targets/ec2_vpc_vpn/tasks/tags.yml +++ /dev/null @@ -1,330 +0,0 @@ -- vars: - first_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - second_tags: - 'New Key with Spaces': Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - third_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - final_tags: - 'Key with Spaces': Value with spaces - CamelCaseKey: CamelCaseValue - pascalCaseKey: pascalCaseValue - snake_case_key: snake_case_value - 'New Key with Spaces': Updated Value with spaces - NewCamelCaseKey: CamelCaseValue - newPascalCaseKey: pascalCaseValue - new_snake_case_key: snake_case_value - module_defaults: - ec2_vpc_vpn: - vpn_connection_id: '{{ vpn_id }}' - ec2_vpc_vpn_info: - filters: - vpn-connection-id: '{{ vpn_id }}' - block: - - # ============================================================ - - - name: Add tags (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vpn - check_mode: true - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Add tags - community.aws.ec2_vpc_vpn: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: {} - register: tag_vpn_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == first_tags - - - name: Add tags - IDEMPOTENCY (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vpn - check_mode: true - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Add tags - IDEMPOTENCY - community.aws.ec2_vpc_vpn: - tags: '{{ first_tags }}' - state: 'present' - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: {} - register: tag_vpn_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == first_tags - - # ============================================================ - - - name: Modify tags with purge (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ second_tags }}' - state: 'present' - purge_tags: true - register: tag_vpn - check_mode: true - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Modify tags with purge - community.aws.ec2_vpc_vpn: - tags: '{{ second_tags }}' - state: 'present' - purge_tags: true - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify the tags were added - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == second_tags - - - name: Modify tags with purge - IDEMPOTENCY (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ second_tags }}' - state: 'present' - purge_tags: true - register: tag_vpn - check_mode: True - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Modify tags with purge - IDEMPOTENCY - community.aws.ec2_vpc_vpn: - tags: '{{ second_tags }}' - state: 'present' - purge_tags: true - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == second_tags - - # ============================================================ - - - name: Modify tags without purge (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vpn - check_mode: True - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Modify tags without purge - community.aws.ec2_vpc_vpn: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: False - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: verify the tags were added - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == final_tags - - - name: Modify tags without purge - IDEMPOTENCY (check_mode) - community.aws.ec2_vpc_vpn: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: false - register: tag_vpn - check_mode: true - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Modify tags without purge - IDEMPOTENCY - community.aws.ec2_vpc_vpn: - tags: '{{ third_tags }}' - state: 'present' - purge_tags: false - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == final_tags - - # ============================================================ - - - name: No change to tags without setting tag (check_mode) - community.aws.ec2_vpc_vpn: - state: 'present' - register: tag_vpn - check_mode: true - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: No change to tags without setting tags - community.aws.ec2_vpc_vpn: - state: 'present' - register: tag_vpn - - - name: Get CE2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify no tags were added - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].tags == final_tags - - # ============================================================ - - - name: Remove tags (check_mode) - community.aws.ec2_vpc_vpn: - tags: {} - state: 'present' - purge_tags: true - register: tag_vpn - check_mode: true - - - name: Assert would change - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Remove tags - community.aws.ec2_vpc_vpn: - tags: {} - state: present - purge_tags: true - register: tag_vpn - - - name: Get EC2 VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify the tags were removed - ansible.builtin.assert: - that: - - tag_vpn is changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id - - - name: Remove tags - IDEMPOTENCY (check_mode) - community.aws.ec2_vpc_vpn: - tags: {} - state: 'present' - purge_tags: true - register: tag_vpn - check_mode: true - - - name: Assert would not change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - - name: Remove tags - IDEMPOTENCY - community.aws.ec2_vpc_vpn: - tags: {} - state: 'present' - purge_tags: true - register: tag_vpn - - - name: Get VPC VPN facts - community.aws.ec2_vpc_vpn_info: - register: tag_vpn_info - - - name: Verify no change - ansible.builtin.assert: - that: - - tag_vpn is not changed - - tag_vpn.vpn_connection_id == vpn_id - - tag_vpn_info.vpn_connections[0].vpn_connection_id == vpn_id diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/__init__.py b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_1.json deleted file mode 100644 index 2b8018f2548..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "22cf9d88-b0ca-4a6c-8bfa-a2969541f25b", - "HTTPHeaders": { - "content-length": "249", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_2.json deleted file mode 100644 index 540cb22d86b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnectionRoute_2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ee7493f2-1db0-4edb-a2c8-66dc31c41df8", - "HTTPHeaders": { - "content-length": "249", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 16510d83d40..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9b06e28e", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b0fe4793-77a1-4c92-978c-975c7b963c59", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 30d8ac08ee9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "92162d1f-1563-4b14-8fc5-0821c50687cb", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:48 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 97f64fd2526..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9843e24b-c094-451f-9be3-3f859dc39385", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5887", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:06 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index d67ec8ac010..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d5d76451-0539-4de2-a197-dac87c4eb91b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:17:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index c61544026a8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7906c368-77fc-4afc-9ee4-c822dab4864e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:17:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 95032ac3f5b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b9e2ca97-e467-4dcc-a8fc-eff788e8ed49", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:17:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 76d21af3c23..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "249f8e82-8137-4b69-8002-969e880dbcd2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 101822a5d9c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "554aea72-2359-4c35-956b-1cd55c3b1ded", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index a4fd2ecce72..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a9203775-14d5-4020-aa61-f6709cd6c455", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:32 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 6092812e211..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 18, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c0621c72-8851-4c34-9d3d-7ae4bb5de50f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index ef7b5d3723b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 18, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "62aae2fc-e699-4a66-9bea-1b4b2b26ce35", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_18.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_18.json deleted file mode 100644 index afa295f3bfd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_18.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 18, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0d20ed3c-a88e-42ba-87cc-f573d22b0a11", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_19.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_19.json deleted file mode 100644 index 320101d50cd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_19.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [ - { - "DestinationCidrBlock": "195.168.2.0/24", - "State": "available" - }, - { - "DestinationCidrBlock": "196.168.2.0/24", - "State": "available" - } - ], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 2, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 18, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 2, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 23, - "minute": 17, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d5ce628c-8270-4bb8-b0d9-c68b5834a9a8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:18:48 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 12e36ed156e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "96ef43c9-1210-47a7-87f7-22c85a05eb2b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_20.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_20.json deleted file mode 100644 index bca49264855..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_20.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "Routes": [ - { - "DestinationCidrBlock": "196.168.2.0/24", - "State": "deleted" - }, - { - "DestinationCidrBlock": "195.168.2.0/24", - "State": "deleted" - } - ], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3a0d05ae-dbf7-4885-9b50-db2899bc30d5", - "HTTPHeaders": { - "content-length": "1066", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:18:48 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index b868885c82d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c4fb8aa0-39ad-4333-9b45-25b48ce5a8cd", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:22 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 619c4866240..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b728a197-4790-4987-afe1-23ba2d2edf55", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:38 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 9ab3007c3a9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "06bdac8b-d1ec-48d6-9af4-b2d5bf3fa2f4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:55 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 193586bf442..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "baefffe5-7638-423e-84fc-fd21fa7fc6d1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:16:10 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index b8569545efc..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "591329e5-78f5-4655-90c0-bf2b312b54af", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:16:26 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 66e29949af0..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4e526b69-b5ea-4f05-a81b-831aa5825e18", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:16:42 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 35f035130df..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_routes/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9b06e28e", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.38\n 255.255.255.252\n 30\n \n \n \n \n 52.11.116.135\n \n \n 169.254.13.37\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n OwpaQwQaVjEM2nWZRYOhh3.TxgU5QyG1\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.130\n 255.255.255.252\n 30\n \n \n \n \n 52.38.13.135\n \n \n 169.254.13.129\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oIbjSO1e2SVBqRuW2PzKn.CgsAdSOMME\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.11.116.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.13.135", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 7, - "minute": 15, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "534f5ec5-2d5f-46ac-8216-453fc4cad713", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:16:58 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateTags_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateTags_1.json deleted file mode 100644 index 8af115a96ec..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateTags_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9661b9b4-e18b-491b-8182-6548bfb680bb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:12:21 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateVpnConnection_1.json deleted file mode 100644 index e7cd28ab8b1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9e06e28b", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0c445bcd-4e37-4368-b45d-b4560bde459f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5236", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index e190e232a71..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8deda3c9-1498-44ef-a663-111e93657c7f", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:22 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 6d975f1ac7c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e3c0cd84-d327-4a9e-8cac-0361a0afaaac", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "4836", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 6066eb507ba..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3888db16-157b-404a-9fea-fe27e8bd556d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:11:34 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 92d1f1e7f57..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ada7d223-32a6-4b60-81bb-63bca2cb2d56", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:11:50 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index e60cb21cec4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "def174a4-c5c2-4e5b-a5b6-1c2448e869f1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 055f7de90ef..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7c65999e-0e70-4aac-a720-b2216dbe70af", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:20 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index e199f3c0fc3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1153ff47-87b6-40b1-bcdd-ae66c4d4a3ae", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:21 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index f67a916094c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c0748f40-1e33-4f0b-9417-77092bfc9090", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:21 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 8b6d7e2d30a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 41, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 11, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "16aa6a4d-0fca-4035-b607-c223fc424f81", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:12:22 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 78a05ba8605..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0d463b0f-87ea-4ada-a79a-f2bb0910c31c", - "HTTPHeaders": { - "content-length": "878", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:22 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 5c0dea83c39..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bab29653-3411-49bb-af70-3d7b3284ca06", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 3b47382cf9d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d3732d64-34fb-40eb-bddb-c34e5e571921", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 701f05ae0a9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bd3ccd25-a6d6-44cf-9371-f01ca22d3f57", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:10:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index f25da7060f1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "36906e17-078f-4c15-9e01-af3e233af2d3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:10:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index f8aa9ec9734..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "cab9bb1a-7afe-4c5f-b106-038b10cba813", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:10:31 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index 1a8a4f86aae..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "938c6207-f582-4935-bef5-a9e3b01e18e1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:10:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index e7f974dced9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0bf3fb58-412a-447c-8cf7-af7185ec7f93", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:11:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index dbbefcbc5a6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/add_tags/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 34.212.254.7\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n b2DU0T9yhIWbDPukoG2NBtbPNrruDTRm\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.106\n 255.255.255.252\n 30\n \n \n \n \n 35.160.254.75\n \n \n 169.254.15.105\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n FOhYu_zZqXdic2Bvm_dYS03ONJCK.LfP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.212.254.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.160.254.75", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b67d7024-2bad-4283-b440-5519b5541867", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:11:18 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 503422fc263..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9f06e28a", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3239a34a-f3ed-4ba7-9d31-99265ceda2a9", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5237", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 46de4d6ab4c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bdcbf647-c1cc-4971-b133-3e1cd8ee36d5", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 835d53a9d95..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "87d4db59-f8e6-4d4c-9800-7c0bda5ebee2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "4397", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:46 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 7ee030b7d87..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "40e8326d-2f4b-4761-a2f9-011c989b0d11", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:08:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 9e4979b24f6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 3, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5c5688ae-0f6e-4d88-adb6-d9f654c74b42", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:08 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index ba464dc252b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 3, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7a5c5c59-d48a-467b-9414-097a93c923ae", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 57967a5e57e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 3, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "cb26ba43-cfc6-466b-8bde-5e63d58728e0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 6f500939bb7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 3, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1005f435-3e86-461f-a96c-a4f45c32c795", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index 6f500939bb7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 3, - "minute": 9, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1005f435-3e86-461f-a96c-a4f45c32c795", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 55bbb3116e8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "edac5b19-14be-4b2d-ab47-a2279de47d40", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:09:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index a69976b5566..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "07ee7fe5-c16a-4940-b099-3cd39aa9c2c8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index b1254a9ff9a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7f34b516-b810-4a2b-8e9c-2e4ac5ea32f2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:07:03 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 97128118379..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3f0d6abf-421a-4e56-9f19-a95c4639cbe6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:07:18 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 71ccc5f0bfb..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8174eae1-ae94-492c-b8d3-369a912dc994", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:07:34 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 7fba5fbca67..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ab76cd4e-9a69-48f4-8fa6-7b1ea9710f2d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:07:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index e98f0cead5f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9e552112-f325-4d3e-bb3d-0698b69a9074", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:08:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 9f3c01830c7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1c10aa65-e78f-41e5-bb24-7902b7974bff", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:08:21 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 863aa6350ce..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_nonmodifiable_attr/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.114\n 255.255.255.252\n 30\n \n \n \n \n 52.43.202.248\n \n \n 169.254.15.113\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n spNJGPBQfzbK8hNvpHNOaaml_paRZNKs\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.126\n 255.255.255.252\n 30\n \n \n \n \n 54.70.185.193\n \n \n 169.254.14.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n yE7hnuavW4SzersgnMyKIoKbd0rE8giW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.43.202.248", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 47, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.70.185.193", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 8, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1963dfb1-564a-4a0c-932c-ecddcdb39d41", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:08:37 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateTags_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateTags_1.json deleted file mode 100644 index 32afe4c15d7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateTags_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8738f361-b294-47d7-a6d7-82d289db5e5f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:06:44 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 0e22d719b02..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9c06e289", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d94359a8-8a4f-4087-b848-27de6253ff6c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 0d225110b26..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e780e8ce-5417-4a33-a39e-dd78a18b69a5", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 548dcfe963a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "35740449-70e9-4723-b5c4-8c82dc5ec5e6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "3673", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 584a6216a2a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "2d618f80-4045-4951-8d2e-c8d33395a141", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:42 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index f328bac1ba8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c9e48b82-1edc-4aa7-ac4d-c45c7bd4ae19", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:42 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 4137627685e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b346f588-dc55-4be6-95c8-e4708609a4e2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:43 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index b8a3a18fa79..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a5650999-a5ad-4eea-b407-6d9913738f24", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:06:43 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 56db26d9b81..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5e8c0572-8f87-4708-9aca-997ea3736bc4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:43 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index 84a774dd80d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "134576b2-43ed-40ac-aefb-c4770a81f587", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6407", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index e2bdf29eeeb..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 28, - "minute": 6, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5daf9a13-6835-4e6d-be9f-040405da8dff", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6407", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 4f365045384..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "561b039d-ffee-42dc-a390-6dde1ae4fcfe", - "HTTPHeaders": { - "content-length": "990", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index ebd539e3a5c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "29d88495-a6b4-4f53-9ec7-32ac21fd80c6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 9b004c2a971..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a647316d-7079-4a0a-8ad3-91a0a36dc124", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:51 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 9cf6f0ffc36..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f913c208-ac39-4b8e-aba5-1410f2e4d6cf", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:05:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 88eeadf41a5..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "260f7ff4-ec3b-452e-90f3-9ffb3d5f6895", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:05:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 860dcfd3312..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fb308284-ea47-44f9-af61-3c0271809839", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:05:39 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index d71b6108ec2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5e0c4efb-8f23-4ce1-b1fe-c5bccac45063", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:05:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 6ca0be0346b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "be516d5b-d999-4de7-bd3e-9c0cb5de857c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:09 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 633be4130cd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/check_for_update_tags/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.163.112.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n HxHFvA2bBdWo_sBRDHLiRCDviolMhaMR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.42\n 255.255.255.252\n 30\n \n \n \n \n 54.148.246.46\n \n \n 169.254.15.41\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n YANkpCz981zsiW_QkZCFrjN1QAiKm73G\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.112.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 36, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.148.246.46", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 57, - "minute": 5, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "007948c6-bac8-4f43-8b80-5e7c32f2d1e8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:06:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.CreateVpnConnection_1.json deleted file mode 100644 index c7f4a8a970d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9006e285", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e312dbd3-7956-4b0e-bb66-29a85e65e477", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5233", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 933d9868223..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fd2ddf0e-f378-46d7-92e7-1b6008d98b04", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:11 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 4c2a4f72bc4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bcdba325-fd96-4c4b-bb15-dc9a88c456ae", - "HTTPHeaders": { - "content-length": "1917", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 25f9a24c45a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ee75ebe8-0587-49b5-a231-0d31f713e3be", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:55:39 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index fde1cd4c02e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5cbe30a2-8771-4116-ba7d-78c32a06546e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:55:55 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 3c37b32a2bb..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 56, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3d3d8178-0359-4c80-85c7-410411a532f4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:11 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index e13b27d041c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 56, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "67e4f285-2875-4615-ba4e-a36105d24dd7", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:11 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index beaa98a1c0a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 56, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a31cc536-1f4b-46d7-a91d-c8d0909eb897", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:11 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index cf88d5b8d0f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0cf4c8bf-4f69-4f9f-b6ae-aecbbcb60081", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:12 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 4803740289d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "07019e0f-0012-47dc-8f86-950bb2b36e52", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 5e69b0584df..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8174c5d9-d54a-4173-aef3-5e9c3e86bac6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 47ad906096b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "46432541-20bd-444f-ab0a-38db7c36aab5", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:54:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index f7137760d33..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "84598175-301b-40e4-884d-4e4777267375", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:54:21 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 69249db308c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "092fbf9c-c529-4f71-855e-20b4289dc6f4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:54:37 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index da6185154f4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6d1bb01f-6afe-418c-94c2-7d83c4f94a4d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:54:52 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 284e8b5492f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "830ae224-6cdf-46e2-817b-92bcd5fa86ec", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:55:08 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 3f1a6a680f2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 52.24.101.167\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n ZqeYNh0tOtKAbA2GjOnfP1ckplrsKR0I\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.58\n 255.255.255.252\n 30\n \n \n \n \n 52.40.126.9\n \n \n 169.254.14.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 2hNRbfughR8JKpllR1mEg0uPRckXd0bR\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.24.101.167", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 10, - "minute": 55, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.126.9", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 34, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "51ec304a-3c90-4bbe-86dc-56d87d693ef6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:55:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 45abc721826..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9306e286", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "541d2997-d79d-42b4-af0a-7d49754a99a0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5235", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:14 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 46c92879a6f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e9b91aeb-4237-44ba-9367-b9d240b3d8ba", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 5a1e79ea42e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fc165fe7-372e-4517-a256-5e12138aa890", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "2356", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:14 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 06d4d8371d6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9e46eaa5-4f5b-42ff-ada0-d90504c0bd9c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:58:20 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index fc46769aff2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a3d938cd-ea4f-4739-87df-956db661c1a3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:58:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 0a7045f11ed..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c49c942f-0408-4d6d-b04a-1778dc3a3c43", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:58:52 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 385a832a5e4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "18debff6-05c3-44ad-8106-1c1099fba0e0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index cb313c523ce..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6fb7285e-c4ff-4f11-bdbc-464efbb66f15", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index 4749c57d5dc..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "cffd1787-58a7-4506-b14b-0bab509b8a1a", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index de15a8f21dc..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "cb19e2ba-a42a-47d3-a20f-9ea9521978f4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:23 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 33283151024..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "de97618e-a5a7-4efd-925c-6ca24b2603c6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:59:24 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_18.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_18.json deleted file mode 100644 index 505d1a36a5b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_18.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "aa76261f-ab0e-4bd4-a412-a59e7fdfb6db", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_19.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_19.json deleted file mode 100644 index caac14d220a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_19.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 58, - "minute": 58, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 0, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9885231e-ee67-49cb-ada6-e8eb3c772e6b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 7e870bbe37f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ca30a295-dfce-49f8-a1d1-f5af0dffd1c2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:14 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_20.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_20.json deleted file mode 100644 index 0f39c5aa638..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_20.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "204f247b-ad5a-4917-bc3e-a793bf09bd48", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 1af37e30570..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a8ebc328-fea9-430d-a546-c5e24d447cef", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index e8ab98030aa..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "edf29e1c-30a1-4d11-9e5a-feddd7f082ab", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:56:46 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 5e8203fec88..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "51c5182c-f83e-496b-ba45-e4972064d690", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:57:01 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index cf06e0ad472..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b9255f48-f509-42a9-8c0f-6626a492b46e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:57:17 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index e7965bd025f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bab0deee-150b-4952-b949-4acefe6ebafe", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:57:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index e7c600455d1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c90d25a2-7e6c-42cc-8f5a-17ab0c58e720", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:57:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 17bd7e73954..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/create_connection_that_exists/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.15.146\n 255.255.255.252\n 30\n \n \n \n \n 34.213.145.113\n \n \n 169.254.15.145\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n iNsKYUCSTSepYCf0igJVeirisatbjYiw\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.86\n 255.255.255.252\n 30\n \n \n \n \n 52.40.202.36\n \n \n 169.254.14.85\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n KZpfPULAV7ahI1aUspYf9oy4412BFNoP\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.213.145.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.202.36", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 15, - "minute": 56, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b1da658d-a66a-4def-873f-193ede827765", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:58:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 21408b7a6da..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9d06e288", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6b76950f-28f0-4e74-9b61-14780c62ced9", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index a27bc82cf9f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e0e829b9-86e9-4b26-aa01-ccacf0a77edc", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:31 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index fc618a3241d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "149f4f23-9fec-4995-acc5-0db46d4d698f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "3234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 958e8a9821a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5bb89e85-8f96-43b1-96e3-0fd6c00f9b14", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:03:58 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 265a34962da..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "40ebbb4a-0a18-494e-9666-3481637027fc", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:14 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 71caefcf584..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 19, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a86ec01a-5ea5-4fba-8123-5567a04a3596", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 037ba1a1d95..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 19, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6c96cc41-2657-47a0-b437-a79b0631bbd8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 7e74e95fbe4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 19, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1f605613-e582-4b3b-8838-e9fcf0c58e67", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index 5bbb025be0a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 19, - "minute": 4, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9e38c8b0-f339-463a-b92f-aa90fd3315e8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:04:31 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 786f224ead0..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0d2390b1-83fb-40f6-ab75-adf605a9a3fc", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:31 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 7abf137d37f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e29c19bc-d875-4b6b-83b2-bc2fdfb87bf0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index e7dc1a4a4f2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "686ef8bb-a95e-4b86-b814-f272c54c8ea5", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:02:09 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 3e3f889f906..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c0583208-1fa5-4c6e-8970-8dd2f3ecd62d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:02:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 59d520d1c43..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b10cdcbf-b16e-43c0-99b1-2fe2ad8db09b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:02:40 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 06ce44a44db..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "93d3176a-6d6a-44de-8a20-91bd4a64b3a3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:02:56 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index e15dc61ebf8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "329c10c9-0ee8-48d3-acb2-b48668ddbab6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:03:12 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 806c717d2f4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bf983aa1-224e-470a-b0a1-add5bda488b5", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:03:27 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 8e7c3eccfb9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_connection/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.166.247.180\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n vMOOPmaOf_RaI5CYB1HP1LSN7fKVajOB\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.126\n 255.255.255.252\n 30\n \n \n \n \n 35.167.45.7\n \n \n 169.254.12.125\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n DP5uNzsBDGM2M79qOw0w4uttdQvvTmuE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.166.247.180", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 54, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.167.45.7", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 29, - "minute": 3, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4857fe1d-dc96-4168-a7e1-9fbb73282ab2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:03:43 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_nonexistent_connection/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_nonexistent_connection/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index eebfb3a70bf..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/delete_nonexistent_connection/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "VpnConnections": [], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8218208e-030d-4aea-9ae5-6e8534efe1ef", - "HTTPHeaders": { - "content-length": "243", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:04:32 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_1.json deleted file mode 100644 index 9f4209eea08..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ccf8e327-eeee-4db8-9ae6-006a8fe5628c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:48:04 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_2.json deleted file mode 100644 index 062840fc216..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateTags_2.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0e1859bf-b896-4a30-ab94-849441b914f9", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:48:05 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_1.json deleted file mode 100644 index c81bb5f509e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-6a06e27f", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5db2e287-2d09-4a50-aaa1-a4615ece9bd6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5235", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:03 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_2.json deleted file mode 100644 index 69c39a89a83..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.CreateVpnConnection_2.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-9e13c880", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9506e280", - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7533469a-5979-42fd-94de-c33a66d34065", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index cc17b12afc6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5670f275-006d-48db-91e0-72058d9d881f", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:06 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_2.json deleted file mode 100644 index d2fd5524e8f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DeleteVpnConnection_2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "35514550-20a7-4f91-b175-d21182ad8bdd", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index d9d2f28724b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "edae433c-c2f8-475a-95f9-5c3c00d0b54b", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:03 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index aeb3224679e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a30a934b-5716-4d4d-958a-7e780e333a24", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:08 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 3132117c7cd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "99b8bb83-e3f0-4b87-9121-5d862e2627f0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 89a6fd077d6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c6d1bf65-4f3e-4f7f-9274-281ebf433b2b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 6c50e6b66c8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "28733dff-592e-4c48-94f9-b4d56bbc246a", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index c8ad595dcb8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d38f939c-ded7-416b-a563-88161b71be1c", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index 06fd99e110b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "af7c54ed-ca7f-4013-adee-16133b822d53", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:26 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index ef0845944ac..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "24133f7b-2620-4f2b-98b5-427aaa5d04bd", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:41 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 1a5bc6e7858..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5ac6d438-cae6-40cc-9c63-81073def54be", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:45:57 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_18.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_18.json deleted file mode 100644 index 77dbba5bba1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_18.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "968a8ebd-ed59-4a8d-a314-83a6430bebd3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:46:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_19.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_19.json deleted file mode 100644 index 6c01e2c67f6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_19.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "07f96ac8-f5ec-43e4-ab7d-6b989e071808", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:46:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 2f51af37102..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b1b10bb7-e85c-44ca-b74e-85352550db52", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:04 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_20.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_20.json deleted file mode 100644 index 30ecbe4b4e2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_20.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0750711f-fafd-4323-a685-65329a0a9302", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:46:43 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_21.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_21.json deleted file mode 100644 index 844fdab041c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_21.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ec319bcc-2a61-43d3-a69c-9d94235aeb56", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:46:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_22.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_22.json deleted file mode 100644 index be8c4aa55b3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_22.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6fe5a339-9436-4077-a201-dab2b7b95039", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:47:16 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_23.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_23.json deleted file mode 100644 index 0a98ebdf353..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_23.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7897be6a-fc15-4608-bac0-c3cf7bba28c6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:47:31 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_24.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_24.json deleted file mode 100644 index d304915288f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_24.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 26, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "898cc57f-ab56-47d7-920e-995814f532a4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:47:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_25.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_25.json deleted file mode 100644 index 79b0739f098..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_25.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "134c741c-757b-4a87-9a34-c8f1848ef33e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_26.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_26.json deleted file mode 100644 index 49b4c09ab6d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_26.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8009af6c-6d35-45fa-a94d-5384d3b92573", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_27.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_27.json deleted file mode 100644 index 059a154eebd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_27.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7ef9e804-1eb9-4486-9285-584204a824a3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_28.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_28.json deleted file mode 100644 index 76ad9ba8ec6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_28.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "05c178e1-3f1f-4e0f-bb43-027d2b41f56c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6561", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:04 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_29.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_29.json deleted file mode 100644 index 0b2918289ea..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_29.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "92db5b5e-d7e6-4cfd-9d62-abdda5a6083c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:04 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 9f85a23b561..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "2a3a4fd7-189b-43b0-8a44-82ebd52dba01", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:19 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_30.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_30.json deleted file mode 100644 index cad1188b977..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_30.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 6, - "minute": 45, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ffa7e24d-e004-4b4e-9317-80b97dc89cc8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6288", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:04 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_31.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_31.json deleted file mode 100644 index 94f87c7d060..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_31.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0cebf278-197b-4bdd-b8d9-c44250637154", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6559", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_32.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_32.json deleted file mode 100644 index bba62063290..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_32.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4bc3a17b-6896-4f8a-b3bc-07cbbf88e9e2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:05 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_33.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_33.json deleted file mode 100644 index 630ea016d7f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_33.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7371d436-849d-4717-a284-e33389f8982d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6288", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:06 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_34.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_34.json deleted file mode 100644 index a294fb7421c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_34.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.15.138\n 255.255.255.252\n 30\n \n \n \n \n 35.164.115.77\n \n \n 169.254.15.137\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n LOIUEOybh.7onRDbkA0jIjVgwAanpstb\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.13.14\n 255.255.255.252\n 30\n \n \n \n \n 52.32.43.175\n \n \n 169.254.13.13\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n gVdPYm2D00u04GU8PlcRg8NayCIB.8hu\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.164.115.77", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.32.43.175", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 49, - "minute": 47, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b645a20e-3689-4a13-8af1-2dcc38f70a9b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6288", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:06 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_35.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_35.json deleted file mode 100644 index 42ea2ec0db8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_35.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6e80e598-aeb2-4ae1-bfe3-2383505379cc", - "HTTPHeaders": { - "content-length": "871", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_36.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_36.json deleted file mode 100644 index 9a97df1f0eb..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_36.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f4072f73-ff8c-49ed-89a7-eaed0389b11a", - "HTTPHeaders": { - "content-length": "873", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:08 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index ad74fa0620f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ed467717-f22a-4c33-a9e7-0f871d1b35b2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 9f2bb01f3fa..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "49f28398-4458-4c9d-9c04-598c9d8e76bd", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:50 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 58c773d2c01..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bebb46be-76a1-486b-a9d0-7f0e33f68294", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:44:06 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index a15fd0e3264..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "090f369a-71f4-4e60-b860-c1f5cc52a5ab", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:44:21 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 2765a9f26f7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f98ad6e5-e3c6-48ae-b6c1-d9ed9824ea88", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:44:37 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 9b6e2ada236..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_filters/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.194\n 255.255.255.252\n 30\n \n \n \n \n 35.163.160.156\n \n \n 169.254.14.193\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oC1SMX2FbEbY71f2sWq3DPOQELqt4h0p\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.13.90\n 255.255.255.252\n 30\n \n \n \n \n 52.33.241.73\n \n \n 169.254.13.89\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n oNaPmhtWjtzz4Wy3TolB1e5C1UK6_6t9\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.160.156", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 4, - "minute": 43, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.33.241.73", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 53, - "minute": 44, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ef918599-de1c-40e5-95ab-2a4b16356455", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:44:52 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_1.json deleted file mode 100644 index 52ca9673111..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f39595f7-c4f7-4e7c-9681-83e5619e0d84", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:50:34 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_2.json deleted file mode 100644 index 3aeb21cf6fe..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateTags_2.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "61647610-452d-4a99-abce-d8e61a6ada95", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:53:28 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 17aca9388e3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9706e282", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "080cc661-516b-4d6c-806b-64f54b232f57", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5235", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_2.json deleted file mode 100644 index 0080abe9dc4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.CreateVpnConnection_2.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-9e13c880", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9606e283", - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d49ec118-3438-40cb-bcb5-8e98d9676688", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5236", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index ddce99bb1ed..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "995f99a1-42d4-4d0f-b216-5e54c7052a71", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_2.json deleted file mode 100644 index 65af7a36663..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DeleteVpnConnection_2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "701a2c53-ef2e-4b77-bb0c-b0e4904dc714", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 59bbeec791c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "22e251ed-4e2b-49a4-8747-fcc9c39ad99e", - "HTTPHeaders": { - "content-length": "1310", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:12 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 334a32fc447..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 9, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "66c5b212-f514-4075-ab41-6c70424d13ef", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:17 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 27cf0e60f48..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 9, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4fa0db43-456e-491d-a6f6-2a2a262bc068", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 12afe81e0da..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 9, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "521f0a1b-e935-40c2-b896-b13b5b6f2d1a", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:34 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 0c5d8ca7849..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 9, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "da5b58d2-4042-4ed5-8faf-daceb3d706c6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6290", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 861ebd74b53..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d4e21661-391e-48b9-80f8-6c04a13a653e", - "HTTPHeaders": { - "content-length": "1312", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:35 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index d54c65027c0..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3b4a1671-80a6-45a7-b620-885f88f5fd77", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 41fc9a238f3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "55115858-ebfd-4329-85e8-5bd15b31e62d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:51 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 1d82c71110a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "241b82e1-4611-495a-952d-21fce8354e6e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:51:07 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_18.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_18.json deleted file mode 100644 index 0b0861b6896..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_18.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "898fcbc8-4c89-49cd-943f-7c2f0e3a73b7", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:51:22 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_19.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_19.json deleted file mode 100644 index c054486c7a3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_19.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "2f8be95a-d488-412c-9bc3-bca1c66c3ccf", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:51:38 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 9900b9b0a8b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bd0e67d4-f5a5-4e98-a388-e80af982bebf", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_20.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_20.json deleted file mode 100644 index 39ddd25ed78..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_20.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "66fe299d-2a18-4693-bdc3-00475c529a7f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:51:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_21.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_21.json deleted file mode 100644 index cd711acfe3f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_21.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b5ebc50e-0f1d-4d96-87c1-bf222c186911", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:52:09 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_22.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_22.json deleted file mode 100644 index 490f336b65d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_22.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4f123753-f797-4aff-83f2-edfdb31b679f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:52:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_23.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_23.json deleted file mode 100644 index 78223c6e995..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_23.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ff8ad5d4-4798-44f2-b89a-100387a1e1bc", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:52:40 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_24.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_24.json deleted file mode 100644 index 2a98e206985..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_24.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c69b6d28-6925-4b09-9a23-c58bd23a952d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:52:56 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_25.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_25.json deleted file mode 100644 index 069b679c245..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_25.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 36, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "30239673-06bd-4122-8187-834e098e3035", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:12 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_26.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_26.json deleted file mode 100644 index 95f632a8339..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_26.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 14, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a35493d8-79cf-44ce-a5d9-a322984952bb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:27 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_27.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_27.json deleted file mode 100644 index f3e3744186d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_27.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 14, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a0d807f4-6947-474e-86bc-f1d978a1e6c6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:27 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_28.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_28.json deleted file mode 100644 index 0eb348b26b7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_28.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 14, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "123f065b-f06a-4464-93e9-f0c9224825dc", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6290", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_29.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_29.json deleted file mode 100644 index 15182c9cab1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_29.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.142\n 255.255.255.252\n 30\n \n \n \n \n 34.215.4.190\n \n \n 169.254.12.141\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n l9lo.f40_7mQk6G.Xe1tZ3HnYaGrqeis\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.12.214\n 255.255.255.252\n 30\n \n \n \n \n 35.163.123.41\n \n \n 169.254.12.213\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n By_kbJfKdll6PTY4W.pMr7CC0gqeP5U2\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.215.4.190", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 41, - "minute": 52, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.163.123.41", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 14, - "minute": 53, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 9, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "State": "available" - }, - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c6c78a9a-e004-4766-8ef6-16c52b25475d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 12:53:28 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index fb9619cdcd6..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "2b96bd10-97eb-44b0-9ab9-548b0ddf03b9", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_30.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_30.json deleted file mode 100644 index 4dd608bc648..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_30.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1b613de0-c6e1-48d3-9c9d-b94de070ccda", - "HTTPHeaders": { - "content-length": "873", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_31.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_31.json deleted file mode 100644 index 6e537944b51..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_31.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0e36b69f-39b7-40ac-8273-8003211fc5f5", - "HTTPHeaders": { - "content-length": "873", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 4a13f61e8c3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ace0b6a9-e76f-4198-a077-1e2dffbc6c2e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:43 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 3695e62250f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "434a478c-99ab-4da1-9446-0190d615553f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:48:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 337959a7984..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "406c570c-4ca9-4657-aab6-c3aec6943a24", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:49:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index 171cce65798..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bc262f2c-187c-45ff-bd0e-b8287760d26e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:49:31 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 9b63c6f5f0c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "99bc2889-52c9-4933-ba37-9fc2524a6ec1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:49:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index a6472849102..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_insufficient_filters/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.26\n 255.255.255.252\n 30\n \n \n \n \n 34.214.254.212\n \n \n 169.254.14.25\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n AwW2EGlLGc4apzToCgrKQ2e4RexOSfj8\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.174\n 255.255.255.252\n 30\n \n \n \n \n 52.38.34.113\n \n \n 169.254.14.173\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n 5Slu8XDI5h2_TGXkCw_E2wAiRzyz3yIn\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "34.214.254.212", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 1, - "minute": 50, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.38.34.113", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 48, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "26fd3e6c-8c41-4e3b-8bda-47ee9b1ef167", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:50:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_nonexistent/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_nonexistent/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 288d2313bc4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_nonexistent/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9606e283", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-9506e280", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "79832782-f6e3-483a-b848-306c43731940", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "2087", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:53:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 90b1f2dd202..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-6f06e27a", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ef16cc59-db82-49e8-b39f-5ed5035a6fba", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5236", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_2.json deleted file mode 100644 index dbb692fb60b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.CreateVpnConnection_2.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-9e13c880", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-6906e27c", - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7311c482-6425-4bf5-b764-06652c9ea4b8", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5232", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:37 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 7d346168ad3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "73286a1c-f428-4617-9b23-b0af8e8e2657", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_2.json deleted file mode 100644 index cde1d023770..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DeleteVpnConnection_2.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6ff1e7ac-f41b-45f8-a925-99f12f15df72", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 079fe193fc1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "VpnConnections": [], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "784ab580-8495-4cff-b8a9-a70474686d99", - "HTTPHeaders": { - "content-length": "243", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 5a14e8385b3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "45a3a55f-4577-4292-9c88-6b20c8968bdb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:39:18 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index d70a4c405e4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "dea0cb15-a87a-4340-836d-6cd460b2243e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:39:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index 731805d6b95..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c9f63be4-079d-4dcd-adb8-ab18f8787a9c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:39:48 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index b7406b64cb7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "75e6bdc7-dab7-428c-900b-f8566fcdd8b4", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:04 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index a5f05224ef3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "02cad910-6d43-4d55-a031-4055a30bf411", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:20 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index f663512223e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 25, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "18e05aff-5c66-4e73-97bd-a63061019ed2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 53623b87b39..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 25, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "6df83c0e-40bd-41ed-8149-960375e0b0cf", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_17.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_17.json deleted file mode 100644 index 62f01fc341b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_17.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 25, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a6f596eb-c6a8-4e31-8e1a-bc1ae80443c5", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:36 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_18.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_18.json deleted file mode 100644 index 2336ab51cb7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_18.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "VpnConnections": [], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "dde896f2-98ea-45d2-8208-b71b46a88cd7", - "HTTPHeaders": { - "content-length": "243", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:37 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_19.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_19.json deleted file mode 100644 index 3741da6497e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_19.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "22bd50ce-bac1-4b63-bef5-d91e10a27cb6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:38 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 7552a17aae8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "acad86c4-655b-488f-a552-f04c60502dcb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_20.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_20.json deleted file mode 100644 index 448959205db..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_20.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4df8324c-5d9f-436e-b9c8-31d123170bcd", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:40:53 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_21.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_21.json deleted file mode 100644 index fcfe29941d3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_21.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "b2fddbbe-070c-40c4-b3ff-31b4ab039a93", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:41:09 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_22.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_22.json deleted file mode 100644 index 819d4fb183c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_22.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e4575384-f0ae-4ddb-a6f0-60bf09ae3431", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:41:24 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_23.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_23.json deleted file mode 100644 index f7b5de10de3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_23.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3c2df2d8-21ff-435b-a25e-309708e5d728", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:41:40 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_24.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_24.json deleted file mode 100644 index d2b789983e0..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_24.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "47bedfce-6c4f-40e5-8d3c-2f7618670665", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:41:55 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_25.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_25.json deleted file mode 100644 index bf69c4d5798..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_25.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "25fb78ea-cc25-427c-a1bb-c9bc06a0fcf0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:11 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_26.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_26.json deleted file mode 100644 index 005ca53be1a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_26.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "dfd25f0b-3331-46b0-9594-739e54b3633b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:27 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_27.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_27.json deleted file mode 100644 index a8dc687f131..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_27.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 31, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 37, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e0ce84a4-b7fa-4c51-89c5-f689f5ab05e7", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6116", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:42 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_28.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_28.json deleted file mode 100644 index 207caacdcff..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_28.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 31, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 46, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fbb5d0bf-db4a-4865-b74a-15c9d5dc9acb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:58 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_29.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_29.json deleted file mode 100644 index 397ea49ca36..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_29.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 31, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 46, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "06310935-6410-44da-ab8a-0a3a77b2ed02", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 6c2a473a761..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bc0abc0d-3217-4a9c-91b7-4cf7d1612270", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:29 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_30.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_30.json deleted file mode 100644 index 86a37a4779e..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_30.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-9e13c880\n vgw-32d70c2c\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 5.4.3.2\n \n \n 169.254.12.78\n 255.255.255.252\n 30\n \n \n \n \n 52.40.19.84\n \n \n 169.254.12.77\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n uckHBwcFkdkno4gf5nZHDLCNIM7WXFaW\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 5.4.3.2\n \n \n 169.254.15.46\n 255.255.255.252\n 30\n \n \n \n \n 54.149.194.122\n \n \n 169.254.15.45\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hyFjiPPXAKg6WDjLQkfT7be6lPSK1.TE\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.40.19.84", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 31, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "54.149.194.122", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 46, - "minute": 42, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-32d70c2c", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5ce492e4-a36b-4148-9db4-1cd1390f4d94", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:42:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_31.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_31.json deleted file mode 100644 index c5d67fffc90..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_31.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 25, - "minute": 40, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 39, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fab3e62a-b821-40cc-ac9d-3b589ddd7be9", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6124", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_32.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_32.json deleted file mode 100644 index 66db65f6bf7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_32.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c45356e9-b255-4886-bdeb-a200225b3066", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_33.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_33.json deleted file mode 100644 index 0abc8171746..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_33.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-9e13c880", - "VpnConnectionId": "vpn-6906e27c", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-32d70c2c", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "39d1181a-5c5b-4d7e-97cd-dcd5b83bc0b3", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:43:00 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 2c4135812dd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ed7c7fbb-b31b-4244-b588-e90821e65bff", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:45 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 6434571b265..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "096fa68d-3ed3-4483-b323-4b03cc2c1ebd", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:37:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 5e30b888c19..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e18b7cde-2baa-466e-a5ac-ac5cd94db089", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:38:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index c84d4c084d3..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5845f7f3-a0ea-4948-b3ee-d9ee3fc0f303", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:38:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 3b729eccb5d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4a29bfaa-c800-4ed7-858c-9ea4fc8de167", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:38:47 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 87dd4df8e48..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/find_connection_vpc_conn_id/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.14.34\n 255.255.255.252\n 30\n \n \n \n \n 35.161.239.138\n \n \n 169.254.14.33\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n XGAHy.QMOtIujnLKHvwNdGivflNQGbxc\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.12.230\n 255.255.255.252\n 30\n \n \n \n \n 52.26.108.105\n \n \n 169.254.12.229\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n hk9hgD21aBIIJSz4809scBxMT3dsX_0h\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.161.239.138", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.108.105", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 13, - "minute": 37, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "8c873704-b869-4dc2-890d-ebc7d62d7963", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:39:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.CreateVpnConnection_1.json deleted file mode 100644 index 1262491d43b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9206e287", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "686913e8-485a-4de0-880d-60a0c2444f65", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5235", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 2f8b7802e67..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ba0807f4-446e-471b-ad25-dc627d0917ff", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 3fe09832d7f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e85e108f-c5c6-4627-a409-ae5e57519e68", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "2795", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index 5726948840b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 32, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "fe0912ad-2a87-4f24-a2e9-ecce88edd3a6", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:33 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index c1593d62e4b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 32, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "3d9c0acf-a5e7-41cf-a929-17a804c23cf1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index f1d5f5b426f..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 32, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c59001df-f7a6-413d-8ba2-a3a3e1f3a08c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 686dfef8424..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 32, - "minute": 1, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f9a5a6a9-a952-4183-8600-f0d709ca5902", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:49 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 5a65e1dcb4d..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ad7f2a01-f5a2-41cb-b572-e55cfff6f0fd", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:50 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index b2bbc32a63b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "ffd0c558-1fb0-4e47-8a78-ad93241a8909", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:50 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index 4ce279f36de..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "aefdae0c-715c-468d-b209-df744593d702", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index a2d6c448ba0..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5e7d2b85-1951-4fa5-8003-dcae818ab111", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 9075e75e642..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "648be063-6a5d-4871-8ccf-047275662818", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 12:59:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index ba6c47c51ac..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "e5f1a740-ef05-454b-a8ce-26c6c96d6822", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:00:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index 089a0a16973..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "240aa4a8-495f-4e22-973a-d1b8ca85a7b7", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:00:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index a93c555c8b2..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "71e9943b-886d-442f-bd0d-eb50d92522e2", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:00:46 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index ca810951ba1..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "518172bc-6355-4988-8a92-14c589fbfc6f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 2af22bb65b8..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/modify_deleted_connection/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.13.206\n 255.255.255.252\n 30\n \n \n \n \n 52.26.213.112\n \n \n 169.254.13.205\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n PyWmFHtlfQSgohtXYC1MXVSE9i80QMOK\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.14.226\n 255.255.255.252\n 30\n \n \n \n \n 52.36.80.33\n \n \n 169.254.14.225\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n K_tnJM.Z5LxS.Y6vpeXIaCLdetEZik__\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.26.213.112", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.36.80.33", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 12, - "second": 28, - "minute": 59, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4679b3c8-f187-4207-81fc-79982e721cb0", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6118", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:01:18 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.CreateVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.CreateVpnConnection_1.json deleted file mode 100644 index f278854b925..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.CreateVpnConnection_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "data": { - "VpnConnection": { - "CustomerGatewayId": "cgw-6113c87f", - "Options": { - "StaticRoutesOnly": true - }, - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "VpnConnectionId": "vpn-9806e28d", - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - }, - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f5a54fbe-aabf-4b5e-82f6-0fc9cd13e50c", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5234", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteTags_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteTags_1.json deleted file mode 100644 index bf0afd35e49..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteTags_1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "2714ec51-d05e-4034-8401-2c99f5247755", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:15:02 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteVpnConnection_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteVpnConnection_1.json deleted file mode 100644 index 5cdff416eb9..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DeleteVpnConnection_1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": { - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d635286c-b0e0-4048-9edd-5370c643aab4", - "HTTPHeaders": { - "content-length": "239", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:03 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_1.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_1.json deleted file mode 100644 index 0e552275c2c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_1.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "0a7676c6-68de-4301-b107-5ef0fcf5136e", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "5448", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:25 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_10.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_10.json deleted file mode 100644 index f5afd3ed161..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_10.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "68efe4ef-9c50-414b-bd65-cbf418c25f72", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:14:30 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_11.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_11.json deleted file mode 100644 index 56c742fafed..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_11.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 38, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7b7f58cb-4e94-4cb2-9d93-ad6e82949476", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:14:46 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_12.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_12.json deleted file mode 100644 index fd2890b7efe..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_12.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 38, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "1d06bb9d-234a-43b4-9465-0f0d6769e7cb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:01 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_13.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_13.json deleted file mode 100644 index 18c7b173fe7..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_13.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 38, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d967fe54-4131-4d3c-8bec-ca51039d51f5", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:01 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_14.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_14.json deleted file mode 100644 index 3373af1da70..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_14.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 38, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "9bdf35c6-373f-4a9f-a86a-4f01cd15f742", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6122", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:02 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_15.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_15.json deleted file mode 100644 index bfe18c03743..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_15.json +++ /dev/null @@ -1,214 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 38, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 16, - "minute": 14, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "available" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9e06e28b", - "Category": "VPN", - "Tags": [ - { - "Key": "Ansible-Test", - "Value": "VPN" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9f06e28a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9c06e289", - "Category": "VPN", - "Tags": [ - { - "Key": "One", - "Value": "one" - }, - { - "Key": "Two", - "Value": "two" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9d06e288", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9206e287", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9306e286", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9006e285", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9706e282", - "Category": "VPN", - "Tags": [ - { - "Key": "Correct", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6a06e27f", - "Category": "VPN", - "Tags": [ - { - "Key": "Wrong", - "Value": "Tag" - } - ], - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - }, - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-6f06e27a", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "bcdce0f0-10da-4e78-8fbe-ac147d62013b", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-type": "text/xml;charset=UTF-8", - "server": "AmazonEC2", - "date": "Mon, 16 Apr 2018 13:15:02 GMT", - "transfer-encoding": "chunked" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_16.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_16.json deleted file mode 100644 index 1e44c3c514b..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_16.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VpnGatewayId": "vgw-35d70c2b", - "State": "deleted" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "4d572583-1b0c-431f-a9f9-7acd45d588e8", - "HTTPHeaders": { - "content-length": "705", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:15:03 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_2.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_2.json deleted file mode 100644 index d337c7f6938..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_2.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "c8f872e5-ef0e-4517-8ab8-9ef0788a04bc", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:26 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_3.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_3.json deleted file mode 100644 index 1d65fb2c689..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_3.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "d99d51ce-6b82-4f53-ade0-d4967b769c93", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:41 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_4.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_4.json deleted file mode 100644 index 3c63747c06c..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_4.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f43f34f0-e4d7-4888-9037-2d3f99a30f8f", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:12:57 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_5.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_5.json deleted file mode 100644 index 4b1ed8e7fd5..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_5.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "5b03354b-e15d-4cb7-92e3-b359870a99a3", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:13:13 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_6.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_6.json deleted file mode 100644 index f10651beffd..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_6.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "a022a838-4264-4f08-b309-bea8058706ae", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:13:28 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_7.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_7.json deleted file mode 100644 index 6f5406b365a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_7.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "f9ae9cd9-ce79-4245-863b-79fd5b39cdc1", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:13:44 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_8.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_8.json deleted file mode 100644 index 25e0713fdb4..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_8.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "57806378-a669-45b1-96ec-ab29ae8a47bb", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:13:59 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_9.json b/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_9.json deleted file mode 100644 index 98f25682a2a..00000000000 --- a/tests/unit/plugins/modules/placebo_recordings/ec2_vpc_vpn/remove_tags/ec2.DescribeVpnConnections_9.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "data": { - "VpnConnections": [ - { - "CustomerGatewayId": "cgw-6113c87f", - "VpnConnectionId": "vpn-9806e28d", - "Category": "VPN", - "CustomerGatewayConfiguration": "\n\n cgw-6113c87f\n vgw-35d70c2b\n ipsec.1\n NoBGPVPNConnection\n \n \n \n 9.8.7.6\n \n \n 169.254.12.22\n 255.255.255.252\n 30\n \n \n \n \n 35.165.156.252\n \n \n 169.254.12.21\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n z2x1x6uE.UaqsFoLbfNuGIzp0rZTLiT.\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n \n \n \n 9.8.7.6\n \n \n 169.254.15.58\n 255.255.255.252\n 30\n \n \n \n \n 52.39.145.205\n \n \n 169.254.15.57\n 255.255.255.252\n 30\n \n \n \n sha1\n aes-128-cbc\n 28800\n group2\n main\n dsNLWo6G.KUBY99TYvBnEMohghrqm6.k\n \n \n esp\n hmac-sha1-96\n aes-128-cbc\n 3600\n group2\n tunnel\n true\n true\n 1379\n \n 10\n 3\n \n \n \n", - "Routes": [], - "Options": { - "StaticRoutesOnly": true - }, - "Type": "ipsec.1", - "VgwTelemetry": [ - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "35.165.156.252", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - }, - { - "StatusMessage": "", - "Status": "DOWN", - "OutsideIpAddress": "52.39.145.205", - "AcceptedRouteCount": 0, - "LastStatusChange": { - "year": 2018, - "hour": 13, - "second": 26, - "minute": 12, - "__class__": "datetime", - "day": 16, - "month": 4, - "microsecond": 0 - } - } - ], - "VpnGatewayId": "vgw-35d70c2b", - "State": "pending" - } - ], - "ResponseMetadata": { - "HTTPStatusCode": 200, - "RequestId": "7efaeb2a-f071-4178-af9c-1bcdbb383d0d", - "HTTPHeaders": { - "vary": "Accept-Encoding", - "content-length": "6120", - "server": "AmazonEC2", - "content-type": "text/xml;charset=UTF-8", - "date": "Mon, 16 Apr 2018 13:14:15 GMT" - }, - "RetryAttempts": 0 - } - }, - "status_code": 200 -} \ No newline at end of file diff --git a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py b/tests/unit/plugins/modules/test_ec2_vpc_vpn.py deleted file mode 100644 index 8a7d2dee494..00000000000 --- a/tests/unit/plugins/modules/test_ec2_vpc_vpn.py +++ /dev/null @@ -1,263 +0,0 @@ -# (c) 2017 Red Hat Inc. -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - - -from unittest.mock import MagicMock -from unittest.mock import Mock - -import pytest - -from ansible_collections.community.aws.plugins.modules import ec2_vpc_vpn - - -@pytest.fixture -def ansible_module(): - module = MagicMock() - module.check_mode = False - module.params = {"delay": 5, "wait_timeout": 30} - module.fail_json.side_effect = SystemExit(1) - module.fail_json_aws.side_effect = SystemExit(1) - - return module - - -@pytest.mark.parametrize( - "vpn_connections, expected_result, expected_exception", - [ - # Case 1: Single VPN connection available - ( - [{"VpnConnectionId": "vpn-123", "State": "available"}], - {"VpnConnectionId": "vpn-123", "State": "available"}, - None, - ), - # Case 2: Multiple valid VPN connections available (expecting an exception) - ( - [ - {"VpnConnectionId": "vpn-123", "State": "available"}, - {"VpnConnectionId": "vpn-456", "State": "available"}, - ], - None, - "More than one matching VPN connection was found. To modify or delete a VPN please specify vpn_connection_id or add filters.", - ), - # Case 3: No VPN connections available - ([], None, None), - # Case 4: Multiple connections with one deleted (expecting the viable connection) - ( - [ - {"VpnConnectionId": "vpn-123", "State": "deleted"}, - {"VpnConnectionId": "vpn-456", "State": "available"}, - ], - {"VpnConnectionId": "vpn-456", "State": "available"}, - None, - ), - ], -) -def test_find_connection_response(ansible_module, vpn_connections, expected_result, expected_exception): - if expected_exception: - with pytest.raises(SystemExit) as e: # Assuming fail_json raises SystemExit - ec2_vpc_vpn.find_connection_response(ansible_module, vpn_connections) - assert e.value.code == 1 # Ensure exit code is as expected - # Check that the message is the same as expected - assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception - else: - result = ec2_vpc_vpn.find_connection_response(ansible_module, vpn_connections) - assert result == expected_result - - -@pytest.mark.parametrize( - "vpn_connection_id, filters, describe_response, expected_result, expected_exception", - [ - # Case 1: Single VPN connection found - ( - "vpn-123", - None, - {"VpnConnections": [{"VpnConnectionId": "vpn-123", "State": "available"}]}, - {"VpnConnectionId": "vpn-123", "State": "available"}, - None, - ), - # Case 2: Multiple VPN connections found (expecting an exception) - ( - "vpn-123", - None, - { - "VpnConnections": [ - {"VpnConnectionId": "vpn-123", "State": "available"}, - {"VpnConnectionId": "vpn-456", "State": "available"}, - ] - }, - None, - "More than one matching VPN connection was found. To modify or delete a VPN please specify vpn_connection_id or add filters.", - ), - # Case 3: No VPN connections found - ("vpn-123", None, {"VpnConnections": []}, None, None), - ], -) -def test_find_vpn_connection( - ansible_module, vpn_connection_id, filters, describe_response, expected_result, expected_exception -): - client = Mock() - ansible_module.params = {"vpn_connection_id": vpn_connection_id, "filters": filters} - - # Mock the describe_vpn_connections function - client.describe_vpn_connections.return_value = describe_response if describe_response else {} - - if expected_exception: - if "More than one matching VPN connection" in expected_exception: - with pytest.raises(SystemExit) as e: - ec2_vpc_vpn.find_vpn_connection(client, ansible_module) - # Check that the exception message matches the expected exception - assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception - else: - result = ec2_vpc_vpn.find_vpn_connection(client, ansible_module) - assert result == expected_result - - -@pytest.mark.parametrize( - "provided_filters, expected_result, expected_exception", - [ - ({"cgw": "cgw-123"}, [{"Name": "customer-gateway-id", "Values": ["cgw-123"]}], None), - ({"invalid_filter": "value"}, None, "invalid_filter is not a valid filter."), - ( - {"tags": {"key1": "value1", "key2": "value2"}}, - [{"Name": "tag:key1", "Values": ["value1"]}, {"Name": "tag:key2", "Values": ["value2"]}], - None, - ), - ({"static-routes-only": True}, [{"Name": "option.static-routes-only", "Values": ["true"]}], None), - ], -) -def test_create_filter(ansible_module, provided_filters, expected_result, expected_exception): - if expected_exception: - with pytest.raises(SystemExit) as e: - ec2_vpc_vpn.create_filter(ansible_module, provided_filters) - # Check that the exception message matches the expected exception - assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception - else: - result = ec2_vpc_vpn.create_filter(ansible_module, provided_filters) - assert result == expected_result - - -@pytest.mark.parametrize( - "params, expected_result, expected_exception", - [ - # Case 1: Successful creation of a VPN connection - ( - {"customer_gateway_id": "cgw-123", "vpn_gateway_id": "vgw-123", "static_only": True}, - {"VpnConnectionId": "vpn-123"}, - None, - ), - # Case 3: Missing required parameters (simulating failure) - ( - {"customer_gateway_id": None, "vpn_gateway_id": "vgw-123", "static_only": True}, - None, - "No matching connection was found. To create a new connection you must provide customer_gateway_id" - + " and one of either transit_gateway_id or vpn_gateway_id.", - ), - # Case 4: Both customer gateway and VPN gateway are None - ( - {"customer_gateway_id": None, "vpn_gateway_id": None, "static_only": False}, - None, - "No matching connection was found. To create a new connection you must provide customer_gateway_id" - + " and one of either transit_gateway_id or vpn_gateway_id.", - ), - # Case 5: Optional parameters passed (e.g., static routes) - ( - {"customer_gateway_id": "cgw-123", "vpn_gateway_id": "vgw-123", "static_only": True}, - {"VpnConnectionId": "vpn-456"}, - None, - ), - ], -) -def test_create_connection(ansible_module, params, expected_result, expected_exception): - client = Mock() - ansible_module.params = params - - if expected_exception: - client.create_vpn_connection.side_effect = Exception("AWS Error") - with pytest.raises(SystemExit) as e: # Assuming fail_json raises SystemExit - ec2_vpc_vpn.create_connection( - client, - ansible_module, - params["customer_gateway_id"], - params["static_only"], - params["vpn_gateway_id"], - None, - None, - None, - None, - None, - ) - # Check that the exception message matches the expected exception - assert str(ansible_module.fail_json.call_args[1]["msg"]) == expected_exception - else: - client.create_vpn_connection.return_value = {"VpnConnection": expected_result} - result = ec2_vpc_vpn.create_connection( - client, - ansible_module, - params["customer_gateway_id"], - params["static_only"], - params["vpn_gateway_id"], - None, - None, - None, - None, - None, - ) - assert result == expected_result - - -@pytest.mark.parametrize( - "vpn_connection_id, routes, purge_routes, current_routes, expected_result", - [ - # Case 1: No changes in routes - ( - "vpn-123", - ["10.0.0.0/16"], - False, - [{"DestinationCidrBlock": "10.0.0.0/16"}], - {"routes_to_add": [], "routes_to_remove": []}, - ), - # Case 3: Old routes empty, new routes not empty - ("vpn-123", ["10.0.1.0/16"], False, [], {"routes_to_add": ["10.0.1.0/16"], "routes_to_remove": []}), - # Case 4: New routes empty, old routes not empty - ( - "vpn-123", - [], - False, - [{"DestinationCidrBlock": "10.0.0.0/16"}], - {"routes_to_add": [], "routes_to_remove": []}, - ), - # Case 5: Purge routes - removing non-existent routes - ( - "vpn-123", - ["10.0.1.0/16"], - True, - [{"DestinationCidrBlock": "10.0.0.0/16"}], - {"routes_to_add": ["10.0.1.0/16"], "routes_to_remove": ["10.0.0.0/16"]}, - ), - # Case 6: Both old and new routes are empty - ("vpn-123", [], False, [], {"routes_to_add": [], "routes_to_remove": []}), - # Case 7: Purge routes with existing routes - ( - "vpn-123", - [], - True, - [{"DestinationCidrBlock": "10.0.0.0/16"}], - {"routes_to_add": [], "routes_to_remove": ["10.0.0.0/16"]}, - ), - ], -) -def test_check_for_routes_update( - ansible_module, vpn_connection_id, routes, purge_routes, current_routes, expected_result -): - ansible_module.params = { - "routes": routes, - "purge_routes": purge_routes, - } - - # Mock the find_vpn_connection function - client = MagicMock() - ec2_vpc_vpn.find_vpn_connection = Mock(return_value={"Routes": current_routes}) - - # Call the function and check results - result = ec2_vpc_vpn.check_for_routes_update(client, ansible_module, vpn_connection_id) - assert result == expected_result From c6622aff7aced870e32e2bd0ac3c81015670e5b9 Mon Sep 17 00:00:00 2001 From: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:45:18 +0200 Subject: [PATCH 70/77] DNM - Migrate modules autoscaling_instance_refresh,autoscaling_instance_refresh_info and tests (#2177) Depends-On: ansible-collections/amazon.aws#2338 Remove autoscaling_instance_refresh,autoscaling_instance_refresh_info modules and tests, these modules have been migrated to amazon.aws collection. Update runtime.yml with redirects to that collection Update ignore files Reviewed-by: Mandar Kulkarni Reviewed-by: Alina Buzachis --- ...esh_autoscaling_instance_refresh_info.yaml | 8 + meta/runtime.yml | 12 +- .../modules/autoscaling_instance_refresh.py | 298 ------------------ .../autoscaling_instance_refresh_info.py | 224 ------------- .../autoscaling_instance_refresh/aliases | 3 - .../defaults/main.yml | 16 - .../meta/main.yml | 2 - .../tasks/instance_refresh_info.yml | 99 ------ .../tasks/main.yml | 226 ------------- .../tasks/refresh_and_cancel_three_times.yml | 14 - .../tasks/start_cancel_instance_refresh.yml | 206 ------------ .../test_autoscaling_instance_refresh.py | 28 -- 12 files changed, 14 insertions(+), 1122 deletions(-) create mode 100644 changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml delete mode 100644 plugins/modules/autoscaling_instance_refresh.py delete mode 100644 plugins/modules/autoscaling_instance_refresh_info.py delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/aliases delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/defaults/main.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/meta/main.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml delete mode 100644 tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml delete mode 100644 tests/unit/plugins/modules/test_autoscaling_instance_refresh.py diff --git a/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml b/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml new file mode 100644 index 00000000000..8f5a62d849c --- /dev/null +++ b/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml @@ -0,0 +1,8 @@ +--- +breaking_changes: + - autoscaling_instance_refresh - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.autoscaling_instance_refresh`` (https://github.com/ansible-collections/community.aws/pull/2177). + - autoscaling_instance_refresh_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.autoscaling_instance_refresh_info`` (https://github.com/ansible-collections/community.aws/pull/2177). diff --git a/meta/runtime.yml b/meta/runtime.yml index d9324dea195..6513c540dd3 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -10,8 +10,6 @@ action_groups: - api_gateway_info - application_autoscaling_policy - autoscaling_complete_lifecycle_action - - autoscaling_instance_refresh - - autoscaling_instance_refresh_info - autoscaling_launch_config - autoscaling_launch_config_find - autoscaling_launch_config_info @@ -94,8 +92,6 @@ action_groups: - ec2_ami_copy - ec2_asg - ec2_asg_info - - ec2_asg_instance_refresh - - ec2_asg_instance_refresh_info - ec2_asg_lifecycle_hook - ec2_asg_scheduled_action - ec2_customer_gateway @@ -371,10 +367,10 @@ plugin_routing: redirect: amazon.aws.autoscaling_group_info ec2_asg_instance_refresh: # Deprecation for this alias should not *start* prior to 2024-09-01 - redirect: community.aws.autoscaling_instance_refresh + redirect: amazon.aws.autoscaling_instance_refresh ec2_asg_instance_refresh_info: # Deprecation for this alias should not *start* prior to 2024-09-01 - redirect: community.aws.autoscaling_instance_refresh_info + redirect: amazon.aws.autoscaling_instance_refresh_info ec2_asg_lifecycle_hook: # Deprecation for this alias should not *start* prior to 2024-09-01 redirect: community.aws.autoscaling_lifecycle_hook @@ -537,6 +533,10 @@ plugin_routing: redirect: amazon.aws.ec2_vpc_vpn ec2_vpc_vpn_info: redirect: amazon.aws.ec2_vpc_vpn_info + autoscaling_instance_refresh: + redirect: amazon.aws.autoscaling_instance_refresh + autoscaling_instance_refresh_info: + redirect: amazon.aws.autoscaling_instance_refresh_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/autoscaling_instance_refresh.py b/plugins/modules/autoscaling_instance_refresh.py deleted file mode 100644 index b337b5b1f52..00000000000 --- a/plugins/modules/autoscaling_instance_refresh.py +++ /dev/null @@ -1,298 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: autoscaling_instance_refresh -version_added: 3.2.0 -short_description: Start or cancel an EC2 Auto Scaling Group (ASG) instance refresh in AWS -description: - - Start or cancel an EC2 Auto Scaling Group instance refresh in AWS. - - Can be used with M(community.aws.autoscaling_instance_refresh_info) to track the subsequent progress. - - Prior to release 5.0.0 this module was called M(community.aws.ec2_asg_instance_refresh). - The usage did not change. -author: - - "Dan Khersonsky (@danquixote)" -options: - state: - description: - - Desired state of the ASG. - type: str - required: true - choices: [ 'started', 'cancelled' ] - name: - description: - - The name of the auto scaling group you are searching for. - type: str - required: true - strategy: - description: - - The strategy to use for the instance refresh. The only valid value is V(Rolling). - - A rolling update is an update that is applied to all instances in an Auto Scaling group until all instances have been updated. - - A rolling update can fail due to failed health checks or if instances are on standby or are protected from scale in. - - If the rolling update process fails, any instances that were already replaced are not rolled back to their previous configuration. - type: str - default: 'Rolling' - preferences: - description: - - Set of preferences associated with the instance refresh request. - - If not provided, the default values are used. - - For O(preferences.min_healthy_percentage), the default value is V(90). - - For O(preferences.instance_warmup), the default is to use the value specified for the health check grace period for the Auto Scaling group. - - Can not be specified when O(state=cancelled). - required: false - suboptions: - min_healthy_percentage: - description: - - Total percent of capacity in ASG that must remain healthy during instance refresh to allow operation to continue. - - It is rounded up to the nearest integer. - - Value range is V(0) to V(100). - type: int - default: 90 - instance_warmup: - description: - - The number of seconds until a newly launched instance is configured and ready to use. - - During this time, Amazon EC2 Auto Scaling does not immediately move on to the next replacement. - - The default is to use the value for the health check grace period defined for the group. - type: int - skip_matching: - description: - - Indicates whether skip matching is enabled. - - If enabled V(true), then Amazon EC2 Auto Scaling skips replacing instances that match the desired configuration. - type: bool - version_added: 9.0.0 - max_healthy_percentage: - description: - - Specifies the maximum percentage of the group that can be in service and healthy, or pending, - to support your workload when replacing instances. - - The value is expressed as a percentage of the desired capacity of the Auto Scaling group. - - Value range is V(100) to V(200). - - When specified, you must also specify O(preferences.min_healthy_percentage), and the difference between them cannot be greater than V(100). - type: int - version_added: 9.0.0 - type: dict -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -- name: Start a refresh - community.aws.autoscaling_instance_refresh: - name: some-asg - state: started - -- name: Cancel a refresh - community.aws.autoscaling_instance_refresh: - name: some-asg - state: cancelled - -- name: Start a refresh and pass preferences - community.aws.autoscaling_instance_refresh: - name: some-asg - state: started - preferences: - min_healthy_percentage: 91 - instance_warmup: 60 - skip_matching: true -""" - -RETURN = r""" -instance_refreshes: - description: Details of the instance refreshes for the Auto Scaling group. - returned: always - type: complex - contains: - instance_refresh_id: - description: Instance refresh id. - returned: success - type: str - sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" - auto_scaling_group_name: - description: Name of autoscaling group. - returned: success - type: str - sample: "public-webapp-production-1" - status: - description: - - The current state of the group when DeleteAutoScalingGroup is in progress. - - The following are the possible statuses - - Pending - The request was created, but the operation has not started. - - InProgress - The operation is in progress. - - Successful - The operation completed successfully. - - Failed - The operation failed to complete. - You can troubleshoot using the status reason and the scaling activities. - - Cancelling - An ongoing operation is being cancelled. - Cancellation does not roll back any replacements that have already been - completed, but it prevents new replacements from being started. - - Cancelled - The operation is cancelled. - returned: success - type: str - sample: "Pending" - preferences: - description: The preferences for an instance refresh. - returned: always - type: dict - sample: { - 'AlarmSpecification': { - 'Alarms': [ - 'my-alarm', - ], - }, - 'AutoRollback': True, - 'InstanceWarmup': 200, - 'MinHealthyPercentage': 90, - 'ScaleInProtectedInstances': 'Ignore', - 'SkipMatching': False, - 'StandbyInstances': 'Ignore', - } - start_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" - end_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" - percentage_complete: - description: the % of completeness. - returned: success - type: int - sample: 100 - instances_to_update: - description: number of instances to update. - returned: success - type: int - sample: 5 -""" - -from typing import Dict -from typing import Optional -from typing import Union - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict -from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict - -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import AnsibleAutoScalingError -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import cancel_instance_refresh -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import describe_instance_refreshes -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import start_instance_refresh -from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def validate_healthy_percentage(preferences: Dict[str, Union[bool, int]]) -> Optional[str]: - min_healthy_percentage = preferences.get("min_healthy_percentage") - max_healthy_percentage = preferences.get("max_healthy_percentage") - - if min_healthy_percentage is not None and (min_healthy_percentage < 0 or min_healthy_percentage > 100): - return "The value range for the min_healthy_percentage is 0 to 100." - if max_healthy_percentage is not None: - if max_healthy_percentage < 100 or max_healthy_percentage > 200: - return "The value range for the max_healthy_percentage is 100 to 200." - if min_healthy_percentage is None: - return "You must also specify min_healthy_percentage when max_healthy_percentage is specified." - if (max_healthy_percentage - min_healthy_percentage) > 100: - return "The difference between the max_healthy_percentage and min_healthy_percentage cannot be greater than 100." - return None - - -def start_or_cancel_instance_refresh(conn, module: AnsibleAWSModule) -> None: - """ - Args: - conn (boto3.AutoScaling.Client): Valid Boto3 ASG client. - module: AnsibleAWSModule object - """ - - asg_state = module.params.get("state") - asg_name = module.params.get("name") - preferences = module.params.get("preferences") - - args = {} - if asg_state == "started": - args["Strategy"] = module.params.get("strategy") - if preferences: - if asg_state == "cancelled": - module.fail_json(msg="can not pass preferences dict when canceling a refresh") - error = validate_healthy_percentage(preferences) - if error: - module.fail_json(msg=error) - args["Preferences"] = snake_dict_to_camel_dict(scrub_none_parameters(preferences), capitalize_first=True) - cmd_invocations = { - "cancelled": cancel_instance_refresh, - "started": start_instance_refresh, - } - try: - if module.check_mode: - ongoing_refresh = describe_instance_refreshes(conn, auto_scaling_group_name=asg_name).get( - "InstanceRefreshes", [] - ) - if asg_state == "started": - if ongoing_refresh: - module.exit_json( - changed=False, - msg="In check_mode - Instance Refresh is already in progress, can not start new instance refresh.", - ) - else: - module.exit_json(changed=True, msg="Would have started instance refresh if not in check mode.") - elif asg_state == "cancelled": - if ongoing_refresh and ongoing_refresh[0].get("Status", "") in ["Cancelling", "Cancelled"]: - module.exit_json( - changed=False, - msg="In check_mode - Instance Refresh already cancelled or is pending cancellation.", - ) - elif not ongoing_refresh: - module.exit_json(changed=False, msg="In check_mode - No active referesh found, nothing to cancel.") - else: - module.exit_json(changed=True, msg="Would have cancelled instance refresh if not in check mode.") - instance_refresh_id = cmd_invocations[asg_state](conn, auto_scaling_group_name=asg_name, **args) - response = describe_instance_refreshes( - conn, auto_scaling_group_name=asg_name, instance_refresh_ids=[instance_refresh_id] - ) - result = dict(instance_refreshes=camel_dict_to_snake_dict(response["InstanceRefreshes"][0])) - module.exit_json(**result) - except AnsibleAutoScalingError as e: - module.fail_json_aws(e, msg=f"Failed to {asg_state.replace('ed', '')} InstanceRefresh: {e}") - - -def main(): - argument_spec = dict( - state=dict( - type="str", - required=True, - choices=["started", "cancelled"], - ), - name=dict(required=True), - strategy=dict(type="str", default="Rolling", required=False), - preferences=dict( - type="dict", - required=False, - options=dict( - min_healthy_percentage=dict(type="int", default=90), - instance_warmup=dict(type="int"), - skip_matching=dict(type="bool"), - max_healthy_percentage=dict(type="int"), - ), - ), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - autoscaling = module.client("autoscaling") - - start_or_cancel_instance_refresh(autoscaling, module) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/autoscaling_instance_refresh_info.py b/plugins/modules/autoscaling_instance_refresh_info.py deleted file mode 100644 index 1d3bf8fe90c..00000000000 --- a/plugins/modules/autoscaling_instance_refresh_info.py +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" ---- -module: autoscaling_instance_refresh_info -version_added: 3.2.0 -short_description: Gather information about EC2 Auto Scaling Group (ASG) Instance Refreshes in AWS -description: - - Describes one or more instance refreshes. - - You can determine the status of a request by looking at the RV(instance_refreshes.status) return value. - - Prior to release 5.0.0 this module was called M(community.aws.ec2_asg_instance_refresh_info). - The usage did not change. -author: - - "Dan Khersonsky (@danquixote)" -options: - name: - description: - - The name of the Auto Scaling group. - type: str - required: true - ids: - description: - - One or more instance refresh IDs. - type: list - elements: str - default: [] - next_token: - description: - - The token for the next set of items to return. (You received this token from a previous call.) - type: str - max_records: - description: - - The maximum number of items to return with this call. The default value is V(50) and the maximum value is V(100). - type: int - required: false -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -- name: Find an refresh by ASG name - community.aws.autoscaling_instance_refresh_info: - name: somename-asg - -- name: Find an refresh by ASG name and one or more refresh-IDs - community.aws.autoscaling_instance_refresh_info: - name: somename-asg - ids: ['some-id-123'] - register: asgs - -- name: Find an refresh by ASG name and set max_records - community.aws.autoscaling_instance_refresh_info: - name: somename-asg - max_records: 4 - register: asgs - -- name: Find an refresh by ASG name and NextToken, if received from a previous call - community.aws.autoscaling_instance_refresh_info: - name: somename-asg - next_token: 'some-token-123' - register: asgs -""" - -RETURN = r""" -next_token: - description: A string that indicates that the response contains more items than can be returned in a single response. - returned: always - type: str -instance_refreshes: - description: A list of instance refreshes. - returned: always - type: complex - contains: - instance_refresh_id: - description: instance refresh id. - returned: success - type: str - sample: "08b91cf7-8fa6-48af-b6a6-d227f40f1b9b" - auto_scaling_group_name: - description: Name of autoscaling group. - returned: success - type: str - sample: "public-webapp-production-1" - status: - description: - - The current state of the group when DeleteAutoScalingGroup is in progress. - - The following are the possible statuses - - Pending - The request was created, but the operation has not started. - - InProgress - The operation is in progress. - - Successful - The operation completed successfully. - - Failed - The operation failed to complete. - You can troubleshoot using the status reason and the scaling activities. - - Cancelling - An ongoing operation is being cancelled. - Cancellation does not roll back any replacements that have already been - completed, but it prevents new replacements from being started. - - Cancelled - The operation is cancelled. - returned: success - type: str - sample: "Pending" - preferences: - description: The preferences for an instance refresh. - returned: always - type: dict - sample: { - 'AlarmSpecification': { - 'Alarms': [ - 'my-alarm', - ], - }, - 'AutoRollback': True, - 'InstanceWarmup': 200, - 'MinHealthyPercentage': 90, - 'ScaleInProtectedInstances': 'Ignore', - 'SkipMatching': False, - 'StandbyInstances': 'Ignore', - } - start_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" - end_time: - description: The date and time this ASG was created, in ISO 8601 format. - returned: success - type: str - sample: "2015-11-25T00:05:36.309Z" - percentage_complete: - description: the % of completeness - returned: success - type: int - sample: 100 - instances_to_update: - description: number of instances to update. - returned: success - type: int - sample: 5 -""" - -from typing import Any -from typing import Dict - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import AnsibleAutoScalingError -from ansible_collections.amazon.aws.plugins.module_utils.autoscaling import describe_instance_refreshes - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def format_response(response: Dict[str, Any]) -> Dict[str, Any]: - result = {} - if "InstanceRefreshes" in response: - instance_refreshes_dict = { - "instance_refreshes": response["InstanceRefreshes"], - "next_token": response.get("NextToken", ""), - } - result = camel_dict_to_snake_dict(instance_refreshes_dict) - return result - - -def find_asg_instance_refreshes(client, module: AnsibleAWSModule) -> None: - """ - Args: - client (boto3.AutoScaling.Client): Valid Boto3 ASG client. - module: AnsibleAWSModule object - """ - - try: - max_records = module.params.get("max_records") - response = describe_instance_refreshes( - client, - auto_scaling_group_name=module.params.get("name"), - instance_refresh_ids=module.params.get("ids"), - next_token=module.params.get("next_token"), - max_records=max_records, - ) - instance_refreshes_result = format_response(response) - - if max_records is None: - while "NextToken" in response: - response = describe_instance_refreshes( - client, - auto_scaling_group_name=module.params.get("name"), - instance_refresh_ids=module.params.get("ids"), - next_token=response["NextToken"], - max_records=max_records, - ) - f_response = format_response(response) - if "instance_refreshes" in f_response: - instance_refreshes_result["instance_refreshes"].extend(f_response["instance_refreshes"]) - instance_refreshes_result["next_token"] = f_response["next_token"] - - module.exit_json(changed=False, **instance_refreshes_result) - except AnsibleAutoScalingError as e: - module.fail_json_aws(e, msg=f"Failed to describe InstanceRefreshes: {e}") - - -def main(): - argument_spec = dict( - name=dict(required=True, type="str"), - ids=dict(required=False, default=[], elements="str", type="list"), - next_token=dict(required=False, default=None, type="str", no_log=True), - max_records=dict(required=False, type="int"), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - autoscaling = module.client("autoscaling") - find_asg_instance_refreshes(autoscaling, module) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/autoscaling_instance_refresh/aliases b/tests/integration/targets/autoscaling_instance_refresh/aliases deleted file mode 100644 index 6ce549da4bb..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/aliases +++ /dev/null @@ -1,3 +0,0 @@ -time=14m -cloud/aws -autoscaling_instance_refresh_info diff --git a/tests/integration/targets/autoscaling_instance_refresh/defaults/main.yml b/tests/integration/targets/autoscaling_instance_refresh/defaults/main.yml deleted file mode 100644 index 08e57d2558e..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/defaults/main.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# defaults file for ec2_asg -vpc_seed: '{{ tiny_prefix }}' -subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24' - -default_resource_name: '{{ resource_prefix }}-asg-refresh' -short_resource_name: '{{ tiny_prefix }}-asg-refresh' - -vpc_name: '{{ default_resource_name }}' -subnet_name: '{{ default_resource_name }}' -route_name: '{{ default_resource_name }}' -sg_name: '{{ default_resource_name }}' -asg_name: '{{ default_resource_name }}' -lc_name_1: '{{ default_resource_name }}-1' -lc_name_2: '{{ default_resource_name }}-2' -load_balancer_name: '{{ short_resource_name }}' diff --git a/tests/integration/targets/autoscaling_instance_refresh/meta/main.yml b/tests/integration/targets/autoscaling_instance_refresh/meta/main.yml deleted file mode 100644 index 1471b11f658..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - setup_ec2_facts diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml deleted file mode 100644 index bf95b1668db..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/instance_refresh_info.yml +++ /dev/null @@ -1,99 +0,0 @@ ---- -- name: Test getting info for an ASG name - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - register: output - -- name: Assert that the correct number of records are returned - assert: - that: - - output.instance_refreshes | map(attribute='instance_refresh_id') | unique | length == 7 - -- name: Test using fake refresh ID - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - ids: ['0e367f58-blabla-bla-bla-ca870dc5dbfe'] - register: output - -- name: Assert that no record is returned - assert: - that: - - output.instance_refreshes | length == 0 - -- name: Test using a real refresh ID - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - ids: [ '{{ refreshout.instance_refreshes.instance_refresh_id }}' ] - register: output - -- name: Assert that the correct record is returned - assert: - that: - - output.instance_refreshes | length == 1 - -- name: Test getting info for an ASG name which doesn't exist - autoscaling_instance_refresh_info: - name: n0n3x1stentname27b - ignore_errors: true - register: output - -- name: Assert that module failed to return record - assert: - that: - - "'Failed to describe InstanceRefreshes: An error occurred (ValidationError) when calling the DescribeInstanceRefreshes operation: AutoScalingGroup name not found - AutoScalingGroup n0n3x1stentname27b not found' in output.msg" - -- name: Retrieve instance refresh info - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - register: output - -- name: Assert that the correct number of records are returned - assert: - that: - - output.instance_refreshes | length == 7 - -- name: Retrieve instance refresh info using next_token - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - next_token: "fake-token-123" - ignore_errors: true - register: output - -- name: Assert that valid message with fake-token is returned - assert: - that: - - '"Failed to describe InstanceRefreshes: An error occurred (InvalidNextToken) when calling the DescribeInstanceRefreshes operation: The token ''********'' is invalid." in output.msg' - -- name: Retrieve instance refresh info using max_records - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - max_records: 1 - register: output_with_token - -- name: Assert that max records=1 returns no more than one record - assert: - that: - - output_with_token.instance_refreshes | length == 1 - -- name: Retrieve instance refresh using valid token - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - next_token: "{{ output_with_token.next_token }}" - register: output - -- name: Assert that valid message with real-token is returned - assert: - that: - - output.instance_refreshes | length == 6 - -- name: Test using both real nextToken and max_records=1 - autoscaling_instance_refresh_info: - name: "{{ asg_name }}" - max_records: 1 - next_token: "{{ output_with_token.next_token }}" - register: output - -- name: Assert that only one instance refresh is returned - assert: - that: - - output.instance_refreshes | length == 1 diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml deleted file mode 100644 index cdfa2e00106..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/main.yml +++ /dev/null @@ -1,226 +0,0 @@ ---- -- name: setup credentials and region - module_defaults: - group/aws: - access_key: "{{ aws_access_key }}" - secret_key: "{{ aws_secret_key }}" - session_token: "{{ security_token | default(omit) }}" - region: "{{ aws_region }}" - - collections: - - amazon.aws - - block: - # Set up the testing dependencies: VPC, subnet, security group, and two launch configurations - - name: Create VPC for use in testing - ec2_vpc_net: - name: "{{ vpc_name }}" - cidr_block: '{{ subnet_a_cidr }}' - tenancy: default - register: testing_vpc - - - name: Create internet gateway for use in testing - ec2_vpc_igw: - vpc_id: "{{ testing_vpc.vpc.id }}" - state: present - register: igw - - - name: Create subnet for use in testing - ec2_vpc_subnet: - state: present - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: '{{ subnet_a_cidr }}' - az: "{{ aws_region }}a" - resource_tags: - Name: "{{ subnet_name }}" - register: testing_subnet - - - name: Create routing rules - ec2_vpc_route_table: - vpc_id: "{{ testing_vpc.vpc.id }}" - tags: - created: "{{ route_name }}" - routes: - - dest: 0.0.0.0/0 - gateway_id: "{{ igw.gateway_id }}" - subnets: - - "{{ testing_subnet.subnet.id }}" - - - name: Create a security group with the vpc created in the ec2_setup - ec2_security_group: - name: "{{ sg_name }}" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - rules: - - proto: tcp - from_port: 22 - to_port: 22 - cidr_ip: 0.0.0.0/0 - - proto: tcp - from_port: 80 - to_port: 80 - cidr_ip: 0.0.0.0/0 - register: sg - - - name: Ensure launch configs exist - autoscaling_launch_config: - name: "{{ item }}" - assign_public_ip: true - image_id: "{{ ec2_ami_id }}" - user_data: | - package_upgrade: true - package_update: true - packages: - - httpd - runcmd: - - "service httpd start" - security_groups: "{{ sg.group_id }}" - instance_type: t3.micro - loop: - - "{{ lc_name_1 }}" - - "{{ lc_name_2 }}" - - - name: Launch asg and do not wait for instances to be deemed healthy (no ELB) - autoscaling_group: - name: "{{ asg_name }}" - launch_config_name: "{{ lc_name_1 }}" - desired_capacity: 1 - min_size: 1 - max_size: 1 - vpc_zone_identifier: "{{ testing_subnet.subnet.id }}" - wait_for_instances: no - state: present - register: output - - - name: Assert that there is no viable instance - assert: - that: - - "output.viable_instances == 0" - - # ============================================================ - - name: Run test with start_cancel_instance_refresh.yml - include_tasks: start_cancel_instance_refresh.yml - - # ============================================================ - - - name: Run test with refresh_and_cancel_three_times.yml - include_tasks: refresh_and_cancel_three_times.yml - loop: "{{ query('sequence', 'start=1 end=3') }}" - - - name: Run test with instance_refresh_info.yml - include_tasks: instance_refresh_info.yml - - always: - - - name: Kill asg - autoscaling_group: - name: "{{ asg_name }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - # Remove the testing dependencies - - - name: Remove the load balancer - elb_classic_lb: - name: "{{ load_balancer_name }}" - state: absent - security_group_ids: - - "{{ sg.group_id }}" - subnets: "{{ testing_subnet.subnet.id }}" - wait: true - connection_draining_timeout: 60 - listeners: - - protocol: http - load_balancer_port: 80 - instance_port: 80 - health_check: - ping_protocol: tcp - ping_port: 80 - ping_path: "/" - response_timeout: 5 - interval: 10 - unhealthy_threshold: 4 - healthy_threshold: 2 - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - - - name: Remove launch configs - autoscaling_launch_config: - name: "{{ item }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - loop: - - "{{ lc_name_1 }}" - - "{{ lc_name_2 }}" - - - name: Delete launch template - ec2_launch_template: - name: "{{ resource_prefix }}-lt" - state: absent - register: del_lt - retries: 10 - until: del_lt is not failed - ignore_errors: true - - - name: Remove the security group - ec2_security_group: - name: "{{ sg_name }}" - description: a security group for ansible tests - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - - - name: Remove routing rules - ec2_vpc_route_table: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - tags: - created: "{{ route_name }}" - routes: - - dest: 0.0.0.0/0 - gateway_id: "{{ igw.gateway_id }}" - subnets: - - "{{ testing_subnet.subnet.id }}" - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - - - name: Remove internet gateway - ec2_vpc_igw: - vpc_id: "{{ testing_vpc.vpc.id }}" - state: absent - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - - - name: Remove the subnet - ec2_vpc_subnet: - state: absent - vpc_id: "{{ testing_vpc.vpc.id }}" - cidr: '{{ subnet_a_cidr }}' - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 - - - name: Remove the VPC - ec2_vpc_net: - name: "{{ vpc_name }}" - cidr_block: '{{ subnet_a_cidr }}' - state: absent - register: removed - until: removed is not failed - ignore_errors: true - retries: 10 diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml deleted file mode 100644 index e2cebe924a9..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/refresh_and_cancel_three_times.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Test starting a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - retries: 10 - delay: 5 - register: refreshout - until: refreshout is not failed - -- name: Test cancelling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" diff --git a/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml b/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml deleted file mode 100644 index a15e71cc3d3..00000000000 --- a/tests/integration/targets/autoscaling_instance_refresh/tasks/start_cancel_instance_refresh.yml +++ /dev/null @@ -1,206 +0,0 @@ ---- -- name: test invalid cancelation - V1 - (pre-refresh) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - ignore_errors: true - register: result - -- name: Assert that module failed with proper message - assert: - that: - - "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group ' ~ resource_prefix ~ '-asg' in result.msg" - -- name: Test starting a refresh with a valid ASG name - check_mode - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - check_mode: true - register: output - -- name: Validate starting in check_mode - assert: - that: - - output is changed - - '"autoscaling:StartInstanceRefresh" not in output.resource_actions' - -- name: Test starting a refresh with a valid ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - register: output - -- name: Validate start - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Test starting a refresh with a valid ASG name - Idempotent - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - ignore_errors: true - register: output - -- name: Validate starting Idempotency - assert: - that: - - output is not changed - - '"Failed to start InstanceRefresh: An error occurred (InstanceRefreshInProgress) when calling the StartInstanceRefresh operation: An Instance Refresh is already in progress and blocks the execution of this Instance Refresh." in output.msg' - -- name: Test starting a refresh with a valid ASG name - Idempotent (check_mode) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - check_mode: true - register: output - -- name: Validate starting Idempotency in check_mode - assert: - that: - - output is not changed - - '"In check_mode - Instance Refresh is already in progress, can not start new instance refresh." in output.msg' - -- name: Test starting a refresh with a nonexistent ASG name - autoscaling_instance_refresh: - name: "nonexistentname-asg" - state: "started" - ignore_errors: true - register: result - -- name: Assert that module failed with proper message - assert: - that: - - "'Failed to start InstanceRefresh: An error occurred (ValidationError) when calling the StartInstanceRefresh operation: AutoScalingGroup name not found' in result.msg" - -- name: Test canceling a refresh with an ASG name - check_mode - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - check_mode: true - register: output - -- name: Validate cancelation - assert: - that: - - output is not failed - - output is changed - - '"autoscaling:CancelInstanceRefresh" not in output.resource_actions' - -- name: Test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - -- name: Validate cancelation - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Test canceling a refresh with a ASG name - Idempotent - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - ignore_errors: true - -- name: Validate cancelling Idempotency - assert: - that: - - output is not changed - -- name: Test cancelling a refresh with a valid ASG name - Idempotent (check_mode) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - check_mode: true - register: output - -- name: Validate cancelling Idempotency in check_mode - assert: - that: - - output is not changed - -- name: Test starting a refresh with an ASG name and preferences dict - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - min_healthy_percentage: 10 - instance_warmup: 10 - retries: 5 - register: output - until: output is not failed - -- name: Assert that module succeed with preferences - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Re-test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - -- name: Assert that module returned instance refresh id - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Test valid start - V1 - (with preferences missing instance_warmup) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - min_healthy_percentage: 10 - retries: 5 - register: output - until: output is not failed - -- name: Validate start with preferences missing instance warmup - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Re-test canceling a refresh with an ASG name - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - register: output - -- name: Validate canceling Idempotency - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Test valid start - V2 - (with preferences missing min_healthy_percentage) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "started" - preferences: - instance_warmup: 10 - retries: 5 - register: output - until: output is not failed - -- name: Assert that module did not returned and instance refresh id - assert: - that: - - "'instance_refresh_id' in output.instance_refreshes" - -- name: Test invalid cancelation - V2 - (with preferences) - autoscaling_instance_refresh: - name: "{{ asg_name }}" - state: "cancelled" - preferences: - min_healthy_percentage: 10 - instance_warmup: 10 - ignore_errors: true - register: result - -- name: Assert that module failed with proper message - assert: - that: - - "'can not pass preferences dict when canceling a refresh' in result.msg" diff --git a/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py b/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py deleted file mode 100644 index 590074367a2..00000000000 --- a/tests/unit/plugins/modules/test_autoscaling_instance_refresh.py +++ /dev/null @@ -1,28 +0,0 @@ -# (c) 2024 Red Hat Inc. -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -import pytest - -from ansible_collections.community.aws.plugins.modules.autoscaling_instance_refresh import validate_healthy_percentage - - -@pytest.mark.parametrize( - "min_healthy, max_healthy, expected_error", - [ - (90, None, None), - (-1, None, "The value range for the min_healthy_percentage is 0 to 100."), - (101, None, "The value range for the min_healthy_percentage is 0 to 100."), - (None, 90, "The value range for the max_healthy_percentage is 100 to 200."), - (None, 201, "The value range for the max_healthy_percentage is 100 to 200."), - (None, 100, "You must also specify min_healthy_percentage when max_healthy_percentage is specified."), - (10, 100, None), - ( - 10, - 150, - "The difference between the max_healthy_percentage and min_healthy_percentage cannot be greater than 100.", - ), - ], -) -def test_validate_healthy_percentage(min_healthy, max_healthy, expected_error): - preferences = dict(min_healthy_percentage=min_healthy, max_healthy_percentage=max_healthy) - assert expected_error == validate_healthy_percentage(preferences) From 1fc8af10692de71796958aec244635d55d26b9af Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 25 Oct 2024 09:46:18 -0700 Subject: [PATCH 71/77] DNM Migrate ec2_transit_gateway_info modules and tests (#2189) SUMMARY DNM Migrate ec2_transit_gateway_info modules and tests Refer : https://issues.redhat.com/browse/ACA-1877 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- .../migrate_ec2_transit_gateway_info.yml | 5 + meta/runtime.yml | 3 +- plugins/modules/ec2_transit_gateway_info.py | 254 ------------------ 3 files changed, 7 insertions(+), 255 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_transit_gateway_info.yml delete mode 100644 plugins/modules/ec2_transit_gateway_info.py diff --git a/changelogs/fragments/migrate_ec2_transit_gateway_info.yml b/changelogs/fragments/migrate_ec2_transit_gateway_info.yml new file mode 100644 index 00000000000..1a38b74625b --- /dev/null +++ b/changelogs/fragments/migrate_ec2_transit_gateway_info.yml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - ec2_transit_gateway_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_transit_gateway_info``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 6513c540dd3..239ce32fe89 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -104,7 +104,6 @@ action_groups: - ec2_scaling_policy - ec2_snapshot_copy - ec2_transit_gateway - - ec2_transit_gateway_info - ec2_transit_gateway_vpc_attachment - ec2_transit_gateway_vpc_attachment_info - ec2_win_password @@ -537,6 +536,8 @@ plugin_routing: redirect: amazon.aws.autoscaling_instance_refresh autoscaling_instance_refresh_info: redirect: amazon.aws.autoscaling_instance_refresh_info + ec2_transit_gateway_info: + redirect: amazon.aws.ec2_transit_gateway_info module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_transit_gateway_info.py b/plugins/modules/ec2_transit_gateway_info.py deleted file mode 100644 index f07be7ae941..00000000000 --- a/plugins/modules/ec2_transit_gateway_info.py +++ /dev/null @@ -1,254 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_transit_gateway_info -short_description: Retrieve information about EC2 Transit Gateways in AWS -version_added: 1.0.0 -description: - - Gather information about EC2 Transit Gateways in AWS. -author: - - "Bob Boldin (@BobBoldin)" -options: - transit_gateway_ids: - description: - - A list of Transit Gateway IDs for which to gather information. - aliases: [transit_gateway_id] - type: list - elements: str - default: [] - filters: - description: - - A dictionary of filters to apply to the query. Each key-value pair represents a filter key and its corresponding value. - - For a complete list of available filters, - refer to the AWS documentation U(https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGateways.html). - type: dict - default: {} -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 -""" - -EXAMPLES = r""" -# Note: These examples do not set authentication details, see the AWS Guide for details. - -- name: Gather info about all transit gateways - community.aws.ec2_transit_gateway_info: - -- name: Gather info about a particular transit gateway using filter transit gateway ID - community.aws.ec2_transit_gateway_info: - filters: - transit-gateway-id: tgw-02c42332e6b7da829 - -- name: Gather info about a particular transit gateway using multiple option filters - community.aws.ec2_transit_gateway_info: - filters: - options.dns-support: enable - options.vpn-ecmp-support: enable - -- name: Gather info about multiple transit gateways using module param - community.aws.ec2_transit_gateway_info: - transit_gateway_ids: - - tgw-02c42332e6b7da829 - - tgw-03c53443d5a8cb716 -""" - -RETURN = r""" -transit_gateways: - description: - - Transit gateways that match the provided filters. - - Each element consists of a dict with all the information related to that transit gateway. - returned: on success - type: list - elements: dict - contains: - creation_time: - description: The creation time. - returned: always - type: str - sample: "2019-02-05T16:19:58+00:00" - description: - description: The description of the transit gateway. - returned: always - type: str - sample: "A transit gateway" - options: - description: A dictionary of the transit gateway options. - returned: always - type: dict - contains: - amazon_side_asn: - description: - - A private Autonomous System Number (ASN) for the Amazon ide of a BGP session. - - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. - returned: always - type: int - sample: 64512 - auto_accept_shared_attachments: - description: Indicates whether attachment requests are automatically accepted. - returned: always - type: str - sample: "enable" - default_route_table_association: - description: Indicates whether resource attachments are automatically associated with the default association route table. - returned: always - type: str - sample: "disable" - association_default_route_table_id: - description: The ID of the default association route table. - returned: when present - type: str - sample: "tgw-rtb-0fd332c911223344" - default_route_table_propagation: - description: Indicates whether resource attachments automatically propagate routes to the default propagation route table. - returned: always - type: str - sample: "disable" - dns_support: - description: Indicates whether DNS support is enabled. - returned: always - type: str - sample: "enable" - multicast_support: - description: Indicates whether Multicast support is enabled. - returned: always - type: str - sample: "enable" - version_added: 7.3.0 - propagation_default_route_table_id: - description: The ID of the default propagation route table. - returned: when present - type: str - sample: "rtb-11223344" - vpn_ecmp_support: - description: Indicates whether Equal Cost Multipath Protocol support is enabled. - returned: always - type: str - sample: "enable" - owner_id: - description: The AWS account number ID which owns the transit gateway. - returned: always - type: str - sample: "123456789012" - state: - description: The state of the transit gateway. - returned: always - type: str - sample: "available" - tags: - description: A dict of tags associated with the transit gateway. - returned: always - type: dict - sample: { - "Name": "A sample TGW", - "Env": "Dev" - } - transit_gateway_arn: - description: The Amazon Resource Name (ARN) of the transit gateway. - returned: always - type: str - sample: "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-02c42332e6b7da829" - transit_gateway_id: - description: The ID of the transit gateway. - returned: always - type: str - sample: "tgw-02c42332e6b7da829" -""" - -from typing import Any -from typing import Dict -from typing import List - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AnsibleEC2Error -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_transit_gateways -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -def get_transit_gateway_response(module: AnsibleAWSModule, connection) -> Dict[str, Any]: - """ - Get transit gateway response from AWS. - - module : AnsibleAWSModule object - connection : boto3 client connection object - :return: Response from describe_transit_gateways call - """ - filters = ansible_dict_to_boto3_filter_list(module.params["filters"]) - transit_gateway_ids = module.params["transit_gateway_ids"] - - params = {} - if transit_gateway_ids: - params["TransitGatewayIds"] = transit_gateway_ids - if filters: - params["Filters"] = filters - - result = describe_ec2_transit_gateways(connection, **params) - return result - - -def extract_transit_gateway_info(transit_gateway: Dict[str, Any]) -> Dict[str, Any]: - """ - Extract and transform transit gateway information. - - transit_gateway : The transit gateway data from AWS - :return: Transformed transit gateway information - """ - tgw_data = camel_dict_to_snake_dict(transit_gateway, ignore_list=["Tags"]) - tgw_data["tags"] = boto3_tag_list_to_ansible_dict(transit_gateway.get("Tags", [])) - return tgw_data - - -def describe_transit_gateways(module: AnsibleAWSModule, connection) -> List[Dict[str, Any]]: - """ - Describe transit gateways. - - module : AnsibleAWSModule object - connection : boto3 client connection object - :return: List of transit gateways - """ - response = get_transit_gateway_response(module, connection) - return [extract_transit_gateway_info(tgw) for tgw in response] - - -def setup_module_object() -> AnsibleAWSModule: - """ - Merge argument spec and create Ansible module object. - :return: Ansible module object - """ - argument_spec = dict( - transit_gateway_ids=dict(type="list", default=[], elements="str", aliases=["transit_gateway_id"]), - filters=dict(type="dict", default={}), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - supports_check_mode=True, - ) - - return module - - -def main(): - module = setup_module_object() - results = {"changed": False} - - connection = module.client("ec2") - try: - transit_gateways = describe_transit_gateways(module, connection) - results["transit_gateways"] = transit_gateways - except AnsibleEC2Error as e: - module.fail_json_aws(e) - - module.exit_json(**results) - - -if __name__ == "__main__": - main() From 4bfb44bb63570308d2905a45ffeb469108a88cb2 Mon Sep 17 00:00:00 2001 From: Mandar Kulkarni Date: Fri, 25 Oct 2024 10:50:02 -0700 Subject: [PATCH 72/77] DNM Migrate ec2_transit_gateway module and tests (#2192) SUMMARY DNM Migrate ec2_transit_gateway modules and tests Refer : https://issues.redhat.com/browse/ACA-1877 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- .../fragments/migrate_ec2_transit_gateway.yml | 5 + meta/runtime.yml | 5 +- plugins/modules/ec2_transit_gateway.py | 486 ------------------ .../targets/ec2_transit_gateway/aliases | 3 - .../targets/ec2_transit_gateway/meta/main.yml | 1 - .../ec2_transit_gateway/tasks/main.yml | 300 ----------- 6 files changed, 7 insertions(+), 793 deletions(-) create mode 100644 changelogs/fragments/migrate_ec2_transit_gateway.yml delete mode 100644 plugins/modules/ec2_transit_gateway.py delete mode 100644 tests/integration/targets/ec2_transit_gateway/aliases delete mode 100644 tests/integration/targets/ec2_transit_gateway/meta/main.yml delete mode 100644 tests/integration/targets/ec2_transit_gateway/tasks/main.yml diff --git a/changelogs/fragments/migrate_ec2_transit_gateway.yml b/changelogs/fragments/migrate_ec2_transit_gateway.yml new file mode 100644 index 00000000000..f0638ebe6be --- /dev/null +++ b/changelogs/fragments/migrate_ec2_transit_gateway.yml @@ -0,0 +1,5 @@ +--- +breaking_changes: + - ec2_transit_gateway - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_transit_gateway``. diff --git a/meta/runtime.yml b/meta/runtime.yml index 239ce32fe89..5d54de6274b 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -103,9 +103,6 @@ action_groups: - ec2_metric_alarm - ec2_scaling_policy - ec2_snapshot_copy - - ec2_transit_gateway - - ec2_transit_gateway_vpc_attachment - - ec2_transit_gateway_vpc_attachment_info - ec2_win_password - ecs_attribute - ecs_cluster @@ -538,6 +535,8 @@ plugin_routing: redirect: amazon.aws.autoscaling_instance_refresh_info ec2_transit_gateway_info: redirect: amazon.aws.ec2_transit_gateway_info + ec2_transit_gateway: + redirect: amazon.aws.ec2_transit_gateway module_utils: route53: redirect: amazon.aws.route53 diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py deleted file mode 100644 index 160d37f4bd6..00000000000 --- a/plugins/modules/ec2_transit_gateway.py +++ /dev/null @@ -1,486 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright: Ansible Project -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -DOCUMENTATION = r""" -module: ec2_transit_gateway -short_description: Create and delete AWS Transit Gateways -version_added: 1.0.0 -description: - - Creates AWS Transit Gateways. - - Deletes AWS Transit Gateways. - - Updates tags on existing transit gateways. -options: - asn: - description: - - A private Autonomous System Number (ASN) for the Amazon side of a BGP session. - - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. - type: int - auto_associate: - description: - - Enable or disable automatic association with the default association route table. - default: true - type: bool - auto_attach: - description: Enable or disable automatic acceptance of attachment requests. - default: false - type: bool - auto_propagate: - description: Enable or disable automatic propagation of routes to the default propagation route table. - default: true - type: bool - description: - description: The description of the transit gateway. - type: str - dns_support: - description: Whether to enable AWS DNS support. - default: true - type: bool - multicast_support: - description: Whether to enable AWS Multicast support. Valid only at the time of creation of the Transit Gateway. - type: bool - version_added: 8.1.0 - state: - description: - - V(present) to ensure resource is created. - - V(absent) to remove resource. - default: present - choices: [ "present", "absent"] - type: str - transit_gateway_id: - description: The ID of the transit gateway. - type: str - vpn_ecmp_support: - description: Enable or disable Equal Cost Multipath Protocol support. - default: true - type: bool - wait: - description: Whether to wait for status. - default: true - type: bool - wait_timeout: - description: Number of seconds to wait for status. - default: 300 - type: int - -author: - - "Bob Boldin (@BobBoldin)" -extends_documentation_fragment: - - amazon.aws.common.modules - - amazon.aws.region.modules - - amazon.aws.boto3 - - amazon.aws.tags -""" - -EXAMPLES = r""" -- name: Create a new transit gateway using defaults - community.aws.ec2_transit_gateway: - state: present - region: us-east-1 - description: personal-testing - register: created_tgw - -- name: Create a new transit gateway with options - community.aws.ec2_transit_gateway: - asn: 64514 - auto_associate: false - auto_propagate: false - multicast_support: true - dns_support: true - description: "nonprod transit gateway" - purge_tags: false - state: present - region: us-east-1 - tags: - Name: nonprod transit gateway - status: testing - -- name: Remove a transit gateway by description - community.aws.ec2_transit_gateway: - state: absent - region: us-east-1 - description: personal-testing - -- name: Remove a transit gateway by id - community.aws.ec2_transit_gateway: - state: absent - region: ap-southeast-2 - transit_gateway_id: tgw-3a9aa123 - register: deleted_tgw -""" - -RETURN = r""" -transit_gateway: - description: The attributes of the transit gateway. - type: dict - returned: I(state=present) - contains: - creation_time: - description: The creation time of the transit gateway. - returned: always - type: str - sample: "2019-03-06T17:13:51+00:00" - description: - description: The description of the transit gateway. - returned: always - type: str - sample: "my test tgw" - options: - description: The options attributes of the transit gateway. - returned: always - type: dict - contains: - amazon_side_asn: - description: - - A private Autonomous System Number (ASN) for the Amazon side of a BGP session. - The range is 64512 to 65534 for 16-bit ASNs and 4200000000 to 4294967294 for 32-bit ASNs. - returned: always - type: str - sample: "64512" - auto_accept_shared_attachements: - description: Indicates whether attachment requests are automatically accepted. - returned: always - type: str - sample: "disable" - default_route_table_association: - description: - - Indicates whether resource attachments are automatically - associated with the default association route table. - returned: always - type: str - sample: "enable" - association_default_route_table_id: - description: The ID of the default association route table. - returned: Iwhen exists - type: str - sample: "tgw-rtb-abc123444" - default_route_table_propagation: - description: - - Indicates whether resource attachments automatically - propagate routes to the default propagation route table. - returned: always - type: str - sample: "disable" - propagation_default_route_table_id: - description: The ID of the default propagation route table. - returned: when exists - type: str - sample: "tgw-rtb-def456777" - vpn_ecmp_support: - description: Indicates whether Equal Cost Multipath Protocol support is enabled. - returned: always - type: str - sample: "enable" - dns_support: - description: Indicates whether DNS support is enabled. - returned: always - type: str - sample: "enable" - multicast_support: - description: Indicates whether Multicast support is enabled. - returned: always - type: str - sample: "enable" - version_added: 7.3.0 - owner_id: - description: The account that owns the transit gateway. - returned: always - type: str - sample: "123456789012" - state: - description: The state of the transit gateway. - returned: always - type: str - sample: "pending" - tags: - description: A dictionary of resource tags. - returned: always - type: dict - sample: - tags: - Name: nonprod_tgw - transit_gateway_arn: - description: The ID of the transit_gateway. - returned: always - type: str - sample: "tgw-3a9aa123" - transit_gateway_id: - description: The ID of the transit_gateway. - returned: always - type: str - sample: "tgw-3a9aa123" -""" - -from typing import Any -from typing import Dict -from typing import Optional - -from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict - -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import create_ec2_transit_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import delete_ec2_transit_gateway -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import describe_ec2_transit_gateways -from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ensure_ec2_tags -from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry -from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict -from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list -from ansible_collections.amazon.aws.plugins.module_utils.waiters import wait_for_resource_state - -from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule - - -class AnsibleEc2Tgw: - def __init__(self, module: AnsibleAWSModule, results: Dict[str, Any]) -> None: - self._module = module - self._results = results - retry_decorator = AWSRetry.jittered_backoff( - catch_extra_error_codes=["IncorrectState"], - ) - self._connection = module.client("ec2") - self._check_mode = self._module.check_mode - - def process(self) -> None: - """Process the request based on state parameter.""" - description = self._module.params.get("description") - state = self._module.params.get("state", "present") - tgw_id = self._module.params.get("transit_gateway_id") - - if state == "present": - self.ensure_tgw_present(tgw_id, description) - elif state == "absent": - self.ensure_tgw_absent(tgw_id, description) - - def wait_for_status(self, wait_timeout: int, tgw_id: str, status: str, skip_deleted: bool = True) -> Dict[str, Any]: - """ - Wait for the Transit Gateway to reach the specified status. - :param wait_timeout: Number of seconds to wait, until this timeout is reached. - :param tgw_id: The Amazon NAT ID. - :param status: The status to wait for. - :param skip_deleted: Ignore deleted transit gateways. - :return: Transit gateway object. - """ - polling_increment_secs = 5 - max_attempts = wait_timeout // polling_increment_secs - - waiter_method = f"transit_gateway_{status}" - - wait_for_resource_state( - self._connection, - self._module, - waiter_method, - TransitGatewayIds=[tgw_id], - delay=polling_increment_secs, - max_attempts=max_attempts, - ) - - transit_gateway = self.get_matching_tgw(tgw_id=tgw_id, skip_deleted=skip_deleted) - if transit_gateway is None: - self._module.fail_json(msg="Transit Gateway not found after waiting.") - - return transit_gateway - - def get_matching_tgw( - self, tgw_id: Optional[str], description: Optional[str] = None, skip_deleted: bool = True - ) -> Optional[Dict[str, Any]]: - """Search for an existing tgw by either tgw_id or description. - :param tgw_id: The AWS id of the transit gateway. - :param description: The description of the transit gateway. - :param skip_deleted: Ignore deleted transit gateways. - :return: Transit gateway object. - """ - filters = [] - params = {} - if tgw_id: - filters = ansible_dict_to_boto3_filter_list({"transit-gateway-id": tgw_id}) - - params["Filters"] = filters - response = describe_ec2_transit_gateways(self._connection, **params) - - tgw = None - tgws = [] - - if len(response) == 1 and tgw_id: - if (response[0]["State"] != "deleted") or not skip_deleted: - tgws.extend(response) - - for gateway in response: - if description == gateway["Description"] and gateway["State"] != "deleted": - tgws.append(gateway) - - if len(tgws) > 1: - self._module.fail_json( - msg=f"EC2 returned more than one transit Gateway for description {description}, aborting" - ) - elif tgws: - tgw = camel_dict_to_snake_dict(tgws[0], ignore_list=["Tags"]) - tgw["tags"] = boto3_tag_list_to_ansible_dict(tgws[0]["Tags"]) - - return tgw - - @staticmethod - def enable_option_flag(flag: Optional[bool]) -> str: - disabled = "disable" - enabled = "enable" - return enabled if flag else disabled - - def create_tgw(self, description: str) -> Dict[str, Any]: - """ - Create a transit gateway and optionally wait for status to become available. - :param description: The description of the transit gateway. - :return: Transit gateway object. - """ - options: Dict[str, Any] = {} - wait = self._module.params.get("wait") - wait_timeout = self._module.params.get("wait_timeout") - - if self._module.params.get("asn"): - options["AmazonSideAsn"] = self._module.params.get("asn") - - options["AutoAcceptSharedAttachments"] = self.enable_option_flag(self._module.params.get("auto_attach")) - options["DefaultRouteTableAssociation"] = self.enable_option_flag(self._module.params.get("auto_associate")) - options["DefaultRouteTablePropagation"] = self.enable_option_flag(self._module.params.get("auto_propagate")) - options["VpnEcmpSupport"] = self.enable_option_flag(self._module.params.get("vpn_ecmp_support")) - options["DnsSupport"] = self.enable_option_flag(self._module.params.get("dns_support")) - options["MulticastSupport"] = self.enable_option_flag(self._module.params.get("multicast_support")) - - params = {"Description": description, "Options": options} - - response = create_ec2_transit_gateway(self._connection, **params) - - tgw_id = response["TransitGatewayId"] - - if wait: - result = self.wait_for_status(wait_timeout=wait_timeout, tgw_id=tgw_id, status="available") - else: - result = self.get_matching_tgw(tgw_id=tgw_id) - - self._results["msg"] = f"Transit gateway {result['transit_gateway_id']} created" - - return result - - def delete_tgw(self, tgw_id: str) -> Dict[str, Any]: - """ - Delete the transit gateway and optionally wait for status to become deleted. - :param tgw_id: The id of the transit gateway. - :return: Transit gateway object. - """ - wait = self._module.params.get("wait") - wait_timeout = self._module.params.get("wait_timeout") - - delete_ec2_transit_gateway(self._connection, tgw_id) - - if wait: - result = self.wait_for_status( - wait_timeout=wait_timeout, tgw_id=tgw_id, status="deleted", skip_deleted=False - ) - else: - result = self.get_matching_tgw(tgw_id=tgw_id, skip_deleted=False) - - self._results["msg"] = f"Transit gateway {tgw_id} deleted" - - return result - - def ensure_tgw_present(self, tgw_id: Optional[str] = None, description: Optional[str] = None) -> Dict[str, Any]: - """ - Will create a tgw if no match to the tgw_id or description are found. - Will update the tgw tags if matching one found but tags are not synced. - :param tgw_id: The AWS id of the transit gateway. - :param description: The description of the transit gateway. - :return: Transit gateway object. - """ - tgw = self.get_matching_tgw(tgw_id, description) - - if tgw is None: - if self._check_mode: - self._results["changed"] = True - self._results["transit_gateway_id"] = None - return self._results - - if not description: - self._module.fail_json(msg="Failed to create Transit Gateway: description argument required") - tgw = self.create_tgw(description) - self._results["changed"] = True - - self._results["changed"] |= ensure_ec2_tags( - self._connection, - self._module, - tgw["transit_gateway_id"], - tags=self._module.params.get("tags"), - purge_tags=self._module.params.get("purge_tags"), - ) - - self._results["transit_gateway"] = self.get_matching_tgw(tgw_id=tgw["transit_gateway_id"]) - - return self._results - - def ensure_tgw_absent(self, tgw_id: Optional[str] = None, description: Optional[str] = None) -> Dict[str, Any]: - """ - Will delete the tgw if a single tgw is found not yet in deleted status. - :param tgw_id: The AWS id of the transit gateway. - :param description: The description of the transit gateway. - :return: Transit gateway object. - """ - self._results["transit_gateway_id"] = None - tgw = self.get_matching_tgw(tgw_id, description) - - if tgw is not None: - if self._check_mode: - self._results["changed"] = True - return self._results - - tgw = self.delete_tgw(tgw_id=tgw["transit_gateway_id"]) - self._results["changed"] = True - self._results["transit_gateway"] = self.get_matching_tgw( - tgw_id=tgw["transit_gateway_id"], skip_deleted=False - ) - - return self._results - - -def setup_module_object() -> AnsibleAWSModule: - """ - merge argument spec and create Ansible module object - :return: Ansible module object - """ - - argument_spec = dict( - asn=dict(type="int"), - auto_associate=dict(type="bool", default=True), - auto_attach=dict(type="bool", default=False), - auto_propagate=dict(type="bool", default=True), - description=dict(type="str"), - multicast_support=dict(type="bool"), - dns_support=dict(type="bool", default=True), - purge_tags=dict(type="bool", default=True), - state=dict(default="present", choices=["present", "absent"]), - tags=dict(type="dict", aliases=["resource_tags"]), - transit_gateway_id=dict(type="str"), - vpn_ecmp_support=dict(type="bool", default=True), - wait=dict(type="bool", default=True), - wait_timeout=dict(type="int", default=300), - ) - - module = AnsibleAWSModule( - argument_spec=argument_spec, - required_one_of=[("description", "transit_gateway_id")], - supports_check_mode=True, - ) - - return module - - -def main(): - module = setup_module_object() - - results = dict(changed=False) - - tgw_manager = AnsibleEc2Tgw(module=module, results=results) - tgw_manager.process() - - module.exit_json(**results) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/ec2_transit_gateway/aliases b/tests/integration/targets/ec2_transit_gateway/aliases deleted file mode 100644 index cfcde0de380..00000000000 --- a/tests/integration/targets/ec2_transit_gateway/aliases +++ /dev/null @@ -1,3 +0,0 @@ -cloud/aws - -ec2_transit_gateway_info diff --git a/tests/integration/targets/ec2_transit_gateway/meta/main.yml b/tests/integration/targets/ec2_transit_gateway/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/ec2_transit_gateway/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml deleted file mode 100644 index fe542b1e1ec..00000000000 --- a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml +++ /dev/null @@ -1,300 +0,0 @@ ---- -- name: Run 'ec2_transit_gateway integration tests' - collections: - - amazon.aws - module_defaults: - group/aws: - access_key: '{{ aws_access_key }}' - secret_key: '{{ aws_secret_key }}' - session_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - block: - - - name: Generate unique value for testing - ansible.builtin.set_fact: - tgw_description: "{{ resource_prefix }}-tgw" - - - name: Test create transit gateway without tags - check_mode - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - register: create_result - check_mode: true - - - name: Assert changed is True - check_mode - ansible.builtin.assert: - that: - - create_result.changed == True - - '"ec2:CreateTransitGateway" not in create_result.resource_actions' - - - name: Test create transit gateway without tags - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - register: create_result - - - name: Assert changed is True - ansible.builtin.assert: - that: - - create_result.changed == True - - - name: Test create transit gateway without tags - idempotency - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - register: create_result - - - name: Assert changed is True - ansible.builtin.assert: - that: - - create_result.changed == False - - '"ec2:CreateTransitGateway" not in create_result.resource_actions' - - - name: Test update transit gateway with tags by description - check_mode - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - tags: - Name: Ansible Test TGW - register: result - check_mode: true - - - name: Assert changed is True - check_mode - ansible.builtin.assert: - that: - - result.changed == True - - '"ec2:CreateTags" not in result.resource_actions' - - - name: Test update transit gateway with tags by description - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - tags: - Name: Ansible Test TGW - register: result - - - name: Assert changed is True - ansible.builtin.assert: - that: - - result.changed == True - - result.transit_gateway.tags | length == 1 - - "'Name' in result.transit_gateway.tags" - - - name: Test update transit gateway with tags by description - idempotency - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - tags: - Name: Ansible Test TGW - register: result - - - name: Assert changed is False - idempotency - ansible.builtin.assert: - that: - - result.changed == False - - result.transit_gateway.tags | length == 1 - - "'Name' in result.transit_gateway.tags" - - - name: Test update transit gateway with new tag and purge_tags false - check_mode - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' - purge_tags: False - tags: - status: ok to delete - register: result - check_mode: true - - - name: Assert changed is True and have 2 tags - check_mode - ansible.builtin.assert: - that: - - result.changed == True - - result.transit_gateway.tags | length != 2 - - "'Name' in result.transit_gateway.tags" - - '"ec2:CreateTags" not in result.resource_actions' - - - name: Test update transit gateway with new tag and purge_tags false - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' - purge_tags: False - tags: - status: ok to delete - register: result - - - name: Assert changed is True and have 2 tags - ansible.builtin.assert: - that: - - result.changed == True - - result.transit_gateway.tags | length == 2 - - "'Name' in result.transit_gateway.tags" - - - name: Test update transit gateway with new tag and purge_tags false - idempotency - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' - purge_tags: False - tags: - status: ok to delete - register: result - - - name: Assert changed is True and have 2 tags - idempotency - ansible.builtin.assert: - that: - - result.changed == False - - result.transit_gateway.tags | length == 2 - - "'Name' in result.transit_gateway.tags" - - - name: Test update transit gateway with purge_tags true - check_mode - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' - purge_tags: True - tags: - status: ok to delete - register: result - check_mode: true - - - name: Assert changed is True and TGW tag is absent - check_mode - ansible.builtin.assert: - that: - - result.changed == True - - result.transit_gateway.tags | length == 2 - - '"ec2:DeleteTags" not in result.resource_actions' - - - name: Test update transit gateway with purge_tags true - community.aws.ec2_transit_gateway: - transit_gateway_id: '{{ create_result.transit_gateway.transit_gateway_id }}' - purge_tags: True - tags: - status: ok to delete - register: result - - - name: Assert changed is True and TGW tag is absent - ansible.builtin.assert: - that: - - result.changed == True - - result.transit_gateway.tags | length == 1 - - "'Name' not in result.transit_gateway.tags" - - - name: Test idempotence - community.aws.ec2_transit_gateway: - description: "{{ tgw_description }}" - purge_tags: True - tags: - status: ok to delete - register: result - - - name: Assert changed is False - ansible.builtin.assert: - that: - - result.changed == False - - - name: Generate unique value for testing - ansible.builtin.set_fact: - tgw_description_multicast: "{{ resource_prefix }}-tgw-multicast" - - - name: Test create transit gateway with multicast enabled - check_mode - community.aws.ec2_transit_gateway: - description: "{{ tgw_description_multicast }}" - multicast_support: true - register: create_result - check_mode: true - - - name: Assert changed is True - check_mode - ansible.builtin.assert: - that: - - create_result.changed == True - - '"ec2:CreateTransitGateway" not in create_result.resource_actions' - - - name: Test create transit gateway with multicast enabled - community.aws.ec2_transit_gateway: - description: "{{ tgw_description_multicast }}" - multicast_support: true - register: create_result - - - name: Assert changed is True - ansible.builtin.assert: - that: - - create_result.changed == True - - - name: Test create transit gateway with multicast enabled - idempotency - community.aws.ec2_transit_gateway: - description: "{{ tgw_description_multicast }}" - multicast_support: true - register: create_result - - - name: Assert changed is True - idempotency - ansible.builtin.assert: - that: - - create_result.changed == False - - - name: Test success with filter - community.aws.ec2_transit_gateway_info: - filters: - options.multicast-support: enable - register: result - - - name: Assert success with multicast-support filter - ansible.builtin.assert: - that: - - 'result.transit_gateways != []' - - # ==== Combine ec2_transit_gateway_info ====================== - - name: Test success with no parameters - community.aws.ec2_transit_gateway_info: - register: result - - name: Assert success with no parameters - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.transit_gateways != []' - - - name: Test success with single filter - community.aws.ec2_transit_gateway_info: - filters: - transit-gateway-id: "{{ create_result.transit_gateway.transit_gateway_id }}" - register: result - - - name: Assert success with transit_gateway_id filter - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.transit_gateways != []' - - - name: Test empty result set for non-existent tgw id via filter - community.aws.ec2_transit_gateway_info: - filters: - transit-gateway-id: tgw-00000011111111122 - register: result - - - name: Assert success with transit_gateway_id filter - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.transit_gateways == []' - - - name: Test NotFound exception caught and returned empty result set - community.aws.ec2_transit_gateway_info: - transit_gateway_id: tgw-00000011111111122 - register: result - - - name: Assert success with transit_gateway_id filter - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.transit_gateways == []' - - - name: Test success with multiple filters - community.aws.ec2_transit_gateway_info: - filters: - options.dns-support: enable - options.vpn-ecmp-support: enable - register: result - - - name: Assert success with transit_gateway_id filter - ansible.builtin.assert: - that: - - 'result.changed == false' - - 'result.transit_gateways != []' - - always: - ###### TEARDOWN STARTS HERE ###### - - name: Delete transit gateway - community.aws.ec2_transit_gateway: - description: "{{ item }}" - state: absent - ignore_errors: true - loop: - - "{{ tgw_description }}" - - "{{ tgw_description_multicast }}" From 3fb210c71b106adffbcae96f25dd8d256138dbae Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 29 Oct 2024 10:48:47 +0100 Subject: [PATCH 73/77] Drop deprecated options (#2165) SUMMARY Drop deprecated options ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell --- .../fragments/20241007-drop_deprecations.yml | 3 +++ plugins/modules/ecs_cluster.py | 12 +++--------- plugins/modules/glue_connection.py | 16 +--------------- tests/sanity/ignore-2.15.txt | 2 -- tests/sanity/ignore-2.16.txt | 2 -- tests/sanity/ignore-2.17.txt | 2 -- tests/sanity/ignore-2.18.txt | 2 -- tests/sanity/ignore-2.19.txt | 2 -- 8 files changed, 7 insertions(+), 34 deletions(-) create mode 100644 changelogs/fragments/20241007-drop_deprecations.yml diff --git a/changelogs/fragments/20241007-drop_deprecations.yml b/changelogs/fragments/20241007-drop_deprecations.yml new file mode 100644 index 00000000000..fbee107af1f --- /dev/null +++ b/changelogs/fragments/20241007-drop_deprecations.yml @@ -0,0 +1,3 @@ +breaking_changes: + - ecs_cluster - the parameter ``purge_capacity_providers`` defaults to true. (https://github.com/ansible-collections/community.aws/pull/2165). + - iam_policy - the ``connection_properties`` return key was previously deprecated and has been removed, please use ``raw_connection_properties`` instead (https://github.com/ansible-collections/community.aws/pull/2165). diff --git a/plugins/modules/ecs_cluster.py b/plugins/modules/ecs_cluster.py index 0500a27ffdb..c94095bf7b8 100644 --- a/plugins/modules/ecs_cluster.py +++ b/plugins/modules/ecs_cluster.py @@ -72,10 +72,10 @@ version_added: 5.2.0 description: - Toggle overwriting of existing capacity providers or strategy. This is needed for backwards compatibility. - - By default I(purge_capacity_providers=false). In release 9.0.0 this default will be changed to I(purge_capacity_providers=true). + - By default I(purge_capacity_providers=true). required: false type: bool - default: false + default: true extends_documentation_fragment: - amazon.aws.common.modules - amazon.aws.region.modules @@ -237,7 +237,7 @@ def main(): name=dict(required=True, type="str"), delay=dict(required=False, type="int", default=10), repeat=dict(required=False, type="int", default=10), - purge_capacity_providers=dict(required=False, type="bool", default=False), + purge_capacity_providers=dict(required=False, type="bool", default=True), capacity_providers=dict(required=False, type="list", elements="str"), capacity_provider_strategy=dict( required=False, @@ -291,12 +291,6 @@ def main(): # Unless purge_capacity_providers is true, we will not be updating the providers or strategy. if not purge_capacity_providers: - module.deprecate( - "In release 9.0.0 the default value of purge_capacity_providers will change from false to true." - " To maintain the existing behaviour explicitly set purge_capacity_providers=true", - version="9.0.0", - collection_name="community.aws", - ) cps_update_needed = False requested_cp = existing_cp requested_cps = existing_cps diff --git a/plugins/modules/glue_connection.py b/plugins/modules/glue_connection.py index f44ca8bbf76..f967fcddcdc 100644 --- a/plugins/modules/glue_connection.py +++ b/plugins/modules/glue_connection.py @@ -107,13 +107,6 @@ """ RETURN = r""" -connection_properties: - description: - - (deprecated) A dict of key-value pairs (converted to lowercase) used as parameters for this connection. - - This return key has been deprecated, and will be removed in release 9.0.0. - returned: when state is present - type: dict - sample: {'jdbc_connection_url':'jdbc:mysql://mydb:3306/databasename','username':'x','password':'y'} connection_type: description: The type of the connection. returned: when state is present @@ -332,15 +325,8 @@ def create_or_update_glue_connection(connection, connection_ec2, module, glue_co glue_connection = _await_glue_connection(connection, module) if glue_connection: - module.deprecate( - ( - "The 'connection_properties' return key is deprecated and will be replaced" - " by 'raw_connection_properties'. Both values are returned for now." - ), - version="9.0.0", - collection_name="community.aws", - ) glue_connection["RawConnectionProperties"] = glue_connection["ConnectionProperties"] + glue_connection.pop("ConnectionProperties") module.exit_json( changed=changed, **camel_dict_to_snake_dict(glue_connection or {}, ignore_list=["RawConnectionProperties"]) diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index e846a866640..67d3693df63 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -1,4 +1,2 @@ plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 -plugins/modules/ecs_cluster.py pylint:collection-deprecated-version -plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index e846a866640..67d3693df63 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -1,4 +1,2 @@ plugins/connection/aws_ssm.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 plugins/inventory/aws_mq.py yamllint:unparsable-with-libyaml # bug in ansible-test - https://github.com/ansible/ansible/issues/82353 -plugins/modules/ecs_cluster.py pylint:collection-deprecated-version -plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index e925c5a05f2..e69de29bb2d 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -1,2 +0,0 @@ -plugins/modules/ecs_cluster.py pylint:collection-deprecated-version -plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt index e925c5a05f2..e69de29bb2d 100644 --- a/tests/sanity/ignore-2.18.txt +++ b/tests/sanity/ignore-2.18.txt @@ -1,2 +0,0 @@ -plugins/modules/ecs_cluster.py pylint:collection-deprecated-version -plugins/modules/glue_connection.py pylint:collection-deprecated-version diff --git a/tests/sanity/ignore-2.19.txt b/tests/sanity/ignore-2.19.txt index e925c5a05f2..e69de29bb2d 100644 --- a/tests/sanity/ignore-2.19.txt +++ b/tests/sanity/ignore-2.19.txt @@ -1,2 +0,0 @@ -plugins/modules/ecs_cluster.py pylint:collection-deprecated-version -plugins/modules/glue_connection.py pylint:collection-deprecated-version From a5f54a5a7950a8e7d51df896e2f8db37aa2ad84d Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 29 Oct 2024 15:23:48 +0100 Subject: [PATCH 74/77] Bump botocore/boto3 requirements (add deprecation reminder about Python 3.8 support) (#2195) SUMMARY Bump botocore/boto3 requirements (add deprecation reminder about Python 3.8 support ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell Reviewed-by: GomathiselviS --- README.md | 2 +- changelogs/fragments/botocore-python.yaml | 14 ++++++++++++++ plugins/modules/ecs_service.py | 1 - requirements.txt | 4 ++-- tests/integration/constraints.txt | 6 +++--- tests/unit/constraints.txt | 6 +++--- 6 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/botocore-python.yaml diff --git a/README.md b/README.md index d63c845a58e..1c4a4ed6173 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ As such support for Python less than 3.8 will be removed in a release after 2024 Starting with the 2.0.0 releases of amazon.aws and community.aws, it is generally the collection's policy to support the versions of `botocore` and `boto3` that were released 12 months prior to the most recent major collection release, following semantic versioning (for example, 2.0.0, 3.0.0). -Version 7.0.0 of this collection supports `boto3 >= 1.26.0` and `botocore >= 1.29.0` +Version 9.0.0 of this collection supports `boto3 >= 1.28.0` and `botocore >= 1.31.0` All support for the original AWS SDK `boto` was removed in release 4.0.0. diff --git a/changelogs/fragments/botocore-python.yaml b/changelogs/fragments/botocore-python.yaml new file mode 100644 index 00000000000..08b72eacd07 --- /dev/null +++ b/changelogs/fragments/botocore-python.yaml @@ -0,0 +1,14 @@ +--- +breaking_changes: + - The community.aws collection has dropped support for ``botocore<1.31.0`` and + ``boto3<1.28.0``. Most modules will continue to work with older versions of + the AWS SDK. However, compatability with older versions of the SDK is not guaranteed + and will not be tested. When using older versions of the SDK a warning will + be emitted by Ansible + (https://github.com/ansible-collections/community.aws/pull/2195). +deprecated_features: + - community.aws collection - due to the AWS SDKs announcing the end of support + for Python less than 3.8 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) + support for Python less than 3.8 by this collection has been deprecated + and will removed in release 10.0.0 + (https://github.com/ansible-collections/community.aws/pull/2195). diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index be2735cf6da..fae0af619b5 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -420,7 +420,6 @@ loadBalancers: description: - A list of load balancer objects - - Updating the loadbalancer configuration of an existing service requires botocore>=1.24.14. returned: always type: complex contains: diff --git a/requirements.txt b/requirements.txt index cd474e3b66b..131cc3b8f5c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ # - tests/unit/constraints.txt # - tests/integration/constraints.txt # - tests/integration/targets/setup_botocore_pip -botocore>=1.29.0 -boto3>=1.26.0 +botocore>=1.31.0 +boto3>=1.28.0 diff --git a/tests/integration/constraints.txt b/tests/integration/constraints.txt index f388e1f900b..c55f7cdd016 100644 --- a/tests/integration/constraints.txt +++ b/tests/integration/constraints.txt @@ -1,10 +1,10 @@ # Specifically run tests against the oldest versions that we support -botocore==1.29.0 -boto3==1.26.0 +botocore==1.31.0 +boto3==1.28.0 # AWS CLI has `botocore==` dependencies, provide the one that matches botocore # to avoid needing to download over a years worth of awscli wheels. -awscli==1.27.0 +awscli==1.29.0 # AWS CLI depends on PyYAML <5.5,>=3.10; the latest PyYAML release in that range, 5.4.1, fails to install. # Use a version in that range that is known to work (https://github.com/yaml/pyyaml/issues/736) diff --git a/tests/unit/constraints.txt b/tests/unit/constraints.txt index 5708323f110..c2fad718813 100644 --- a/tests/unit/constraints.txt +++ b/tests/unit/constraints.txt @@ -1,7 +1,7 @@ # Specifically run tests against the oldest versions that we support -botocore==1.29.0 -boto3==1.26.0 +botocore==1.31.0 +boto3==1.28.0 # AWS CLI has `botocore==` dependencies, provide the one that matches botocore # to avoid needing to download over a years worth of awscli wheels. -awscli==1.27.0 +awscli==1.29.0 From 3a71abd0e10ff994af4a2c4f5c08f839cafedfa2 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 30 Oct 2024 14:41:22 +0100 Subject: [PATCH 75/77] Fix broken SES integration tests (#2198) SUMMARY It would appear that Amazon now provides a window, during which a deleted SES identity can be revived (even if marked as deleted). This resulted in some of our integration tests breaking. The identities were still marked as "deleted", AWS just revived them... ISSUE TYPE Bugfix Pull Request COMPONENT NAME ses_identity ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- .../targets/ses_identity/tasks/main.yaml | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/tests/integration/targets/ses_identity/tasks/main.yaml b/tests/integration/targets/ses_identity/tasks/main.yaml index 3ecb68c38de..79008346a84 100644 --- a/tests/integration/targets/ses_identity/tasks/main.yaml +++ b/tests/integration/targets/ses_identity/tasks/main.yaml @@ -15,7 +15,7 @@ block: - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-email" state: present register: result - name: assert changed is True @@ -24,18 +24,18 @@ - result.changed == True - import_tasks: assert_defaults.yaml vars: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-email" always: - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-email" state: absent # ============================================================ - name: test register domain identity block: - name: register domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain" state: present register: result - name: assert changed is True @@ -44,7 +44,7 @@ - result.changed == True - import_tasks: assert_defaults.yaml vars: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain" - name: assert verification_attributes.verification_token is defined assert: that: @@ -52,18 +52,18 @@ always: - name: cleanup domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain" state: absent # ============================================================ - name: test email_identity unchanged when already existing block: - name: register identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-duplicate" state: present - name: duplicate register identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-duplicate" state: present register: result - name: assert changed is False @@ -72,22 +72,22 @@ - result.changed == False - import_tasks: assert_defaults.yaml vars: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-duplicate" always: - name: cleanup identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-duplicate" state: absent # ============================================================ - name: test domain_identity unchanged when already existing block: - name: register identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-duplicate" state: present - name: duplicate register identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-duplicate" state: present register: result - name: assert changed is False @@ -96,11 +96,11 @@ - result.changed == False - import_tasks: assert_defaults.yaml vars: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-duplicate" always: - name: cleanup identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-duplicate" state: absent # ============================================================ # Test for https://github.com/ansible/ansible/issues/51531 @@ -111,7 +111,7 @@ block: - name: register email identity without explicit region ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-noregion" state: present region: "{{ omit }}" register: result @@ -123,18 +123,18 @@ - result.changed == True - import_tasks: assert_defaults.yaml vars: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-noregion" always: - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-noregion" state: absent # ============================================================ - name: test register email identity check mode block: - name: register email identity check mode ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-check" state: present register: result check_mode: True @@ -146,12 +146,12 @@ - import_tasks: assert_defaults.yaml vars: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-check" always: - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-check" state: absent register: result @@ -164,7 +164,7 @@ block: - name: register domain identity check mode ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain-check" state: present register: result check_mode: True @@ -176,12 +176,12 @@ - import_tasks: assert_defaults.yaml vars: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain-check" always: - name: cleanup domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-domain-check" state: absent register: result @@ -192,7 +192,7 @@ # ============================================================ - name: remove non-existent email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-missing" state: absent register: result - name: assert changed is False @@ -202,7 +202,7 @@ # ============================================================ - name: remove non-existent domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-missing-domain" state: absent register: result - name: assert changed is False @@ -214,13 +214,13 @@ block: - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-remove-check" state: present register: result - name: remove email identity check mode ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-remove-check" state: absent register: result check_mode: True @@ -232,7 +232,7 @@ always: - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-remove-check" state: absent register: result @@ -245,13 +245,13 @@ block: - name: register domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-remove-domain-check" state: present register: result - name: remove domain identity check mode ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-remove-domain-check" state: absent register: result check_mode: True @@ -263,7 +263,7 @@ always: - name: cleanup domain identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-remove-domain-check" state: absent register: result @@ -285,7 +285,7 @@ - delivery - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics" state: present bounce_notifications: topic: "{{ topic_info.results[0].sns_arn }}" @@ -317,7 +317,7 @@ - delivery - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics" state: absent # ============================================================ - name: test change notification queues after create @@ -333,11 +333,11 @@ - delivery - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-post" state: present - name: set notification topics ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-post" state: present bounce_notifications: topic: "{{ topic_info.results[0].sns_arn }}" @@ -367,7 +367,7 @@ - delivery - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-post" state: absent # ============================================================ - name: test clear notification configuration @@ -383,7 +383,7 @@ - delivery - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-clear" state: present bounce_notifications: topic: "{{ topic_info.results[0].sns_arn }}" @@ -393,7 +393,7 @@ topic: "{{ topic_info.results[2].sns_arn }}" - name: Make no change to identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-clear" state: present register: result - name: assert no change @@ -403,7 +403,7 @@ - name: clear notification settings ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-clear" state: present bounce_notifications: {} complaint_notifications: {} @@ -427,7 +427,7 @@ - delivery - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-clear" state: absent # ============================================================ - name: test change notification settings check mode @@ -444,12 +444,12 @@ - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-check" state: present - name: set notification settings check mode ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-check" state: present bounce_notifications: topic: "{{ topic_info.results[0].sns_arn }}" @@ -482,7 +482,7 @@ - name: re-register base email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-check" state: present register: result @@ -509,14 +509,14 @@ - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-topics-check" state: absent # ============================================================ - name: test include headers on notification queues block: - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-headers" state: present bounce_notifications: include_headers: Yes @@ -534,7 +534,7 @@ always: - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-headers" state: absent # ============================================================ - name: test disable feedback forwarding @@ -549,7 +549,7 @@ - complaint - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback" state: present bounce_notifications: topic: "{{ topic_info.results[0].sns_arn }}" @@ -571,14 +571,14 @@ - complaint - name: cleanup email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback" state: absent # ============================================================ - name: test disable feedback forwarding fails if no topics block: - name: register identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-feedback-nt" state: present feedback_forwarding: No register: result @@ -590,7 +590,7 @@ always: - name: cleanup identity ses_identity: - identity: "{{ domain_identity }}" + identity: "{{ domain_identity }}-feedback-nt" state: absent # ============================================================ - name: test disable feedback forwarding fails if no complaint topic @@ -602,7 +602,7 @@ register: topic_info - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback-nb" state: present bounce_notifications: topic: "{{ topic_info.sns_arn }}" @@ -620,7 +620,7 @@ state: absent - name: cleanup identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback-nb" state: absent # ============================================================ - name: test disable feedback forwarding fails if no bounce topic @@ -632,7 +632,7 @@ register: topic_info - name: register email identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback-nc" state: present complaint_notifications: topic: "{{ topic_info.sns_arn }}" @@ -650,5 +650,5 @@ state: absent - name: cleanup identity ses_identity: - identity: "{{ email_identity }}" + identity: "{{ email_identity }}-feedback-nc" state: absent From 1ad3f31d4b27f3660bac499035ff5b8eb34bde29 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Thu, 31 Oct 2024 13:51:11 +0100 Subject: [PATCH 76/77] Bump release for main branch to 10.0.0-dev0 (#2193) SUMMARY Bump release for main branch to 10.0.0-dev0 ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mark Chappell Reviewed-by: GomathiselviS --- changelogs/fragments/20241029-main-10.0.0.yml | 2 ++ galaxy.yml | 2 +- plugins/module_utils/common.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/20241029-main-10.0.0.yml diff --git a/changelogs/fragments/20241029-main-10.0.0.yml b/changelogs/fragments/20241029-main-10.0.0.yml new file mode 100644 index 00000000000..9fbf7b5efb3 --- /dev/null +++ b/changelogs/fragments/20241029-main-10.0.0.yml @@ -0,0 +1,2 @@ +trivial: + - galaxy.yml - bump ``release`` for main branch to ``10.0.0-dev0``. diff --git a/galaxy.yml b/galaxy.yml index 72c91f51b01..a509b6468f5 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: community name: aws -version: 9.0.0-dev0 +version: 10.0.0-dev0 readme: README.md authors: - Ansible (https://github.com/ansible) diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index b21074bc278..b5afdf0ec96 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -5,4 +5,4 @@ COMMUNITY_AWS_COLLECTION_NAME = "community.aws" -COMMUNITY_AWS_COLLECTION_VERSION = "9.0.0-dev0" +COMMUNITY_AWS_COLLECTION_VERSION = "10.0.0-dev0" From 822fe812029a0fa19bb759451deeaf591849fcd9 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 5 Nov 2024 14:02:36 +0100 Subject: [PATCH 77/77] Update main branch after releasing 9.0 (#2200) SUMMARY Update main branch after releasing 9.0 Will rebase on top of #2193 ISSUE TYPE Docs Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Mike Graves --- CHANGELOG.rst | 76 ++++++++ changelogs/changelog.yaml | 177 ++++++++++++++++++ changelogs/fragments/0-readme.yml | 3 - .../20240110-ec2_launch_template-refactor.yml | 9 - .../20240423-msk_cluster-disable-tests.yml | 2 - .../20240613_ec2_placement_group_tags.yml | 2 - ...40909-ec2_vpc_vgw-fix-super-exception.yaml | 3 - changelogs/fragments/20240919-fix_sanity.yml | 2 - ...r-autoscaling_instance_refresh-modules.yml | 7 - ...23-refactor-ec2_vpc_egress_igw-modules.yml | 4 - .../fragments/20240924-create-ignore-2.19.yml | 2 - .../20240924-ec2_vpc_peer-refactor.yml | 4 - ...20240924-fix-documentation-tgw-vpc-att.yml | 2 - ...0240924-refactor-ec2_vpc_nacl-modules.yaml | 4 - .../20240930-ec2_vpc_vpn_refactoring.yml | 3 - .../fragments/20241007-drop_deprecations.yml | 3 - changelogs/fragments/20250515-main-9.0.0.yml | 2 - .../fragments/2063-add-multicast-support.yml | 2 - .../2124-add-retry-to-ecs_taskdefinition.yml | 2 - ...39-elb_classic_lb_info-refactor-module.yml | 2 - ...work_lb-update-tests-to-use-valid-cert.yml | 2 - ...esh_autoscaling_instance_refresh_info.yaml | 8 - .../migrate_ec2_launch_template.yaml | 5 - .../fragments/migrate_ec2_placement_group.yml | 8 - .../fragments/migrate_ec2_transit_gateway.yml | 5 - .../migrate_ec2_transit_gateway_info.yml | 5 - ...ate_ec2_transit_gateway_vpc_attachment.yml | 8 - .../fragments/migrate_ec2_vpc_egress_igw.yml | 5 - ...igrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml | 8 - changelogs/fragments/migrate_ec2_vpc_peer.yml | 8 - changelogs/fragments/migrate_ec2_vpc_vgw.yml | 8 - changelogs/fragments/migrate_ec2_vpc_vpn.yml | 8 - .../fragments/migrate_elb_classic_lb_info.yml | 5 - .../refactor-ec2_transit_gateway-modules.yml | 3 - .../refactor-ec2_vpc_vgw-modules.yml | 3 - .../refactor_ec2_placement_group.yml | 2 - galaxy.yml | 2 +- 37 files changed, 254 insertions(+), 150 deletions(-) delete mode 100644 changelogs/fragments/0-readme.yml delete mode 100644 changelogs/fragments/20240110-ec2_launch_template-refactor.yml delete mode 100644 changelogs/fragments/20240423-msk_cluster-disable-tests.yml delete mode 100644 changelogs/fragments/20240613_ec2_placement_group_tags.yml delete mode 100644 changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml delete mode 100644 changelogs/fragments/20240919-fix_sanity.yml delete mode 100644 changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml delete mode 100644 changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml delete mode 100644 changelogs/fragments/20240924-create-ignore-2.19.yml delete mode 100644 changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml delete mode 100644 changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml delete mode 100644 changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml delete mode 100644 changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml delete mode 100644 changelogs/fragments/20241007-drop_deprecations.yml delete mode 100644 changelogs/fragments/20250515-main-9.0.0.yml delete mode 100644 changelogs/fragments/2063-add-multicast-support.yml delete mode 100644 changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml delete mode 100644 changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml delete mode 100644 changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml delete mode 100644 changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml delete mode 100644 changelogs/fragments/migrate_ec2_launch_template.yaml delete mode 100644 changelogs/fragments/migrate_ec2_placement_group.yml delete mode 100644 changelogs/fragments/migrate_ec2_transit_gateway.yml delete mode 100644 changelogs/fragments/migrate_ec2_transit_gateway_info.yml delete mode 100644 changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml delete mode 100644 changelogs/fragments/migrate_ec2_vpc_egress_igw.yml delete mode 100644 changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml delete mode 100644 changelogs/fragments/migrate_ec2_vpc_peer.yml delete mode 100644 changelogs/fragments/migrate_ec2_vpc_vgw.yml delete mode 100644 changelogs/fragments/migrate_ec2_vpc_vpn.yml delete mode 100644 changelogs/fragments/migrate_elb_classic_lb_info.yml delete mode 100644 changelogs/fragments/refactor-ec2_transit_gateway-modules.yml delete mode 100644 changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml delete mode 100644 changelogs/fragments/refactor_ec2_placement_group.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5e7208f47ed..ea2a0ce2dbd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,82 @@ community.aws Release Notes .. contents:: Topics +v9.0.0 +====== + +Release Summary +--------------- + +This release includes some new features, bugfixes and breaking changes. Several modules have been migrated to amazon.aws and the Fully Qualified Collection Name for these modules needs to be updated. The community.aws collection has dropped support for botocore<1.31.0 and boto3<1.28.0. Due to the AWS SDKs announcing Python less than 3.8 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/), support for Python less than 3.8 by this collection was deprecated in this release and will be removed in release 10.0.0 (https://github.com/ansible-collections/community.aws/pull/2194). + +Minor Changes +------------- + +- autoscaling_instance_refresh - Add support for ``skip_matching`` and ``max_healthy_percentage`` in ``preference`` (https://github.com/ansible-collections/community.aws/pull/2150). +- autoscaling_instance_refresh - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). +- autoscaling_instance_refresh_info - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). +- ec2_launch_template - Add option ``tag_specifications`` to define tags to be applied to the resources created with the launch template (https://github.com/ansible-collections/community.aws/issues/176). +- ec2_launch_template - Add suboption ``throughput`` to ``block_device_mappings`` argument (https://github.com/ansible-collections/community.aws/issues/1944). +- ec2_launch_template - Add support ``purge_tags`` parameter (https://github.com/ansible-collections/community.aws/issues/176). +- ec2_launch_template - Add the possibility to delete specific versions of a launch template using ``versions_to_delete`` (https://github.com/ansible-collections/community.aws/pull/2164). +- ec2_launch_template - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2164). +- ec2_placement_group - Added support for creating with ``tags`` (https://github.com/ansible-collections/community.aws/pull/2081). +- ec2_placement_group - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2167). +- ec2_transit_gateway - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). +- ec2_transit_gateway - Support for enable multicast on Transit Gateway (https://github.com/ansible-collections/community.aws/pull/2063). +- ec2_transit_gateway_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). +- ec2_transit_gateway_vpc_attachment - Modify doumentation and refactor to adhere to coding guidelines (https://github.com/ansible-collections/community.aws/pull/2157). +- ec2_vpc_egress_igw - Add the possibility to update/add tags on Egress only internet gateway (https://github.com/ansible-collections/community.aws/pull/2152). +- ec2_vpc_egress_igw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` util (https://github.com/ansible-collections/community.aws/pull/2152). +- ec2_vpc_nacl - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). +- ec2_vpc_nacl_info - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). +- ec2_vpc_peer - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). +- ec2_vpc_peering_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). +- ec2_vpc_vgw - Fix call to parent static method in class ``VGWRetry`` (https://github.com/ansible-collections/community.aws/pull/2140). +- ec2_vpc_vgw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). +- ec2_vpc_vgw_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). +- ec2_vpc_vpn - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). +- ec2_vpc_vpn_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). +- elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). + +Breaking Changes / Porting Guide +-------------------------------- + +- The community.aws collection has dropped support for ``botocore<1.31.0`` and ``boto3<1.28.0``. Most modules will continue to work with older versions of the AWS SDK. However, compatability with older versions of the SDK is not guaranteed and will not be tested. When using older versions of the SDK a warning will be emitted by Ansible (https://github.com/ansible-collections/community.aws/pull/2195). +- autoscaling_instance_refresh - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.autoscaling_instance_refresh`` (https://github.com/ansible-collections/community.aws/pull/2177). +- autoscaling_instance_refresh_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.autoscaling_instance_refresh_info`` (https://github.com/ansible-collections/community.aws/pull/2177). +- ec2_launch_template - Tags defined using option ``tags`` are now applied to the launch template resources not the resource created using this launch template (https://github.com/ansible-collections/community.aws/issues/176). +- ec2_launch_template - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_launch_template`` (https://github.com/ansible-collections/community.aws/pull/2185). +- ec2_placement_group - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_placement_group``. +- ec2_placement_group_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_placement_group_info``. +- ec2_transit_gateway - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway``. +- ec2_transit_gateway_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway_info``. +- ec2_transit_gateway_vpc_attachment - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment``. +- ec2_transit_gateway_vpc_attachment_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment_info``. +- ec2_vpc_egress_igw - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_egress_igw`` (https://api.github.com/repos/ansible-collections/community.aws/pulls/2169). +- ec2_vpc_nacl - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_nacl`` (https://github.com/ansible-collections/community.aws/pull/2178). +- ec2_vpc_nacl_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_nacl_info`` (https://github.com/ansible-collections/community.aws/pull/2178). +- ec2_vpc_peer - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_peer``. +- ec2_vpc_peering_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_peering_info``. +- ec2_vpc_vgw - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_vgw``. +- ec2_vpc_vgw_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_vgw_info``. +- ec2_vpc_vpn - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_vpn``. +- ec2_vpc_vpn_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.ec2_vpc_vpn_info``. +- ecs_cluster - the parameter ``purge_capacity_providers`` defaults to true. (https://github.com/ansible-collections/community.aws/pull/2165). +- elb_classic_lb_info - The module has been migrated from the ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name for this module should be updated to use ``amazon.aws.elb_classic_lb_info``. +- iam_policy - the ``connection_properties`` return key was previously deprecated and has been removed, please use ``raw_connection_properties`` instead (https://github.com/ansible-collections/community.aws/pull/2165). + +Deprecated Features +------------------- + +- community.aws collection - due to the AWS SDKs announcing the end of support for Python less than 3.8 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) support for Python less than 3.8 by this collection has been deprecated and will removed in release 10.0.0 (https://github.com/ansible-collections/community.aws/pull/2195). + +Bugfixes +-------- + +- autoscaling_instance_refresh - Fix typo in module ``exit_json`` (https://github.com/ansible-collections/community.aws/issues/2019). +- ecs_taskdefinition - avoid throttling exceptions on task definitions with a large number of revisions by using the retry mechanism (https://github.com/ansible-collections/community.aws/issues/2123). + v8.0.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index beb6b030ceb..e2702bdfb5a 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -3875,3 +3875,180 @@ releases: - python37.yml - workflow-requirements.yml release_date: '2024-05-20' + 9.0.0: + changes: + breaking_changes: + - The community.aws collection has dropped support for ``botocore<1.31.0`` and + ``boto3<1.28.0``. Most modules will continue to work with older versions of + the AWS SDK. However, compatability with older versions of the SDK is not + guaranteed and will not be tested. When using older versions of the SDK a + warning will be emitted by Ansible (https://github.com/ansible-collections/community.aws/pull/2195). + - autoscaling_instance_refresh - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.autoscaling_instance_refresh`` (https://github.com/ansible-collections/community.aws/pull/2177). + - autoscaling_instance_refresh_info - The module has been migrated from the + ``community.aws`` collection. Playbooks using the Fully Qualified Collection + Name for this module should be updated to use ``amazon.aws.autoscaling_instance_refresh_info`` + (https://github.com/ansible-collections/community.aws/pull/2177). + - ec2_launch_template - Tags defined using option ``tags`` are now applied to + the launch template resources not the resource created using this launch template + (https://github.com/ansible-collections/community.aws/issues/176). + - ec2_launch_template - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_launch_template`` (https://github.com/ansible-collections/community.aws/pull/2185). + - ec2_placement_group - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_placement_group``. + - ec2_placement_group_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_placement_group_info``. + - ec2_transit_gateway - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_transit_gateway``. + - ec2_transit_gateway_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_transit_gateway_info``. + - ec2_transit_gateway_vpc_attachment - The module has been migrated from the + ``community.aws`` collection. Playbooks using the Fully Qualified Collection + Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment``. + - ec2_transit_gateway_vpc_attachment_info - The module has been migrated from + the ``community.aws`` collection. Playbooks using the Fully Qualified Collection + Name for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment_info``. + - ec2_vpc_egress_igw - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_egress_igw`` (https://api.github.com/repos/ansible-collections/community.aws/pulls/2169). + - ec2_vpc_nacl - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.ec2_vpc_nacl`` (https://github.com/ansible-collections/community.aws/pull/2178). + - ec2_vpc_nacl_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_nacl_info`` (https://github.com/ansible-collections/community.aws/pull/2178). + - ec2_vpc_peer - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.ec2_vpc_peer``. + - ec2_vpc_peering_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_peering_info``. + - ec2_vpc_vgw - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.ec2_vpc_vgw``. + - ec2_vpc_vgw_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_vgw_info``. + - ec2_vpc_vpn - The module has been migrated from the ``community.aws`` collection. + Playbooks using the Fully Qualified Collection Name for this module should + be updated to use ``amazon.aws.ec2_vpc_vpn``. + - ec2_vpc_vpn_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.ec2_vpc_vpn_info``. + - ecs_cluster - the parameter ``purge_capacity_providers`` defaults to true. + (https://github.com/ansible-collections/community.aws/pull/2165). + - elb_classic_lb_info - The module has been migrated from the ``community.aws`` + collection. Playbooks using the Fully Qualified Collection Name for this module + should be updated to use ``amazon.aws.elb_classic_lb_info``. + - iam_policy - the ``connection_properties`` return key was previously deprecated + and has been removed, please use ``raw_connection_properties`` instead (https://github.com/ansible-collections/community.aws/pull/2165). + bugfixes: + - autoscaling_instance_refresh - Fix typo in module ``exit_json`` (https://github.com/ansible-collections/community.aws/issues/2019). + - ecs_taskdefinition - avoid throttling exceptions on task definitions with + a large number of revisions by using the retry mechanism (https://github.com/ansible-collections/community.aws/issues/2123). + deprecated_features: + - community.aws collection - due to the AWS SDKs announcing the end of support + for Python less than 3.8 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/) + support for Python less than 3.8 by this collection has been deprecated and + will removed in release 10.0.0 (https://github.com/ansible-collections/community.aws/pull/2195). + minor_changes: + - autoscaling_instance_refresh - Add support for ``skip_matching`` and ``max_healthy_percentage`` + in ``preference`` (https://github.com/ansible-collections/community.aws/pull/2150). + - autoscaling_instance_refresh - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` + and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). + - autoscaling_instance_refresh_info - refactor module to use shared code from + ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add + type hinting (https://github.com/ansible-collections/community.aws/pull/2150). + - ec2_launch_template - Add option ``tag_specifications`` to define tags to + be applied to the resources created with the launch template (https://github.com/ansible-collections/community.aws/issues/176). + - ec2_launch_template - Add suboption ``throughput`` to ``block_device_mappings`` + argument (https://github.com/ansible-collections/community.aws/issues/1944). + - ec2_launch_template - Add support ``purge_tags`` parameter (https://github.com/ansible-collections/community.aws/issues/176). + - ec2_launch_template - Add the possibility to delete specific versions of a + launch template using ``versions_to_delete`` (https://github.com/ansible-collections/community.aws/pull/2164). + - ec2_launch_template - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2164). + - ec2_placement_group - Added support for creating with ``tags`` (https://github.com/ansible-collections/community.aws/pull/2081). + - ec2_placement_group - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2167). + - ec2_transit_gateway - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). + - ec2_transit_gateway - Support for enable multicast on Transit Gateway (https://github.com/ansible-collections/community.aws/pull/2063). + - ec2_transit_gateway_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). + - ec2_transit_gateway_vpc_attachment - Modify doumentation and refactor to adhere + to coding guidelines (https://github.com/ansible-collections/community.aws/pull/2157). + - ec2_vpc_egress_igw - Add the possibility to update/add tags on Egress only + internet gateway (https://github.com/ansible-collections/community.aws/pull/2152). + - ec2_vpc_egress_igw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + util (https://github.com/ansible-collections/community.aws/pull/2152). + - ec2_vpc_nacl - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` + (https://github.com/ansible-collections/community.aws/pull/2159). + - ec2_vpc_nacl_info - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` + (https://github.com/ansible-collections/community.aws/pull/2159). + - ec2_vpc_peer - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + (https://github.com/ansible-collections/community.aws/pull/2153). + - ec2_vpc_peering_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + (https://github.com/ansible-collections/community.aws/pull/2153). + - ec2_vpc_vgw - Fix call to parent static method in class ``VGWRetry`` (https://github.com/ansible-collections/community.aws/pull/2140). + - ec2_vpc_vgw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). + - ec2_vpc_vgw_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). + - ec2_vpc_vpn - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + (https://github.com/ansible-collections/community.aws/pull/2160). + - ec2_vpc_vpn_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` + (https://github.com/ansible-collections/community.aws/pull/2160). + - elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). + release_summary: This release includes some new features, bugfixes and breaking + changes. Several modules have been migrated to amazon.aws and the Fully Qualified + Collection Name for these modules needs to be updated. The community.aws collection + has dropped support for botocore<1.31.0 and boto3<1.28.0. Due to the AWS SDKs + announcing Python less than 3.8 (https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/), + support for Python less than 3.8 by this collection was deprecated in this + release and will be removed in release 10.0.0 (https://github.com/ansible-collections/community.aws/pull/2194). + fragments: + - 0-readme.yml + - 20240110-ec2_launch_template-refactor.yml + - 20240423-msk_cluster-disable-tests.yml + - 20240613_ec2_placement_group_tags.yml + - 20240909-ec2_vpc_vgw-fix-super-exception.yaml + - 20240919-fix_sanity.yml + - 20240920-refactor-autoscaling_instance_refresh-modules.yml + - 20240923-refactor-ec2_vpc_egress_igw-modules.yml + - 20240924-create-ignore-2.19.yml + - 20240924-ec2_vpc_peer-refactor.yml + - 20240924-fix-documentation-tgw-vpc-att.yml + - 20240924-refactor-ec2_vpc_nacl-modules.yaml + - 20240930-ec2_vpc_vpn_refactoring.yml + - 20241007-drop_deprecations.yml + - 20241029-update-docs.yml + - 20250515-main-9.0.0.yml + - 2063-add-multicast-support.yml + - 2124-add-retry-to-ecs_taskdefinition.yml + - 2139-elb_classic_lb_info-refactor-module.yml + - 2142-elb_network_lb-update-tests-to-use-valid-cert.yml + - botocore-python.yaml + - migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml + - migrate_ec2_launch_template.yaml + - migrate_ec2_placement_group.yml + - migrate_ec2_transit_gateway.yml + - migrate_ec2_transit_gateway_info.yml + - migrate_ec2_transit_gateway_vpc_attachment.yml + - migrate_ec2_vpc_egress_igw.yml + - migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml + - migrate_ec2_vpc_peer.yml + - migrate_ec2_vpc_vgw.yml + - migrate_ec2_vpc_vpn.yml + - migrate_elb_classic_lb_info.yml + - refactor-ec2_transit_gateway-modules.yml + - refactor-ec2_vpc_vgw-modules.yml + - refactor_ec2_placement_group.yml + - release_summary.yml + release_date: '2024-10-30' diff --git a/changelogs/fragments/0-readme.yml b/changelogs/fragments/0-readme.yml deleted file mode 100644 index 6ae0307d203..00000000000 --- a/changelogs/fragments/0-readme.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -trivial: - - README.md - Add Communication section with Forum information. diff --git a/changelogs/fragments/20240110-ec2_launch_template-refactor.yml b/changelogs/fragments/20240110-ec2_launch_template-refactor.yml deleted file mode 100644 index d2e7293fa9a..00000000000 --- a/changelogs/fragments/20240110-ec2_launch_template-refactor.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -breaking_changes: - - ec2_launch_template - Tags defined using option ``tags`` are now applied to the launch template resources not the resource created using this launch template (https://github.com/ansible-collections/community.aws/issues/176). -minor_changes: - - ec2_launch_template - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2164). - - ec2_launch_template - Add the possibility to delete specific versions of a launch template using ``versions_to_delete`` (https://github.com/ansible-collections/community.aws/pull/2164). - - ec2_launch_template - Add suboption ``throughput`` to ``block_device_mappings`` argument (https://github.com/ansible-collections/community.aws/issues/1944). - - ec2_launch_template - Add option ``tag_specifications`` to define tags to be applied to the resources created with the launch template (https://github.com/ansible-collections/community.aws/issues/176). - - ec2_launch_template - Add support ``purge_tags`` parameter (https://github.com/ansible-collections/community.aws/issues/176). diff --git a/changelogs/fragments/20240423-msk_cluster-disable-tests.yml b/changelogs/fragments/20240423-msk_cluster-disable-tests.yml deleted file mode 100644 index 28be7b8378d..00000000000 --- a/changelogs/fragments/20240423-msk_cluster-disable-tests.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - msk_cluster - Disable integration tests because they are too slow. diff --git a/changelogs/fragments/20240613_ec2_placement_group_tags.yml b/changelogs/fragments/20240613_ec2_placement_group_tags.yml deleted file mode 100644 index 16e197cb254..00000000000 --- a/changelogs/fragments/20240613_ec2_placement_group_tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ec2_placement_group - Added support for creating with ``tags`` (https://github.com/ansible-collections/community.aws/pull/2081). diff --git a/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml b/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml deleted file mode 100644 index 671c7f8f565..00000000000 --- a/changelogs/fragments/20240909-ec2_vpc_vgw-fix-super-exception.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - ec2_vpc_vgw - Fix call to parent static method in class ``VGWRetry`` (https://github.com/ansible-collections/community.aws/pull/2140). \ No newline at end of file diff --git a/changelogs/fragments/20240919-fix_sanity.yml b/changelogs/fragments/20240919-fix_sanity.yml deleted file mode 100644 index ae45638f926..00000000000 --- a/changelogs/fragments/20240919-fix_sanity.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Fix sanity errors happening with the ansible devel branch (e.g., unreachable code, using variable before assignment)." diff --git a/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml b/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml deleted file mode 100644 index 0d3f2efa2f4..00000000000 --- a/changelogs/fragments/20240920-refactor-autoscaling_instance_refresh-modules.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -bugfixes: - - autoscaling_instance_refresh - Fix typo in module ``exit_json`` (https://github.com/ansible-collections/community.aws/issues/2019). -minor_changes: - - autoscaling_instance_refresh - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). - - autoscaling_instance_refresh - Add support for ``skip_matching`` and ``max_healthy_percentage`` in ``preference`` (https://github.com/ansible-collections/community.aws/pull/2150). - - autoscaling_instance_refresh_info - refactor module to use shared code from ``ansible_collections.amazon.aws.plugins.module_utils.autoscaling`` and add type hinting (https://github.com/ansible-collections/community.aws/pull/2150). \ No newline at end of file diff --git a/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml b/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml deleted file mode 100644 index c67e90cc8d4..00000000000 --- a/changelogs/fragments/20240923-refactor-ec2_vpc_egress_igw-modules.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - ec2_vpc_egress_igw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` util (https://github.com/ansible-collections/community.aws/pull/2152). - - ec2_vpc_egress_igw - Add the possibility to update/add tags on Egress only internet gateway (https://github.com/ansible-collections/community.aws/pull/2152). \ No newline at end of file diff --git a/changelogs/fragments/20240924-create-ignore-2.19.yml b/changelogs/fragments/20240924-create-ignore-2.19.yml deleted file mode 100644 index cbb265dc813..00000000000 --- a/changelogs/fragments/20240924-create-ignore-2.19.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Add tests/sanity/ignore-2.19.txt file." diff --git a/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml b/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml deleted file mode 100644 index 97158a3bac0..00000000000 --- a/changelogs/fragments/20240924-ec2_vpc_peer-refactor.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - ec2_vpc_peer - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). - - ec2_vpc_peering_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2153). diff --git a/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml b/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml deleted file mode 100644 index 0fa478776bb..00000000000 --- a/changelogs/fragments/20240924-fix-documentation-tgw-vpc-att.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ec2_transit_gateway_vpc_attachment - Modify doumentation and refactor to adhere to coding guidelines (https://github.com/ansible-collections/community.aws/pull/2157). diff --git a/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml b/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml deleted file mode 100644 index 475d00cb9b9..00000000000 --- a/changelogs/fragments/20240924-refactor-ec2_vpc_nacl-modules.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - ec2_vpc_nacl_info - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). - - ec2_vpc_nacl - Refactor module to use shared code from `amazon.aws.plugins.module_utils.ec2` (https://github.com/ansible-collections/community.aws/pull/2159). diff --git a/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml b/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml deleted file mode 100644 index 6ed1c793a65..00000000000 --- a/changelogs/fragments/20240930-ec2_vpc_vpn_refactoring.yml +++ /dev/null @@ -1,3 +0,0 @@ -minor_changes: - - ec2_vpc_vpn - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). - - ec2_vpc_vpn_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` (https://github.com/ansible-collections/community.aws/pull/2160). diff --git a/changelogs/fragments/20241007-drop_deprecations.yml b/changelogs/fragments/20241007-drop_deprecations.yml deleted file mode 100644 index fbee107af1f..00000000000 --- a/changelogs/fragments/20241007-drop_deprecations.yml +++ /dev/null @@ -1,3 +0,0 @@ -breaking_changes: - - ecs_cluster - the parameter ``purge_capacity_providers`` defaults to true. (https://github.com/ansible-collections/community.aws/pull/2165). - - iam_policy - the ``connection_properties`` return key was previously deprecated and has been removed, please use ``raw_connection_properties`` instead (https://github.com/ansible-collections/community.aws/pull/2165). diff --git a/changelogs/fragments/20250515-main-9.0.0.yml b/changelogs/fragments/20250515-main-9.0.0.yml deleted file mode 100644 index 7d31e9997a9..00000000000 --- a/changelogs/fragments/20250515-main-9.0.0.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - galaxy.yml - bump ``release`` for main branch to ``9.0.0-dev0``. diff --git a/changelogs/fragments/2063-add-multicast-support.yml b/changelogs/fragments/2063-add-multicast-support.yml deleted file mode 100644 index ed6ec1e9eb3..00000000000 --- a/changelogs/fragments/2063-add-multicast-support.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ec2_transit_gateway - Support for enable multicast on Transit Gateway (https://github.com/ansible-collections/community.aws/pull/2063). diff --git a/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml b/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml deleted file mode 100644 index cd03aab2d41..00000000000 --- a/changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - ecs_taskdefinition - avoid throttling exceptions on task definitions with a large number of revisions by using the retry mechanism (https://github.com/ansible-collections/community.aws/issues/2123). diff --git a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml b/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml deleted file mode 100644 index e2ee0cb7a91..00000000000 --- a/changelogs/fragments/2139-elb_classic_lb_info-refactor-module.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: -- elb_classic_lb_info - Refactor elb_classic_lb_info module (https://github.com/ansible-collections/community.aws/pull/2139). diff --git a/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml b/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml deleted file mode 100644 index 9fb16b1e437..00000000000 --- a/changelogs/fragments/2142-elb_network_lb-update-tests-to-use-valid-cert.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - elb_network_lb - Update tests to use valid cert RSA 3072-bit instead of 4096 (https://github.com/ansible-collections/community.aws/pull/2142). diff --git a/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml b/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml deleted file mode 100644 index 8f5a62d849c..00000000000 --- a/changelogs/fragments/migrate_autoscaling_instance_refresh_autoscaling_instance_refresh_info.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - autoscaling_instance_refresh - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.autoscaling_instance_refresh`` (https://github.com/ansible-collections/community.aws/pull/2177). - - autoscaling_instance_refresh_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.autoscaling_instance_refresh_info`` (https://github.com/ansible-collections/community.aws/pull/2177). diff --git a/changelogs/fragments/migrate_ec2_launch_template.yaml b/changelogs/fragments/migrate_ec2_launch_template.yaml deleted file mode 100644 index 898c0e3973a..00000000000 --- a/changelogs/fragments/migrate_ec2_launch_template.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - ec2_launch_template - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_launch_template`` (https://github.com/ansible-collections/community.aws/pull/2185). diff --git a/changelogs/fragments/migrate_ec2_placement_group.yml b/changelogs/fragments/migrate_ec2_placement_group.yml deleted file mode 100644 index 3b273a98983..00000000000 --- a/changelogs/fragments/migrate_ec2_placement_group.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_placement_group - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_placement_group``. - - ec2_placement_group_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_placement_group_info``. diff --git a/changelogs/fragments/migrate_ec2_transit_gateway.yml b/changelogs/fragments/migrate_ec2_transit_gateway.yml deleted file mode 100644 index f0638ebe6be..00000000000 --- a/changelogs/fragments/migrate_ec2_transit_gateway.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - ec2_transit_gateway - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_transit_gateway``. diff --git a/changelogs/fragments/migrate_ec2_transit_gateway_info.yml b/changelogs/fragments/migrate_ec2_transit_gateway_info.yml deleted file mode 100644 index 1a38b74625b..00000000000 --- a/changelogs/fragments/migrate_ec2_transit_gateway_info.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - ec2_transit_gateway_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_transit_gateway_info``. diff --git a/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml b/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml deleted file mode 100644 index ea94dcc1cd4..00000000000 --- a/changelogs/fragments/migrate_ec2_transit_gateway_vpc_attachment.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_transit_gateway_vpc_attachment - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment``. - - ec2_transit_gateway_vpc_attachment_info - The module has been migrated from the - ``community.aws`` collection. Playbooks using the Fully Qualified Collection Name - for this module should be updated to use ``amazon.aws.ec2_transit_gateway_vpc_attachment_info``. diff --git a/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml b/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml deleted file mode 100644 index e98eb6dbd53..00000000000 --- a/changelogs/fragments/migrate_ec2_vpc_egress_igw.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - ec2_vpc_egress_igw - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_egress_igw`` (https://api.github.com/repos/ansible-collections/community.aws/pulls/2169). \ No newline at end of file diff --git a/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml b/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml deleted file mode 100644 index 15a0f626e45..00000000000 --- a/changelogs/fragments/migrate_ec2_vpc_nacl_ec2_vpc_nacl_info.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_vpc_nacl - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_nacl`` (https://github.com/ansible-collections/community.aws/pull/2178). - - ec2_vpc_nacl_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_nacl_info`` (https://github.com/ansible-collections/community.aws/pull/2178). diff --git a/changelogs/fragments/migrate_ec2_vpc_peer.yml b/changelogs/fragments/migrate_ec2_vpc_peer.yml deleted file mode 100644 index 2de2ee15863..00000000000 --- a/changelogs/fragments/migrate_ec2_vpc_peer.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_vpc_peer - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_peer``. - - ec2_vpc_peering_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.ec2_vpc_peering_info``. diff --git a/changelogs/fragments/migrate_ec2_vpc_vgw.yml b/changelogs/fragments/migrate_ec2_vpc_vgw.yml deleted file mode 100644 index 1f2b0bcc972..00000000000 --- a/changelogs/fragments/migrate_ec2_vpc_vgw.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_vpc_vgw - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_vgw``. - - ec2_vpc_vgw_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_vgw_info``. diff --git a/changelogs/fragments/migrate_ec2_vpc_vpn.yml b/changelogs/fragments/migrate_ec2_vpc_vpn.yml deleted file mode 100644 index 44b6cbc205f..00000000000 --- a/changelogs/fragments/migrate_ec2_vpc_vpn.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -breaking_changes: - - ec2_vpc_vpn - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_vpn``. - - ec2_vpc_vpn_info - The module has been migrated from the ``community.aws`` collection. - Playbooks using the Fully Qualified Collection Name for this module should be - updated to use ``amazon.aws.ec2_vpc_vpn_info``. diff --git a/changelogs/fragments/migrate_elb_classic_lb_info.yml b/changelogs/fragments/migrate_elb_classic_lb_info.yml deleted file mode 100644 index f48c34ee3c4..00000000000 --- a/changelogs/fragments/migrate_elb_classic_lb_info.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - elb_classic_lb_info - The module has been migrated from the ``community.aws`` - collection. Playbooks using the Fully Qualified Collection Name for this module - should be updated to use ``amazon.aws.elb_classic_lb_info``. diff --git a/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml b/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml deleted file mode 100644 index cfcfe6476e0..00000000000 --- a/changelogs/fragments/refactor-ec2_transit_gateway-modules.yml +++ /dev/null @@ -1,3 +0,0 @@ -minor_changes: - - ec2_transit_gateway - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). - - ec2_transit_gateway_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2158). diff --git a/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml b/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml deleted file mode 100644 index 917d10ade72..00000000000 --- a/changelogs/fragments/refactor-ec2_vpc_vgw-modules.yml +++ /dev/null @@ -1,3 +0,0 @@ -minor_changes: - - ec2_vpc_vgw - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). - - ec2_vpc_vgw_info - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2171). diff --git a/changelogs/fragments/refactor_ec2_placement_group.yml b/changelogs/fragments/refactor_ec2_placement_group.yml deleted file mode 100644 index c4366ed2c1f..00000000000 --- a/changelogs/fragments/refactor_ec2_placement_group.yml +++ /dev/null @@ -1,2 +0,0 @@ -minor_changes: - - ec2_placement_group - Refactor module to use shared code from ``amazon.aws.plugins.module_utils.ec2`` and update ``RETURN`` block (https://github.com/ansible-collections/community.aws/pull/2167). diff --git a/galaxy.yml b/galaxy.yml index a509b6468f5..e264d3977d6 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ description: A variety of Ansible content to help automate the management of AWS license_file: COPYING tags: [community, aws, cloud, amazon] dependencies: - amazon.aws: '>=8.0.0-dev0' + amazon.aws: '>=10.0.0-dev0' repository: https://github.com/ansible-collections/community.aws documentation: https://ansible-collections.github.io/community.aws/branch/main/collections/community/aws/index.html homepage: https://github.com/ansible-collections/community.aws