From af3710889d373b2439a1476c47e58f7ecd0fe879 Mon Sep 17 00:00:00 2001 From: John Losito Date: Fri, 23 Sep 2022 13:25:00 -0400 Subject: [PATCH 001/138] docs: remove state param in gcp_storage_object example (#493) Removes an invalid parameter from the example given within the gcp_storage_object module to download an object from a GCS bucket. --- plugins/modules/gcp_storage_object.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index a6f4b14..7fd95b3 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -105,7 +105,6 @@ EXAMPLES = """ project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" - state: present """ RETURN = """ From f6d42b4bc161145c7e72895d8c405621b63cc7a3 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 23 Sep 2022 18:42:29 +0000 Subject: [PATCH 002/138] Adding a GitHub action to run ansible-test (#497) As a first step to rehabilitate the google.cloud repository, adding actions to help ensure that the collection is still passing tests as changes are merged. Details: - ansible-devel was not added to the matrix since it may destablize the tests, primarily used to validate the collection. - running sanity tests reported over 100+ issues, backlogged to #498 before turning those on. --- .github/workflows/ansible-test.yml | 56 ++++++++ tests/unit/plugins/test_gcp_utils.py | 199 +++++++-------------------- 2 files changed, 103 insertions(+), 152 deletions(-) create mode 100644 .github/workflows/ansible-test.yml diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml new file mode 100644 index 0000000..10f8c8b --- /dev/null +++ b/.github/workflows/ansible-test.yml @@ -0,0 +1,56 @@ +name: "Run tests for the cloud.google collection" +on: [pull_request] +jobs: + # sanity tests cannot be turned on until #498 is resolved. + # sanity: + # runs-on: ubuntu-latest + # defaults: + # run: + # working-directory: ansible_collections/google/cloud + # strategy: + # matrix: + # ansible_version: + # - stable-2.13 + # - stable-2.11 + # steps: + # - name: check out code + # uses: actions/checkout@v2 + # with: + # path: ansible_collections/google/cloud + # - name: Set up Python + # uses: actions/setup-python@v1 + # with: + # python-version: '3.8' # this is the minimum version required for Ansible 2.11 + # - name: Install ansible-base (${{ matrix.ansible_version }}) + # uses: nick-invision/retry@v2 + # with: + # timeout_minutes: 3 + # max_attempts: 3 + # command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + # - name: Run sanity tests + # run: ansible-test sanity --docker -v --color --python 3.8 + unit: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + - stable-2.13 + - stable-2.11 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.8' # this is the minimum version required for Ansible 2.11 + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install ansible-base (${{ matrix.ansible_version }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Run unit tests + run: ansible-test units --docker -v --color --python 3.8 \ No newline at end of file diff --git a/tests/unit/plugins/test_gcp_utils.py b/tests/unit/plugins/test_gcp_utils.py index a69f36a..51b1fff 100644 --- a/tests/unit/plugins/test_gcp_utils.py +++ b/tests/unit/plugins/test_gcp_utils.py @@ -16,184 +16,109 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import (absolute_import, division, print_function) +from __future__ import absolute_import, division, print_function -from ansible_collections.community.general.tests.unit.compat import unittest -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import (GcpRequest, - navigate_hash, - remove_nones_from_dict, - replace_resource_dict) +import unittest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( + GcpRequest, + navigate_hash, + remove_nones_from_dict, + replace_resource_dict, +) __metaclass__ = type class ReplaceResourceDictTestCase(unittest.TestCase): def test_given_dict(self): - value = { - 'selfLink': 'value' - } - self.assertEqual(replace_resource_dict(value, 'selfLink'), value['selfLink']) + value = {"selfLink": "value"} + self.assertEqual(replace_resource_dict(value, "selfLink"), value["selfLink"]) def test_given_array(self): - value = { - 'selfLink': 'value' - } - self.assertEqual(replace_resource_dict([value] * 3, 'selfLink'), [value['selfLink']] * 3) + value = {"selfLink": "value"} + self.assertEqual( + replace_resource_dict([value] * 3, "selfLink"), [value["selfLink"]] * 3 + ) class NavigateHashTestCase(unittest.TestCase): def test_one_level(self): - value = { - 'key': 'value' - } - self.assertEqual(navigate_hash(value, ['key']), value['key']) + value = {"key": "value"} + self.assertEqual(navigate_hash(value, ["key"]), value["key"]) def test_multilevel(self): - value = { - 'key': { - 'key2': 'value' - } - } - self.assertEqual(navigate_hash(value, ['key', 'key2']), value['key']['key2']) + value = {"key": {"key2": "value"}} + self.assertEqual(navigate_hash(value, ["key", "key2"]), value["key"]["key2"]) def test_default(self): - value = { - 'key': 'value' - } - default = 'not found' - self.assertEqual(navigate_hash(value, ['key', 'key2'], default), default) + value = {"key": "value"} + default = "not found" + self.assertEqual(navigate_hash(value, ["key", "key2"], default), default) class RemoveNonesFromDictTestCase(unittest.TestCase): def test_remove_nones(self): - value = { - 'key': None, - 'good': 'value' - } - value_correct = { - 'good': 'value' - } + value = {"key": None, "good": "value"} + value_correct = {"good": "value"} self.assertEqual(remove_nones_from_dict(value), value_correct) def test_remove_empty_arrays(self): - value = { - 'key': [], - 'good': 'value' - } - value_correct = { - 'good': 'value' - } + value = {"key": [], "good": "value"} + value_correct = {"good": "value"} self.assertEqual(remove_nones_from_dict(value), value_correct) def test_remove_empty_dicts(self): - value = { - 'key': {}, - 'good': 'value' - } - value_correct = { - 'good': 'value' - } + value = {"key": {}, "good": "value"} + value_correct = {"good": "value"} self.assertEqual(remove_nones_from_dict(value), value_correct) class GCPRequestDifferenceTestCase(unittest.TestCase): def test_simple_no_difference(self): - value1 = { - 'foo': 'bar', - 'test': 'original' - } + value1 = {"foo": "bar", "test": "original"} request = GcpRequest(value1) self.assertEqual(request, request) def test_simple_different(self): - value1 = { - 'foo': 'bar', - 'test': 'original' - } - value2 = { - 'foo': 'bar', - 'test': 'different' - } - difference = { - 'test': 'original' - } + value1 = {"foo": "bar", "test": "original"} + value2 = {"foo": "bar", "test": "different"} + difference = {"test": "original"} request1 = GcpRequest(value1) request2 = GcpRequest(value2) self.assertNotEquals(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_nested_dictionaries_no_difference(self): - value1 = { - 'foo': { - 'quiet': { - 'tree': 'test' - }, - 'bar': 'baz' - }, - 'test': 'original' - } + value1 = {"foo": {"quiet": {"tree": "test"}, "bar": "baz"}, "test": "original"} request = GcpRequest(value1) self.assertEqual(request, request) def test_nested_dictionaries_with_difference(self): - value1 = { - 'foo': { - 'quiet': { - 'tree': 'test' - }, - 'bar': 'baz' - }, - 'test': 'original' - } - value2 = { - 'foo': { - 'quiet': { - 'tree': 'baz' - }, - 'bar': 'hello' - }, - 'test': 'original' - } - difference = { - 'foo': { - 'quiet': { - 'tree': 'test' - }, - 'bar': 'baz' - } - } + value1 = {"foo": {"quiet": {"tree": "test"}, "bar": "baz"}, "test": "original"} + value2 = {"foo": {"quiet": {"tree": "baz"}, "bar": "hello"}, "test": "original"} + difference = {"foo": {"quiet": {"tree": "test"}, "bar": "baz"}} request1 = GcpRequest(value1) request2 = GcpRequest(value2) self.assertNotEquals(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_arrays_strings_no_difference(self): - value1 = { - 'foo': [ - 'baz', - 'bar' - ] - } + value1 = {"foo": ["baz", "bar"]} request = GcpRequest(value1) self.assertEqual(request, request) def test_arrays_strings_with_difference(self): value1 = { - 'foo': [ - 'baz', - 'bar', + "foo": [ + "baz", + "bar", ] } - value2 = { - 'foo': [ - 'baz', - 'hello' - ] - } + value2 = {"foo": ["baz", "hello"]} difference = { - 'foo': [ - 'bar', + "foo": [ + "bar", ] } request1 = GcpRequest(value1) @@ -202,48 +127,18 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): self.assertEqual(request1.difference(request2), difference) def test_arrays_dicts_with_no_difference(self): - value1 = { - 'foo': [ - { - 'test': 'value', - 'foo': 'bar' - }, - { - 'different': 'dict' - } - ] - } + value1 = {"foo": [{"test": "value", "foo": "bar"}, {"different": "dict"}]} request = GcpRequest(value1) self.assertEqual(request, request) def test_arrays_dicts_with_difference(self): - value1 = { - 'foo': [ - { - 'test': 'value', - 'foo': 'bar' - }, - { - 'different': 'dict' - } - ] - } + value1 = {"foo": [{"test": "value", "foo": "bar"}, {"different": "dict"}]} value2 = { - 'foo': [ - { - 'test': 'value2', - 'foo': 'bar2' - }, - ] - } - difference = { - 'foo': [ - { - 'test': 'value', - 'foo': 'bar' - } + "foo": [ + {"test": "value2", "foo": "bar2"}, ] } + difference = {"foo": [{"test": "value", "foo": "bar"}]} request1 = GcpRequest(value1) request2 = GcpRequest(value2) self.assertNotEquals(request1, request2) From c025cea9398ca9134f21228a9ce842b794277f15 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 30 Sep 2022 19:19:09 +0000 Subject: [PATCH 003/138] Add test instructions and fix region disk test (#500) As a step toward adding integration testing into the CI process for this project, adding instructions on how to run the tests. compute_region_disk was used as a test. Fixed the tests which was previously hard-coded to the `graphite-playground` GCP project to work with the project in the user-configure .ini file. --- .gitignore | 5 +++ CONTRIBUTING.md | 38 +++++++++++++++++++ .../targets/gcp_compute_region_disk/aliases | 3 +- .../gcp_compute_region_disk/tasks/autogen.yml | 20 +++++----- 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8c03bed --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# personal credentials are added here: do not check in. +tests/integration/cloud-config-gcp.ini +# running ansible integration tests adds files here. +tests/integration/inventory +tests/output/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5072193 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing to the google.cloud collection + +## Cloning + +The `ansible-test` command expects that the repository is in a directory that matches it's collection, +under a directory `ansible_collections`. Clone ensuring that hierarchy: + +```shell +mkdir -p $TARGET_DIR/ansible_collections/google +git clone $TARGET_DIR/collections/google/cloud +``` + +## Running tests + +### prequisites for all tests + +- Install the `ansible` package. + +## Running integration tests + +### Integration testing prequisites + +#### Installing personal GCP credentials + +The integration tests for this module require the use of real GCP credentials, and must provide +ansible-test those values. They can be added by authoring the following in `tests/integration/cloud-config-gcp.ini`: + +``` +[default] +gcp_project: @PROJECT_ID +gcp_cred_file: @CRED_FILE +gcp_cred_kind: @CRED_KIND +gcp_cred_email: @EMAIL +``` + +### Running + +Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). diff --git a/tests/integration/targets/gcp_compute_region_disk/aliases b/tests/integration/targets/gcp_compute_region_disk/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_disk/aliases +++ b/tests/integration/targets/gcp_compute_region_disk/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml index 3463be3..7a2e2e2 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml @@ -21,8 +21,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -36,8 +36,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -71,8 +71,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -91,8 +91,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -126,8 +126,8 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From 76677279f053e30da0ac9fb397e121c5cc75b1e1 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 1 Oct 2022 18:23:22 +0000 Subject: [PATCH 004/138] Adding integration tests on PRs (#502) To help catch issues from PRs that would regress behavior, adding a GitHub action similar to unit tests to run integration tests. GitHub actions do not pass secrets to actions which are triggered by PRs sent from forks. As a result, it is not possible to have CI run on the forks from external contributors. Currently implementing a process that requires manual review until a more direct solution is found. Adding some basic instructions for future maintainers and contributors. --- .../workflows/ansible-integration-tests.yml | 48 +++++++++++++++++++ CONTRIBUTING.md | 9 +++- MAINTAINING.md | 15 ++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ansible-integration-tests.yml create mode 100644 MAINTAINING.md diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml new file mode 100644 index 0000000..6faa2c2 --- /dev/null +++ b/.github/workflows/ansible-integration-tests.yml @@ -0,0 +1,48 @@ +name: "Run integration tests for the cloud.google collection" +on: + # NOTE: GitHub does not allow secrets to be used + # in PRs sent from forks. As such, this configuration is for + # PRs that the maintainers would like to send to test. + pull_request: {} + push: + branches: master +jobs: + integration: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + # - stable-2.13 + - stable-2.11 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.8' # this is the minimum version required for Ansible 2.11 + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install ansible-base (${{ matrix.ansible_version }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Write integration-test configuration files + env: + CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} + run: | + echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" > /tmp/service-account-key.json + echo "[default] + gcp_project: ansible-gcp-ci + gcp_cred_file: /tmp/service-account-key.json + gcp_cred_kind: serviceaccount + gcp_cred_email: github-ci@ansible-gcp-ci.iam.gserviceaccount.com + " > ./tests/integration/cloud-config-gcp.ini + - name: test secrets + env: ${{ secrets }} + run: echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" + - name: Run integration tests + run: ansible-test integration -vvv --color --python 3.8 --venv-system-site-packages \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5072193..9a74dc0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,12 @@ # Contributing to the google.cloud collection +## Workflow summary + +1. [Clone the repository](#cloning). +1. Make the desired code change. +1. [Run integration tests locally and ensure they pass](running-integration-tests). +1. Create a PR. + ## Cloning The `ansible-test` command expects that the repository is in a directory that matches it's collection, @@ -35,4 +42,4 @@ gcp_cred_email: @EMAIL ### Running -Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). +Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). \ No newline at end of file diff --git a/MAINTAINING.md b/MAINTAINING.md new file mode 100644 index 0000000..ea60d9b --- /dev/null +++ b/MAINTAINING.md @@ -0,0 +1,15 @@ +# Maintainer Documentation + +## CI GCP Project Configuration + +To enable running integration tests, a test GCP project must be provided. + +There is a Google-maintained CI project, `ansible-gcp-ci`, that is used for this purpose. For any questions or modification to this project, please contact a maintainer who is employed by Google. + +## Reviewing PRs + +### Merging PRs + +Since running the full set of integration tests requires the usage of GCP +credentials which are stored as a secret, maintainers must verify that tests pass the integration test run that runs on push to the master branch after accepting a change. + From c5723b214f6217a8886d044de0eea4b450a2ceec Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Tue, 4 Oct 2022 21:04:32 +0000 Subject: [PATCH 005/138] Enabling working integration tests (#504) Enabling tests that work without any further modification as an incremental step to enabling all integration tests. Enabling 22 / 64 tests. The following tests do not work today: - gcp_appengine_firewall_rule - gcp_bigtable_instance - gcp_cloudfunctions_cloud_function - gcp_cloudtasks_queue - gcp_compute_backend_service - gcp_compute_external_vpn_gateway - gcp_compute_forwarding_rule - gcp_compute_instance - gcp_compute_instance_group - gcp_compute_instance_group_manager - gcp_compute_instance_group_template - gcp_compute_node_group - gcp_compute_region_autoscaler - gcp_compute_region_instance_group_manager - gcp_compute_region_target_http_proxy - gcp_compute_region_target_https_proxy - gcp_compute_region_url_map - gcp_compute_route - gcp_compute_router - gcp_compute_ssl_certificate - gcp_compute_target_http_proxy - gcp_compute_target_https_proxy - gcp_compute_target_instance - gcp_compute_target_pool - gcp_compute_target_ssl_proxy - gcp_compute_target_tcp_proxy - gcp_compute_target_vpn_proxy - gcp_container_cluster - gcp_container_node_pool - gcp_iam_role - gcp_iam_service_account - gcp_iam_service_account_key - gcp_kms_key_ring - gcp_mlengine_version - gcp_redis_instance - gcp_resourcemanager_project - gcp_serviceusage_service - gcp_spanner_database - gcp_spanner_instance - gcp_sql_ssl_cert - gcp_storage_bucket - gcp_tpu_node --- .../workflows/ansible-integration-tests.yml | 3 +- CONTRIBUTING.md | 14 +++++ requirements.txt | 1 + scripts/bootstrap-project.sh | 60 +++++++++++++++++++ .../targets/gcp_bigquery_dataset/aliases | 3 +- .../targets/gcp_bigquery_table/aliases | 3 +- .../targets/gcp_bigtable_instance/aliases | 2 +- .../targets/gcp_cloudbuild_trigger/aliases | 3 +- .../targets/gcp_cloudscheduler_job/aliases | 3 +- .../targets/gcp_compute_address/aliases | 3 +- .../gcp_compute_backend_bucket/aliases | 3 +- .../gcp_compute_backend_service/aliases | 2 +- .../gcp_compute_external_vpn_gateway/aliases | 2 +- .../targets/gcp_compute_firewall/aliases | 3 +- .../gcp_compute_global_address/aliases | 3 +- .../aliases | 3 +- .../targets/gcp_compute_health_check/aliases | 3 +- .../gcp_compute_http_health_check/aliases | 3 +- .../gcp_compute_https_health_check/aliases | 3 +- .../targets/gcp_compute_image/aliases | 3 +- .../aliases | 3 +- .../aliases | 1 - .../targets/gcp_compute_network/aliases | 3 +- .../aliases | 3 +- .../targets/gcp_compute_node_template/aliases | 3 +- .../aliases | 3 +- .../gcp_compute_region_health_check/aliases | 3 +- .../targets/gcp_compute_reservation/aliases | 3 +- .../gcp_compute_resource_policy/aliases | 3 +- .../targets/gcp_compute_snapshot/aliases | 3 +- .../targets/gcp_compute_ssl_policy/aliases | 3 +- .../targets/gcp_compute_subnetwork/aliases | 3 +- .../targets/gcp_compute_url_map/aliases | 3 +- .../targets/gcp_dns_managed_zone/aliases | 3 +- .../gcp_dns_resource_record_set/aliases | 3 +- .../targets/gcp_filestore_instance/aliases | 3 +- .../gcp_iam_service_account_key/aliases | 3 +- .../targets/gcp_logging_metric/aliases | 1 - .../targets/gcp_mlengine_model/aliases | 3 +- .../targets/gcp_pubsub_subscription/aliases | 3 +- .../targets/gcp_pubsub_topic/aliases | 3 +- .../targets/gcp_runtimeconfig_config/aliases | 3 +- .../gcp_runtimeconfig_variable/aliases | 3 +- .../targets/gcp_sourcerepo_repository/aliases | 3 +- .../targets/gcp_sql_database/aliases | 3 +- .../targets/gcp_sql_instance/aliases | 3 +- .../integration/targets/gcp_sql_user/aliases | 3 +- .../gcp_storage_bucket_access_control/aliases | 3 +- .../gcp_storage_default_object_acl/aliases | 2 +- .../targets/gcp_storage_object/aliases | 3 +- 50 files changed, 121 insertions(+), 87 deletions(-) create mode 100755 scripts/bootstrap-project.sh diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index 6faa2c2..c2d1002 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -45,4 +45,5 @@ jobs: env: ${{ secrets }} run: echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" - name: Run integration tests - run: ansible-test integration -vvv --color --python 3.8 --venv-system-site-packages \ No newline at end of file + # Add the -vvv flag to print out more output + run: ansible-test integration -v --color --python 3.8 --venv-system-site-packages \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a74dc0..7b74cc1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,6 +40,20 @@ gcp_cred_kind: @CRED_KIND gcp_cred_email: @EMAIL ``` +#### Setting up the project for testing + +Some of the setup of the project itself is done outside of the test, +and is expected to be configured beforehand. + +For convenience, a bootstrap script is provided. + +NOTE: running this script will make irreversible changes in your +GCP project (e.g. create an AppEngine project): + +```bash +bash ./scripts/bootstrap-project.sh $PROJECT_ID $SERVICE_ACCOUNT_NAME +``` + ### Running Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 8840a83..fef75ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ requests google-auth +google-cloud-storage diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh new file mode 100755 index 0000000..2590624 --- /dev/null +++ b/scripts/bootstrap-project.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Bootstrap-project sets a project up so that ansible-test integration +# can be run. +# +# dependencies: +# - google-cloud-sdk (gcloud) +# +# +PROJECT_ID="${1}" +SERVICE_ACCOUNT_NAME="${2}" +SERVICE_LIST=( + "appengine" + "bigtable" + "cloudfunctions" + "cloudkms.googleapis.com" + "cloudresourcemanager.googleapis.com" + "cloudscheduler.googleapis.com" + "cloudtasks.googleapis.com" + "container" + "dns" + "file.googleapis.com" + "ml.googleapis.com" + "runtimeconfig.googleapis.com" + "sourcerepo.googleapis.com" + "spanner.googleapis.com" + "sqladmin.googleapis.com" + "storage.googleapis.com" + "tpu.googleapis.com" +) + +REQUIRED_ROLE_LIST=( + "roles/storage.objectAdmin" + "roles/source.admin" +) + +for SERVICE in "${SERVICE_LIST[@]}"; do + echo "enabling service $SERVICE..." + gcloud services enable "$SERVICE" --project="$PROJECT_ID" +done + +for ROLE in "${REQUIRED_ROLE_LIST[@]}"; do + echo "enabling role $ROLE..." + gcloud projects add-iam-policy-binding "$PROJECT_ID" \ + --member="serviceAccount:$SERVICE_ACCOUNT_NAME" \ + --role="$ROLE" +done + +if ! gcloud app describe --project="$PROJECT_ID" > /dev/null; then + echo "creating appengine project..." + gcloud app create --project="$PROJECT_ID" --region=us-central +fi + + + +# Add bindings + +# roles/storage.objectAdmin + +# The following is hard to automate, so echo +echo "Done! It may take up to 10 minutes for some of the changes to fully propagate." \ No newline at end of file diff --git a/tests/integration/targets/gcp_bigquery_dataset/aliases b/tests/integration/targets/gcp_bigquery_dataset/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/aliases +++ b/tests/integration/targets/gcp_bigquery_dataset/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_bigquery_table/aliases b/tests/integration/targets/gcp_bigquery_table/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_bigquery_table/aliases +++ b/tests/integration/targets/gcp_bigquery_table/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_bigtable_instance/aliases b/tests/integration/targets/gcp_bigtable_instance/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_bigtable_instance/aliases +++ b/tests/integration/targets/gcp_bigtable_instance/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_cloudbuild_trigger/aliases b/tests/integration/targets/gcp_cloudbuild_trigger/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_cloudbuild_trigger/aliases +++ b/tests/integration/targets/gcp_cloudbuild_trigger/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_cloudscheduler_job/aliases b/tests/integration/targets/gcp_cloudscheduler_job/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/aliases +++ b/tests/integration/targets/gcp_cloudscheduler_job/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_address/aliases b/tests/integration/targets/gcp_compute_address/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_address/aliases +++ b/tests/integration/targets/gcp_compute_address/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_backend_bucket/aliases b/tests/integration/targets/gcp_compute_backend_bucket/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/aliases +++ b/tests/integration/targets/gcp_compute_backend_bucket/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_backend_service/aliases b/tests/integration/targets/gcp_compute_backend_service/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_compute_backend_service/aliases +++ b/tests/integration/targets/gcp_compute_backend_service/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases b/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_firewall/aliases b/tests/integration/targets/gcp_compute_firewall/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_firewall/aliases +++ b/tests/integration/targets/gcp_compute_firewall/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_global_address/aliases b/tests/integration/targets/gcp_compute_global_address/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_global_address/aliases +++ b/tests/integration/targets/gcp_compute_global_address/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_health_check/aliases b/tests/integration/targets/gcp_compute_health_check/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_health_check/aliases +++ b/tests/integration/targets/gcp_compute_health_check/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_http_health_check/aliases b/tests/integration/targets/gcp_compute_http_health_check/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/aliases +++ b/tests/integration/targets/gcp_compute_http_health_check/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_https_health_check/aliases b/tests/integration/targets/gcp_compute_https_health_check/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/aliases +++ b/tests/integration/targets/gcp_compute_https_health_check/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_image/aliases b/tests/integration/targets/gcp_compute_image/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_image/aliases +++ b/tests/integration/targets/gcp_compute_image/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_interconnect_attachment/aliases b/tests/integration/targets/gcp_compute_interconnect_attachment/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_interconnect_attachment/aliases +++ b/tests/integration/targets/gcp_compute_interconnect_attachment/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_managed_ssl_certificate/aliases b/tests/integration/targets/gcp_compute_managed_ssl_certificate/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_compute_managed_ssl_certificate/aliases +++ b/tests/integration/targets/gcp_compute_managed_ssl_certificate/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_compute_network/aliases b/tests/integration/targets/gcp_compute_network/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_network/aliases +++ b/tests/integration/targets/gcp_compute_network/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/aliases b/tests/integration/targets/gcp_compute_network_endpoint_group/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/aliases +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_node_template/aliases b/tests/integration/targets/gcp_compute_node_template/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_node_template/aliases +++ b/tests/integration/targets/gcp_compute_node_template/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_backend_service/aliases b/tests/integration/targets/gcp_compute_region_backend_service/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/aliases +++ b/tests/integration/targets/gcp_compute_region_backend_service/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_health_check/aliases b/tests/integration/targets/gcp_compute_region_health_check/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/aliases +++ b/tests/integration/targets/gcp_compute_region_health_check/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_reservation/aliases b/tests/integration/targets/gcp_compute_reservation/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_reservation/aliases +++ b/tests/integration/targets/gcp_compute_reservation/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_resource_policy/aliases b/tests/integration/targets/gcp_compute_resource_policy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/aliases +++ b/tests/integration/targets/gcp_compute_resource_policy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_snapshot/aliases b/tests/integration/targets/gcp_compute_snapshot/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_snapshot/aliases +++ b/tests/integration/targets/gcp_compute_snapshot/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_ssl_policy/aliases b/tests/integration/targets/gcp_compute_ssl_policy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/aliases +++ b/tests/integration/targets/gcp_compute_ssl_policy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_subnetwork/aliases b/tests/integration/targets/gcp_compute_subnetwork/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/aliases +++ b/tests/integration/targets/gcp_compute_subnetwork/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_url_map/aliases b/tests/integration/targets/gcp_compute_url_map/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_url_map/aliases +++ b/tests/integration/targets/gcp_compute_url_map/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_dns_managed_zone/aliases b/tests/integration/targets/gcp_dns_managed_zone/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/aliases +++ b/tests/integration/targets/gcp_dns_managed_zone/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_dns_resource_record_set/aliases b/tests/integration/targets/gcp_dns_resource_record_set/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/aliases +++ b/tests/integration/targets/gcp_dns_resource_record_set/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_filestore_instance/aliases b/tests/integration/targets/gcp_filestore_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_filestore_instance/aliases +++ b/tests/integration/targets/gcp_filestore_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_iam_service_account_key/aliases b/tests/integration/targets/gcp_iam_service_account_key/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_iam_service_account_key/aliases +++ b/tests/integration/targets/gcp_iam_service_account_key/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_logging_metric/aliases b/tests/integration/targets/gcp_logging_metric/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_logging_metric/aliases +++ b/tests/integration/targets/gcp_logging_metric/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_mlengine_model/aliases b/tests/integration/targets/gcp_mlengine_model/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_mlengine_model/aliases +++ b/tests/integration/targets/gcp_mlengine_model/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_pubsub_subscription/aliases b/tests/integration/targets/gcp_pubsub_subscription/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/aliases +++ b/tests/integration/targets/gcp_pubsub_subscription/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_pubsub_topic/aliases b/tests/integration/targets/gcp_pubsub_topic/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_pubsub_topic/aliases +++ b/tests/integration/targets/gcp_pubsub_topic/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_runtimeconfig_config/aliases b/tests/integration/targets/gcp_runtimeconfig_config/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/aliases +++ b/tests/integration/targets/gcp_runtimeconfig_config/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/aliases b/tests/integration/targets/gcp_runtimeconfig_variable/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/aliases +++ b/tests/integration/targets/gcp_runtimeconfig_variable/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sourcerepo_repository/aliases b/tests/integration/targets/gcp_sourcerepo_repository/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/aliases +++ b/tests/integration/targets/gcp_sourcerepo_repository/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_database/aliases b/tests/integration/targets/gcp_sql_database/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_sql_database/aliases +++ b/tests/integration/targets/gcp_sql_database/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_instance/aliases b/tests/integration/targets/gcp_sql_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_sql_instance/aliases +++ b/tests/integration/targets/gcp_sql_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_user/aliases b/tests/integration/targets/gcp_sql_user/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_sql_user/aliases +++ b/tests/integration/targets/gcp_sql_user/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/aliases b/tests/integration/targets/gcp_storage_bucket_access_control/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/aliases +++ b/tests/integration/targets/gcp_storage_bucket_access_control/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_default_object_acl/aliases b/tests/integration/targets/gcp_storage_default_object_acl/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/aliases +++ b/tests/integration/targets/gcp_storage_default_object_acl/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_object/aliases b/tests/integration/targets/gcp_storage_object/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_storage_object/aliases +++ b/tests/integration/targets/gcp_storage_object/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From 0387ad3c17ff0a5ffbd40e3aba8b14d51b6be154 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 17:36:39 +0000 Subject: [PATCH 006/138] Fixing additional tests Fixing some of the existing failing tests in the CI process. Specifically: - gcp_appengine_firewall_rule: modified validation to support the default firewall rule - gcp_cloudfunctions_cloud_function: bootstrapping the required GS bucket and files for creating a valid cloud function. - Slight update to the functionality, which now requires a runtime specified for new functions. - --- .../gcp_cloudfunctions_cloud_function.py | 287 ++++++++++-------- scripts/bootstrap-project.sh | 10 +- .../build-function-zip.sh | 7 + test-fixtures/cloud-function-source/main.py | 9 + .../cloud-function-source/requirements.txt | 1 + test-fixtures/cloud-function.zip | Bin 0 -> 776 bytes .../gcp_appengine_firewall_rule/aliases | 3 +- .../tasks/autogen.yml | 4 +- .../gcp_cloudfunctions_cloud_function/aliases | 1 - .../tasks/autogen.yml | 15 +- 10 files changed, 203 insertions(+), 134 deletions(-) create mode 100755 test-fixtures/cloud-function-source/build-function-zip.sh create mode 100644 test-fixtures/cloud-function-source/main.py create mode 100644 test-fixtures/cloud-function-source/requirements.txt create mode 100644 test-fixtures/cloud-function.zip diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function.py b/plugins/modules/gcp_cloudfunctions_cloud_function.py index a3f68dc..0b3c38c 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function.py @@ -25,9 +25,13 @@ __metaclass__ = type # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} -DOCUMENTATION = ''' +DOCUMENTATION = """ --- module: gcp_cloudfunctions_cloud_function description: @@ -69,8 +73,8 @@ options: type: str runtime: description: - - The runtime in which the function is going to run. If empty, defaults to Node.js - 6. + - The runtime in which to run the function. Required when deploying a new function, + optional when updating an existing function. required: false type: str timeout: @@ -195,9 +199,9 @@ options: - This should not be set unless you know what you're doing. - This only alters the User Agent string for any API requests. type: str -''' +""" -EXAMPLES = ''' +EXAMPLES = """ - name: create a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: test_object @@ -209,9 +213,9 @@ EXAMPLES = ''' auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" state: present -''' +""" -RETURN = ''' +RETURN = """ name: description: - A user-defined name of the function. Function names must be unique globally and @@ -353,7 +357,7 @@ trigger_http: - Use HTTP to trigger this function. returned: success type: bool -''' +""" ################################################################################ # Imports @@ -381,43 +385,50 @@ def main(): module = GcpModule( argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(required=True, type='str'), - description=dict(type='str'), - entry_point=dict(type='str'), - runtime=dict(type='str'), - timeout=dict(type='str'), - available_memory_mb=dict(type='int'), - labels=dict(type='dict'), - environment_variables=dict(type='dict'), - source_archive_url=dict(type='str'), - source_upload_url=dict(type='str'), - source_repository=dict(type='dict', options=dict(url=dict(required=True, type='str'))), - https_trigger=dict(type='dict', options=dict()), - event_trigger=dict( - type='dict', options=dict(event_type=dict(required=True, type='str'), resource=dict(required=True, type='str'), service=dict(type='str')) + state=dict(default="present", choices=["present", "absent"], type="str"), + name=dict(required=True, type="str"), + description=dict(type="str"), + entry_point=dict(type="str"), + runtime=dict(type="str"), + timeout=dict(type="str"), + available_memory_mb=dict(type="int"), + labels=dict(type="dict"), + environment_variables=dict(type="dict"), + source_archive_url=dict(type="str"), + source_upload_url=dict(type="str"), + source_repository=dict( + type="dict", options=dict(url=dict(required=True, type="str")) ), - location=dict(required=True, type='str'), - trigger_http=dict(type='bool'), + https_trigger=dict(type="dict", options=dict()), + event_trigger=dict( + type="dict", + options=dict( + event_type=dict(required=True, type="str"), + resource=dict(required=True, type="str"), + service=dict(type="str"), + ), + ), + location=dict(required=True, type="str"), + trigger_http=dict(type="bool"), ) ) - if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + if not module.params["scopes"]: + module.params["scopes"] = ["https://www.googleapis.com/auth/cloud-platform"] - state = module.params['state'] + state = module.params["state"] fetch = fetch_resource(module, self_link(module)) changed = False # Need to set triggerHttps to {} if boolean true. - if fetch and fetch.get('httpsTrigger') and module.params['trigger_http']: - module.params['https_trigger'] = fetch.get('httpsTrigger') - elif module.params['trigger_http']: - module.params['https_trigger'] = {} + if fetch and fetch.get("httpsTrigger") and module.params["trigger_http"]: + module.params["https_trigger"] = fetch.get("httpsTrigger") + elif module.params["trigger_http"]: + module.params["https_trigger"] = {} if fetch: - if state == 'present': + if state == "present": if is_different(module, fetch): update(module, self_link(module), fetch) fetch = fetch_resource(module, self_link(module)) @@ -427,101 +438,115 @@ def main(): fetch = {} changed = True else: - if state == 'present': + if state == "present": fetch = create(module, collection(module)) changed = True else: fetch = {} - fetch.update({'changed': changed}) + fetch.update({"changed": changed}) module.exit_json(**fetch) def create(module, link): - auth = GcpSession(module, 'cloudfunctions') + auth = GcpSession(module, "cloudfunctions") return wait_for_operation(module, auth.post(link, resource_to_request(module))) def update(module, link, fetch): - auth = GcpSession(module, 'cloudfunctions') - params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))} + auth = GcpSession(module, "cloudfunctions") + params = { + "updateMask": updateMask( + resource_to_request(module), response_to_hash(module, fetch) + ) + } request = resource_to_request(module) - del request['name'] + del request["name"] return wait_for_operation(module, auth.put(link, request, params=params)) def updateMask(request, response): update_mask = [] - if request.get('name') != response.get('name'): - update_mask.append('name') - if request.get('description') != response.get('description'): - update_mask.append('description') - if request.get('entryPoint') != response.get('entryPoint'): - update_mask.append('entryPoint') - if request.get('runtime') != response.get('runtime'): - update_mask.append('runtime') - if request.get('timeout') != response.get('timeout'): - update_mask.append('timeout') - if request.get('availableMemoryMb') != response.get('availableMemoryMb'): - update_mask.append('availableMemoryMb') - if request.get('labels') != response.get('labels'): - update_mask.append('labels') - if request.get('environmentVariables') != response.get('environmentVariables'): - update_mask.append('environmentVariables') - if request.get('sourceArchiveUrl') != response.get('sourceArchiveUrl'): - update_mask.append('sourceArchiveUrl') - if request.get('sourceUploadUrl') != response.get('sourceUploadUrl'): - update_mask.append('sourceUploadUrl') - if request.get('sourceRepository') != response.get('sourceRepository'): - update_mask.append('sourceRepository') - if request.get('httpsTrigger') != response.get('httpsTrigger'): - update_mask.append('httpsTrigger') - if request.get('eventTrigger') != response.get('eventTrigger'): - update_mask.append('eventTrigger') - if request.get('location') != response.get('location'): - update_mask.append('location') - if request.get('trigger_http') != response.get('trigger_http'): - update_mask.append('trigger_http') - return ','.join(update_mask) + if request.get("name") != response.get("name"): + update_mask.append("name") + if request.get("description") != response.get("description"): + update_mask.append("description") + if request.get("entryPoint") != response.get("entryPoint"): + update_mask.append("entryPoint") + if request.get("runtime") != response.get("runtime"): + update_mask.append("runtime") + if request.get("timeout") != response.get("timeout"): + update_mask.append("timeout") + if request.get("availableMemoryMb") != response.get("availableMemoryMb"): + update_mask.append("availableMemoryMb") + if request.get("labels") != response.get("labels"): + update_mask.append("labels") + if request.get("environmentVariables") != response.get("environmentVariables"): + update_mask.append("environmentVariables") + if request.get("sourceArchiveUrl") != response.get("sourceArchiveUrl"): + update_mask.append("sourceArchiveUrl") + if request.get("sourceUploadUrl") != response.get("sourceUploadUrl"): + update_mask.append("sourceUploadUrl") + if request.get("sourceRepository") != response.get("sourceRepository"): + update_mask.append("sourceRepository") + if request.get("httpsTrigger") != response.get("httpsTrigger"): + update_mask.append("httpsTrigger") + if request.get("eventTrigger") != response.get("eventTrigger"): + update_mask.append("eventTrigger") + if request.get("location") != response.get("location"): + update_mask.append("location") + if request.get("trigger_http") != response.get("trigger_http"): + update_mask.append("trigger_http") + return ",".join(update_mask) def delete(module, link): - auth = GcpSession(module, 'cloudfunctions') + auth = GcpSession(module, "cloudfunctions") return wait_for_operation(module, auth.delete(link)) def resource_to_request(module): request = { - u'name': name_pattern(module.params.get('name'), module), - u'description': module.params.get('description'), - u'entryPoint': module.params.get('entry_point'), - u'runtime': module.params.get('runtime'), - u'timeout': module.params.get('timeout'), - u'availableMemoryMb': module.params.get('available_memory_mb'), - u'labels': module.params.get('labels'), - u'environmentVariables': module.params.get('environment_variables'), - u'sourceArchiveUrl': module.params.get('source_archive_url'), - u'sourceUploadUrl': module.params.get('source_upload_url'), - u'sourceRepository': CloudFunctionSourcerepository(module.params.get('source_repository', {}), module).to_request(), - u'httpsTrigger': CloudFunctionHttpstrigger(module.params.get('https_trigger', {}), module).to_request(), - u'eventTrigger': CloudFunctionEventtrigger(module.params.get('event_trigger', {}), module).to_request(), + "name": name_pattern(module.params.get("name"), module), + "description": module.params.get("description"), + "entryPoint": module.params.get("entry_point"), + "runtime": module.params.get("runtime"), + "timeout": module.params.get("timeout"), + "availableMemoryMb": module.params.get("available_memory_mb"), + "labels": module.params.get("labels"), + "environmentVariables": module.params.get("environment_variables"), + "sourceArchiveUrl": module.params.get("source_archive_url"), + "sourceUploadUrl": module.params.get("source_upload_url"), + "sourceRepository": CloudFunctionSourcerepository( + module.params.get("source_repository", {}), module + ).to_request(), + "httpsTrigger": CloudFunctionHttpstrigger( + module.params.get("https_trigger", {}), module + ).to_request(), + "eventTrigger": CloudFunctionEventtrigger( + module.params.get("event_trigger", {}), module + ).to_request(), } request = encode_request(request, module) return request def fetch_resource(module, link, allow_not_found=True): - auth = GcpSession(module, 'cloudfunctions') + auth = GcpSession(module, "cloudfunctions") return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): - return "https://cloudfunctions.googleapis.com/v1/projects/{project}/locations/{location}/functions/{name}".format(**module.params) + return "https://cloudfunctions.googleapis.com/v1/projects/{project}/locations/{location}/functions/{name}".format( + **module.params + ) def collection(module): - return "https://cloudfunctions.googleapis.com/v1/projects/{project}/locations/{location}/functions".format(**module.params) + return "https://cloudfunctions.googleapis.com/v1/projects/{project}/locations/{location}/functions".format( + **module.params + ) def return_if_object(module, response, allow_not_found=False): @@ -536,11 +561,11 @@ def return_if_object(module, response, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError): + except getattr(json.decoder, "JSONDecodeError", ValueError): module.fail_json(msg="Invalid JSON response with error: %s" % response.text) - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if navigate_hash(result, ["error", "errors"]): + module.fail_json(msg=navigate_hash(result, ["error", "errors"])) return result @@ -567,23 +592,29 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'name': response.get(u'name'), - u'description': response.get(u'description'), - u'status': response.get(u'status'), - u'entryPoint': response.get(u'entryPoint'), - u'runtime': response.get(u'runtime'), - u'timeout': response.get(u'timeout'), - u'availableMemoryMb': response.get(u'availableMemoryMb'), - u'serviceAccountEmail': response.get(u'serviceAccountEmail'), - u'updateTime': response.get(u'updateTime'), - u'versionId': response.get(u'versionId'), - u'labels': response.get(u'labels'), - u'environmentVariables': response.get(u'environmentVariables'), - u'sourceArchiveUrl': response.get(u'sourceArchiveUrl'), - u'sourceUploadUrl': response.get(u'sourceUploadUrl'), - u'sourceRepository': CloudFunctionSourcerepository(response.get(u'sourceRepository', {}), module).from_response(), - u'httpsTrigger': CloudFunctionHttpstrigger(response.get(u'httpsTrigger', {}), module).from_response(), - u'eventTrigger': CloudFunctionEventtrigger(response.get(u'eventTrigger', {}), module).from_response(), + "name": response.get("name"), + "description": response.get("description"), + "status": response.get("status"), + "entryPoint": response.get("entryPoint"), + "runtime": response.get("runtime"), + "timeout": response.get("timeout"), + "availableMemoryMb": response.get("availableMemoryMb"), + "serviceAccountEmail": response.get("serviceAccountEmail"), + "updateTime": response.get("updateTime"), + "versionId": response.get("versionId"), + "labels": response.get("labels"), + "environmentVariables": response.get("environmentVariables"), + "sourceArchiveUrl": response.get("sourceArchiveUrl"), + "sourceUploadUrl": response.get("sourceUploadUrl"), + "sourceRepository": CloudFunctionSourcerepository( + response.get("sourceRepository", {}), module + ).from_response(), + "httpsTrigger": CloudFunctionHttpstrigger( + response.get("httpsTrigger", {}), module + ).from_response(), + "eventTrigger": CloudFunctionEventtrigger( + response.get("eventTrigger", {}), module + ).from_response(), } @@ -594,7 +625,9 @@ def name_pattern(name, module): regex = r"projects/.*/locations/.*/functions/.*" if not re.match(regex, name): - name = "projects/{project}/locations/{location}/functions/{name}".format(**module.params) + name = "projects/{project}/locations/{location}/functions/{name}".format( + **module.params + ) return name @@ -612,20 +645,20 @@ def wait_for_operation(module, response): op_result = return_if_object(module, response) if op_result is None: return {} - status = navigate_hash(op_result, ['done']) + status = navigate_hash(op_result, ["done"]) wait_done = wait_for_completion(status, op_result, module) - raise_if_errors(wait_done, ['error'], module) - return navigate_hash(wait_done, ['response']) + raise_if_errors(wait_done, ["error"], module) + return navigate_hash(wait_done, ["response"]) def wait_for_completion(status, op_result, module): - op_id = navigate_hash(op_result, ['name']) - op_uri = async_op_url(module, {'op_id': op_id}) + op_id = navigate_hash(op_result, ["name"]) + op_uri = async_op_url(module, {"op_id": op_id}) while not status: - raise_if_errors(op_result, ['error'], module) + raise_if_errors(op_result, ["error"], module) time.sleep(1.0) op_result = fetch_resource(module, op_uri, False) - status = navigate_hash(op_result, ['done']) + status = navigate_hash(op_result, ["done"]) return op_result @@ -641,8 +674,8 @@ def encode_request(request, module): if v or v is False: return_vals[k] = v - if module.params['trigger_http'] and not return_vals.get('httpsTrigger'): - return_vals['httpsTrigger'] = {} + if module.params["trigger_http"] and not return_vals.get("httpsTrigger"): + return_vals["httpsTrigger"] = {} return return_vals @@ -656,10 +689,10 @@ class CloudFunctionSourcerepository(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'url': self.request.get('url')}) + return remove_nones_from_dict({"url": self.request.get("url")}) def from_response(self): - return remove_nones_from_dict({u'url': self.request.get(u'url')}) + return remove_nones_from_dict({"url": self.request.get("url")}) class CloudFunctionHttpstrigger(object): @@ -687,14 +720,22 @@ class CloudFunctionEventtrigger(object): def to_request(self): return remove_nones_from_dict( - {u'eventType': self.request.get('event_type'), u'resource': self.request.get('resource'), u'service': self.request.get('service')} + { + "eventType": self.request.get("event_type"), + "resource": self.request.get("resource"), + "service": self.request.get("service"), + } ) def from_response(self): return remove_nones_from_dict( - {u'eventType': self.request.get(u'eventType'), u'resource': self.request.get(u'resource'), u'service': self.request.get(u'service')} + { + "eventType": self.request.get("eventType"), + "resource": self.request.get("resource"), + "service": self.request.get("service"), + } ) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 2590624..fbf49a7 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -11,6 +11,7 @@ SERVICE_ACCOUNT_NAME="${2}" SERVICE_LIST=( "appengine" "bigtable" + "cloudbuild.googleapis.com" "cloudfunctions" "cloudkms.googleapis.com" "cloudresourcemanager.googleapis.com" @@ -50,11 +51,16 @@ if ! gcloud app describe --project="$PROJECT_ID" > /dev/null; then gcloud app create --project="$PROJECT_ID" --region=us-central fi +# create and upload cloud function for testing +BUCKET_NAME="gs://${PROJECT_ID}-ansible-testing" -# Add bindings +if ! gcloud storage buckets describe "${BUCKET_NAME}" > /dev/null; then + gcloud storage buckets create "gs://${PROJECT_ID}-ansible-testing" --project="${PROJECT_ID}" +fi + +gsutil cp ./test-fixtures/cloud-function.zip "gs://${PROJECT_ID}-ansible-testing" -# roles/storage.objectAdmin # The following is hard to automate, so echo echo "Done! It may take up to 10 minutes for some of the changes to fully propagate." \ No newline at end of file diff --git a/test-fixtures/cloud-function-source/build-function-zip.sh b/test-fixtures/cloud-function-source/build-function-zip.sh new file mode 100755 index 0000000..626b80c --- /dev/null +++ b/test-fixtures/cloud-function-source/build-function-zip.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Build the cloud function zip file, +# in the desired cloud function source format. +if [ -f ../cloud-function.zip ]; then + rm ../cloud-function.zip +fi +zip ../cloud-function.zip * \ No newline at end of file diff --git a/test-fixtures/cloud-function-source/main.py b/test-fixtures/cloud-function-source/main.py new file mode 100644 index 0000000..980996a --- /dev/null +++ b/test-fixtures/cloud-function-source/main.py @@ -0,0 +1,9 @@ +import functions_framework + +# Register an HTTP function with the Functions Framework +@functions_framework.http +def helloGET(request): + # Your code here + + # Return an HTTP response + return "OK" diff --git a/test-fixtures/cloud-function-source/requirements.txt b/test-fixtures/cloud-function-source/requirements.txt new file mode 100644 index 0000000..a675cdd --- /dev/null +++ b/test-fixtures/cloud-function-source/requirements.txt @@ -0,0 +1 @@ +functions-framework==3.* diff --git a/test-fixtures/cloud-function.zip b/test-fixtures/cloud-function.zip new file mode 100644 index 0000000000000000000000000000000000000000..8d3d090ea63dbf87965757c355bc5d23ea340b1f GIT binary patch literal 776 zcmWIWW@Zs#U|`^2uyUuR{i|AQ&lS4JuKsJpdoeb?}q|JJ^myT847zkRCe85B%UbOOC_3W(W(-pEbN%+o8V1Ur1m7RO`|Mt6AMUXa6^zuO#L8JqBsaYlrO z2hRd6ZsAo??Jiq9cf?$|uKsAbu-x18)9#8ebI*KJU3hT$?1y=WWPU6R@zs5&$2r5w z-+iqpjn2y7PDD?TCph*d#Vd951->TJ-VEi79(SLqaZ_rYy7L(co~d zy(>29rar%f=Cs5;!T(aO{tQ_u4)O^X(A^9Sw>msR!@3JqB!O%Y76AIBD7COOvnVw; zHLs*tucV>`>?NIbj>#a5<|SCP73-!ICFZ7<=NDz$+8XO=aRqoYGRZOHiggK)-3*LC z{Gt)W!jT48A!z{3PGqAoV*+9Hg2v-Oqv7!aGz?3eKn%kb7|4cA1UeTpXn>|-36=nF SRyL5on1S#gkp2SlDgyw`2=coC literal 0 HcmV?d00001 diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/aliases b/tests/integration/targets/gcp_appengine_firewall_rule/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/aliases +++ b/tests/integration/targets/gcp_appengine_firewall_rule/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml index 4f87ea5..4441d53 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml @@ -90,7 +90,9 @@ - name: verify that command succeeded assert: that: - - results['resources'] | length == 0 + # there is a default firewall rule that cannot be + # deleted, so the length should be 1. + - results['resources'] | length == 1 # ---------------------------------------------------------------------------- - name: delete a firewall rule that does not exist google.cloud.gcp_appengine_firewall_rule: diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/aliases b/tests/integration/targets/gcp_cloudfunctions_cloud_function/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/aliases +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml index 5d8c29c..530ac70 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml @@ -18,9 +18,10 @@ name: "{{ resource_name }}" location: us-central1 entry_point: helloGET - source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip + source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip trigger_http: 'true' project: "{{ gcp_project }}" + runtime: "python310" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: absent @@ -30,9 +31,10 @@ name: "{{ resource_name }}" location: us-central1 entry_point: helloGET - source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip + source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip trigger_http: 'true' project: "{{ gcp_project }}" + runtime: "python310" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: present @@ -60,10 +62,13 @@ name: "{{ resource_name }}" location: us-central1 entry_point: helloGET - source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip + source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip trigger_http: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" + # runtime is not sent as it is optional for + # existing functions. + # runtime: "python310" service_account_file: "{{ gcp_cred_file }}" state: present register: result @@ -77,7 +82,7 @@ name: "{{ resource_name }}" location: us-central1 entry_point: helloGET - source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip + source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip trigger_http: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -107,7 +112,7 @@ name: "{{ resource_name }}" location: us-central1 entry_point: helloGET - source_archive_url: gs://ansible-cloudfunctions-bucket/function.zip + source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip trigger_http: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From 372141f3adaab5e5556b6eb25bd4301ea4a17f53 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 17:46:21 +0000 Subject: [PATCH 007/138] tests: fixing gcp_compute_external_backend_service The description field had a typo, resulting in an invalid payload. --- .../targets/gcp_compute_external_vpn_gateway/aliases | 3 +-- .../gcp_compute_external_vpn_gateway/tasks/autogen.yml | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases b/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml index 094b45b..a2cd623 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml @@ -17,7 +17,7 @@ google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT - descrpition: An externalyl managed VPN gateway + description: An externaly managed VPN gateway interfaces: - id: 0 ip_address: 8.8.8.8 @@ -30,7 +30,7 @@ google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT - descrpition: An externalyl managed VPN gateway + description: An externalyl managed VPN gateway interfaces: - id: 0 ip_address: 8.8.8.8 @@ -62,7 +62,7 @@ google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT - descrpition: An externalyl managed VPN gateway + description: An externalyl managed VPN gateway interfaces: - id: 0 ip_address: 8.8.8.8 @@ -80,7 +80,7 @@ google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT - descrpition: An externalyl managed VPN gateway + description: An externalyl managed VPN gateway interfaces: - id: 0 ip_address: 8.8.8.8 @@ -112,7 +112,7 @@ google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT - descrpition: An externalyl managed VPN gateway + description: An externalyl managed VPN gateway interfaces: - id: 0 ip_address: 8.8.8.8 From 6f1ee2b2b4e64743872d925891dc7748740d1818 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 17:57:06 +0000 Subject: [PATCH 008/138] tests: fix gcp_compute_forwarding_rule test The targetpool object was being passed directly to the forwarding rule, rather than passing the selfLink string. --- .../targets/gcp_compute_forwarding_rule/aliases | 1 - .../gcp_compute_forwarding_rule/tasks/autogen.yml | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_forwarding_rule/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_forwarding_rule/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml index 01c5028..38c67df 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml @@ -35,7 +35,7 @@ google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 - target: "{{ targetpool }}" + target: "{{ targetpool.selfLink }}" ip_protocol: TCP port_range: 80-80 ip_address: "{{ address.address }}" @@ -48,7 +48,7 @@ google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 - target: "{{ targetpool }}" + target: "{{ targetpool.selfLink }}" ip_protocol: TCP port_range: 80-80 ip_address: "{{ address.address }}" @@ -81,7 +81,7 @@ google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 - target: "{{ targetpool }}" + target: "{{ targetpool.selfLink }}" ip_protocol: TCP port_range: 80-80 ip_address: "{{ address.address }}" @@ -99,7 +99,7 @@ google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 - target: "{{ targetpool }}" + target: "{{ targetpool.selfLink }}" ip_protocol: TCP port_range: 80-80 ip_address: "{{ address.address }}" @@ -132,7 +132,7 @@ google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 - target: "{{ targetpool }}" + target: "{{ targetpool.selfLink }}" ip_protocol: TCP port_range: 80-80 ip_address: "{{ address.address }}" From 7cd653e50dcd66baf4d74e594caccbbc1b16c58c Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 18:18:42 +0000 Subject: [PATCH 009/138] minor improvement in gcp_compute_instance The test does not yet pass due to a discovered change, but some progress was made. - updating disk image to an existing, non-EOL image. - updating subnetwork configuration. --- .../targets/gcp_compute_instance/aliases | 2 +- .../gcp_compute_instance/tasks/autogen.yml | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/gcp_compute_instance/aliases b/tests/integration/targets/gcp_compute_instance/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_compute_instance/aliases +++ b/tests/integration/targets/gcp_compute_instance/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index fb88569..f96d489 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -15,9 +15,9 @@ # Pre-test setup - name: create a disk google.cloud.gcp_compute_disk: - name: disk-instance + name: "{{ resource_prefix }}" size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -26,10 +26,11 @@ register: disk - name: create a network google.cloud.gcp_compute_network: - name: network-instance + name: "{{ resource_prefix }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -55,7 +56,6 @@ initialize_params: disk_type: local-ssd metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh cost-center: '12345' labels: environment: production @@ -80,12 +80,11 @@ boot: 'true' source: "{{ disk }}" - auto_delete: 'true' - interface: NVME + interface: SCS type: SCRATCH initialize_params: disk_type: local-ssd metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh cost-center: '12345' labels: environment: production @@ -135,7 +134,6 @@ initialize_params: disk_type: local-ssd metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh cost-center: '12345' labels: environment: production @@ -170,7 +168,6 @@ initialize_params: disk_type: local-ssd metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh cost-center: '12345' labels: environment: production @@ -220,7 +217,6 @@ initialize_params: disk_type: local-ssd metadata: - startup-script-url: gs:://graphite-playground/bootstrap.sh cost-center: '12345' labels: environment: production @@ -255,16 +251,17 @@ ignore_errors: true - name: delete a network google.cloud.gcp_compute_network: - name: network-instance + name: "{{ resource_prefix }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true - name: delete a disk google.cloud.gcp_compute_disk: - name: disk-instance + name: "{{ resource_prefix }}" size_gb: 50 source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts zone: us-central1-a From d52e5f0c3c82194df203e3a3bb6f80681ba86675 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 18:24:04 +0000 Subject: [PATCH 010/138] tests: fix google_compute_route test google_compute_route was creating legacy subnetworks in the example, which are now deprecated. --- tests/integration/targets/gcp_compute_route/aliases | 3 +-- tests/integration/targets/gcp_compute_route/tasks/autogen.yml | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/gcp_compute_route/aliases b/tests/integration/targets/gcp_compute_route/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_route/aliases +++ b/tests/integration/targets/gcp_compute_route/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml index cd11426..b687de9 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a route @@ -147,6 +148,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true From c96294561522b9d0600ac61d13581698663ad403 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 18:27:14 +0000 Subject: [PATCH 011/138] tests: fix google_compute_router test google_compute_router was attempting to create a legacy network. Creating a new network that passes the test. --- tests/integration/targets/gcp_compute_router/aliases | 3 +-- tests/integration/targets/gcp_compute_router/tasks/autogen.yml | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/gcp_compute_router/aliases b/tests/integration/targets/gcp_compute_router/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_router/aliases +++ b/tests/integration/targets/gcp_compute_router/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml index dbe8108..0be0d14 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a router @@ -169,6 +170,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true From 7fb64edcc5a62c407bb7c691ab7528f1b7d4cadd Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 18:40:05 +0000 Subject: [PATCH 012/138] tests: fix gcp_compute_region_url_map - remove the global health check (not necessary to create a backend service) - configure backend service to external, as internal backend services cannot use the HTTP protocol. --- .../gcp_compute_region_url_map/aliases | 3 +- .../tasks/autogen.yml | 35 ++----------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/tests/integration/targets/gcp_compute_region_url_map/aliases b/tests/integration/targets/gcp_compute_region_url_map/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/aliases +++ b/tests/integration/targets/gcp_compute_region_url_map/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml index b47476c..75e998c 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml @@ -13,29 +13,15 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a health check - google.cloud.gcp_compute_health_check: - name: "{{ resource_name }}" - type: HTTP - http_health_check: - port: 80 - check_interval_sec: 1 - timeout_sec: 1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck - name: create a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 - health_checks: - - "{{ healthcheck.selfLink }}" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + load_balancing_scheme: "EXTERNAL" state: present register: backendservice - name: delete a region URL map @@ -144,26 +130,11 @@ google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 - health_checks: - - "{{ healthcheck.selfLink }}" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + load_balancing_scheme: "EXTERNAL" state: absent register: backendservice - ignore_errors: true -- name: delete a health check - google.cloud.gcp_compute_health_check: - name: "{{ resource_name }}" - type: HTTP - http_health_check: - port: 80 - check_interval_sec: 1 - timeout_sec: 1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true + ignore_errors: true \ No newline at end of file From 9e7748bc23dc90d54088989a9b00b71d613aceda Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 8 Oct 2022 18:47:52 +0000 Subject: [PATCH 013/138] tests: fixing bootstrap code and invalid instance - bootstrap code was not correctly instantiating the cloud function. - compute_instance has a typo from a previous commit. - re-disabling forwarding rule as it still has the backend_service fingerprint requirement --- scripts/bootstrap-project.sh | 4 ++-- tests/integration/targets/gcp_compute_forwarding_rule/aliases | 1 + .../targets/gcp_compute_instance/tasks/autogen.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index fbf49a7..0bce608 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -56,10 +56,10 @@ fi BUCKET_NAME="gs://${PROJECT_ID}-ansible-testing" if ! gcloud storage buckets describe "${BUCKET_NAME}" > /dev/null; then - gcloud storage buckets create "gs://${PROJECT_ID}-ansible-testing" --project="${PROJECT_ID}" + gcloud storage buckets create "${BUCKET_NAME}" --project="${PROJECT_ID}" fi -gsutil cp ./test-fixtures/cloud-function.zip "gs://${PROJECT_ID}-ansible-testing" +gsutil cp ./test-fixtures/cloud-function.zip "${BUCKET_NAME}" # The following is hard to automate, so echo diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_forwarding_rule/aliases index 26507c2..9812f01 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_forwarding_rule/aliases @@ -1 +1,2 @@ cloud/gcp +unsupported diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index f96d489..57ac983 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -80,7 +80,7 @@ boot: 'true' source: "{{ disk }}" - auto_delete: 'true' - interface: SCS + interface: NVME type: SCRATCH initialize_params: disk_type: local-ssd From 24d09d17c3ac7f6cda178ce0b6f373da68918833 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 05:10:15 +0000 Subject: [PATCH 014/138] tests: fixing more fixed tests - gcp_compute_ssl_certificate: region is not a supported parameter. --- plugins/modules/gcp_compute_ssl_certificate.py | 1 - .../integration/targets/gcp_compute_ssl_certificate/aliases | 3 +-- .../targets/gcp_compute_ssl_certificate/tasks/autogen.yml | 5 ----- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/plugins/modules/gcp_compute_ssl_certificate.py b/plugins/modules/gcp_compute_ssl_certificate.py index 5d0ef0f..15ddaba 100644 --- a/plugins/modules/gcp_compute_ssl_certificate.py +++ b/plugins/modules/gcp_compute_ssl_certificate.py @@ -133,7 +133,6 @@ EXAMPLES = ''' - name: create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: test_object - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/aliases b/tests/integration/targets/gcp_compute_ssl_certificate/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/aliases +++ b/tests/integration/targets/gcp_compute_ssl_certificate/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml index 911bc63..a8346cd 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml @@ -16,7 +16,6 @@ - name: delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -50,7 +49,6 @@ - name: create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -103,7 +101,6 @@ - name: create a SSL certificate that already exists google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -142,7 +139,6 @@ - name: delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -195,7 +191,6 @@ - name: delete a SSL certificate that does not exist google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- From f1f41177e4bd71f418e2407ca479150ecb113d31 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 05:27:18 +0000 Subject: [PATCH 015/138] tests: fixing gcp_iam_service_account there was a hardcoded GCP project for testing purposes. --- .../targets/gcp_iam_service_account/aliases | 3 +-- .../gcp_iam_service_account/tasks/autogen.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/integration/targets/gcp_iam_service_account/aliases b/tests/integration/targets/gcp_iam_service_account/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_iam_service_account/aliases +++ b/tests/integration/targets/gcp_iam_service_account/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index 9c70ab3..e511e99 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +24,7 @@ #---------------------------------------------------------- - name: create a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -46,11 +46,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a service account that already exists google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +64,7 @@ #---------------------------------------------------------- - name: delete a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -86,11 +86,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a service account that does not exist google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From 1a753eff05a85ff1de1147c16f99ef2f63af2d85 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 05:45:37 +0000 Subject: [PATCH 016/138] tests: fix key_ring and redis - gcp_key_ring was already passing, needed to be enabled. - gcp_redis_instance was using legacy networks, switch to net networks. --- scripts/bootstrap-project.sh | 1 + tests/integration/targets/gcp_kms_key_ring/aliases | 3 +-- tests/integration/targets/gcp_mlengine_version/aliases | 2 +- tests/integration/targets/gcp_redis_instance/aliases | 3 +-- tests/integration/targets/gcp_redis_instance/tasks/autogen.yml | 2 ++ 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 0bce608..924d713 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -21,6 +21,7 @@ SERVICE_LIST=( "dns" "file.googleapis.com" "ml.googleapis.com" + "redis.googleapis.com" "runtimeconfig.googleapis.com" "sourcerepo.googleapis.com" "spanner.googleapis.com" diff --git a/tests/integration/targets/gcp_kms_key_ring/aliases b/tests/integration/targets/gcp_kms_key_ring/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_kms_key_ring/aliases +++ b/tests/integration/targets/gcp_kms_key_ring/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_mlengine_version/aliases b/tests/integration/targets/gcp_mlengine_version/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_mlengine_version/aliases +++ b/tests/integration/targets/gcp_mlengine_version/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_redis_instance/aliases b/tests/integration/targets/gcp_redis_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_redis_instance/aliases +++ b/tests/integration/targets/gcp_redis_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml index 3580c1a..9980558 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a instance @@ -165,6 +166,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true From cfbc4d8be516ab6a7f97efb08d985bb71b461b64 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 06:07:25 +0000 Subject: [PATCH 017/138] tests: cleaning up resourcemanager, enabling spanner - gcp_spanner_instance works, enabling for CI. - gcp_resourcemanager_project is running into quota issues for listing the API to verify state. Adding a to-do as well as removing some people-specific names. --- plugins/modules/gcp_resourcemanager_project.py | 2 +- scripts/bootstrap-project.sh | 1 + .../targets/gcp_resourcemanager_project/aliases | 2 +- .../gcp_resourcemanager_project/tasks/autogen.yml | 10 +++++----- .../targets/gcp_serviceusage_service/tasks/autogen.yml | 5 +++++ tests/integration/targets/gcp_spanner_instance/aliases | 3 +-- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index 41664bf..9cae5f0 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -134,7 +134,7 @@ EXAMPLES = ''' - name: create a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" parent: diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 924d713..2cf6cd9 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -33,6 +33,7 @@ SERVICE_LIST=( REQUIRED_ROLE_LIST=( "roles/storage.objectAdmin" "roles/source.admin" + "roles/resourcemanager.projects.create" ) for SERVICE in "${SERVICE_LIST[@]}"; do diff --git a/tests/integration/targets/gcp_resourcemanager_project/aliases b/tests/integration/targets/gcp_resourcemanager_project/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/aliases +++ b/tests/integration/targets/gcp_resourcemanager_project/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 81043b0..5e02c41 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -16,7 +16,7 @@ - name: delete a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -27,7 +27,7 @@ - name: create a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -55,7 +55,7 @@ - name: create a project that already exists google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -71,7 +71,7 @@ - name: delete a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -99,7 +99,7 @@ - name: delete a project that does not exist google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml index 473a198..6db1573 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml @@ -71,6 +71,11 @@ assert: that: - result.changed == true +# TODO(@toumorokoshi): investigate if the pause helps +# prevent quota issues. +# - name: Pause for 1 minute to keep from hitting quota limit +# ansible.builtin.pause: +# minutes: 1 - name: verify that service was deleted google.cloud.gcp_serviceusage_service_info: project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_spanner_instance/aliases b/tests/integration/targets/gcp_spanner_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_spanner_instance/aliases +++ b/tests/integration/targets/gcp_spanner_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From d03d7beda201353546ef26d94ef4c0e9c6e90b5b Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 06:15:24 +0000 Subject: [PATCH 018/138] tests: fix gcp_storage_bucket test - gcp_storage_bucket had a hard-coded bucket name. Making it based on the GCP project name to allow some attribution in the case of garbage detection. --- tests/integration/targets/gcp_storage_bucket/aliases | 3 +-- .../targets/gcp_storage_bucket/defaults/main.yml | 2 +- .../targets/gcp_storage_bucket/tasks/autogen.yml | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/integration/targets/gcp_storage_bucket/aliases b/tests/integration/targets/gcp_storage_bucket/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_storage_bucket/aliases +++ b/tests/integration/targets/gcp_storage_bucket/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_bucket/defaults/main.yml b/tests/integration/targets/gcp_storage_bucket/defaults/main.yml index ba66644..10f1ec1 100644 --- a/tests/integration/targets/gcp_storage_bucket/defaults/main.yml +++ b/tests/integration/targets/gcp_storage_bucket/defaults/main.yml @@ -1,2 +1,2 @@ --- -resource_name: "{{ resource_prefix }}" +resource_name: "{{ gcp_project }}-ansible-test-bucket" diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml index c82302e..b6d83e4 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -23,7 +23,7 @@ #---------------------------------------------------------- - name: create a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -36,7 +36,7 @@ # ---------------------------------------------------------------------------- - name: create a bucket that already exists google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -49,7 +49,7 @@ #---------------------------------------------------------- - name: delete a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -62,7 +62,7 @@ # ---------------------------------------------------------------------------- - name: delete a bucket that does not exist google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" From 516f0d8e0bc17cac3190d5c4d533d73ded0d6dc1 Mon Sep 17 00:00:00 2001 From: David Moreau Simard Date: Sun, 9 Oct 2022 02:44:12 -0400 Subject: [PATCH 019/138] docs: update repository URL in galaxy.yml (#387) The previous URL properly redirects to the new one but let's put the updated one. From d8c1d2f8b8f0e5dd39fd94d4f346738a8c892df0 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 9 Oct 2022 06:34:12 +0000 Subject: [PATCH 020/138] tests: fix gcp_tpu_node test - gcp_tpu_node was using an old TensorFlow version, as well as using a popular TPU variant (3-8) in a zone that had a capacity limit. Both have been updated to working values. --- scripts/bootstrap-project.sh | 1 - .../integration/targets/gcp_tpu_node/aliases | 3 +-- .../targets/gcp_tpu_node/tasks/autogen.yml | 20 +++++++++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 2cf6cd9..924d713 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -33,7 +33,6 @@ SERVICE_LIST=( REQUIRED_ROLE_LIST=( "roles/storage.objectAdmin" "roles/source.admin" - "roles/resourcemanager.projects.create" ) for SERVICE in "${SERVICE_LIST[@]}"; do diff --git a/tests/integration/targets/gcp_tpu_node/aliases b/tests/integration/targets/gcp_tpu_node/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_tpu_node/aliases +++ b/tests/integration/targets/gcp_tpu_node/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index 4f00836..eeadf54 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -17,8 +17,8 @@ google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + accelerator_type: v2-8 + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -29,8 +29,8 @@ google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + accelerator_type: v2-8 + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -59,8 +59,8 @@ google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + accelerator_type: v2-8 + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -76,8 +76,8 @@ google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + accelerator_type: v2-8 + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -106,8 +106,8 @@ google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + accelerator_type: v2-8 + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From 3aa8682d5fb178ff4cf4697a440a29c438302e90 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Mon, 10 Oct 2022 18:50:27 +0000 Subject: [PATCH 021/138] tests: enable forwarding_rule, disable global version the wrong forwarding rule was turned on, while the correct one was turned off. --- tests/integration/targets/gcp_compute_forwarding_rule/aliases | 3 +-- .../targets/gcp_compute_global_forwarding_rule/aliases | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_forwarding_rule/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_forwarding_rule/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases index 0e4419e..ff7eb2d 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases @@ -1 +1,2 @@ -cloud/gcp \ No newline at end of file +cloud/gcp +unsupported \ No newline at end of file From 3f6a50208d46befa46793d3abc4bd93d64cb9436 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Mon, 10 Oct 2022 20:33:23 +0000 Subject: [PATCH 022/138] tests: changing gcp_tpu_node side v2-8 seems to be in high demand causing test failures. changing it to v2-32 seems to pass more consistently. --- .../targets/gcp_tpu_node/tasks/autogen.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index eeadf54..e44d632 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -16,8 +16,8 @@ - name: delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v2-8 + zone: us-central1-a + accelerator_type: "v2-32" tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" @@ -28,8 +28,8 @@ - name: create a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v2-8 + zone: us-central1-a + accelerator_type: "v2-32" tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" @@ -43,7 +43,7 @@ - result.changed == true - name: verify that node was created google.cloud.gcp_tpu_node_info: - zone: us-central1-b + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -58,8 +58,8 @@ - name: create a node that already exists google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v2-8 + zone: us-central1-a + accelerator_type: "v2-32" tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" @@ -75,8 +75,8 @@ - name: delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v2-8 + zone: us-central1-a + accelerator_type: "v2-32" tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" @@ -90,7 +90,7 @@ - result.changed == true - name: verify that node was deleted google.cloud.gcp_tpu_node_info: - zone: us-central1-b + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -105,8 +105,8 @@ - name: delete a node that does not exist google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v2-8 + zone: us-central1-a + accelerator_type: "v2-32" tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" From 5182023c9135d454d6b05b5f8d5aeb6d07a3852e Mon Sep 17 00:00:00 2001 From: Nonoctis Date: Sat, 5 Nov 2022 17:55:09 +0100 Subject: [PATCH 023/138] Docs: fix typo in gcp_storage_object.py (#507) While version `1.2..0` might work it does not reflect the desired requirement (`1.2.0`). --- plugins/modules/gcp_storage_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index 7fd95b3..e71a528 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -28,7 +28,7 @@ requirements: - python >= 2.6 - requests >= 2.18.4 - google-auth >= 1.3.0 -- google-cloud-storage >= 1.2..0 +- google-cloud-storage >= 1.2.0 options: action: description: From 2b8cbcc07217fd4c61372a301c789a4052e3e962 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 5 Nov 2022 11:35:23 -0700 Subject: [PATCH 024/138] docs: switchin _facts to _info (#508) The modules for facts were renamed to info. Fixing incorrect documentation. This is a re-implementation of #222. --- README.md | 172 +++++++++++++++++++++++++++--------------------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 4fa7e9b..24dec78 100644 --- a/README.md +++ b/README.md @@ -9,89 +9,89 @@ ansible-galaxy collection install google.cloud ``` # Resources Supported - * App Engine FirewallRule (gcp_appengine_firewall_rule, gcp_appengine_firewall_rule_facts) - * BigQuery Dataset (gcp_bigquery_dataset, gcp_bigquery_dataset_facts) - * BigQuery Table (gcp_bigquery_table, gcp_bigquery_table_facts) - * Cloud Bigtable Instance (gcp_bigtable_instance, gcp_bigtable_instance_facts) - * Cloud Build Trigger (gcp_cloudbuild_trigger, gcp_cloudbuild_trigger_facts) - * Cloud Functions CloudFunction (gcp_cloudfunctions_cloud_function, gcp_cloudfunctions_cloud_function_facts) - * Cloud Scheduler Job (gcp_cloudscheduler_job, gcp_cloudscheduler_job_facts) - * Cloud Tasks Queue (gcp_cloudtasks_queue, gcp_cloudtasks_queue_facts) - * Compute Engine Address (gcp_compute_address, gcp_compute_address_facts) - * Compute Engine Autoscaler (gcp_compute_autoscaler, gcp_compute_autoscaler_facts) - * Compute Engine BackendBucket (gcp_compute_backend_bucket, gcp_compute_backend_bucket_facts) - * Compute Engine BackendService (gcp_compute_backend_service, gcp_compute_backend_service_facts) - * Compute Engine RegionBackendService (gcp_compute_region_backend_service, gcp_compute_region_backend_service_facts) - * Compute Engine Disk (gcp_compute_disk, gcp_compute_disk_facts) - * Compute Engine Firewall (gcp_compute_firewall, gcp_compute_firewall_facts) - * Compute Engine ForwardingRule (gcp_compute_forwarding_rule, gcp_compute_forwarding_rule_facts) - * Compute Engine GlobalAddress (gcp_compute_global_address, gcp_compute_global_address_facts) - * Compute Engine GlobalForwardingRule (gcp_compute_global_forwarding_rule, gcp_compute_global_forwarding_rule_facts) - * Compute Engine HttpHealthCheck (gcp_compute_http_health_check, gcp_compute_http_health_check_facts) - * Compute Engine HttpsHealthCheck (gcp_compute_https_health_check, gcp_compute_https_health_check_facts) - * Compute Engine HealthCheck (gcp_compute_health_check, gcp_compute_health_check_facts) - * Compute Engine InstanceTemplate (gcp_compute_instance_template, gcp_compute_instance_template_facts) - * Compute Engine Image (gcp_compute_image, gcp_compute_image_facts) - * Compute Engine Instance (gcp_compute_instance, gcp_compute_instance_facts) - * Compute Engine InstanceGroup (gcp_compute_instance_group, gcp_compute_instance_group_facts) - * Compute Engine InstanceGroupManager (gcp_compute_instance_group_manager, gcp_compute_instance_group_manager_facts) - * Compute Engine RegionInstanceGroupManager (gcp_compute_region_instance_group_manager, gcp_compute_region_instance_group_manager_facts) - * Compute Engine InterconnectAttachment (gcp_compute_interconnect_attachment, gcp_compute_interconnect_attachment_facts) - * Compute Engine Network (gcp_compute_network, gcp_compute_network_facts) - * Compute Engine NetworkEndpointGroup (gcp_compute_network_endpoint_group, gcp_compute_network_endpoint_group_facts) - * Compute Engine NodeGroup (gcp_compute_node_group, gcp_compute_node_group_facts) - * Compute Engine NodeTemplate (gcp_compute_node_template, gcp_compute_node_template_facts) - * Compute Engine RegionAutoscaler (gcp_compute_region_autoscaler, gcp_compute_region_autoscaler_facts) - * Compute Engine RegionDisk (gcp_compute_region_disk, gcp_compute_region_disk_facts) - * Compute Engine RegionUrlMap (gcp_compute_region_url_map, gcp_compute_region_url_map_facts) - * Compute Engine RegionHealthCheck (gcp_compute_region_health_check, gcp_compute_region_health_check_facts) - * Compute Engine ResourcePolicy (gcp_compute_resource_policy, gcp_compute_resource_policy_facts) - * Compute Engine Route (gcp_compute_route, gcp_compute_route_facts) - * Compute Engine Router (gcp_compute_router, gcp_compute_router_facts) - * Compute Engine Snapshot (gcp_compute_snapshot, gcp_compute_snapshot_facts) - * Compute Engine SslCertificate (gcp_compute_ssl_certificate, gcp_compute_ssl_certificate_facts) - * Compute Engine Reservation (gcp_compute_reservation, gcp_compute_reservation_facts) - * Compute Engine SslPolicy (gcp_compute_ssl_policy, gcp_compute_ssl_policy_facts) - * Compute Engine Subnetwork (gcp_compute_subnetwork, gcp_compute_subnetwork_facts) - * Compute Engine TargetHttpProxy (gcp_compute_target_http_proxy, gcp_compute_target_http_proxy_facts) - * Compute Engine TargetHttpsProxy (gcp_compute_target_https_proxy, gcp_compute_target_https_proxy_facts) - * Compute Engine RegionTargetHttpProxy (gcp_compute_region_target_http_proxy, gcp_compute_region_target_http_proxy_facts) - * Compute Engine RegionTargetHttpsProxy (gcp_compute_region_target_https_proxy, gcp_compute_region_target_https_proxy_facts) - * Compute Engine TargetInstance (gcp_compute_target_instance, gcp_compute_target_instance_facts) - * Compute Engine TargetPool (gcp_compute_target_pool, gcp_compute_target_pool_facts) - * Compute Engine TargetSslProxy (gcp_compute_target_ssl_proxy, gcp_compute_target_ssl_proxy_facts) - * Compute Engine TargetTcpProxy (gcp_compute_target_tcp_proxy, gcp_compute_target_tcp_proxy_facts) - * Compute Engine TargetVpnGateway (gcp_compute_target_vpn_gateway, gcp_compute_target_vpn_gateway_facts) - * Compute Engine UrlMap (gcp_compute_url_map, gcp_compute_url_map_facts) - * Compute Engine VpnTunnel (gcp_compute_vpn_tunnel, gcp_compute_vpn_tunnel_facts) - * Google Kubernetes Engine Cluster (gcp_container_cluster, gcp_container_cluster_facts) - * Google Kubernetes Engine NodePool (gcp_container_node_pool, gcp_container_node_pool_facts) - * Cloud DNS ManagedZone (gcp_dns_managed_zone, gcp_dns_managed_zone_facts) - * Cloud DNS ResourceRecordSet (gcp_dns_resource_record_set, gcp_dns_resource_record_set_facts) - * Filestore Instance (gcp_filestore_instance, gcp_filestore_instance_facts) - * Cloud IAM Role (gcp_iam_role, gcp_iam_role_facts) - * Cloud IAM ServiceAccount (gcp_iam_service_account, gcp_iam_service_account_facts) - * Cloud IAM ServiceAccountKey (gcp_iam_service_account_key, gcp_iam_service_account_key_facts) - * Cloud Key Management Service KeyRing (gcp_kms_key_ring, gcp_kms_key_ring_facts) - * Cloud Key Management Service CryptoKey (gcp_kms_crypto_key, gcp_kms_crypto_key_facts) - * Cloud (Stackdriver) Logging Metric (gcp_logging_metric, gcp_logging_metric_facts) - * ML Engine Model (gcp_mlengine_model, gcp_mlengine_model_facts) - * ML Engine Version (gcp_mlengine_version, gcp_mlengine_version_facts) - * Cloud Pub/Sub Topic (gcp_pubsub_topic, gcp_pubsub_topic_facts) - * Cloud Pub/Sub Subscription (gcp_pubsub_subscription, gcp_pubsub_subscription_facts) - * Memorystore (Redis) Instance (gcp_redis_instance, gcp_redis_instance_facts) - * Resource Manager Project (gcp_resourcemanager_project, gcp_resourcemanager_project_facts) - * Runtime Configurator Config (gcp_runtimeconfig_config, gcp_runtimeconfig_config_facts) - * Runtime Configurator Variable (gcp_runtimeconfig_variable, gcp_runtimeconfig_variable_facts) - * Service Usage Service (gcp_serviceusage_service, gcp_serviceusage_service_facts) - * Cloud Source Repositories Repository (gcp_sourcerepo_repository, gcp_sourcerepo_repository_facts) - * Cloud Spanner Instance (gcp_spanner_instance, gcp_spanner_instance_facts) - * Cloud Spanner Database (gcp_spanner_database, gcp_spanner_database_facts) - * Cloud SQL Instance (gcp_sql_instance, gcp_sql_instance_facts) - * Cloud SQL Database (gcp_sql_database, gcp_sql_database_facts) - * Cloud SQL User (gcp_sql_user, gcp_sql_user_facts) - * Cloud SQL SslCert (gcp_sql_ssl_cert, gcp_sql_ssl_cert_facts) - * Cloud Storage Bucket (gcp_storage_bucket, gcp_storage_bucket_facts) - * Cloud Storage BucketAccessControl (gcp_storage_bucket_access_control, gcp_storage_bucket_access_control_facts) - * Cloud Storage DefaultObjectACL (gcp_storage_default_object_acl, gcp_storage_default_object_acl_facts) - * Cloud TPU Node (gcp_tpu_node, gcp_tpu_node_facts) + * App Engine FirewallRule (gcp_appengine_firewall_rule, gcp_appengine_firewall_rule_info) + * BigQuery Dataset (gcp_bigquery_dataset, gcp_bigquery_dataset_info) + * BigQuery Table (gcp_bigquery_table, gcp_bigquery_table_info) + * Cloud Bigtable Instance (gcp_bigtable_instance, gcp_bigtable_instance_info) + * Cloud Build Trigger (gcp_cloudbuild_trigger, gcp_cloudbuild_trigger_info) + * Cloud Functions CloudFunction (gcp_cloudfunctions_cloud_function, gcp_cloudfunctions_cloud_function_info) + * Cloud Scheduler Job (gcp_cloudscheduler_job, gcp_cloudscheduler_job_info) + * Cloud Tasks Queue (gcp_cloudtasks_queue, gcp_cloudtasks_queue_info) + * Compute Engine Address (gcp_compute_address, gcp_compute_address_info) + * Compute Engine Autoscaler (gcp_compute_autoscaler, gcp_compute_autoscaler_info) + * Compute Engine BackendBucket (gcp_compute_backend_bucket, gcp_compute_backend_bucket_info) + * Compute Engine BackendService (gcp_compute_backend_service, gcp_compute_backend_service_info) + * Compute Engine RegionBackendService (gcp_compute_region_backend_service, gcp_compute_region_backend_service_info) + * Compute Engine Disk (gcp_compute_disk, gcp_compute_disk_info) + * Compute Engine Firewall (gcp_compute_firewall, gcp_compute_firewall_info) + * Compute Engine ForwardingRule (gcp_compute_forwarding_rule, gcp_compute_forwarding_rule_info) + * Compute Engine GlobalAddress (gcp_compute_global_address, gcp_compute_global_address_info) + * Compute Engine GlobalForwardingRule (gcp_compute_global_forwarding_rule, gcp_compute_global_forwarding_rule_info) + * Compute Engine HttpHealthCheck (gcp_compute_http_health_check, gcp_compute_http_health_check_info) + * Compute Engine HttpsHealthCheck (gcp_compute_https_health_check, gcp_compute_https_health_check_info) + * Compute Engine HealthCheck (gcp_compute_health_check, gcp_compute_health_check_info) + * Compute Engine InstanceTemplate (gcp_compute_instance_template, gcp_compute_instance_template_info) + * Compute Engine Image (gcp_compute_image, gcp_compute_image_info) + * Compute Engine Instance (gcp_compute_instance, gcp_compute_instance_info) + * Compute Engine InstanceGroup (gcp_compute_instance_group, gcp_compute_instance_group_info) + * Compute Engine InstanceGroupManager (gcp_compute_instance_group_manager, gcp_compute_instance_group_manager_info) + * Compute Engine RegionInstanceGroupManager (gcp_compute_region_instance_group_manager, gcp_compute_region_instance_group_manager_info) + * Compute Engine InterconnectAttachment (gcp_compute_interconnect_attachment, gcp_compute_interconnect_attachment_info) + * Compute Engine Network (gcp_compute_network, gcp_compute_network_info) + * Compute Engine NetworkEndpointGroup (gcp_compute_network_endpoint_group, gcp_compute_network_endpoint_group_info) + * Compute Engine NodeGroup (gcp_compute_node_group, gcp_compute_node_group_info) + * Compute Engine NodeTemplate (gcp_compute_node_template, gcp_compute_node_template_info) + * Compute Engine RegionAutoscaler (gcp_compute_region_autoscaler, gcp_compute_region_autoscaler_info) + * Compute Engine RegionDisk (gcp_compute_region_disk, gcp_compute_region_disk_info) + * Compute Engine RegionUrlMap (gcp_compute_region_url_map, gcp_compute_region_url_map_info) + * Compute Engine RegionHealthCheck (gcp_compute_region_health_check, gcp_compute_region_health_check_info) + * Compute Engine ResourcePolicy (gcp_compute_resource_policy, gcp_compute_resource_policy_info) + * Compute Engine Route (gcp_compute_route, gcp_compute_route_info) + * Compute Engine Router (gcp_compute_router, gcp_compute_router_info) + * Compute Engine Snapshot (gcp_compute_snapshot, gcp_compute_snapshot_info) + * Compute Engine SslCertificate (gcp_compute_ssl_certificate, gcp_compute_ssl_certificate_info) + * Compute Engine Reservation (gcp_compute_reservation, gcp_compute_reservation_info) + * Compute Engine SslPolicy (gcp_compute_ssl_policy, gcp_compute_ssl_policy_info) + * Compute Engine Subnetwork (gcp_compute_subnetwork, gcp_compute_subnetwork_info) + * Compute Engine TargetHttpProxy (gcp_compute_target_http_proxy, gcp_compute_target_http_proxy_info) + * Compute Engine TargetHttpsProxy (gcp_compute_target_https_proxy, gcp_compute_target_https_proxy_info) + * Compute Engine RegionTargetHttpProxy (gcp_compute_region_target_http_proxy, gcp_compute_region_target_http_proxy_info) + * Compute Engine RegionTargetHttpsProxy (gcp_compute_region_target_https_proxy, gcp_compute_region_target_https_proxy_info) + * Compute Engine TargetInstance (gcp_compute_target_instance, gcp_compute_target_instance_info) + * Compute Engine TargetPool (gcp_compute_target_pool, gcp_compute_target_pool_info) + * Compute Engine TargetSslProxy (gcp_compute_target_ssl_proxy, gcp_compute_target_ssl_proxy_info) + * Compute Engine TargetTcpProxy (gcp_compute_target_tcp_proxy, gcp_compute_target_tcp_proxy_info) + * Compute Engine TargetVpnGateway (gcp_compute_target_vpn_gateway, gcp_compute_target_vpn_gateway_info) + * Compute Engine UrlMap (gcp_compute_url_map, gcp_compute_url_map_info) + * Compute Engine VpnTunnel (gcp_compute_vpn_tunnel, gcp_compute_vpn_tunnel_info) + * Google Kubernetes Engine Cluster (gcp_container_cluster, gcp_container_cluster_info) + * Google Kubernetes Engine NodePool (gcp_container_node_pool, gcp_container_node_pool_info) + * Cloud DNS ManagedZone (gcp_dns_managed_zone, gcp_dns_managed_zone_info) + * Cloud DNS ResourceRecordSet (gcp_dns_resource_record_set, gcp_dns_resource_record_set_info) + * Filestore Instance (gcp_filestore_instance, gcp_filestore_instance_info) + * Cloud IAM Role (gcp_iam_role, gcp_iam_role_info) + * Cloud IAM ServiceAccount (gcp_iam_service_account, gcp_iam_service_account_info) + * Cloud IAM ServiceAccountKey (gcp_iam_service_account_key, gcp_iam_service_account_key_info) + * Cloud Key Management Service KeyRing (gcp_kms_key_ring, gcp_kms_key_ring_info) + * Cloud Key Management Service CryptoKey (gcp_kms_crypto_key, gcp_kms_crypto_key_info) + * Cloud (Stackdriver) Logging Metric (gcp_logging_metric, gcp_logging_metric_info) + * ML Engine Model (gcp_mlengine_model, gcp_mlengine_model_info) + * ML Engine Version (gcp_mlengine_version, gcp_mlengine_version_info) + * Cloud Pub/Sub Topic (gcp_pubsub_topic, gcp_pubsub_topic_info) + * Cloud Pub/Sub Subscription (gcp_pubsub_subscription, gcp_pubsub_subscription_info) + * Memorystore (Redis) Instance (gcp_redis_instance, gcp_redis_instance_info) + * Resource Manager Project (gcp_resourcemanager_project, gcp_resourcemanager_project_info) + * Runtime Configurator Config (gcp_runtimeconfig_config, gcp_runtimeconfig_config_info) + * Runtime Configurator Variable (gcp_runtimeconfig_variable, gcp_runtimeconfig_variable_info) + * Service Usage Service (gcp_serviceusage_service, gcp_serviceusage_service_info) + * Cloud Source Repositories Repository (gcp_sourcerepo_repository, gcp_sourcerepo_repository_info) + * Cloud Spanner Instance (gcp_spanner_instance, gcp_spanner_instance_info) + * Cloud Spanner Database (gcp_spanner_database, gcp_spanner_database_info) + * Cloud SQL Instance (gcp_sql_instance, gcp_sql_instance_info) + * Cloud SQL Database (gcp_sql_database, gcp_sql_database_info) + * Cloud SQL User (gcp_sql_user, gcp_sql_user_info) + * Cloud SQL SslCert (gcp_sql_ssl_cert, gcp_sql_ssl_cert_info) + * Cloud Storage Bucket (gcp_storage_bucket, gcp_storage_bucket_info) + * Cloud Storage BucketAccessControl (gcp_storage_bucket_access_control, gcp_storage_bucket_access_control_info) + * Cloud Storage DefaultObjectACL (gcp_storage_default_object_acl, gcp_storage_default_object_acl_info) + * Cloud TPU Node (gcp_tpu_node, gcp_tpu_node_info) From da28bcb84509f1af57a3e81608f58662c5d7e674 Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Wed, 31 Mar 2021 17:41:24 +0530 Subject: [PATCH 025/138] fix: fix finger print issue while updating gcp services Resolves: https://github.com/ansible-collections/google.cloud/issues/342 --- plugins/modules/gcp_compute_backend_service.py | 3 +++ plugins/modules/gcp_compute_url_map.py | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index a5e2803..cb3b613 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -1423,6 +1423,7 @@ def main(): argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), affinity_cookie_ttl_sec=dict(type='int'), + fingerprint=dict(type='str'), backends=dict( type='list', elements='dict', @@ -1540,6 +1541,7 @@ def main(): changed = False if fetch: + module.params['fingerprint'] = fetch['fingerprint'] if state == 'present': if is_different(module, fetch): update(module, self_link(module), kind) @@ -1601,6 +1603,7 @@ def resource_to_request(module): u'sessionAffinity': module.params.get('session_affinity'), u'timeoutSec': module.params.get('timeout_sec'), u'logConfig': BackendServiceLogconfig(module.params.get('log_config', {}), module).to_request(), + u'fingerprint': module.params.get('fingerprint') } return_vals = {} for k, v in request.items(): diff --git a/plugins/modules/gcp_compute_url_map.py b/plugins/modules/gcp_compute_url_map.py index bb8ab41..cda66d3 100644 --- a/plugins/modules/gcp_compute_url_map.py +++ b/plugins/modules/gcp_compute_url_map.py @@ -4972,6 +4972,7 @@ def main(): state=dict(default='present', choices=['present', 'absent'], type='str'), default_service=dict(type='dict'), description=dict(type='str'), + fingerprint=dict(type='str'), header_action=dict( type='dict', options=dict( @@ -5486,11 +5487,11 @@ def main(): changed = False if fetch: + module.params['fingerprint'] = fetch['fingerprint'] if state == 'present': - if is_different(module, fetch): - update(module, self_link(module), kind) - fetch = fetch_resource(module, self_link(module), kind) - changed = True + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) + changed = True else: delete(module, self_link(module), kind) fetch = {} @@ -5534,6 +5535,7 @@ def resource_to_request(module): u'tests': UrlMapTestsArray(module.params.get('tests', []), module).to_request(), u'defaultUrlRedirect': UrlMapDefaulturlredirect(module.params.get('default_url_redirect', {}), module).to_request(), u'defaultRouteAction': UrlMapDefaultrouteaction(module.params.get('default_route_action', {}), module).to_request(), + u'fingerprint': module.params.get('fingerprint') } return_vals = {} for k, v in request.items(): From 5ea5ecda34c2a67fb54f0727a821896b0718b241 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 5 Nov 2022 18:49:50 +0000 Subject: [PATCH 026/138] tests: enabling gcp_compute_backend_service test with #393 merged, it is now possible to enable gcp_compute_backend_test. Adding a temporary fix for server-normalized value of capacity_scaler, which is resolving into perma-diff due to "1.0" != "1". --- .../modules/gcp_compute_backend_service.py | 690 +++++++++++------- .../gcp_compute_backend_service/aliases | 3 +- 2 files changed, 421 insertions(+), 272 deletions(-) diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index cb3b613..3cff36d 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -25,9 +25,13 @@ __metaclass__ = type # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} -DOCUMENTATION = ''' +DOCUMENTATION = """ --- module: gcp_compute_backend_service description: @@ -736,9 +740,9 @@ notes: - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. - The I(service_account_email) and I(service_account_file) options are mutually exclusive. -''' +""" -EXAMPLES = ''' +EXAMPLES = """ - name: create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-backendservice @@ -774,9 +778,9 @@ EXAMPLES = ''' auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" state: present -''' +""" -RETURN = ''' +RETURN = """ affinityCookieTtlSec: description: - Lifetime of cookies in seconds if session_affinity is GENERATED_COOKIE. If set @@ -1394,7 +1398,7 @@ logConfig: - The default value is 1.0. returned: success type: str -''' +""" ################################################################################ # Imports @@ -1421,128 +1425,159 @@ def main(): module = GcpModule( argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - affinity_cookie_ttl_sec=dict(type='int'), - fingerprint=dict(type='str'), + state=dict(default="present", choices=["present", "absent"], type="str"), + affinity_cookie_ttl_sec=dict(type="int"), + fingerprint=dict(type="str"), backends=dict( - type='list', - elements='dict', + type="list", + elements="dict", options=dict( - balancing_mode=dict(default='UTILIZATION', type='str'), - capacity_scaler=dict(default=1.0, type='str'), - description=dict(type='str'), - group=dict(required=True, type='str'), - max_connections=dict(type='int'), - max_connections_per_instance=dict(type='int'), - max_connections_per_endpoint=dict(type='int'), - max_rate=dict(type='int'), - max_rate_per_instance=dict(type='str'), - max_rate_per_endpoint=dict(type='str'), - max_utilization=dict(type='str'), + balancing_mode=dict(default="UTILIZATION", type="str"), + # TODO: capacity_scaler does some value normalization + # server-side, so there needs to be a way to do proper + # value comparison. + capacity_scaler=dict(default="1", type="str"), + description=dict(type="str"), + group=dict(required=True, type="str"), + max_connections=dict(type="int"), + max_connections_per_instance=dict(type="int"), + max_connections_per_endpoint=dict(type="int"), + max_rate=dict(type="int"), + max_rate_per_instance=dict(type="str"), + max_rate_per_endpoint=dict(type="str"), + max_utilization=dict(type="str"), ), ), circuit_breakers=dict( - type='dict', + type="dict", options=dict( - max_requests_per_connection=dict(type='int'), - max_connections=dict(default=1024, type='int'), - max_pending_requests=dict(default=1024, type='int'), - max_requests=dict(default=1024, type='int'), - max_retries=dict(default=3, type='int'), + max_requests_per_connection=dict(type="int"), + max_connections=dict(default=1024, type="int"), + max_pending_requests=dict(default=1024, type="int"), + max_requests=dict(default=1024, type="int"), + max_retries=dict(default=3, type="int"), ), ), consistent_hash=dict( - type='dict', + type="dict", options=dict( http_cookie=dict( - type='dict', + type="dict", options=dict( - ttl=dict(type='dict', options=dict(seconds=dict(required=True, type='int'), nanos=dict(type='int'))), - name=dict(type='str'), - path=dict(type='str'), + ttl=dict( + type="dict", + options=dict( + seconds=dict(required=True, type="int"), + nanos=dict(type="int"), + ), + ), + name=dict(type="str"), + path=dict(type="str"), ), ), - http_header_name=dict(type='str'), - minimum_ring_size=dict(default=1024, type='int'), + http_header_name=dict(type="str"), + minimum_ring_size=dict(default=1024, type="int"), ), ), cdn_policy=dict( - type='dict', + type="dict", options=dict( cache_key_policy=dict( - type='dict', + type="dict", options=dict( - include_host=dict(type='bool'), - include_protocol=dict(type='bool'), - include_query_string=dict(type='bool'), - query_string_blacklist=dict(type='list', elements='str'), - query_string_whitelist=dict(type='list', elements='str'), + include_host=dict(type="bool"), + include_protocol=dict(type="bool"), + include_query_string=dict(type="bool"), + query_string_blacklist=dict(type="list", elements="str"), + query_string_whitelist=dict(type="list", elements="str"), ), ), - signed_url_cache_max_age_sec=dict(default=3600, type='int'), - default_ttl=dict(type='int'), - max_ttl=dict(type='int'), - client_ttl=dict(type='int'), - negative_caching=dict(type='bool'), - negative_caching_policy=dict(type='list', elements='dict', options=dict(code=dict(type='int'), ttl=dict(type='int'))), - cache_mode=dict(type='str'), - serve_while_stale=dict(type='int'), + signed_url_cache_max_age_sec=dict(default=3600, type="int"), + default_ttl=dict(type="int"), + max_ttl=dict(type="int"), + client_ttl=dict(type="int"), + negative_caching=dict(type="bool"), + negative_caching_policy=dict( + type="list", + elements="dict", + options=dict(code=dict(type="int"), ttl=dict(type="int")), + ), + cache_mode=dict(type="str"), + serve_while_stale=dict(type="int"), ), ), - connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(default=300, type='int'))), - custom_request_headers=dict(type='list', elements='str'), - custom_response_headers=dict(type='list', elements='str'), - description=dict(type='str'), - enable_cdn=dict(type='bool'), - health_checks=dict(type='list', elements='str'), + connection_draining=dict( + type="dict", + options=dict(draining_timeout_sec=dict(default=300, type="int")), + ), + custom_request_headers=dict(type="list", elements="str"), + custom_response_headers=dict(type="list", elements="str"), + description=dict(type="str"), + enable_cdn=dict(type="bool"), + health_checks=dict(type="list", elements="str"), iap=dict( - type='dict', + type="dict", options=dict( - enabled=dict(type='bool'), - oauth2_client_id=dict(required=True, type='str'), - oauth2_client_secret=dict(required=True, type='str', no_log=True), + enabled=dict(type="bool"), + oauth2_client_id=dict(required=True, type="str"), + oauth2_client_secret=dict(required=True, type="str", no_log=True), ), ), - load_balancing_scheme=dict(default='EXTERNAL', type='str'), - locality_lb_policy=dict(type='str'), - name=dict(required=True, type='str'), + load_balancing_scheme=dict(default="EXTERNAL", type="str"), + locality_lb_policy=dict(type="str"), + name=dict(required=True, type="str"), outlier_detection=dict( - type='dict', + type="dict", options=dict( - base_ejection_time=dict(type='dict', options=dict(seconds=dict(required=True, type='int'), nanos=dict(type='int'))), - consecutive_errors=dict(default=5, type='int'), - consecutive_gateway_failure=dict(default=5, type='int'), - enforcing_consecutive_errors=dict(default=100, type='int'), - enforcing_consecutive_gateway_failure=dict(default=0, type='int'), - enforcing_success_rate=dict(default=100, type='int'), - interval=dict(type='dict', options=dict(seconds=dict(required=True, type='int'), nanos=dict(type='int'))), - max_ejection_percent=dict(default=10, type='int'), - success_rate_minimum_hosts=dict(default=5, type='int'), - success_rate_request_volume=dict(default=100, type='int'), - success_rate_stdev_factor=dict(default=1900, type='int'), + base_ejection_time=dict( + type="dict", + options=dict( + seconds=dict(required=True, type="int"), + nanos=dict(type="int"), + ), + ), + consecutive_errors=dict(default=5, type="int"), + consecutive_gateway_failure=dict(default=5, type="int"), + enforcing_consecutive_errors=dict(default=100, type="int"), + enforcing_consecutive_gateway_failure=dict(default=0, type="int"), + enforcing_success_rate=dict(default=100, type="int"), + interval=dict( + type="dict", + options=dict( + seconds=dict(required=True, type="int"), + nanos=dict(type="int"), + ), + ), + max_ejection_percent=dict(default=10, type="int"), + success_rate_minimum_hosts=dict(default=5, type="int"), + success_rate_request_volume=dict(default=100, type="int"), + success_rate_stdev_factor=dict(default=1900, type="int"), ), ), - port_name=dict(type='str'), - protocol=dict(type='str'), - security_policy=dict(type='str'), - session_affinity=dict(type='str'), - timeout_sec=dict(type='int', aliases=['timeout_seconds']), - log_config=dict(type='dict', options=dict(enable=dict(type='bool'), sample_rate=dict(type='str'))), + port_name=dict(type="str"), + protocol=dict(type="str"), + security_policy=dict(type="str"), + session_affinity=dict(type="str"), + timeout_sec=dict(type="int", aliases=["timeout_seconds"]), + log_config=dict( + type="dict", + options=dict(enable=dict(type="bool"), sample_rate=dict(type="str")), + ), ) ) - if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + if not module.params["scopes"]: + module.params["scopes"] = ["https://www.googleapis.com/auth/compute"] - state = module.params['state'] - kind = 'compute#backendService' + state = module.params["state"] + kind = "compute#backendService" fetch = fetch_resource(module, self_link(module), kind) changed = False if fetch: - module.params['fingerprint'] = fetch['fingerprint'] - if state == 'present': + module.params["fingerprint"] = fetch["fingerprint"] + if state == "present": if is_different(module, fetch): update(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind) @@ -1552,58 +1587,72 @@ def main(): fetch = {} changed = True else: - if state == 'present': + if state == "present": fetch = create(module, collection(module), kind) changed = True else: fetch = {} - fetch.update({'changed': changed}) + fetch.update({"changed": changed}) module.exit_json(**fetch) def create(module, link, kind): - auth = GcpSession(module, 'compute') + auth = GcpSession(module, "compute") return wait_for_operation(module, auth.post(link, resource_to_request(module))) def update(module, link, kind): - auth = GcpSession(module, 'compute') + auth = GcpSession(module, "compute") return wait_for_operation(module, auth.put(link, resource_to_request(module))) def delete(module, link, kind): - auth = GcpSession(module, 'compute') + auth = GcpSession(module, "compute") return wait_for_operation(module, auth.delete(link)) def resource_to_request(module): request = { - u'kind': 'compute#backendService', - u'affinityCookieTtlSec': module.params.get('affinity_cookie_ttl_sec'), - u'backends': BackendServiceBackendsArray(module.params.get('backends', []), module).to_request(), - u'circuitBreakers': BackendServiceCircuitbreakers(module.params.get('circuit_breakers', {}), module).to_request(), - u'consistentHash': BackendServiceConsistenthash(module.params.get('consistent_hash', {}), module).to_request(), - u'cdnPolicy': BackendServiceCdnpolicy(module.params.get('cdn_policy', {}), module).to_request(), - u'connectionDraining': BackendServiceConnectiondraining(module.params.get('connection_draining', {}), module).to_request(), - u'customRequestHeaders': module.params.get('custom_request_headers'), - u'customResponseHeaders': module.params.get('custom_response_headers'), - u'description': module.params.get('description'), - u'enableCDN': module.params.get('enable_cdn'), - u'healthChecks': module.params.get('health_checks'), - u'iap': BackendServiceIap(module.params.get('iap', {}), module).to_request(), - u'loadBalancingScheme': module.params.get('load_balancing_scheme'), - u'localityLbPolicy': module.params.get('locality_lb_policy'), - u'name': module.params.get('name'), - u'outlierDetection': BackendServiceOutlierdetection(module.params.get('outlier_detection', {}), module).to_request(), - u'portName': module.params.get('port_name'), - u'protocol': module.params.get('protocol'), - u'securityPolicy': module.params.get('security_policy'), - u'sessionAffinity': module.params.get('session_affinity'), - u'timeoutSec': module.params.get('timeout_sec'), - u'logConfig': BackendServiceLogconfig(module.params.get('log_config', {}), module).to_request(), - u'fingerprint': module.params.get('fingerprint') + "kind": "compute#backendService", + "affinityCookieTtlSec": module.params.get("affinity_cookie_ttl_sec"), + "backends": BackendServiceBackendsArray( + module.params.get("backends", []), module + ).to_request(), + "circuitBreakers": BackendServiceCircuitbreakers( + module.params.get("circuit_breakers", {}), module + ).to_request(), + "consistentHash": BackendServiceConsistenthash( + module.params.get("consistent_hash", {}), module + ).to_request(), + "cdnPolicy": BackendServiceCdnpolicy( + module.params.get("cdn_policy", {}), module + ).to_request(), + "connectionDraining": BackendServiceConnectiondraining( + module.params.get("connection_draining", {}), module + ).to_request(), + "customRequestHeaders": module.params.get("custom_request_headers"), + "customResponseHeaders": module.params.get("custom_response_headers"), + "description": module.params.get("description"), + "enableCDN": module.params.get("enable_cdn"), + "healthChecks": module.params.get("health_checks"), + "iap": BackendServiceIap(module.params.get("iap", {}), module).to_request(), + "loadBalancingScheme": module.params.get("load_balancing_scheme"), + "localityLbPolicy": module.params.get("locality_lb_policy"), + "name": module.params.get("name"), + "outlierDetection": BackendServiceOutlierdetection( + module.params.get("outlier_detection", {}), module + ).to_request(), + "portName": module.params.get("port_name"), + "protocol": module.params.get("protocol"), + "securityPolicy": module.params.get("security_policy"), + "sessionAffinity": module.params.get("session_affinity"), + "timeoutSec": module.params.get("timeout_sec"), + "logConfig": BackendServiceLogconfig( + module.params.get("log_config", {}), module + ).to_request(), + "fingerprint": module.params.get("fingerprint"), } return_vals = {} for k, v in request.items(): @@ -1614,16 +1663,20 @@ def resource_to_request(module): def fetch_resource(module, link, kind, allow_not_found=True): - auth = GcpSession(module, 'compute') + auth = GcpSession(module, "compute") return return_if_object(module, auth.get(link), kind, allow_not_found) def self_link(module): - return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices/{name}".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices/{name}".format( + **module.params + ) def collection(module): - return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/global/backendServices".format( + **module.params + ) def return_if_object(module, response, kind, allow_not_found=False): @@ -1638,11 +1691,11 @@ def return_if_object(module, response, kind, allow_not_found=False): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError): + except getattr(json.decoder, "JSONDecodeError", ValueError): module.fail_json(msg="Invalid JSON response with error: %s" % response.text) - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if navigate_hash(result, ["error", "errors"]): + module.fail_json(msg=navigate_hash(result, ["error", "errors"])) return result @@ -1662,6 +1715,9 @@ def is_different(module, response): if k in response: request_vals[k] = v + # req = GcpRequest(request_vals) + # res = GcpRequest(response_vals) + # import epdb; epdb.serve() return GcpRequest(request_vals) != GcpRequest(response_vals) @@ -1669,31 +1725,45 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'affinityCookieTtlSec': response.get(u'affinityCookieTtlSec'), - u'backends': BackendServiceBackendsArray(response.get(u'backends', []), module).from_response(), - u'circuitBreakers': BackendServiceCircuitbreakers(response.get(u'circuitBreakers', {}), module).from_response(), - u'consistentHash': BackendServiceConsistenthash(response.get(u'consistentHash', {}), module).from_response(), - u'cdnPolicy': BackendServiceCdnpolicy(response.get(u'cdnPolicy', {}), module).from_response(), - u'connectionDraining': BackendServiceConnectiondraining(response.get(u'connectionDraining', {}), module).from_response(), - u'creationTimestamp': response.get(u'creationTimestamp'), - u'customRequestHeaders': response.get(u'customRequestHeaders'), - u'customResponseHeaders': response.get(u'customResponseHeaders'), - u'fingerprint': response.get(u'fingerprint'), - u'description': response.get(u'description'), - u'enableCDN': response.get(u'enableCDN'), - u'healthChecks': response.get(u'healthChecks'), - u'id': response.get(u'id'), - u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(), - u'loadBalancingScheme': module.params.get('load_balancing_scheme'), - u'localityLbPolicy': response.get(u'localityLbPolicy'), - u'name': module.params.get('name'), - u'outlierDetection': BackendServiceOutlierdetection(response.get(u'outlierDetection', {}), module).from_response(), - u'portName': response.get(u'portName'), - u'protocol': response.get(u'protocol'), - u'securityPolicy': response.get(u'securityPolicy'), - u'sessionAffinity': response.get(u'sessionAffinity'), - u'timeoutSec': response.get(u'timeoutSec'), - u'logConfig': BackendServiceLogconfig(response.get(u'logConfig', {}), module).from_response(), + "affinityCookieTtlSec": response.get("affinityCookieTtlSec"), + "backends": BackendServiceBackendsArray( + response.get("backends", []), module + ).from_response(), + "circuitBreakers": BackendServiceCircuitbreakers( + response.get("circuitBreakers", {}), module + ).from_response(), + "consistentHash": BackendServiceConsistenthash( + response.get("consistentHash", {}), module + ).from_response(), + "cdnPolicy": BackendServiceCdnpolicy( + response.get("cdnPolicy", {}), module + ).from_response(), + "connectionDraining": BackendServiceConnectiondraining( + response.get("connectionDraining", {}), module + ).from_response(), + "creationTimestamp": response.get("creationTimestamp"), + "customRequestHeaders": response.get("customRequestHeaders"), + "customResponseHeaders": response.get("customResponseHeaders"), + "fingerprint": response.get("fingerprint"), + "description": response.get("description"), + "enableCDN": response.get("enableCDN"), + "healthChecks": response.get("healthChecks"), + "id": response.get("id"), + "iap": BackendServiceIap(response.get("iap", {}), module).from_response(), + "loadBalancingScheme": module.params.get("load_balancing_scheme"), + "localityLbPolicy": response.get("localityLbPolicy"), + "name": module.params.get("name"), + "outlierDetection": BackendServiceOutlierdetection( + response.get("outlierDetection", {}), module + ).from_response(), + "portName": response.get("portName"), + "protocol": response.get("protocol"), + "securityPolicy": response.get("securityPolicy"), + "sessionAffinity": response.get("sessionAffinity"), + "timeoutSec": response.get("timeoutSec"), + "logConfig": BackendServiceLogconfig( + response.get("logConfig", {}), module + ).from_response(), } @@ -1707,22 +1777,24 @@ def async_op_url(module, extra_data=None): def wait_for_operation(module, response): - op_result = return_if_object(module, response, 'compute#operation') + op_result = return_if_object(module, response, "compute#operation") if op_result is None: return {} - status = navigate_hash(op_result, ['status']) + status = navigate_hash(op_result, ["status"]) wait_done = wait_for_completion(status, op_result, module) - return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'compute#backendService') + return fetch_resource( + module, navigate_hash(wait_done, ["targetLink"]), "compute#backendService" + ) def wait_for_completion(status, op_result, module): - op_id = navigate_hash(op_result, ['name']) - op_uri = async_op_url(module, {'op_id': op_id}) - while status != 'DONE': - raise_if_errors(op_result, ['error', 'errors'], module) + op_id = navigate_hash(op_result, ["name"]) + op_uri = async_op_url(module, {"op_id": op_id}) + while status != "DONE": + raise_if_errors(op_result, ["error", "errors"], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation', False) - status = navigate_hash(op_result, ['status']) + op_result = fetch_resource(module, op_uri, "compute#operation", False) + status = navigate_hash(op_result, ["status"]) return op_result @@ -1755,34 +1827,34 @@ class BackendServiceBackendsArray(object): def _request_for_item(self, item): return remove_nones_from_dict( { - u'balancingMode': item.get('balancing_mode'), - u'capacityScaler': item.get('capacity_scaler'), - u'description': item.get('description'), - u'group': item.get('group'), - u'maxConnections': item.get('max_connections'), - u'maxConnectionsPerInstance': item.get('max_connections_per_instance'), - u'maxConnectionsPerEndpoint': item.get('max_connections_per_endpoint'), - u'maxRate': item.get('max_rate'), - u'maxRatePerInstance': item.get('max_rate_per_instance'), - u'maxRatePerEndpoint': item.get('max_rate_per_endpoint'), - u'maxUtilization': item.get('max_utilization'), + "balancingMode": item.get("balancing_mode"), + "capacityScaler": item.get("capacity_scaler"), + "description": item.get("description"), + "group": item.get("group"), + "maxConnections": item.get("max_connections"), + "maxConnectionsPerInstance": item.get("max_connections_per_instance"), + "maxConnectionsPerEndpoint": item.get("max_connections_per_endpoint"), + "maxRate": item.get("max_rate"), + "maxRatePerInstance": item.get("max_rate_per_instance"), + "maxRatePerEndpoint": item.get("max_rate_per_endpoint"), + "maxUtilization": item.get("max_utilization"), } ) def _response_from_item(self, item): return remove_nones_from_dict( { - u'balancingMode': item.get(u'balancingMode'), - u'capacityScaler': item.get(u'capacityScaler'), - u'description': item.get(u'description'), - u'group': item.get(u'group'), - u'maxConnections': item.get(u'maxConnections'), - u'maxConnectionsPerInstance': item.get(u'maxConnectionsPerInstance'), - u'maxConnectionsPerEndpoint': item.get(u'maxConnectionsPerEndpoint'), - u'maxRate': item.get(u'maxRate'), - u'maxRatePerInstance': item.get(u'maxRatePerInstance'), - u'maxRatePerEndpoint': item.get(u'maxRatePerEndpoint'), - u'maxUtilization': item.get(u'maxUtilization'), + "balancingMode": item.get("balancingMode"), + "capacityScaler": item.get("capacityScaler"), + "description": item.get("description"), + "group": item.get("group"), + "maxConnections": item.get("maxConnections"), + "maxConnectionsPerInstance": item.get("maxConnectionsPerInstance"), + "maxConnectionsPerEndpoint": item.get("maxConnectionsPerEndpoint"), + "maxRate": item.get("maxRate"), + "maxRatePerInstance": item.get("maxRatePerInstance"), + "maxRatePerEndpoint": item.get("maxRatePerEndpoint"), + "maxUtilization": item.get("maxUtilization"), } ) @@ -1798,22 +1870,26 @@ class BackendServiceCircuitbreakers(object): def to_request(self): return remove_nones_from_dict( { - u'maxRequestsPerConnection': self.request.get('max_requests_per_connection'), - u'maxConnections': self.request.get('max_connections'), - u'maxPendingRequests': self.request.get('max_pending_requests'), - u'maxRequests': self.request.get('max_requests'), - u'maxRetries': self.request.get('max_retries'), + "maxRequestsPerConnection": self.request.get( + "max_requests_per_connection" + ), + "maxConnections": self.request.get("max_connections"), + "maxPendingRequests": self.request.get("max_pending_requests"), + "maxRequests": self.request.get("max_requests"), + "maxRetries": self.request.get("max_retries"), } ) def from_response(self): return remove_nones_from_dict( { - u'maxRequestsPerConnection': self.request.get(u'maxRequestsPerConnection'), - u'maxConnections': self.request.get(u'maxConnections'), - u'maxPendingRequests': self.request.get(u'maxPendingRequests'), - u'maxRequests': self.request.get(u'maxRequests'), - u'maxRetries': self.request.get(u'maxRetries'), + "maxRequestsPerConnection": self.request.get( + "maxRequestsPerConnection" + ), + "maxConnections": self.request.get("maxConnections"), + "maxPendingRequests": self.request.get("maxPendingRequests"), + "maxRequests": self.request.get("maxRequests"), + "maxRetries": self.request.get("maxRetries"), } ) @@ -1829,18 +1905,22 @@ class BackendServiceConsistenthash(object): def to_request(self): return remove_nones_from_dict( { - u'httpCookie': BackendServiceHttpcookie(self.request.get('http_cookie', {}), self.module).to_request(), - u'httpHeaderName': self.request.get('http_header_name'), - u'minimumRingSize': self.request.get('minimum_ring_size'), + "httpCookie": BackendServiceHttpcookie( + self.request.get("http_cookie", {}), self.module + ).to_request(), + "httpHeaderName": self.request.get("http_header_name"), + "minimumRingSize": self.request.get("minimum_ring_size"), } ) def from_response(self): return remove_nones_from_dict( { - u'httpCookie': BackendServiceHttpcookie(self.request.get(u'httpCookie', {}), self.module).from_response(), - u'httpHeaderName': self.request.get(u'httpHeaderName'), - u'minimumRingSize': self.request.get(u'minimumRingSize'), + "httpCookie": BackendServiceHttpcookie( + self.request.get("httpCookie", {}), self.module + ).from_response(), + "httpHeaderName": self.request.get("httpHeaderName"), + "minimumRingSize": self.request.get("minimumRingSize"), } ) @@ -1856,18 +1936,22 @@ class BackendServiceHttpcookie(object): def to_request(self): return remove_nones_from_dict( { - u'ttl': BackendServiceTtl(self.request.get('ttl', {}), self.module).to_request(), - u'name': self.request.get('name'), - u'path': self.request.get('path'), + "ttl": BackendServiceTtl( + self.request.get("ttl", {}), self.module + ).to_request(), + "name": self.request.get("name"), + "path": self.request.get("path"), } ) def from_response(self): return remove_nones_from_dict( { - u'ttl': BackendServiceTtl(self.request.get(u'ttl', {}), self.module).from_response(), - u'name': self.request.get(u'name'), - u'path': self.request.get(u'path'), + "ttl": BackendServiceTtl( + self.request.get("ttl", {}), self.module + ).from_response(), + "name": self.request.get("name"), + "path": self.request.get("path"), } ) @@ -1881,10 +1965,14 @@ class BackendServiceTtl(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'seconds': self.request.get('seconds'), u'nanos': self.request.get('nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) def from_response(self): - return remove_nones_from_dict({u'seconds': self.request.get(u'seconds'), u'nanos': self.request.get(u'nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) class BackendServiceCdnpolicy(object): @@ -1898,30 +1986,40 @@ class BackendServiceCdnpolicy(object): def to_request(self): return remove_nones_from_dict( { - u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get('cache_key_policy', {}), self.module).to_request(), - u'signedUrlCacheMaxAgeSec': self.request.get('signed_url_cache_max_age_sec'), - u'defaultTtl': self.request.get('default_ttl'), - u'maxTtl': self.request.get('max_ttl'), - u'clientTtl': self.request.get('client_ttl'), - u'negativeCaching': self.request.get('negative_caching'), - u'negativeCachingPolicy': BackendServiceNegativecachingpolicyArray(self.request.get('negative_caching_policy', []), self.module).to_request(), - u'cacheMode': self.request.get('cache_mode'), - u'serveWhileStale': self.request.get('serve_while_stale'), + "cacheKeyPolicy": BackendServiceCachekeypolicy( + self.request.get("cache_key_policy", {}), self.module + ).to_request(), + "signedUrlCacheMaxAgeSec": self.request.get( + "signed_url_cache_max_age_sec" + ), + "defaultTtl": self.request.get("default_ttl"), + "maxTtl": self.request.get("max_ttl"), + "clientTtl": self.request.get("client_ttl"), + "negativeCaching": self.request.get("negative_caching"), + "negativeCachingPolicy": BackendServiceNegativecachingpolicyArray( + self.request.get("negative_caching_policy", []), self.module + ).to_request(), + "cacheMode": self.request.get("cache_mode"), + "serveWhileStale": self.request.get("serve_while_stale"), } ) def from_response(self): return remove_nones_from_dict( { - u'cacheKeyPolicy': BackendServiceCachekeypolicy(self.request.get(u'cacheKeyPolicy', {}), self.module).from_response(), - u'signedUrlCacheMaxAgeSec': self.request.get(u'signedUrlCacheMaxAgeSec'), - u'defaultTtl': self.request.get(u'defaultTtl'), - u'maxTtl': self.request.get(u'maxTtl'), - u'clientTtl': self.request.get(u'clientTtl'), - u'negativeCaching': self.request.get(u'negativeCaching'), - u'negativeCachingPolicy': BackendServiceNegativecachingpolicyArray(self.request.get(u'negativeCachingPolicy', []), self.module).from_response(), - u'cacheMode': self.request.get(u'cacheMode'), - u'serveWhileStale': self.request.get(u'serveWhileStale'), + "cacheKeyPolicy": BackendServiceCachekeypolicy( + self.request.get("cacheKeyPolicy", {}), self.module + ).from_response(), + "signedUrlCacheMaxAgeSec": self.request.get("signedUrlCacheMaxAgeSec"), + "defaultTtl": self.request.get("defaultTtl"), + "maxTtl": self.request.get("maxTtl"), + "clientTtl": self.request.get("clientTtl"), + "negativeCaching": self.request.get("negativeCaching"), + "negativeCachingPolicy": BackendServiceNegativecachingpolicyArray( + self.request.get("negativeCachingPolicy", []), self.module + ).from_response(), + "cacheMode": self.request.get("cacheMode"), + "serveWhileStale": self.request.get("serveWhileStale"), } ) @@ -1937,22 +2035,22 @@ class BackendServiceCachekeypolicy(object): def to_request(self): return remove_nones_from_dict( { - u'includeHost': self.request.get('include_host'), - u'includeProtocol': self.request.get('include_protocol'), - u'includeQueryString': self.request.get('include_query_string'), - u'queryStringBlacklist': self.request.get('query_string_blacklist'), - u'queryStringWhitelist': self.request.get('query_string_whitelist'), + "includeHost": self.request.get("include_host"), + "includeProtocol": self.request.get("include_protocol"), + "includeQueryString": self.request.get("include_query_string"), + "queryStringBlacklist": self.request.get("query_string_blacklist"), + "queryStringWhitelist": self.request.get("query_string_whitelist"), } ) def from_response(self): return remove_nones_from_dict( { - u'includeHost': self.request.get(u'includeHost'), - u'includeProtocol': self.request.get(u'includeProtocol'), - u'includeQueryString': self.request.get(u'includeQueryString'), - u'queryStringBlacklist': self.request.get(u'queryStringBlacklist'), - u'queryStringWhitelist': self.request.get(u'queryStringWhitelist'), + "includeHost": self.request.get("includeHost"), + "includeProtocol": self.request.get("includeProtocol"), + "includeQueryString": self.request.get("includeQueryString"), + "queryStringBlacklist": self.request.get("queryStringBlacklist"), + "queryStringWhitelist": self.request.get("queryStringWhitelist"), } ) @@ -1978,10 +2076,14 @@ class BackendServiceNegativecachingpolicyArray(object): return items def _request_for_item(self, item): - return remove_nones_from_dict({u'code': item.get('code'), u'ttl': item.get('ttl')}) + return remove_nones_from_dict( + {"code": item.get("code"), "ttl": item.get("ttl")} + ) def _response_from_item(self, item): - return remove_nones_from_dict({u'code': item.get(u'code'), u'ttl': item.get(u'ttl')}) + return remove_nones_from_dict( + {"code": item.get("code"), "ttl": item.get("ttl")} + ) class BackendServiceConnectiondraining(object): @@ -1993,10 +2095,14 @@ class BackendServiceConnectiondraining(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'drainingTimeoutSec': self.request.get('draining_timeout_sec')}) + return remove_nones_from_dict( + {"drainingTimeoutSec": self.request.get("draining_timeout_sec")} + ) def from_response(self): - return remove_nones_from_dict({u'drainingTimeoutSec': self.request.get(u'drainingTimeoutSec')}) + return remove_nones_from_dict( + {"drainingTimeoutSec": self.request.get("drainingTimeoutSec")} + ) class BackendServiceIap(object): @@ -2010,18 +2116,18 @@ class BackendServiceIap(object): def to_request(self): return remove_nones_from_dict( { - u'enabled': self.request.get('enabled'), - u'oauth2ClientId': self.request.get('oauth2_client_id'), - u'oauth2ClientSecret': self.request.get('oauth2_client_secret'), + "enabled": self.request.get("enabled"), + "oauth2ClientId": self.request.get("oauth2_client_id"), + "oauth2ClientSecret": self.request.get("oauth2_client_secret"), } ) def from_response(self): return remove_nones_from_dict( { - u'enabled': self.request.get(u'enabled'), - u'oauth2ClientId': self.request.get(u'oauth2ClientId'), - u'oauth2ClientSecret': self.request.get(u'oauth2ClientSecret'), + "enabled": self.request.get("enabled"), + "oauth2ClientId": self.request.get("oauth2ClientId"), + "oauth2ClientSecret": self.request.get("oauth2ClientSecret"), } ) @@ -2037,34 +2143,60 @@ class BackendServiceOutlierdetection(object): def to_request(self): return remove_nones_from_dict( { - u'baseEjectionTime': BackendServiceBaseejectiontime(self.request.get('base_ejection_time', {}), self.module).to_request(), - u'consecutiveErrors': self.request.get('consecutive_errors'), - u'consecutiveGatewayFailure': self.request.get('consecutive_gateway_failure'), - u'enforcingConsecutiveErrors': self.request.get('enforcing_consecutive_errors'), - u'enforcingConsecutiveGatewayFailure': self.request.get('enforcing_consecutive_gateway_failure'), - u'enforcingSuccessRate': self.request.get('enforcing_success_rate'), - u'interval': BackendServiceInterval(self.request.get('interval', {}), self.module).to_request(), - u'maxEjectionPercent': self.request.get('max_ejection_percent'), - u'successRateMinimumHosts': self.request.get('success_rate_minimum_hosts'), - u'successRateRequestVolume': self.request.get('success_rate_request_volume'), - u'successRateStdevFactor': self.request.get('success_rate_stdev_factor'), + "baseEjectionTime": BackendServiceBaseejectiontime( + self.request.get("base_ejection_time", {}), self.module + ).to_request(), + "consecutiveErrors": self.request.get("consecutive_errors"), + "consecutiveGatewayFailure": self.request.get( + "consecutive_gateway_failure" + ), + "enforcingConsecutiveErrors": self.request.get( + "enforcing_consecutive_errors" + ), + "enforcingConsecutiveGatewayFailure": self.request.get( + "enforcing_consecutive_gateway_failure" + ), + "enforcingSuccessRate": self.request.get("enforcing_success_rate"), + "interval": BackendServiceInterval( + self.request.get("interval", {}), self.module + ).to_request(), + "maxEjectionPercent": self.request.get("max_ejection_percent"), + "successRateMinimumHosts": self.request.get( + "success_rate_minimum_hosts" + ), + "successRateRequestVolume": self.request.get( + "success_rate_request_volume" + ), + "successRateStdevFactor": self.request.get("success_rate_stdev_factor"), } ) def from_response(self): return remove_nones_from_dict( { - u'baseEjectionTime': BackendServiceBaseejectiontime(self.request.get(u'baseEjectionTime', {}), self.module).from_response(), - u'consecutiveErrors': self.request.get(u'consecutiveErrors'), - u'consecutiveGatewayFailure': self.request.get(u'consecutiveGatewayFailure'), - u'enforcingConsecutiveErrors': self.request.get(u'enforcingConsecutiveErrors'), - u'enforcingConsecutiveGatewayFailure': self.request.get(u'enforcingConsecutiveGatewayFailure'), - u'enforcingSuccessRate': self.request.get(u'enforcingSuccessRate'), - u'interval': BackendServiceInterval(self.request.get(u'interval', {}), self.module).from_response(), - u'maxEjectionPercent': self.request.get(u'maxEjectionPercent'), - u'successRateMinimumHosts': self.request.get(u'successRateMinimumHosts'), - u'successRateRequestVolume': self.request.get(u'successRateRequestVolume'), - u'successRateStdevFactor': self.request.get(u'successRateStdevFactor'), + "baseEjectionTime": BackendServiceBaseejectiontime( + self.request.get("baseEjectionTime", {}), self.module + ).from_response(), + "consecutiveErrors": self.request.get("consecutiveErrors"), + "consecutiveGatewayFailure": self.request.get( + "consecutiveGatewayFailure" + ), + "enforcingConsecutiveErrors": self.request.get( + "enforcingConsecutiveErrors" + ), + "enforcingConsecutiveGatewayFailure": self.request.get( + "enforcingConsecutiveGatewayFailure" + ), + "enforcingSuccessRate": self.request.get("enforcingSuccessRate"), + "interval": BackendServiceInterval( + self.request.get("interval", {}), self.module + ).from_response(), + "maxEjectionPercent": self.request.get("maxEjectionPercent"), + "successRateMinimumHosts": self.request.get("successRateMinimumHosts"), + "successRateRequestVolume": self.request.get( + "successRateRequestVolume" + ), + "successRateStdevFactor": self.request.get("successRateStdevFactor"), } ) @@ -2078,10 +2210,14 @@ class BackendServiceBaseejectiontime(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'seconds': self.request.get('seconds'), u'nanos': self.request.get('nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) def from_response(self): - return remove_nones_from_dict({u'seconds': self.request.get(u'seconds'), u'nanos': self.request.get(u'nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) class BackendServiceInterval(object): @@ -2093,10 +2229,14 @@ class BackendServiceInterval(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'seconds': self.request.get('seconds'), u'nanos': self.request.get('nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) def from_response(self): - return remove_nones_from_dict({u'seconds': self.request.get(u'seconds'), u'nanos': self.request.get(u'nanos')}) + return remove_nones_from_dict( + {"seconds": self.request.get("seconds"), "nanos": self.request.get("nanos")} + ) class BackendServiceLogconfig(object): @@ -2108,11 +2248,21 @@ class BackendServiceLogconfig(object): self.request = {} def to_request(self): - return remove_nones_from_dict({u'enable': self.request.get('enable'), u'sampleRate': self.request.get('sample_rate')}) + return remove_nones_from_dict( + { + "enable": self.request.get("enable"), + "sampleRate": self.request.get("sample_rate"), + } + ) def from_response(self): - return remove_nones_from_dict({u'enable': self.request.get(u'enable'), u'sampleRate': self.request.get(u'sampleRate')}) + return remove_nones_from_dict( + { + "enable": self.request.get("enable"), + "sampleRate": self.request.get("sampleRate"), + } + ) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/tests/integration/targets/gcp_compute_backend_service/aliases b/tests/integration/targets/gcp_compute_backend_service/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_backend_service/aliases +++ b/tests/integration/targets/gcp_compute_backend_service/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file From 53955f2fa0760a65a8e1bb87d4d1019a0082c784 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Mon, 7 Jun 2021 10:32:57 -0700 Subject: [PATCH 027/138] fix the tests, and update documentation --- .github/workflows/gcloud.yml | 17 +++++++++++---- molecule/gcloud/converge.yml | 2 ++ molecule/gcsfuse/converge.yml | 2 ++ roles/gcloud/LICENSE | 21 ------------------- roles/gcloud/README.md | 6 ++---- roles/gcloud/defaults/main.yml | 2 +- roles/gcloud/meta/main.yml | 5 ++--- .../gcloud/tasks/archive/archive_install.yml | 2 +- .../tasks/archive/command_completion.yml | 1 + roles/gcloud/tasks/archive/main.yml | 9 +++++--- 10 files changed, 30 insertions(+), 37 deletions(-) delete mode 100644 roles/gcloud/LICENSE diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 341fb85..effeb61 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -27,10 +27,10 @@ jobs: command: /usr/sbin/init - distro: centos:8 command: /usr/sbin/init - - distro: ubuntu:16.04 - command: /sbin/init - distro: ubuntu:18.04 command: /lib/systemd/systemd + - distro: ubuntu:20.04 + command: /lib/systemd/systemd - distro: debian:9 command: /lib/systemd/systemd collection_role: @@ -48,9 +48,18 @@ jobs: - name: Install dependencies run: | - sudo apt install docker + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg \ + lsb-release + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg \ + --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule yamllint ansible-lint docker + pip install molecule yamllint ansible ansible-lint docker \ + molecule[docker] - name: Run role test run: >- diff --git a/molecule/gcloud/converge.yml b/molecule/gcloud/converge.yml index 6889b4b..3790ebf 100644 --- a/molecule/gcloud/converge.yml +++ b/molecule/gcloud/converge.yml @@ -13,11 +13,13 @@ file: path: /etc/systemd/system/containerd.service.d state: directory + mode: 0755 when: ansible_service_mgr == "systemd" - name: override file for containerd copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf + mode: 0644 when: ansible_service_mgr == "systemd" roles: - role: google.cloud.gcloud diff --git a/molecule/gcsfuse/converge.yml b/molecule/gcsfuse/converge.yml index f4c2bce..b0e6311 100644 --- a/molecule/gcsfuse/converge.yml +++ b/molecule/gcsfuse/converge.yml @@ -14,11 +14,13 @@ file: path: /etc/systemd/system/containerd.service.d state: directory + mode: 0755 when: ansible_service_mgr == "systemd" - name: override file for containerd copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf + mode: 0644 when: ansible_service_mgr == "systemd" roles: - role: google.cloud.gcsfuse diff --git a/roles/gcloud/LICENSE b/roles/gcloud/LICENSE deleted file mode 100644 index 616fc1e..0000000 --- a/roles/gcloud/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Eric Anderson - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/roles/gcloud/README.md b/roles/gcloud/README.md index dfc365a..8c6b83a 100644 --- a/roles/gcloud/README.md +++ b/roles/gcloud/README.md @@ -1,6 +1,4 @@ -# ericsysmin.gcloud - -[![Build Status](https://travis-ci.org/ericsysmin/ansible-role-gcloud.svg?branch=master)](https://travis-ci.org/ericsysmin/ansible-role-gcloud) +# google.cloud.gcloud This role installs the gcloud command-line tool on a linux system. @@ -48,7 +46,7 @@ All variables which can be overridden are stored in defaults/main.yml file as we ```yaml - hosts: servers roles: - - role: ericsysmin.gcloud + - role: google.cloud.gcloud ``` ## License diff --git a/roles/gcloud/defaults/main.yml b/roles/gcloud/defaults/main.yml index b5c4534..deeec69 100644 --- a/roles/gcloud/defaults/main.yml +++ b/roles/gcloud/defaults/main.yml @@ -5,7 +5,7 @@ gcloud_install_type: package # default values for gcloud apt installation gcloud_apt_key: https://packages.cloud.google.com/apt/doc/apt-key.gpg gcloud_apt_url: http://packages.cloud.google.com/apt -gcloud_apt_repo: cloud-sdk-{{ ansible_distribution_release }} +gcloud_apt_repo: cloud-sdk # default values for gcloud yum installation gcloud_yum_baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 diff --git a/roles/gcloud/meta/main.yml b/roles/gcloud/meta/main.yml index 50918c4..8c8e784 100644 --- a/roles/gcloud/meta/main.yml +++ b/roles/gcloud/meta/main.yml @@ -3,9 +3,8 @@ galaxy_info: role_name: gcloud author: Eric Anderson description: Ansible role to install google-cloud-sdk - company: Avi Networks - license: MIT - min_ansible_version: 2.4 + license: GPL-3.0 + min_ansible_version: 2.9 platforms: - name: Ubuntu versions: diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index b1a6606..009d262 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -1,6 +1,6 @@ --- - name: gcloud | Archive | Ensure temp path exists - file: path={{ gcloud_archive_path }} state=directory + file: path={{ gcloud_archive_path }} state=directory mode=0755 - name: gcloud | Archive | Extract Cloud SDK archive unarchive: diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index 866dbfb..1c6a457 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -24,6 +24,7 @@ owner: root group: root state: directory + mode: 0755 - name: gcloud | Archive | Link binaries to /usr/bin (like package install) file: diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 7fff493..1175bfc 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -5,7 +5,8 @@ path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" register: gcloud_status -- debug: var=gcloud_status +- name: gcloud | Archive | Get gcloud_status + debug: var=gcloud_status - name: gcloud | Archive | Set installed version if installation exists block: @@ -16,9 +17,11 @@ - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact set_fact: gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}" - - debug: + - name: gcloud | Archive | get the gcloud_installed_version + debug: msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" - - debug: + - name: gcloud | Archive | Version already installed + debug: msg: >- Skipping installation of google-cloud-sdk version {{ gcloud_version }} when {{ gcloud_installed_version }} is already installed. From 2582030e510806b29481c6efc8b96eab2cabb5ec Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 3 Dec 2020 08:40:26 +0100 Subject: [PATCH 028/138] Updating gcp_storage_object example The example contained the non-existent "status" parameter which causes an error with the latest release. --- plugins/modules/gcp_storage_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index e71a528..72227cc 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -96,7 +96,7 @@ options: """ EXAMPLES = """ -- name: create a object +- name: Download an object google.cloud.gcp_storage_object: action: download bucket: ansible-bucket From 0cece672cf0bfe6db74effe939382d64fe1c3394 Mon Sep 17 00:00:00 2001 From: Bill Dinger Date: Mon, 11 May 2020 11:01:31 -0500 Subject: [PATCH 029/138] Added in link to where machineTypes are defined --- plugins/modules/gcp_compute_instance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py index b62286d..390acd4 100644 --- a/plugins/modules/gcp_compute_instance.py +++ b/plugins/modules/gcp_compute_instance.py @@ -827,7 +827,8 @@ metadata: type: dict machineType: description: - - A reference to a machine type which defines VM kind. + - A reference to a machine type which defines VM kind. See https://cloud.google.com/compute/docs/machine-types + for a list of current valid machine types. returned: success type: str minCpuPlatform: From 4816e97719ef45a9a424da391c541b53b0b1b41d Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 12 Nov 2022 17:56:34 +0000 Subject: [PATCH 030/138] fixing compute_url_map, add cleanup script Compute_url_map was broken by #509: It also merged in #393, which has an erroneous understanding that compute_url_map always returns a diff (integration tests show it does not). Adding a cleanup script to help with environment hygiene. Added cleanup to CI to help make tests less flakey. --- .../workflows/ansible-integration-tests.yml | 24 +++++++++++--- plugins/modules/gcp_compute_url_map.py | 1 + scripts/cleanup-project.sh | 33 +++++++++++++++++++ 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100755 scripts/cleanup-project.sh diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index c2d1002..0cc2a05 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -6,6 +6,9 @@ on: pull_request: {} push: branches: master +env: + GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" + GCP_PROJECT: "ansible-gcp-ci" jobs: integration: runs-on: ubuntu-latest @@ -30,20 +33,31 @@ jobs: run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + # bootstrap integration env - name: Write integration-test configuration files env: CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} run: | echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" > /tmp/service-account-key.json echo "[default] - gcp_project: ansible-gcp-ci + gcp_project: $GCP_PROJECT gcp_cred_file: /tmp/service-account-key.json gcp_cred_kind: serviceaccount - gcp_cred_email: github-ci@ansible-gcp-ci.iam.gserviceaccount.com + gcp_cred_email: $GCP_SERVICE_ACCOUNT " > ./tests/integration/cloud-config-gcp.ini - - name: test secrets - env: ${{ secrets }} - run: echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" + # cleanup test environment + - name: Auth to Gcloud + uses: google-github-actions/auth@v1 + env: + CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} + with: + service_account: "$GCP_SERVICE_ACCOUNT" + credentials_json: "${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}" + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + - name: Run cleanup + run: ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT + # run tests - name: Run integration tests # Add the -vvv flag to print out more output run: ansible-test integration -v --color --python 3.8 --venv-system-site-packages \ No newline at end of file diff --git a/plugins/modules/gcp_compute_url_map.py b/plugins/modules/gcp_compute_url_map.py index cda66d3..b27d41a 100644 --- a/plugins/modules/gcp_compute_url_map.py +++ b/plugins/modules/gcp_compute_url_map.py @@ -5489,6 +5489,7 @@ def main(): if fetch: module.params['fingerprint'] = fetch['fingerprint'] if state == 'present': + if is_different(module, fetch): update(module, self_link(module), kind) fetch = fetch_resource(module, self_link(module), kind) changed = True diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh new file mode 100755 index 0000000..962cb87 --- /dev/null +++ b/scripts/cleanup-project.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# cleanup-project cleans up an ansible testing project +# +# WARNING: do not run tests against a project while +# this is running, or else your tests will fail. +# +# dependencies: +# - google-cloud-sdk (gcloudgcloud ) +set -e +PROJECT_ID="${1}" +SERVICE_ACCOUNT_NAME="${2}" +ZONE="us-central1-a" + +main() { + # note: the ordering here is deliberate, to start with + # leaf resources and work upwards to parent resources. + cleanup_resource "compute instances" "--zone=$ZONE" + cleanup_resource "compute target-http-proxies" "--global" + cleanup_resource "compute forwarding-rules" "--global" + cleanup_resource "compute url-maps" "--global" + cleanup_resource "compute backend-services" "--global" +} + +cleanup_resource() { + resource_group="$1" + extra_delete_args="$2" + + for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)"); do + gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q $extra_delete_args + done +} + +main \ No newline at end of file From 0fc41bbda4f16fe73edffb08e51d9435262c7b47 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 12 Nov 2022 19:03:57 +0000 Subject: [PATCH 031/138] WIP: fix compute instance + several tests compute selflinks return back `wwww.googleapis.com` as the domain, which was causing a perma-diff. Fixing google.cloud's normalization fixes that. Fixing the following tests as well, since creating an instance now works: - gcp_compute_instance - gcp_compute_instance_group - gcp_compute_instance_group_manager - gcp_compute_instance_template - gcp_compute_region_autoscaler - gcp_compute_region_instance_group_manager - gcp_compute_target_instance - gcp_compute_target_pool --- plugins/modules/gcp_compute_instance.py | 4 ++-- .../targets/gcp_compute_autoscaler/tasks/autogen.yml | 4 ++-- .../integration/targets/gcp_compute_instance/aliases | 3 +-- .../targets/gcp_compute_instance/tasks/autogen.yml | 2 +- .../targets/gcp_compute_instance_group/aliases | 3 +-- .../gcp_compute_instance_group/tasks/autogen.yml | 2 ++ .../gcp_compute_instance_group_manager/aliases | 3 +-- .../tasks/autogen.yml | 6 ++++-- .../targets/gcp_compute_instance_template/aliases | 1 - .../gcp_compute_instance_template/tasks/autogen.yml | 12 +++++++----- .../targets/gcp_compute_region_autoscaler/aliases | 3 +-- .../gcp_compute_region_autoscaler/tasks/autogen.yml | 6 ++++-- .../aliases | 3 +-- .../tasks/autogen.yml | 6 ++++-- .../targets/gcp_compute_target_instance/aliases | 1 - .../gcp_compute_target_instance/tasks/autogen.yml | 6 ++++-- .../targets/gcp_compute_target_pool/aliases | 3 +-- 17 files changed, 36 insertions(+), 32 deletions(-) diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py index 390acd4..703ec4c 100644 --- a/plugins/modules/gcp_compute_instance.py +++ b/plugins/modules/gcp_compute_instance.py @@ -1379,9 +1379,9 @@ def disk_type_selflink(name, params): def machine_type_selflink(name, params): if name is None: return - url = r"https://compute.googleapis.com/compute/v1/projects/.*/zones/.*/machineTypes/.*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/.*/machineTypes/.*" if not re.match(url, name): - name = "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name + name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name return name diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml index 10192d9..df1baa1 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml @@ -38,7 +38,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -216,7 +216,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" diff --git a/tests/integration/targets/gcp_compute_instance/aliases b/tests/integration/targets/gcp_compute_instance/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_instance/aliases +++ b/tests/integration/targets/gcp_compute_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index 57ac983..5c19f7b 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -263,7 +263,7 @@ google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/tests/integration/targets/gcp_compute_instance_group/aliases b/tests/integration/targets/gcp_compute_instance_group/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_instance_group/aliases +++ b/tests/integration/targets/gcp_compute_instance_group/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml index 87ac081..30893e4 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a instance group @@ -144,6 +145,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/aliases b/tests/integration/targets/gcp_compute_instance_group_manager/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/aliases +++ b/tests/integration/targets/gcp_compute_instance_group_manager/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml index bdb26d3..8ce7668 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -38,7 +39,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -171,7 +172,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -201,6 +202,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_instance_template/aliases b/tests/integration/targets/gcp_compute_instance_template/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_compute_instance_template/aliases +++ b/tests/integration/targets/gcp_compute_instance_template/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml index a80d7c4..441a455 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -38,7 +39,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -59,7 +60,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -99,7 +100,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -125,7 +126,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -165,7 +166,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -201,6 +202,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/aliases b/tests/integration/targets/gcp_compute_region_autoscaler/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/aliases +++ b/tests/integration/targets/gcp_compute_region_autoscaler/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml index 0273aa1..ba64d6f 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -38,7 +39,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -216,7 +217,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -246,6 +247,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/aliases b/tests/integration/targets/gcp_compute_region_instance_group_manager/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/aliases +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml index c430581..8c7f188 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -38,7 +39,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -171,7 +172,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - network: "{{ network }}" @@ -201,6 +202,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_instance/aliases b/tests/integration/targets/gcp_compute_target_instance/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_compute_target_instance/aliases +++ b/tests/integration/targets/gcp_compute_target_instance/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml index 2985918..5341856 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a instance @@ -29,7 +30,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: @@ -150,7 +151,7 @@ - auto_delete: 'true' boot: 'true' initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: @@ -168,6 +169,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_pool/aliases b/tests/integration/targets/gcp_compute_target_pool/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_pool/aliases +++ b/tests/integration/targets/gcp_compute_target_pool/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From b6f694ed7e5382ac955123a4dca53646288ea970 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 19 Nov 2022 17:29:17 +0000 Subject: [PATCH 032/138] enabling 3 more tests Tests were working with only minor config tweaks - compute_autoscaler - compute_disk - global_forwarding_rule --- tests/integration/targets/gcp_compute_autoscaler/aliases | 3 +-- .../targets/gcp_compute_autoscaler/tasks/autogen.yml | 2 ++ tests/integration/targets/gcp_compute_disk/aliases | 3 +-- .../targets/gcp_compute_global_forwarding_rule/aliases | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/integration/targets/gcp_compute_autoscaler/aliases b/tests/integration/targets/gcp_compute_autoscaler/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/aliases +++ b/tests/integration/targets/gcp_compute_autoscaler/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml index df1baa1..5182fa9 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: create a address @@ -246,6 +247,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_disk/aliases b/tests/integration/targets/gcp_compute_disk/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_disk/aliases +++ b/tests/integration/targets/gcp_compute_disk/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file From 5fc619fbb71110832f84f687073d7637fd380447 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 19 Nov 2022 18:09:43 +0000 Subject: [PATCH 033/138] tests: fixing region_target_http_proxy The backend_service resource was not regional, which is in invalid configuration for a regional proxy to depend on. Fixing up cleanup-script to better handle region/ global resources. --- scripts/cleanup-project.sh | 17 +++-- .../aliases | 3 +- .../tasks/autogen.yml | 74 ++++--------------- 3 files changed, 25 insertions(+), 69 deletions(-) diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 962cb87..15f2d38 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -14,18 +14,21 @@ ZONE="us-central1-a" main() { # note: the ordering here is deliberate, to start with # leaf resources and work upwards to parent resources. - cleanup_resource "compute instances" "--zone=$ZONE" - cleanup_resource "compute target-http-proxies" "--global" - cleanup_resource "compute forwarding-rules" "--global" - cleanup_resource "compute url-maps" "--global" - cleanup_resource "compute backend-services" "--global" + cleanup_resource "compute instances" "" "--zone=$ZONE" + cleanup_resource "compute target-http-proxies" "" "--global" + cleanup_resource "compute forwarding-rules" "" "--global" + cleanup_resource "compute url-maps" "" "--global" + cleanup_resource "compute backend-services" "--global" "--global" + cleanup_resource "compute backend-services" \ + "--regions=us-central1" "--region=us-central1" } cleanup_resource() { resource_group="$1" - extra_delete_args="$2" + extra_list_args="$2" + extra_delete_args="$3" - for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)"); do + for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)" $extra_list_args); do gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q $extra_delete_args done } diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases b/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml index abb8447..9dcd753 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml @@ -13,43 +13,22 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group - google.cloud.gcp_compute_instance_group: - name: instancegroup-targethttpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a HTTP health check - google.cloud.gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck - name: create a backend service - google.cloud.gcp_compute_backend_service: + google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" + region: us-central1 enable_cdn: 'true' + protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + load_balancing_scheme: "EXTERNAL" state: present register: backendservice - name: create a URL map - google.cloud.gcp_compute_url_map: + google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy + region: us-central1 default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -159,49 +138,24 @@ # Post-test teardown # If errors happen, don't crash the playbook! - name: delete a URL map - google.cloud.gcp_compute_url_map: + google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy + region: us-central1 default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: absent - register: urlmap ignore_errors: true - name: delete a backend service - google.cloud.gcp_compute_backend_service: + google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" + region: us-central1 enable_cdn: 'true' + protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a HTTP health check - google.cloud.gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - google.cloud.gcp_compute_instance_group: - name: instancegroup-targethttpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true + load_balancing_scheme: "EXTERNAL" + state: present + ignore_errors: true \ No newline at end of file From 54c14b66f60be3982ce682e1056129244b44f008 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 19 Nov 2022 18:42:46 +0000 Subject: [PATCH 034/138] tests: enabling 5 tests the following tests can be enabled without any changes: - gcp_compute_target_http_proxy - gcp_compute_target_https_proxy - gcp_compute_target_ssl_proxy - gcp_compute_target_tcp_proxy --- .../integration/targets/gcp_compute_target_http_proxy/aliases | 3 +-- .../integration/targets/gcp_compute_target_https_proxy/aliases | 3 +-- tests/integration/targets/gcp_compute_target_ssl_proxy/aliases | 3 +-- tests/integration/targets/gcp_compute_target_tcp_proxy/aliases | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/aliases b/tests/integration/targets/gcp_compute_target_http_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/aliases +++ b/tests/integration/targets/gcp_compute_target_http_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/aliases b/tests/integration/targets/gcp_compute_target_https_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/aliases +++ b/tests/integration/targets/gcp_compute_target_https_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/aliases b/tests/integration/targets/gcp_compute_target_ssl_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/aliases +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/aliases b/tests/integration/targets/gcp_compute_target_tcp_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/aliases +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From ebf095d22d60ea78ff1e3ba211535900cffe6c1c Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 19 Nov 2022 20:05:46 +0000 Subject: [PATCH 035/138] tests: fix gcp_compute_vpn_tunnel - vpn_gateway required minimal changes (stop using legacy load balancers) - compute_vpn_tunnel requires a valid vpn configuration (several dependent forwarding rules and configuration to set up a proper tunnel). --- plugins/modules/gcp_compute_vpn_tunnel.py | 7 + scripts/cleanup-project.sh | 18 +- .../gcp_compute_target_vpn_gateway/aliases | 3 +- .../tasks/autogen.yml | 2 + .../targets/gcp_compute_vpn_tunnel/aliases | 1 - .../gcp_compute_vpn_tunnel/tasks/autogen.yml | 212 +++++++++++++++++- 6 files changed, 229 insertions(+), 14 deletions(-) diff --git a/plugins/modules/gcp_compute_vpn_tunnel.py b/plugins/modules/gcp_compute_vpn_tunnel.py index d54d081..d91717c 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel.py +++ b/plugins/modules/gcp_compute_vpn_tunnel.py @@ -527,15 +527,22 @@ def return_if_object(module, response, kind, allow_not_found=False): def is_different(module, response): request = resource_to_request(module) response = response_to_hash(module, response) + # shared_secret is returned with stars instead of the + # actual secret + keys_to_ignore = ("sharedSecret") # Remove all output-only from response. response_vals = {} for k, v in response.items(): + if k in keys_to_ignore: + continue if k in request: response_vals[k] = v request_vals = {} for k, v in request.items(): + if k in keys_to_ignore: + continue if k in response: request_vals[k] = v diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 15f2d38..1394b42 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -14,10 +14,16 @@ ZONE="us-central1-a" main() { # note: the ordering here is deliberate, to start with # leaf resources and work upwards to parent resources. + cleanup_resource_per_region "compute vpn-tunnels" cleanup_resource "compute instances" "" "--zone=$ZONE" + cleanup_resource_per_region "compute addresses" cleanup_resource "compute target-http-proxies" "" "--global" - cleanup_resource "compute forwarding-rules" "" "--global" - cleanup_resource "compute url-maps" "" "--global" + cleanup_resource "compute forwarding-rules" "--global" "--global" + cleanup_resource "compute forwarding-rules" \ + "--regions=us-central1" "--region=us-central1" + cleanup_resource "compute url-maps" "--global" "--global" + cleanup_resource "compute url-maps" \ + "--regions=us-central1" "--region=us-central1" cleanup_resource "compute backend-services" "--global" "--global" cleanup_resource "compute backend-services" \ "--regions=us-central1" "--region=us-central1" @@ -33,4 +39,12 @@ cleanup_resource() { done } +cleanup_resource_per_region() { + resource_group="$1" + for resource_and_region in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do + read -r resource region < <(echo "$resource_and_region" | tr "," " ") + gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q --region="${region}" + done +} + main \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/aliases b/tests/integration/targets/gcp_compute_target_vpn_gateway/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/aliases +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml index c5f9cb3..818f885 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml @@ -28,6 +28,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a target vpn gateway @@ -138,6 +139,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/aliases b/tests/integration/targets/gcp_compute_vpn_tunnel/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/aliases +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml index 1c9ef37..21c4c69 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml @@ -13,14 +13,73 @@ # # ---------------------------------------------------------------------------- # Pre-test setup +- name: create a address + google.cloud.gcp_compute_address: + name: address + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: address +- name: create a forward address + google.cloud.gcp_compute_address: + name: address-forwardingrule + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: address_forwardingrule - name: create a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network +- name: create a disk + google.cloud.gcp_compute_disk: + name: "{{ resource_prefix }}" + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: disk +- name: create a instance + google.cloud.gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + - auto_delete: 'true' + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd + metadata: + cost-center: '12345' + labels: + environment: production + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result - name: create a router google.cloud.gcp_compute_router: name: router-vpn-tunnel @@ -42,35 +101,75 @@ - name: create a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel - region: us-west1 + region: us-central1 network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: present register: gateway +- name: create a forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: ESP + ip_address: "{{ address_forwardingrule.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: create a UDP-500 forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}-udp" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: UDP + port_range: 500-500 + ip_address: "{{ address_forwardingrule.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: create a UDP-4500 forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}-udp-4500" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: UDP + port_range: 4500-4500 + ip_address: "{{ address_forwardingrule.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result - name: delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" - region: us-west1 + region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + peer_ip: "{{address.address}}" state: absent #---------------------------------------------------------- - name: create a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" - region: us-west1 + region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + peer_ip: "{{address.address}}" state: present register: result - name: assert changed is true @@ -81,7 +180,7 @@ google.cloud.gcp_compute_vpn_tunnel_info: filters: - name = {{ resource_name }} - region: us-west1 + region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -96,9 +195,10 @@ - name: create a vpn tunnel that already exists google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" - region: us-west1 + region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" + peer_ip: "{{address.address}}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -113,9 +213,10 @@ - name: delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" - region: us-west1 + region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" + peer_ip: "{{address.address}}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -130,7 +231,7 @@ google.cloud.gcp_compute_vpn_tunnel_info: filters: - name = {{ resource_name }} - region: us-west1 + region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -145,9 +246,10 @@ - name: delete a vpn tunnel that does not exist google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" - region: us-west1 + region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" + peer_ip: "{{address.address}}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -160,11 +262,52 @@ - result.changed == false #--------------------------------------------------------- # Post-test teardown +- name: delete a UDP-4500 forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}-udp-4500" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: UDP + port_range: 4500-4500 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + ignore_errors: true + register: result +- name: delete a UDP forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}-udp" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: UDP + port_range: 500-500 + ip_address: "{{ address.address }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + ignore_errors: true + register: result +- name: delete a forwarding rule + google.cloud.gcp_compute_forwarding_rule: + name: "{{ resource_name }}" + region: us-central1 + target: "{{ gateway.selfLink }}" + ip_protocol: ESP + ip_address: "104.197.5.203" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + ignore_errors: true + register: result # If errors happen, don't crash the playbook! - name: delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel - region: us-west1 + region: us-central1 network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -191,12 +334,63 @@ state: absent register: router ignore_errors: true +- name: delete a instance + google.cloud.gcp_compute_instance: + name: "{{ resource_name }}" + machine_type: n1-standard-1 + disks: + - auto_delete: 'true' + boot: 'true' + source: "{{ disk }}" + - auto_delete: 'true' + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd + metadata: + cost-center: '12345' + labels: + environment: production + network_interfaces: + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +- name: delete a disk + google.cloud.gcp_compute_disk: + name: "{{ resource_prefix }}" + size_gb: 50 + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: disk + ignore_errors: true - name: delete a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true +- name: delete a address + google.cloud.gcp_compute_address: + name: address + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true \ No newline at end of file From dc67fb3e171c4b16da7c943483cb34e8ba392ccb Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 00:57:24 +0000 Subject: [PATCH 036/138] tests: service account flaky test fixing a flakey service account test. Sometimes the service account generated can be less than 6 characters (e.g. sa-57), which is an invalid length. This ensures that the name is at least 6 characters. --- .../gcp_iam_service_account/tasks/autogen.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index e511e99..367c9d8 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com + name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +24,7 @@ #---------------------------------------------------------- - name: create a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com + name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -46,11 +46,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a service account that already exists google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com + name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +64,7 @@ #---------------------------------------------------------- - name: delete a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com + name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -86,11 +86,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a service account that does not exist google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com + name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From d3a7287c37d71a8f8ccd7dcc8f9c249ded4ac8b7 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 19 Nov 2022 23:11:29 +0000 Subject: [PATCH 037/138] fix: gcp_container_cluster for GKE 1.19+ Incorporating a fix for GKE 1.19+ (See #444). Inlined: Google has removed basic-auth method from within GKE starting version 1.19 This lead the output response of the backend API not to provide basic-auth data (username and password) anymore. The current implementation of gcp_container_cluster when generating the kubectl config file, always set basic-auth data w/o checking if there actually are available or explicitly provided even when the value are not set/provided from gcp_container_cluster. In addition, re-enabling some tests that #444 fixed. Co-authored-by: Xavier Lamien --- plugins/modules/gcp_container_cluster.py | 50 +++++++++++-------- .../targets/gcp_container_cluster/aliases | 3 +- .../gcp_container_cluster/tasks/autogen.yml | 27 +++------- .../targets/gcp_container_node_pool/aliases | 3 +- 4 files changed, 36 insertions(+), 47 deletions(-) diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index 1460d68..968dfb3 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -259,6 +259,7 @@ options: username: description: - The username to use for HTTP basic authentication to the master endpoint. + (unsupported with GKE >= 1.19). required: false type: str password: @@ -266,6 +267,7 @@ options: - The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password with a minimum of 16 characters. + (unsupported with GKE >= 1.19). required: false type: str client_certificate_config: @@ -711,9 +713,6 @@ EXAMPLES = ''' google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 @@ -930,6 +929,7 @@ masterAuth: username: description: - The username to use for HTTP basic authentication to the master endpoint. + (unsupported with GKE >= 1.19). returned: success type: str password: @@ -937,6 +937,7 @@ masterAuth: - The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password with a minimum of 16 characters. + (unsupported with GKE >= 1.19). returned: success type: str clientCertificateConfig: @@ -1857,6 +1858,29 @@ class Kubectl(object): if not context: context = self.module.params['name'] + user = { + 'name': context, + 'user': { + 'auth-provider': { + 'config': { + 'access-token': token, + 'cmd-args': 'config config-helper --format=json', + 'cmd-path': '/usr/lib64/google-cloud-sdk/bin/gcloud', + 'expiry-key': '{.credential.token_expiry}', + 'token-key': '{.credential.access_token}', + }, + 'name': 'gcp', + }, + }, + } + + auth_keyword = self.fetch['masterAuth'].keys() + if 'username' in auth_keyword and 'password' in auth_keyword: + user['user']['auth-provider'].update({ + 'username': str(self.fetch['masterAuth']['username']), + 'password': str(self.fetch['masterAuth']['password']), + }) + return { 'apiVersion': 'v1', 'clusters': [{'name': context, 'cluster': {'certificate-authority-data': str(self.fetch['masterAuth']['clusterCaCertificate'])}}], @@ -1864,25 +1888,7 @@ class Kubectl(object): 'current-context': context, 'kind': 'Config', 'preferences': {}, - 'users': [ - { - 'name': context, - 'user': { - 'auth-provider': { - 'config': { - 'access-token': token, - 'cmd-args': 'config config-helper --format=json', - 'cmd-path': '/usr/lib64/google-cloud-sdk/bin/gcloud', - 'expiry-key': '{.credential.token_expiry}', - 'token-key': '{.credential.access_token}', - }, - 'name': 'gcp', - }, - 'username': str(self.fetch['masterAuth']['username']), - 'password': str(self.fetch['masterAuth']['password']), - }, - } - ], + 'users': [user], } """ diff --git a/tests/integration/targets/gcp_container_cluster/aliases b/tests/integration/targets/gcp_container_cluster/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_container_cluster/aliases +++ b/tests/integration/targets/gcp_container_cluster/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml index 689027c..b8dedbe 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -17,15 +17,12 @@ google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" state: absent #---------------------------------------------------------- @@ -33,15 +30,12 @@ google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" state: present register: result @@ -53,7 +47,7 @@ google.cloud.gcp_container_cluster_info: location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" scopes: - https://www.googleapis.com/auth/cloud-platform @@ -67,15 +61,12 @@ google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" state: present register: result @@ -88,15 +79,12 @@ google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" state: absent register: result @@ -122,15 +110,12 @@ google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password node_config: machine_type: n1-standard-4 disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" + auth_kind: "serviceaccount" service_account_file: "{{ gcp_cred_file }}" state: absent register: result diff --git a/tests/integration/targets/gcp_container_node_pool/aliases b/tests/integration/targets/gcp_container_node_pool/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_container_node_pool/aliases +++ b/tests/integration/targets/gcp_container_node_pool/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From 0e9f2a74b1595282f63cd4f079bdaed964a93cf2 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 03:01:41 +0000 Subject: [PATCH 038/138] fix: gcp_cloudtasks_queue gcp_cloudtasks_queue was sending a "location" field in the payload, when the resource did not have such a field. Removing it fixes the tests. --- plugins/modules/gcp_cloudtasks_queue.py | 1 - tests/integration/targets/gcp_cloudtasks_queue/aliases | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/modules/gcp_cloudtasks_queue.py b/plugins/modules/gcp_cloudtasks_queue.py index 0b83803..b285859 100644 --- a/plugins/modules/gcp_cloudtasks_queue.py +++ b/plugins/modules/gcp_cloudtasks_queue.py @@ -489,7 +489,6 @@ def delete(module, link): def resource_to_request(module): request = { - u'location': module.params.get('location'), u'name': name_pattern(module.params.get('name'), module), u'appEngineRoutingOverride': QueueAppengineroutingoverride(module.params.get('app_engine_routing_override', {}), module).to_request(), u'rateLimits': QueueRatelimits(module.params.get('rate_limits', {}), module).to_request(), diff --git a/tests/integration/targets/gcp_cloudtasks_queue/aliases b/tests/integration/targets/gcp_cloudtasks_queue/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/aliases +++ b/tests/integration/targets/gcp_cloudtasks_queue/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From 50076e7f36065b044587c99f6331e5a25a562b13 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 03:07:30 +0000 Subject: [PATCH 039/138] fix: crypto_key initial_version_creation default skip_initial_version_creation previously defaulted to None, which results in an invalid value in the create call to gcp_kms_crypto_key. Defaulting to False fixes the issue. --- plugins/modules/gcp_kms_crypto_key.py | 2 +- tests/integration/targets/gcp_kms_crypto_key/aliases | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/modules/gcp_kms_crypto_key.py b/plugins/modules/gcp_kms_crypto_key.py index 03b69d4..bdd6fbc 100644 --- a/plugins/modules/gcp_kms_crypto_key.py +++ b/plugins/modules/gcp_kms_crypto_key.py @@ -279,7 +279,7 @@ def main(): rotation_period=dict(type='str'), version_template=dict(type='dict', options=dict(algorithm=dict(required=True, type='str'), protection_level=dict(type='str'))), key_ring=dict(required=True, type='str'), - skip_initial_version_creation=dict(type='bool'), + skip_initial_version_creation=dict(type='bool', default=False), ) ) diff --git a/tests/integration/targets/gcp_kms_crypto_key/aliases b/tests/integration/targets/gcp_kms_crypto_key/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/aliases +++ b/tests/integration/targets/gcp_kms_crypto_key/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported From 44eb7c2d29a7de758fbdf510b926197899541db1 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 07:20:36 +0000 Subject: [PATCH 040/138] fix gcp_spanner_database delete gcp_spanner_database erroneously used LRO handling on delete, rather than a standard synchronous function. One side effect was not catching 404s as a not found error code. --- plugins/modules/gcp_spanner_database.py | 2 +- tests/integration/targets/gcp_spanner_database/aliases | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/modules/gcp_spanner_database.py b/plugins/modules/gcp_spanner_database.py index 6a91c25..4d7356f 100644 --- a/plugins/modules/gcp_spanner_database.py +++ b/plugins/modules/gcp_spanner_database.py @@ -286,7 +286,7 @@ def extra_statements_update(module, request, response): def delete(module, link): auth = GcpSession(module, 'spanner') - return wait_for_operation(module, auth.delete(link)) + return return_if_object(module, auth.delete(link)) def resource_to_request(module): diff --git a/tests/integration/targets/gcp_spanner_database/aliases b/tests/integration/targets/gcp_spanner_database/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_spanner_database/aliases +++ b/tests/integration/targets/gcp_spanner_database/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file From 61717135729c3fd1c6f7e8a447d8fcaba8236110 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 07:37:17 +0000 Subject: [PATCH 041/138] fix gcp_bigtable_instance gcp_bigtable_instance scope was using an incorrect scope, which was causing oauth requests to not complete successfully. --- plugins/modules/gcp_bigtable_instance.py | 2 +- plugins/modules/gcp_bigtable_instance_info.py | 2 +- tests/integration/targets/gcp_bigtable_instance/aliases | 3 +-- .../targets/gcp_bigtable_instance/tasks/autogen.yml | 4 ---- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/modules/gcp_bigtable_instance.py b/plugins/modules/gcp_bigtable_instance.py index ab36973..b70b004 100644 --- a/plugins/modules/gcp_bigtable_instance.py +++ b/plugins/modules/gcp_bigtable_instance.py @@ -264,7 +264,7 @@ def main(): ) if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/bigtable'] + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] state = module.params['state'] diff --git a/plugins/modules/gcp_bigtable_instance_info.py b/plugins/modules/gcp_bigtable_instance_info.py index 68307a2..deefad0 100644 --- a/plugins/modules/gcp_bigtable_instance_info.py +++ b/plugins/modules/gcp_bigtable_instance_info.py @@ -184,7 +184,7 @@ def main(): module = GcpModule(argument_spec=dict()) if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/bigtable'] + module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] return_value = {'resources': fetch_list(module, collection(module))} module.exit_json(**return_value) diff --git a/tests/integration/targets/gcp_bigtable_instance/aliases b/tests/integration/targets/gcp_bigtable_instance/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_bigtable_instance/aliases +++ b/tests/integration/targets/gcp_bigtable_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml index fa9ae5e..23dccf5 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml @@ -48,8 +48,6 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigtable register: results - name: verify that command succeeded assert: @@ -96,8 +94,6 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/bigtable register: results - name: verify that command succeeded assert: From 117224d3528bd6f37672333a0e41ea52e34ff213 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 08:07:58 +0000 Subject: [PATCH 042/138] fix gcp_iam_role gcp_iam_role did not handle the undelete behavior that is specific to gcp_iam_role. --- plugins/modules/gcp_iam_role.py | 162 +++++++++++------- .../integration/targets/gcp_iam_role/aliases | 3 +- .../targets/gcp_iam_role/tasks/autogen.yml | 14 +- 3 files changed, 106 insertions(+), 73 deletions(-) diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index 6911a8b..3600ab6 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -25,9 +25,13 @@ __metaclass__ = type # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} -DOCUMENTATION = ''' +DOCUMENTATION = """ --- module: gcp_iam_role description: @@ -114,9 +118,9 @@ options: - This should not be set unless you know what you're doing. - This only alters the User Agent string for any API requests. type: str -''' +""" -EXAMPLES = ''' +EXAMPLES = """ - name: create a role google.cloud.gcp_iam_role: name: myCustomRole2 @@ -130,9 +134,9 @@ EXAMPLES = ''' auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" state: present -''' +""" -RETURN = ''' +RETURN = """ name: description: - The name of the role. @@ -163,13 +167,19 @@ deleted: - The current deleted state of the role. returned: success type: bool -''' +""" ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( + navigate_hash, + GcpSession, + GcpModule, + GcpRequest, + replace_resource_dict, +) import json ################################################################################ @@ -182,85 +192,99 @@ def main(): module = GcpModule( argument_spec=dict( - state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(required=True, type='str'), - title=dict(type='str'), - description=dict(type='str'), - included_permissions=dict(type='list', elements='str'), - stage=dict(type='str'), + state=dict(default="present", choices=["present", "absent"], type="str"), + name=dict(required=True, type="str"), + title=dict(type="str"), + description=dict(type="str"), + included_permissions=dict(type="list", elements="str"), + stage=dict(type="str"), ) ) - if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] + if not module.params["scopes"]: + module.params["scopes"] = ["https://www.googleapis.com/auth/iam"] - state = module.params['state'] + state = module.params["state"] fetch = fetch_resource(module, self_link(module)) changed = False if fetch: - if state == 'present': - if is_different(module, fetch): + if state == "present": + if fetch.get("deleted"): + undelete(module, self_link(module), fetch["etag"]) + changed = True + elif is_different(module, fetch): update(module, self_link(module), fetch) fetch = fetch_resource(module, self_link(module)) changed = True - else: - delete(module, self_link(module)) - fetch = {} - changed = True + elif not fetch.get("deleted"): + delete(module, self_link(module)) + fetch = {} + changed = True else: - if state == 'present': + if state == "present": fetch = create(module, collection(module)) changed = True else: fetch = {} - fetch.update({'changed': changed}) + fetch.update({"changed": changed}) module.exit_json(**fetch) def create(module, link): - auth = GcpSession(module, 'iam') + auth = GcpSession(module, "iam") return return_if_object(module, auth.post(link, resource_to_create(module))) +def undelete(module, link, etag): + auth = GcpSession(module, "iam") + return return_if_object(module, auth.post(link + ":undelete", { + "etag": etag + })) + + def update(module, link, fetch): - auth = GcpSession(module, 'iam') - params = {'updateMask': updateMask(resource_to_request(module), response_to_hash(module, fetch))} + auth = GcpSession(module, "iam") + params = { + "updateMask": updateMask( + resource_to_request(module), response_to_hash(module, fetch) + ) + } request = resource_to_request(module) - del request['name'] + del request["name"] return return_if_object(module, auth.put(link, request, params=params)) def updateMask(request, response): update_mask = [] - if request.get('name') != response.get('name'): - update_mask.append('name') - if request.get('title') != response.get('title'): - update_mask.append('title') - if request.get('description') != response.get('description'): - update_mask.append('description') - if request.get('includedPermissions') != response.get('includedPermissions'): - update_mask.append('includedPermissions') - if request.get('stage') != response.get('stage'): - update_mask.append('stage') - return ','.join(update_mask) + if request.get("name") != response.get("name"): + update_mask.append("name") + if request.get("title") != response.get("title"): + update_mask.append("title") + if request.get("description") != response.get("description"): + update_mask.append("description") + if request.get("includedPermissions") != response.get("includedPermissions"): + update_mask.append("includedPermissions") + if request.get("stage") != response.get("stage"): + update_mask.append("stage") + return ",".join(update_mask) def delete(module, link): - auth = GcpSession(module, 'iam') - return return_if_object(module, auth.delete(link)) + auth = GcpSession(module, "iam") + return return_if_object(module, auth.delete(link), allow_not_found=True) def resource_to_request(module): request = { - u'name': module.params.get('name'), - u'title': module.params.get('title'), - u'description': module.params.get('description'), - u'includedPermissions': module.params.get('included_permissions'), - u'stage': module.params.get('stage'), + "name": module.params.get("name"), + "title": module.params.get("title"), + "description": module.params.get("description"), + "includedPermissions": module.params.get("included_permissions"), + "stage": module.params.get("stage"), } return_vals = {} for k, v in request.items(): @@ -271,16 +295,20 @@ def resource_to_request(module): def fetch_resource(module, link, allow_not_found=True): - auth = GcpSession(module, 'iam') + auth = GcpSession(module, "iam") return return_if_object(module, auth.get(link), allow_not_found) def self_link(module): - return "https://iam.googleapis.com/v1/projects/{project}/roles/{name}".format(**module.params) + return "https://iam.googleapis.com/v1/projects/{project}/roles/{name}".format( + **module.params + ) def collection(module): - return "https://iam.googleapis.com/v1/projects/{project}/roles".format(**module.params) + return "https://iam.googleapis.com/v1/projects/{project}/roles".format( + **module.params + ) def return_if_object(module, response, allow_not_found=False): @@ -292,16 +320,22 @@ def return_if_object(module, response, allow_not_found=False): if response.status_code == 204: return None + # catches and edge case specific to IAM roles where the role not + # existing returns 400. + if (allow_not_found and response.status_code == 400 + and "You can't delete role_id" in response.text): + return None + try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError): + except getattr(json.decoder, "JSONDecodeError", ValueError): module.fail_json(msg="Invalid JSON response with error: %s" % response.text) result = decode_response(result, module) - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if navigate_hash(result, ["error", "errors"]): + module.fail_json(msg=navigate_hash(result, ["error", "errors"])) return result @@ -329,26 +363,26 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { - u'name': response.get(u'name'), - u'title': response.get(u'title'), - u'description': response.get(u'description'), - u'includedPermissions': response.get(u'includedPermissions'), - u'stage': response.get(u'stage'), - u'deleted': response.get(u'deleted'), + "name": response.get("name"), + "title": response.get("title"), + "description": response.get("description"), + "includedPermissions": response.get("includedPermissions"), + "stage": response.get("stage"), + "deleted": response.get("deleted"), } def resource_to_create(module): role = resource_to_request(module) - del role['name'] - return {'roleId': module.params['name'], 'role': role} + del role["name"] + return {"roleId": module.params["name"], "role": role} def decode_response(response, module): - if 'name' in response: - response['name'] = response['name'].split('/')[-1] + if "name" in response: + response["name"] = response["name"].split("/")[-1] return response -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/tests/integration/targets/gcp_iam_role/aliases b/tests/integration/targets/gcp_iam_role/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_iam_role/aliases +++ b/tests/integration/targets/gcp_iam_role/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml index 9e55c27..c565d47 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a role google.cloud.gcp_iam_role: - name: myCustomRole2 + name: role_{{ resource_name.split("-")[-1] }} title: My Custom Role description: My custom role description included_permissions: @@ -29,7 +29,7 @@ #---------------------------------------------------------- - name: create a role google.cloud.gcp_iam_role: - name: myCustomRole2 + name: role_{{ resource_name.split("-")[-1] }} title: My Custom Role description: My custom role description included_permissions: @@ -56,11 +56,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*role_{{ resource_name.split("-")[-1] }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a role that already exists google.cloud.gcp_iam_role: - name: myCustomRole2 + name: role_{{ resource_name.split("-")[-1] }} title: My Custom Role description: My custom role description included_permissions: @@ -79,7 +79,7 @@ #---------------------------------------------------------- - name: delete a role google.cloud.gcp_iam_role: - name: myCustomRole2 + name: role_{{ resource_name.split("-")[-1] }} title: My Custom Role description: My custom role description included_permissions: @@ -106,11 +106,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*role_{{ resource_name.split("-")[-1] }}.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a role that does not exist google.cloud.gcp_iam_role: - name: myCustomRole2 + name: role_{{ resource_name.split("-")[-1] }} title: My Custom Role description: My custom role description included_permissions: From 4dc556f94038434c00f6df8d398586e9a0454c10 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 20 Nov 2022 17:14:44 +0000 Subject: [PATCH 043/138] including bigtableadmin in bootstrap APIs bigtableadmin was not enabled in the bootstrapping script. Also running the bootstrap script on every CI run, to ensure the test environment is properly set up. --- .github/workflows/ansible-integration-tests.yml | 4 +++- scripts/bootstrap-project.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index 0cc2a05..d0e8917 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -56,7 +56,9 @@ jobs: - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v1 - name: Run cleanup - run: ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT + run: | + ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT + ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT # run tests - name: Run integration tests # Add the -vvv flag to print out more output diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 924d713..8dd2b2d 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -10,7 +10,7 @@ PROJECT_ID="${1}" SERVICE_ACCOUNT_NAME="${2}" SERVICE_LIST=( "appengine" - "bigtable" + "bigtableadmin.googleapis.com" "cloudbuild.googleapis.com" "cloudfunctions" "cloudkms.googleapis.com" From 4cd61e66c11c93aa5a8d58bb866fc4d370bd73ab Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 27 Nov 2022 06:03:40 +0000 Subject: [PATCH 044/138] tests: remove flakey spanner_database_info test The spanner List API is returning intermittent 404s, which is resulting in the spanner_database test failing every other time. Disabling the API until the test is more stable. --- .gitignore | 3 +- .../gcp_spanner_database/tasks/autogen.yml | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 8c03bed..2277278 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ tests/integration/cloud-config-gcp.ini # running ansible integration tests adds files here. tests/integration/inventory -tests/output/ \ No newline at end of file +tests/output/ +__pycache__ diff --git a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml index 1f4762d..5287f5d 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml @@ -89,19 +89,23 @@ assert: that: - result.changed == true -- name: verify that database was deleted - google.cloud.gcp_spanner_database_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0 +# commented out due to a flakey List endpoint +# on the spanner API. (requests continue to return +# 404s intermittently). +# uncomment if it's desired to test the info. +# - name: verify that database was deleted +# google.cloud.gcp_spanner_database_info: +# instance: "{{ instance }}" +# project: "{{ gcp_project }}" +# auth_kind: "{{ gcp_cred_kind }}" +# service_account_file: "{{ gcp_cred_file }}" +# scopes: +# - https://www.googleapis.com/auth/spanner.admin +# register: results +# - name: verify that command succeeded +# assert: +# that: +# - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a database that does not exist google.cloud.gcp_spanner_database: From 0114ee23d54ef08989f3990c329651298917a4f3 Mon Sep 17 00:00:00 2001 From: Andrey Dolgov Date: Fri, 25 Nov 2022 10:49:58 +0300 Subject: [PATCH 045/138] Add custom domain suffix option (base_domain) --- plugins/inventory/gcp_compute.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 1f31e02..1d3300a 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -48,6 +48,11 @@ DOCUMENTATION = """ 'public_ip', 'private_ip', 'name' or 'labels.vm_name'. default: ['public_ip', 'private_ip', 'name'] type: list + base_domain: + description: Custom domain suffix to append to all hosts. + default: "" + type: string + required: False auth_kind: description: - The type of credential used. @@ -131,6 +136,7 @@ keyed_groups: # Create groups from GCE labels - prefix: gcp key: labels +base_domain: .example.com hostnames: # List host by name instead of the default public ip - name @@ -164,9 +170,10 @@ class GcpMockModule(object): class GcpInstance(object): - def __init__(self, json, hostname_ordering, project_disks, should_format=True): + def __init__(self, json, hostname_ordering, project_disks, should_format=True, base_domain=""): self.hostname_ordering = hostname_ordering self.project_disks = project_disks + self.base_domain = base_domain self.json = json if should_format: self.convert() @@ -237,7 +244,7 @@ class GcpInstance(object): elif order == "private_ip": name = self._get_privateip() elif order == "name": - name = self.json[u"name"] + name = self.json[u"name"] + self.base_domain else: raise AnsibleParserError("%s is not a valid hostname precedent" % order) @@ -422,9 +429,12 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): if self.get_option("hostnames"): hostname_ordering = self.get_option("hostnames") + if self.get_option("base_domain"): + base_domain = self.get_option("base_domain") + for host_json in items: host = GcpInstance( - host_json, hostname_ordering, project_disks, format_items + host_json, hostname_ordering, project_disks, format_items, base_domain ) self._populate_host(host) From 32e7eea25ffe55b95d2a01f6635b325ca0d9c767 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 27 Nov 2022 09:58:56 +0300 Subject: [PATCH 046/138] Rename base_domain to name_suffix, make adjustments based on PR feedback --- plugins/inventory/gcp_compute.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 1d3300a..26ddeb5 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -48,8 +48,8 @@ DOCUMENTATION = """ 'public_ip', 'private_ip', 'name' or 'labels.vm_name'. default: ['public_ip', 'private_ip', 'name'] type: list - base_domain: - description: Custom domain suffix to append to all hosts. + name_suffix: + description: Custom domain suffix. If set, this string will be appended to all hosts. default: "" type: string required: False @@ -136,7 +136,7 @@ keyed_groups: # Create groups from GCE labels - prefix: gcp key: labels -base_domain: .example.com +name_suffix: .example.com hostnames: # List host by name instead of the default public ip - name @@ -170,10 +170,10 @@ class GcpMockModule(object): class GcpInstance(object): - def __init__(self, json, hostname_ordering, project_disks, should_format=True, base_domain=""): + def __init__(self, json, hostname_ordering, project_disks, should_format=True, name_suffix=""): self.hostname_ordering = hostname_ordering self.project_disks = project_disks - self.base_domain = base_domain + self.name_suffix = name_suffix self.json = json if should_format: self.convert() @@ -244,7 +244,7 @@ class GcpInstance(object): elif order == "private_ip": name = self._get_privateip() elif order == "name": - name = self.json[u"name"] + self.base_domain + name = self.json[u"name"] + self.name_suffix else: raise AnsibleParserError("%s is not a valid hostname precedent" % order) @@ -429,12 +429,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): if self.get_option("hostnames"): hostname_ordering = self.get_option("hostnames") - if self.get_option("base_domain"): - base_domain = self.get_option("base_domain") + name_suffix = self.get_option("name_suffix") for host_json in items: host = GcpInstance( - host_json, hostname_ordering, project_disks, format_items, base_domain + host_json, hostname_ordering, project_disks, format_items, name_suffix ) self._populate_host(host) From 18900797c5fd5463a4a38baa1abbb757dfe58463 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 26 Nov 2022 05:49:36 +0000 Subject: [PATCH 047/138] tests: documenting unsupported cases Some test cases are unsupported due to environmental or blocking code restrictions (e.g. unimplemented dependent resources). As these will likely not be fixed before the first release certified for Ansible 2.11 and beyond, documenting them instead. --- tests/integration/targets/gcp_compute_node_group/aliases | 3 +++ .../targets/gcp_compute_region_target_https_proxy/aliases | 2 ++ tests/integration/targets/gcp_resourcemanager_project/aliases | 2 ++ tests/integration/targets/gcp_sql_ssl_cert/aliases | 2 ++ 4 files changed, 9 insertions(+) diff --git a/tests/integration/targets/gcp_compute_node_group/aliases b/tests/integration/targets/gcp_compute_node_group/aliases index 9812f01..5ce6d4c 100644 --- a/tests/integration/targets/gcp_compute_node_group/aliases +++ b/tests/integration/targets/gcp_compute_node_group/aliases @@ -1,2 +1,5 @@ cloud/gcp +# this test cannot run in CI, as the minimum +# node group size is beyond the compute quota +# limit of a default project. unsupported diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/aliases b/tests/integration/targets/gcp_compute_region_target_https_proxy/aliases index 9812f01..d129945 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/aliases +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/aliases @@ -1,2 +1,4 @@ cloud/gcp +# unsupported as testing this resource requires +# a missing resource (compute_regional_ssl_cert) unsupported diff --git a/tests/integration/targets/gcp_resourcemanager_project/aliases b/tests/integration/targets/gcp_resourcemanager_project/aliases index ff7eb2d..72efdb9 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/aliases +++ b/tests/integration/targets/gcp_resourcemanager_project/aliases @@ -1,2 +1,4 @@ cloud/gcp +# unsupported as CI test project does not support +# creating folders / projects to test. unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_ssl_cert/aliases b/tests/integration/targets/gcp_sql_ssl_cert/aliases index 9812f01..8189da3 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/aliases +++ b/tests/integration/targets/gcp_sql_ssl_cert/aliases @@ -1,2 +1,4 @@ cloud/gcp +# unsupported as gcp_sql_ssl_cert_info resource +# does not exist. unsupported From f692dd4c76809dfd1bcf35304abf9b7307f58dbf Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 26 Nov 2022 07:00:46 +0000 Subject: [PATCH 048/138] fix role tests Ansible role tests were failing due to ansible-lint reporting multiple errors. Fixing those errors resolves the failing tests. Switching gcsfuse to use gcloud's bootstrap to follow the current docker install instructions. Removing centos as it's a discontinued distribution. Adding a check to ensure integration tests are skipped unless they are run by a branch (a public fork does not pass required integration test credentials). --- .../workflows/ansible-integration-tests.yml | 7 ++-- .github/workflows/gcloud.yml | 17 ++-------- .github/workflows/gcsfuse.yml | 22 ++++++------- CONTRIBUTING.md | 32 ++++++++++++++++++- molecule/gcloud/archive_playbook.yml | 2 +- molecule/gcloud/converge.yml | 6 ++-- molecule/gcloud/molecule.yml | 10 ++++-- molecule/gcloud/package_playbook.yml | 2 +- molecule/gcloud/verify.yml | 2 +- molecule/gcsfuse/converge.yml | 27 ++++------------ molecule/gcsfuse/molecule.yml | 10 ++++-- molecule/gcsfuse/verify.yml | 2 +- .../gcloud/tasks/archive/archive_install.yml | 10 +++--- .../tasks/archive/command_completion.yml | 8 ++--- roles/gcloud/tasks/archive/main.yml | 18 +++++------ roles/gcloud/tasks/main.yml | 4 +-- roles/gcloud/tasks/package/debian.yml | 8 ++--- roles/gcloud/tasks/package/main.yml | 2 +- roles/gcloud/tasks/package/redhat.yml | 8 ++--- roles/gcsfuse/tasks/debian.yml | 8 ++--- roles/gcsfuse/tasks/main.yml | 4 +-- 21 files changed, 113 insertions(+), 96 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index d0e8917..f4983e4 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -1,8 +1,5 @@ name: "Run integration tests for the cloud.google collection" on: - # NOTE: GitHub does not allow secrets to be used - # in PRs sent from forks. As such, this configuration is for - # PRs that the maintainers would like to send to test. pull_request: {} push: branches: master @@ -11,6 +8,10 @@ env: GCP_PROJECT: "ansible-gcp-ci" jobs: integration: + # NOTE: GitHub does not allow secrets to be used + # in PRs sent from forks. As such, this configuration is for + # PRs that the maintainers would like to send to test. + if: github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index effeb61..61ad651 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -22,17 +22,6 @@ jobs: molecule_playbook: - archive_playbook.yml - package_playbook.yml - molecule_distro: - - distro: centos:7 - command: /usr/sbin/init - - distro: centos:8 - command: /usr/sbin/init - - distro: ubuntu:18.04 - command: /lib/systemd/systemd - - distro: ubuntu:20.04 - command: /lib/systemd/systemd - - distro: debian:9 - command: /lib/systemd/systemd collection_role: - gcloud steps: @@ -58,14 +47,12 @@ jobs: sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule yamllint ansible ansible-lint docker \ - molecule[docker] + pip install molecule[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- molecule --version && ansible --version && - MOLECULE_COMMAND=${{ matrix.molecule_distro.command }} - MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }} MOLECULE_PLAYBOOK=${{ matrix.molecule_playbook }} + MOLECULE_NO_LOG="false" molecule --debug test -s ${{ matrix.collection_role }} diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 75a610e..a9c3a63 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -17,13 +17,6 @@ jobs: strategy: fail-fast: false matrix: - molecule_distro: - - distro: ubuntu:16.04 - command: /sbin/init - - distro: ubuntu:18.04 - command: /lib/systemd/systemd - - distro: debian:9 - command: /lib/systemd/systemd collection_role: - gcsfuse steps: @@ -39,14 +32,21 @@ jobs: - name: Install dependencies run: | - sudo apt install docker + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg \ + lsb-release + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg \ + --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule yamllint ansible-lint docker + pip install molecule[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- molecule --version && ansible --version && - MOLECULE_COMMAND=${{ matrix.molecule_distro.command }} - MOLECULE_DISTRO=${{ matrix.molecule_distro.distro }} + MOLECULE_NO_LOG="false" molecule --debug test -s ${{ matrix.collection_role }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b74cc1..fec48e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,7 @@ git clone $TARGET_DIR/collections/google/cloud ### prequisites for all tests - Install the `ansible` package. +- Some container runtime is necessary (e.g. `podman` or `docker`). The instructions use podman. ## Running integration tests @@ -56,4 +57,33 @@ bash ./scripts/bootstrap-project.sh $PROJECT_ID $SERVICE_ACCOUNT_NAME ### Running -Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). \ No newline at end of file +Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499). + +## Role tests + +### Prequisites for role tests + +If you would like to use podman, you must +install the `molecule[podman]` package in PyPI: + +``` +pip install --upgrade molecule[podman] +``` + +### Running role tests + +Ansible roles are tested via molecule. + +```sh +module debug --test -s ${ROLE} +``` + +Role is the name of the role (e.g. gcloud, gcsfuse). + +Add `-d podman` if you would like to use the podman driver. + +If the linting fails, that is generally due to `ansible-lint`, which can be run directly: + +``` +ansible-lint +``` \ No newline at end of file diff --git a/molecule/gcloud/archive_playbook.yml b/molecule/gcloud/archive_playbook.yml index 52ab0de..5f64954 100644 --- a/molecule/gcloud/archive_playbook.yml +++ b/molecule/gcloud/archive_playbook.yml @@ -3,7 +3,7 @@ hosts: all pre_tasks: - name: Install gpg for apt_key - apt: + ansible.builtin.apt: name: gnupg update_cache: true when: ansible_os_family|lower == "debian" diff --git a/molecule/gcloud/converge.yml b/molecule/gcloud/converge.yml index 3790ebf..eb1bceb 100644 --- a/molecule/gcloud/converge.yml +++ b/molecule/gcloud/converge.yml @@ -3,20 +3,20 @@ hosts: all pre_tasks: - name: Update package cache - package: update_cache=yes + ansible.builtin.package: update_cache=yes changed_when: false register: task_result until: task_result is success retries: 10 delay: 2 - name: create containerd folder - file: + ansible.builtin.file: path: /etc/systemd/system/containerd.service.d state: directory mode: 0755 when: ansible_service_mgr == "systemd" - name: override file for containerd - copy: + ansible.builtin.copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf mode: 0644 diff --git a/molecule/gcloud/molecule.yml b/molecule/gcloud/molecule.yml index da1ce65..7b7ab54 100644 --- a/molecule/gcloud/molecule.yml +++ b/molecule/gcloud/molecule.yml @@ -9,9 +9,15 @@ lint: | ansible-lint platforms: - name: instance - image: ${MOLECULE_DISTRO:-ubuntu:xenial} + image: ubuntu:18.04 privileged: true - command: ${MOLECULE_COMMAND:-"sleep infinity"} + ansible.builtin.command: "/lib/systemd/systemd" + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + - name: instance + image: debian:9 + privileged: true + ansible.builtin.command: "/lib/systemd/systemd" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcloud/package_playbook.yml b/molecule/gcloud/package_playbook.yml index fab1d85..fe18f65 100644 --- a/molecule/gcloud/package_playbook.yml +++ b/molecule/gcloud/package_playbook.yml @@ -3,7 +3,7 @@ hosts: all pre_tasks: - name: Install gpg for apt_key - apt: + ansible.builtin.apt: name: gnupg update_cache: true when: ansible_os_family|lower == "debian" diff --git a/molecule/gcloud/verify.yml b/molecule/gcloud/verify.yml index a82dd6f..86afba4 100644 --- a/molecule/gcloud/verify.yml +++ b/molecule/gcloud/verify.yml @@ -5,5 +5,5 @@ hosts: all tasks: - name: Example assertion - assert: + ansible.builtin.assert: that: true diff --git a/molecule/gcsfuse/converge.yml b/molecule/gcsfuse/converge.yml index b0e6311..69d9cf8 100644 --- a/molecule/gcsfuse/converge.yml +++ b/molecule/gcsfuse/converge.yml @@ -2,25 +2,12 @@ - name: Converge hosts: all pre_tasks: - - name: Using apt update the packages - apt: - update_cache: yes - when: ansible_os_family == "Debian" - - name: Using apt update the packages - yum: - update_cache: yes - when: ansible_os_family == "RedHat" - - name: create containerd folder - file: - path: /etc/systemd/system/containerd.service.d - state: directory - mode: 0755 - when: ansible_service_mgr == "systemd" - - name: override file for containerd - copy: - src: files/override.conf - dest: /etc/systemd/system/containerd.service.d/override.conf - mode: 0644 - when: ansible_service_mgr == "systemd" + - name: Update package cache + ansible.builtin.package: update_cache=yes + changed_when: false + register: task_result + until: task_result is success + retries: 10 + delay: 2 roles: - role: google.cloud.gcsfuse diff --git a/molecule/gcsfuse/molecule.yml b/molecule/gcsfuse/molecule.yml index da1ce65..7b7ab54 100644 --- a/molecule/gcsfuse/molecule.yml +++ b/molecule/gcsfuse/molecule.yml @@ -9,9 +9,15 @@ lint: | ansible-lint platforms: - name: instance - image: ${MOLECULE_DISTRO:-ubuntu:xenial} + image: ubuntu:18.04 privileged: true - command: ${MOLECULE_COMMAND:-"sleep infinity"} + ansible.builtin.command: "/lib/systemd/systemd" + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + - name: instance + image: debian:9 + privileged: true + ansible.builtin.command: "/lib/systemd/systemd" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcsfuse/verify.yml b/molecule/gcsfuse/verify.yml index a82dd6f..86afba4 100644 --- a/molecule/gcsfuse/verify.yml +++ b/molecule/gcsfuse/verify.yml @@ -5,5 +5,5 @@ hosts: all tasks: - name: Example assertion - assert: + ansible.builtin.assert: that: true diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index 009d262..126bc45 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -1,16 +1,16 @@ --- - name: gcloud | Archive | Ensure temp path exists - file: path={{ gcloud_archive_path }} state=directory mode=0755 + ansible.builtin.file: path={{ gcloud_archive_path }} state=directory mode=0755 - name: gcloud | Archive | Extract Cloud SDK archive - unarchive: + ansible.builtin.unarchive: src: "{{ gcloud_archive_url }}" dest: "{{ gcloud_archive_path }}" remote_src: yes creates: "{{ gcloud_library_path }}" - name: gcloud | Archive | Link binaries to /usr/bin (like package install) - file: + ansible.builtin.file: src: "{{ gcloud_library_path }}/bin/{{ item }}" dest: "/usr/bin/{{ item }}" state: link @@ -23,11 +23,11 @@ when: not gcloud_install_script - name: gcloud | Archive | Add command completion - include_tasks: command_completion.yml + ansible.builtin.include_tasks: command_completion.yml when: gcloud_command_completion - name: gcloud | Archive | Install into Path - command: >- + ansible.builtin.command: >- {{ gcloud_archive_path }}/install.sh --quiet --usage-reporting {{ gcloud_usage_reporting | lower }} {% if gcloud_profile_path %} diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index 1c6a457..28c6b48 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -1,7 +1,7 @@ --- # task file to configure bash completion for gcloud - name: gcloud | Archive | Debian | Ensure bash completion is installed - apt: name=bash-completion + ansible.builtin.apt: name=bash-completion register: task_result until: task_result is success retries: 10 @@ -9,7 +9,7 @@ when: ansible_os_family == "Debian" - name: gcloud | Archive | RedHat | Ensure bash completion is installed - yum: + ansible.builtin.yum: name: - bash-completion register: task_result @@ -19,7 +19,7 @@ when: ansible_os_family == "RedHat" - name: gcloud | Archive | Ensure bash_completion.d directory exists - file: + ansible.builtin.file: path: /etc/bash_completion.d owner: root group: root @@ -27,7 +27,7 @@ mode: 0755 - name: gcloud | Archive | Link binaries to /usr/bin (like package install) - file: + ansible.builtin.file: src: "{{ gcloud_library_path }}/completion.bash.inc" dest: /etc/bash_completion.d/gcloud state: link diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 1175bfc..143c2c7 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -1,27 +1,27 @@ --- # tasks to install gcloud via archive - name: gcloud | Archive | Look for existing Google Cloud SDK installation - stat: + ansible.builtin.stat: path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" register: gcloud_status - name: gcloud | Archive | Get gcloud_status - debug: var=gcloud_status + ansible.builtin.debug: var=gcloud_status - name: gcloud | Archive | Set installed version if installation exists block: - - name: gcloud | Archive | Importing contents of {{ gcloud_archive_path }}/google-cloud-sdk/VERSION - slurp: + - name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }} + ansible.builtin.slurp: src: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" register: gcloud_installed_version_data - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact - set_fact: + ansible.builtin.set_fact: gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}" - name: gcloud | Archive | get the gcloud_installed_version - debug: + ansible.builtin.debug: msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" - name: gcloud | Archive | Version already installed - debug: + ansible.builtin.debug: msg: >- Skipping installation of google-cloud-sdk version {{ gcloud_version }} when {{ gcloud_installed_version }} is already installed. @@ -29,12 +29,12 @@ when: gcloud_status.stat.exists - name: gcloud | Archive | Start installation - include_tasks: archive_install.yml + ansible.builtin.include_tasks: archive_install.yml when: gcloud_installed_version is undefined or gcloud_version is version(gcloud_installed_version, '>') - name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 - command: gcloud components install {{ item }} + ansible.builtin.command: gcloud components install {{ item }} register: gcloud_install_comp_status changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines" loop: "{{ gcloud_additional_components }}" diff --git a/roles/gcloud/tasks/main.yml b/roles/gcloud/tasks/main.yml index 090852f..22caaeb 100644 --- a/roles/gcloud/tasks/main.yml +++ b/roles/gcloud/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: gcloud | Load Distro and OS specific variables - include_vars: "{{ lookup('first_found', params) }}" + ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: files: @@ -12,4 +12,4 @@ - 'vars' - name: gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} - include_tasks: "{{ gcloud_install_type }}/main.yml" + ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/roles/gcloud/tasks/package/debian.yml b/roles/gcloud/tasks/package/debian.yml index f38df34..c6790c9 100644 --- a/roles/gcloud/tasks/package/debian.yml +++ b/roles/gcloud/tasks/package/debian.yml @@ -1,25 +1,25 @@ --- # tasks that install gcloud on debian - name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL - apt_key: + ansible.builtin.apt_key: url: "{{ gcloud_apt_key }}" state: present - name: gcloud | Debian | Add the gcloud repository - apt_repository: + ansible.builtin.apt_repository: repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main" state: present filename: google-cloud-sdk - name: gcloud | Debian | Install the google-cloud-sdk package - apt: name=google-cloud-sdk update_cache=yes + ansible.builtin.apt: name=google-cloud-sdk update_cache=yes register: task_result until: task_result is success retries: 10 delay: 2 - name: gcloud | Debian | Install the google-cloud-sdk additional components - apt: name=google-cloud-sdk-{{ item }} update_cache=yes + ansible.builtin.apt: name=google-cloud-sdk-{{ item }} update_cache=yes register: task_result until: task_result is success retries: 10 diff --git a/roles/gcloud/tasks/package/main.yml b/roles/gcloud/tasks/package/main.yml index c9b64ee..f375917 100644 --- a/roles/gcloud/tasks/package/main.yml +++ b/roles/gcloud/tasks/package/main.yml @@ -2,4 +2,4 @@ # tasks file for gcloud - name: gcloud | Start package installation for specific distro - include_tasks: "{{ ansible_os_family|lower }}.yml" + ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index 1a8a17c..e2b731e 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -1,9 +1,9 @@ --- - name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL - yum_repository: + ansible.builtin.yum_repository: name: google-cloud-sdk description: Google Cloud SDK - file: google-cloud-sdk + ansible.builtin.file: google-cloud-sdk baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 enabled: yes gpgcheck: yes @@ -13,14 +13,14 @@ - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - name: gcloud | RHEL | Install the google-cloud-sdk package - yum: name=google-cloud-sdk update_cache=yes + ansible.builtin.yum: name=google-cloud-sdk update_cache=yes register: task_result until: task_result is success retries: 10 delay: 2 - name: gcloud | Debian | Install the google-cloud-sdk additional components - yum: name=google-cloud-sdk-{{ item }} update_cache=yes + ansible.builtin.yum: name=google-cloud-sdk-{{ item }} update_cache=yes register: task_result until: task_result is success retries: 10 diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index 9443524..4ae759b 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -1,24 +1,24 @@ --- - name: gcsfuse | Ensure gpg is installed - apt: name=gnupg + ansible.builtin.apt: name=gnupg register: task_result until: task_result is success retries: 10 delay: 2 - name: gcsfuse | Add an apt signing key - apt_key: + ansible.builtin.apt_key: url: https://packages.cloud.google.com/apt/doc/apt-key.gpg state: present - name: gcsfuse | Add the apt repository - apt_repository: + ansible.builtin.apt_repository: repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main state: present filename: gcsfuse - name: gcsfuse | Install gcsfuse - apt: name=gcsfuse update_cache=yes + ansible.builtin.apt: name=gcsfuse update_cache=yes register: task_result until: task_result is success retries: 10 diff --git a/roles/gcsfuse/tasks/main.yml b/roles/gcsfuse/tasks/main.yml index c5432c5..be0a1a4 100644 --- a/roles/gcsfuse/tasks/main.yml +++ b/roles/gcsfuse/tasks/main.yml @@ -1,4 +1,4 @@ --- # tasks file for google.cloud.gcsfuse - -- include_tasks: "{{ ansible_os_family|lower }}.yml" +- name: main + ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" From 21c9479ece1df95d97dc0348eda351c00972f235 Mon Sep 17 00:00:00 2001 From: Rebecca Peterson <44721098+rebecca-pete@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:39:29 -0800 Subject: [PATCH 049/138] Update gcp_filestore_instance.py `filestore/docs/accessing-fileshares` has been removed and replaced with `filestore/docs/csi-driver` --- plugins/modules/gcp_filestore_instance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/gcp_filestore_instance.py b/plugins/modules/gcp_filestore_instance.py index 6ea212f..7028ffe 100644 --- a/plugins/modules/gcp_filestore_instance.py +++ b/plugins/modules/gcp_filestore_instance.py @@ -159,7 +159,7 @@ options: notes: - 'API Reference: U(https://cloud.google.com/filestore/docs/reference/rest/v1beta1/projects.locations.instances/create)' - 'Official Documentation: U(https://cloud.google.com/filestore/docs/creating-instances)' -- 'Use with Kubernetes: U(https://cloud.google.com/filestore/docs/accessing-fileshares)' +- 'Use with Kubernetes: U(https://cloud.google.com/filestore/docs/csi-driver)' - 'Copying Data In/Out: U(https://cloud.google.com/filestore/docs/copying-data)' - for authentication, you can set service_account_file using the C(GCP_SERVICE_ACCOUNT_FILE) env variable. From 1ec54b286d9520cc9f98d08e8a10c55d68a331f1 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 3 Dec 2022 17:13:27 +0000 Subject: [PATCH 050/138] prepping for 1.1.0-beta release - Updating and documenting changelog creation process. antsibull-changelog was chosen because it is the standard tooling recommended by Ansible developers. - Documenting the release process and several others so others can perform it in the future. - Updating the integration tests to test against 2.13, which the 1.1.0 final release will be certified for. - Created changelog and update galaxy.yaml for 1.1.0-beta, which will be the next release. --- .../workflows/ansible-integration-tests.yml | 5 +- .github/workflows/ansible-test.yml | 1 + .vscode/settings.json | 3 + CHANGELOG.rst | 27 + CONTRIBUTING.md | 14 +- MAINTAINING.md | 53 ++ changelogs/.plugin-cache.yaml | 871 ++++++++++++++++++ changelogs/changelog.yaml | 25 + changelogs/config.yaml | 32 + changelogs/fragments/0001_disk.yml | 2 - galaxy.yml | 3 +- meta/runtime.yml | 2 +- 12 files changed, 1030 insertions(+), 8 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 CHANGELOG.rst create mode 100644 changelogs/.plugin-cache.yaml create mode 100644 changelogs/changelog.yaml create mode 100644 changelogs/config.yaml delete mode 100644 changelogs/fragments/0001_disk.yml diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index f4983e4..5d55523 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -19,8 +19,7 @@ jobs: strategy: matrix: ansible_version: - # - stable-2.13 - - stable-2.11 + - stable-2.13 steps: - name: check out code uses: actions/checkout@v2 @@ -29,7 +28,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.8' # this is the minimum version required for Ansible 2.11 + python-version: '3.8' # this is the minimum version required for Ansible 2.13 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 10f8c8b..87e315b 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -39,6 +39,7 @@ jobs: ansible_version: - stable-2.13 - stable-2.11 + - stable-2.9 steps: - name: check out code uses: actions/checkout@v2 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a7d0fc7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "esbonio.sphinx.confDir": "" +} \ No newline at end of file diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..b1fc26b --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,27 @@ +========================== +Google.Cloud Release Notes +========================== + +.. contents:: Topics + + +v1.1.0-beta.0 +============= + +Minor Changes +------------- + +- GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. + +Bugfixes +-------- + +- Disk has been fixed to send the sourceSnapshot parameter. +- gcp_cloudtasks_queue - was not functional before, and is now functional. +- gcp_compute_* - these resources use the correct selflink (www.googleapis.com) as the domain, no longer erroneously reporting changes after an execution. +- gcp_compute_backend_service - no longer erroneously reports changes after an execution for ``capacity_scaler``. +- gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth. +- gcp_crypto_key - skip_initial_version_creation defaults to the correct value. +- gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. +- gcp_spanner_database - recognize a non-existent resource as absent. +- gcp_storage_object - fix for correct version of dependency requirement. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fec48e6..79f6cb5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,7 @@ 1. [Clone the repository](#cloning). 1. Make the desired code change. +1. Add a [changelog fragment](https://docs.ansible.com/ansible/devel/community/development_process.html#changelogs-how-to) to describe your change. 1. [Run integration tests locally and ensure they pass](running-integration-tests). 1. Create a PR. @@ -86,4 +87,15 @@ If the linting fails, that is generally due to `ansible-lint`, which can be run ``` ansible-lint -``` \ No newline at end of file +``` + +## Specific Tasks + +The following enumerates detailed documentation for specific tasks related tot +the codebase. + +### Updating the supported ansible-core version + +1. modify the [ansible-integration-tests.yaml](.github/workflows/ansible-integration-tests.yml) to the version of ansible-core that you would like to test against. +1. (optional) update the version of ansible-core version required in [meta/runtime.yaml](meta/runtime.yml). + diff --git a/MAINTAINING.md b/MAINTAINING.md index ea60d9b..6b0e208 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -1,5 +1,10 @@ # Maintainer Documentation +## See CONTRIBUTING.md for more tasks + +[CONTRIBUTING.md](./CONTRIBUTING.md) contains more instructions that could +apply to contributors and not just maintainers (e.g. update ansible-core version). + ## CI GCP Project Configuration To enable running integration tests, a test GCP project must be provided. @@ -13,3 +18,51 @@ There is a Google-maintained CI project, `ansible-gcp-ci`, that is used for this Since running the full set of integration tests requires the usage of GCP credentials which are stored as a secret, maintainers must verify that tests pass the integration test run that runs on push to the master branch after accepting a change. +## Release Process + +### Overview + +The process is as follows: + +1. Update the version of the collection. +1. Update the changelog. +2. Create a GitHub release to tag the repo and begin the publishing process. + +### Steps + +#### Update Collection Version + +Modify the [galaxy.yaml](./galaxy.yml) file to the desired collection version: + +```yaml +version: {NEW_VERSION} +``` + +Ansible collection versions [must follow SEMVER](https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_distributing.html#collection-versions). + +Alpha / beta releases are optional. + +#### Update the changelog + +Providing a valid [CHANGELOG.rst](./CHANGELOG.rst) is required for a certifiable +collection release. + +Use the [antsibull-changelog](https://github.com/ansible-community/antsibull-changelog) +tool to generate the changelog: + +```sh +pip install antsibull-changelog +antsibull-changelog release +``` + +This will remove all the changelog fragments from ./changelogs/fragments and +merge them into CHANGELOG.rst. + +### Tag a release + +The release process is mostly automated, relying on GitHub releases and the following +workflows: + +- [publish to Ansible Galaxy](./.github/workflows/pythonpublish.yml). +- [publish to Automation Hub](./.github/workflows/automationhub.yml). + diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml new file mode 100644 index 0000000..fdbf2ed --- /dev/null +++ b/changelogs/.plugin-cache.yaml @@ -0,0 +1,871 @@ +objects: + role: {} +plugins: + become: {} + cache: {} + callback: {} + cliconf: {} + connection: {} + httpapi: {} + inventory: + gcp_compute: + description: Google Cloud Compute Engine inventory source + name: gcp_compute + version_added: null + lookup: {} + module: + gcp_appengine_firewall_rule: + description: Creates a GCP FirewallRule + name: gcp_appengine_firewall_rule + namespace: '' + version_added: null + gcp_appengine_firewall_rule_info: + description: Gather info for GCP FirewallRule + name: gcp_appengine_firewall_rule_info + namespace: '' + version_added: null + gcp_bigquery_dataset: + description: Creates a GCP Dataset + name: gcp_bigquery_dataset + namespace: '' + version_added: null + gcp_bigquery_dataset_info: + description: Gather info for GCP Dataset + name: gcp_bigquery_dataset_info + namespace: '' + version_added: null + gcp_bigquery_table: + description: Creates a GCP Table + name: gcp_bigquery_table + namespace: '' + version_added: null + gcp_bigquery_table_info: + description: Gather info for GCP Table + name: gcp_bigquery_table_info + namespace: '' + version_added: null + gcp_bigtable_instance: + description: Creates a GCP Instance + name: gcp_bigtable_instance + namespace: '' + version_added: null + gcp_bigtable_instance_info: + description: Gather info for GCP Instance + name: gcp_bigtable_instance_info + namespace: '' + version_added: null + gcp_cloudbuild_trigger: + description: Creates a GCP Trigger + name: gcp_cloudbuild_trigger + namespace: '' + version_added: null + gcp_cloudbuild_trigger_info: + description: Gather info for GCP Trigger + name: gcp_cloudbuild_trigger_info + namespace: '' + version_added: null + gcp_cloudfunctions_cloud_function: + description: Creates a GCP CloudFunction + name: gcp_cloudfunctions_cloud_function + namespace: '' + version_added: null + gcp_cloudfunctions_cloud_function_info: + description: Gather info for GCP CloudFunction + name: gcp_cloudfunctions_cloud_function_info + namespace: '' + version_added: null + gcp_cloudscheduler_job: + description: Creates a GCP Job + name: gcp_cloudscheduler_job + namespace: '' + version_added: null + gcp_cloudscheduler_job_info: + description: Gather info for GCP Job + name: gcp_cloudscheduler_job_info + namespace: '' + version_added: null + gcp_cloudtasks_queue: + description: Creates a GCP Queue + name: gcp_cloudtasks_queue + namespace: '' + version_added: null + gcp_cloudtasks_queue_info: + description: Gather info for GCP Queue + name: gcp_cloudtasks_queue_info + namespace: '' + version_added: null + gcp_compute_address: + description: Creates a GCP Address + name: gcp_compute_address + namespace: '' + version_added: null + gcp_compute_address_info: + description: Gather info for GCP Address + name: gcp_compute_address_info + namespace: '' + version_added: null + gcp_compute_autoscaler: + description: Creates a GCP Autoscaler + name: gcp_compute_autoscaler + namespace: '' + version_added: null + gcp_compute_autoscaler_info: + description: Gather info for GCP Autoscaler + name: gcp_compute_autoscaler_info + namespace: '' + version_added: null + gcp_compute_backend_bucket: + description: Creates a GCP BackendBucket + name: gcp_compute_backend_bucket + namespace: '' + version_added: null + gcp_compute_backend_bucket_info: + description: Gather info for GCP BackendBucket + name: gcp_compute_backend_bucket_info + namespace: '' + version_added: null + gcp_compute_backend_service: + description: Creates a GCP BackendService + name: gcp_compute_backend_service + namespace: '' + version_added: null + gcp_compute_backend_service_info: + description: Gather info for GCP BackendService + name: gcp_compute_backend_service_info + namespace: '' + version_added: null + gcp_compute_disk: + description: Creates a GCP Disk + name: gcp_compute_disk + namespace: '' + version_added: null + gcp_compute_disk_info: + description: Gather info for GCP Disk + name: gcp_compute_disk_info + namespace: '' + version_added: null + gcp_compute_external_vpn_gateway: + description: Creates a GCP ExternalVpnGateway + name: gcp_compute_external_vpn_gateway + namespace: '' + version_added: null + gcp_compute_external_vpn_gateway_info: + description: Gather info for GCP ExternalVpnGateway + name: gcp_compute_external_vpn_gateway_info + namespace: '' + version_added: null + gcp_compute_firewall: + description: Creates a GCP Firewall + name: gcp_compute_firewall + namespace: '' + version_added: null + gcp_compute_firewall_info: + description: Gather info for GCP Firewall + name: gcp_compute_firewall_info + namespace: '' + version_added: null + gcp_compute_forwarding_rule: + description: Creates a GCP ForwardingRule + name: gcp_compute_forwarding_rule + namespace: '' + version_added: null + gcp_compute_forwarding_rule_info: + description: Gather info for GCP ForwardingRule + name: gcp_compute_forwarding_rule_info + namespace: '' + version_added: null + gcp_compute_global_address: + description: Creates a GCP GlobalAddress + name: gcp_compute_global_address + namespace: '' + version_added: null + gcp_compute_global_address_info: + description: Gather info for GCP GlobalAddress + name: gcp_compute_global_address_info + namespace: '' + version_added: null + gcp_compute_global_forwarding_rule: + description: Creates a GCP GlobalForwardingRule + name: gcp_compute_global_forwarding_rule + namespace: '' + version_added: null + gcp_compute_global_forwarding_rule_info: + description: Gather info for GCP GlobalForwardingRule + name: gcp_compute_global_forwarding_rule_info + namespace: '' + version_added: null + gcp_compute_health_check: + description: Creates a GCP HealthCheck + name: gcp_compute_health_check + namespace: '' + version_added: null + gcp_compute_health_check_info: + description: Gather info for GCP HealthCheck + name: gcp_compute_health_check_info + namespace: '' + version_added: null + gcp_compute_http_health_check: + description: Creates a GCP HttpHealthCheck + name: gcp_compute_http_health_check + namespace: '' + version_added: null + gcp_compute_http_health_check_info: + description: Gather info for GCP HttpHealthCheck + name: gcp_compute_http_health_check_info + namespace: '' + version_added: null + gcp_compute_https_health_check: + description: Creates a GCP HttpsHealthCheck + name: gcp_compute_https_health_check + namespace: '' + version_added: null + gcp_compute_https_health_check_info: + description: Gather info for GCP HttpsHealthCheck + name: gcp_compute_https_health_check_info + namespace: '' + version_added: null + gcp_compute_image: + description: Creates a GCP Image + name: gcp_compute_image + namespace: '' + version_added: null + gcp_compute_image_info: + description: Gather info for GCP Image + name: gcp_compute_image_info + namespace: '' + version_added: null + gcp_compute_instance: + description: Creates a GCP Instance + name: gcp_compute_instance + namespace: '' + version_added: null + gcp_compute_instance_group: + description: Creates a GCP InstanceGroup + name: gcp_compute_instance_group + namespace: '' + version_added: null + gcp_compute_instance_group_info: + description: Gather info for GCP InstanceGroup + name: gcp_compute_instance_group_info + namespace: '' + version_added: null + gcp_compute_instance_group_manager: + description: Creates a GCP InstanceGroupManager + name: gcp_compute_instance_group_manager + namespace: '' + version_added: null + gcp_compute_instance_group_manager_info: + description: Gather info for GCP InstanceGroupManager + name: gcp_compute_instance_group_manager_info + namespace: '' + version_added: null + gcp_compute_instance_info: + description: Gather info for GCP Instance + name: gcp_compute_instance_info + namespace: '' + version_added: null + gcp_compute_instance_template: + description: Creates a GCP InstanceTemplate + name: gcp_compute_instance_template + namespace: '' + version_added: null + gcp_compute_instance_template_info: + description: Gather info for GCP InstanceTemplate + name: gcp_compute_instance_template_info + namespace: '' + version_added: null + gcp_compute_interconnect_attachment: + description: Creates a GCP InterconnectAttachment + name: gcp_compute_interconnect_attachment + namespace: '' + version_added: null + gcp_compute_interconnect_attachment_info: + description: Gather info for GCP InterconnectAttachment + name: gcp_compute_interconnect_attachment_info + namespace: '' + version_added: null + gcp_compute_network: + description: Creates a GCP Network + name: gcp_compute_network + namespace: '' + version_added: null + gcp_compute_network_endpoint_group: + description: Creates a GCP NetworkEndpointGroup + name: gcp_compute_network_endpoint_group + namespace: '' + version_added: null + gcp_compute_network_endpoint_group_info: + description: Gather info for GCP NetworkEndpointGroup + name: gcp_compute_network_endpoint_group_info + namespace: '' + version_added: null + gcp_compute_network_info: + description: Gather info for GCP Network + name: gcp_compute_network_info + namespace: '' + version_added: null + gcp_compute_node_group: + description: Creates a GCP NodeGroup + name: gcp_compute_node_group + namespace: '' + version_added: null + gcp_compute_node_group_info: + description: Gather info for GCP NodeGroup + name: gcp_compute_node_group_info + namespace: '' + version_added: null + gcp_compute_node_template: + description: Creates a GCP NodeTemplate + name: gcp_compute_node_template + namespace: '' + version_added: null + gcp_compute_node_template_info: + description: Gather info for GCP NodeTemplate + name: gcp_compute_node_template_info + namespace: '' + version_added: null + gcp_compute_region_autoscaler: + description: Creates a GCP RegionAutoscaler + name: gcp_compute_region_autoscaler + namespace: '' + version_added: null + gcp_compute_region_autoscaler_info: + description: Gather info for GCP RegionAutoscaler + name: gcp_compute_region_autoscaler_info + namespace: '' + version_added: null + gcp_compute_region_backend_service: + description: Creates a GCP RegionBackendService + name: gcp_compute_region_backend_service + namespace: '' + version_added: null + gcp_compute_region_backend_service_info: + description: Gather info for GCP RegionBackendService + name: gcp_compute_region_backend_service_info + namespace: '' + version_added: null + gcp_compute_region_disk: + description: Creates a GCP RegionDisk + name: gcp_compute_region_disk + namespace: '' + version_added: null + gcp_compute_region_disk_info: + description: Gather info for GCP RegionDisk + name: gcp_compute_region_disk_info + namespace: '' + version_added: null + gcp_compute_region_health_check: + description: Creates a GCP RegionHealthCheck + name: gcp_compute_region_health_check + namespace: '' + version_added: null + gcp_compute_region_health_check_info: + description: Gather info for GCP RegionHealthCheck + name: gcp_compute_region_health_check_info + namespace: '' + version_added: null + gcp_compute_region_instance_group_manager: + description: Creates a GCP RegionInstanceGroupManager + name: gcp_compute_region_instance_group_manager + namespace: '' + version_added: null + gcp_compute_region_instance_group_manager_info: + description: Gather info for GCP RegionInstanceGroupManager + name: gcp_compute_region_instance_group_manager_info + namespace: '' + version_added: null + gcp_compute_region_target_http_proxy: + description: Creates a GCP RegionTargetHttpProxy + name: gcp_compute_region_target_http_proxy + namespace: '' + version_added: null + gcp_compute_region_target_http_proxy_info: + description: Gather info for GCP RegionTargetHttpProxy + name: gcp_compute_region_target_http_proxy_info + namespace: '' + version_added: null + gcp_compute_region_target_https_proxy: + description: Creates a GCP RegionTargetHttpsProxy + name: gcp_compute_region_target_https_proxy + namespace: '' + version_added: null + gcp_compute_region_target_https_proxy_info: + description: Gather info for GCP RegionTargetHttpsProxy + name: gcp_compute_region_target_https_proxy_info + namespace: '' + version_added: null + gcp_compute_region_url_map: + description: Creates a GCP RegionUrlMap + name: gcp_compute_region_url_map + namespace: '' + version_added: null + gcp_compute_region_url_map_info: + description: Gather info for GCP RegionUrlMap + name: gcp_compute_region_url_map_info + namespace: '' + version_added: null + gcp_compute_reservation: + description: Creates a GCP Reservation + name: gcp_compute_reservation + namespace: '' + version_added: null + gcp_compute_reservation_info: + description: Gather info for GCP Reservation + name: gcp_compute_reservation_info + namespace: '' + version_added: null + gcp_compute_resource_policy: + description: Creates a GCP ResourcePolicy + name: gcp_compute_resource_policy + namespace: '' + version_added: null + gcp_compute_resource_policy_info: + description: Gather info for GCP ResourcePolicy + name: gcp_compute_resource_policy_info + namespace: '' + version_added: null + gcp_compute_route: + description: Creates a GCP Route + name: gcp_compute_route + namespace: '' + version_added: null + gcp_compute_route_info: + description: Gather info for GCP Route + name: gcp_compute_route_info + namespace: '' + version_added: null + gcp_compute_router: + description: Creates a GCP Router + name: gcp_compute_router + namespace: '' + version_added: null + gcp_compute_router_info: + description: Gather info for GCP Router + name: gcp_compute_router_info + namespace: '' + version_added: null + gcp_compute_snapshot: + description: Creates a GCP Snapshot + name: gcp_compute_snapshot + namespace: '' + version_added: null + gcp_compute_snapshot_info: + description: Gather info for GCP Snapshot + name: gcp_compute_snapshot_info + namespace: '' + version_added: null + gcp_compute_ssl_certificate: + description: Creates a GCP SslCertificate + name: gcp_compute_ssl_certificate + namespace: '' + version_added: null + gcp_compute_ssl_certificate_info: + description: Gather info for GCP SslCertificate + name: gcp_compute_ssl_certificate_info + namespace: '' + version_added: null + gcp_compute_ssl_policy: + description: Creates a GCP SslPolicy + name: gcp_compute_ssl_policy + namespace: '' + version_added: null + gcp_compute_ssl_policy_info: + description: Gather info for GCP SslPolicy + name: gcp_compute_ssl_policy_info + namespace: '' + version_added: null + gcp_compute_subnetwork: + description: Creates a GCP Subnetwork + name: gcp_compute_subnetwork + namespace: '' + version_added: null + gcp_compute_subnetwork_info: + description: Gather info for GCP Subnetwork + name: gcp_compute_subnetwork_info + namespace: '' + version_added: null + gcp_compute_target_http_proxy: + description: Creates a GCP TargetHttpProxy + name: gcp_compute_target_http_proxy + namespace: '' + version_added: null + gcp_compute_target_http_proxy_info: + description: Gather info for GCP TargetHttpProxy + name: gcp_compute_target_http_proxy_info + namespace: '' + version_added: null + gcp_compute_target_https_proxy: + description: Creates a GCP TargetHttpsProxy + name: gcp_compute_target_https_proxy + namespace: '' + version_added: null + gcp_compute_target_https_proxy_info: + description: Gather info for GCP TargetHttpsProxy + name: gcp_compute_target_https_proxy_info + namespace: '' + version_added: null + gcp_compute_target_instance: + description: Creates a GCP TargetInstance + name: gcp_compute_target_instance + namespace: '' + version_added: null + gcp_compute_target_instance_info: + description: Gather info for GCP TargetInstance + name: gcp_compute_target_instance_info + namespace: '' + version_added: null + gcp_compute_target_pool: + description: Creates a GCP TargetPool + name: gcp_compute_target_pool + namespace: '' + version_added: null + gcp_compute_target_pool_info: + description: Gather info for GCP TargetPool + name: gcp_compute_target_pool_info + namespace: '' + version_added: null + gcp_compute_target_ssl_proxy: + description: Creates a GCP TargetSslProxy + name: gcp_compute_target_ssl_proxy + namespace: '' + version_added: null + gcp_compute_target_ssl_proxy_info: + description: Gather info for GCP TargetSslProxy + name: gcp_compute_target_ssl_proxy_info + namespace: '' + version_added: null + gcp_compute_target_tcp_proxy: + description: Creates a GCP TargetTcpProxy + name: gcp_compute_target_tcp_proxy + namespace: '' + version_added: null + gcp_compute_target_tcp_proxy_info: + description: Gather info for GCP TargetTcpProxy + name: gcp_compute_target_tcp_proxy_info + namespace: '' + version_added: null + gcp_compute_target_vpn_gateway: + description: Creates a GCP TargetVpnGateway + name: gcp_compute_target_vpn_gateway + namespace: '' + version_added: null + gcp_compute_target_vpn_gateway_info: + description: Gather info for GCP TargetVpnGateway + name: gcp_compute_target_vpn_gateway_info + namespace: '' + version_added: null + gcp_compute_url_map: + description: Creates a GCP UrlMap + name: gcp_compute_url_map + namespace: '' + version_added: null + gcp_compute_url_map_info: + description: Gather info for GCP UrlMap + name: gcp_compute_url_map_info + namespace: '' + version_added: null + gcp_compute_vpn_tunnel: + description: Creates a GCP VpnTunnel + name: gcp_compute_vpn_tunnel + namespace: '' + version_added: null + gcp_compute_vpn_tunnel_info: + description: Gather info for GCP VpnTunnel + name: gcp_compute_vpn_tunnel_info + namespace: '' + version_added: null + gcp_container_cluster: + description: Creates a GCP Cluster + name: gcp_container_cluster + namespace: '' + version_added: null + gcp_container_cluster_info: + description: Gather info for GCP Cluster + name: gcp_container_cluster_info + namespace: '' + version_added: null + gcp_container_node_pool: + description: Creates a GCP NodePool + name: gcp_container_node_pool + namespace: '' + version_added: null + gcp_container_node_pool_info: + description: Gather info for GCP NodePool + name: gcp_container_node_pool_info + namespace: '' + version_added: null + gcp_dns_managed_zone: + description: Creates a GCP ManagedZone + name: gcp_dns_managed_zone + namespace: '' + version_added: null + gcp_dns_managed_zone_info: + description: Gather info for GCP ManagedZone + name: gcp_dns_managed_zone_info + namespace: '' + version_added: null + gcp_dns_resource_record_set: + description: Creates a GCP ResourceRecordSet + name: gcp_dns_resource_record_set + namespace: '' + version_added: null + gcp_dns_resource_record_set_info: + description: Gather info for GCP ResourceRecordSet + name: gcp_dns_resource_record_set_info + namespace: '' + version_added: null + gcp_filestore_instance: + description: Creates a GCP Instance + name: gcp_filestore_instance + namespace: '' + version_added: null + gcp_filestore_instance_info: + description: Gather info for GCP Instance + name: gcp_filestore_instance_info + namespace: '' + version_added: null + gcp_iam_role: + description: Creates a GCP Role + name: gcp_iam_role + namespace: '' + version_added: null + gcp_iam_role_info: + description: Gather info for GCP Role + name: gcp_iam_role_info + namespace: '' + version_added: null + gcp_iam_service_account: + description: Creates a GCP ServiceAccount + name: gcp_iam_service_account + namespace: '' + version_added: null + gcp_iam_service_account_info: + description: Gather info for GCP ServiceAccount + name: gcp_iam_service_account_info + namespace: '' + version_added: null + gcp_iam_service_account_key: + description: Creates a GCP ServiceAccountKey + name: gcp_iam_service_account_key + namespace: '' + version_added: null + gcp_kms_crypto_key: + description: Creates a GCP CryptoKey + name: gcp_kms_crypto_key + namespace: '' + version_added: null + gcp_kms_crypto_key_info: + description: Gather info for GCP CryptoKey + name: gcp_kms_crypto_key_info + namespace: '' + version_added: null + gcp_kms_key_ring: + description: Creates a GCP KeyRing + name: gcp_kms_key_ring + namespace: '' + version_added: null + gcp_kms_key_ring_info: + description: Gather info for GCP KeyRing + name: gcp_kms_key_ring_info + namespace: '' + version_added: null + gcp_logging_metric: + description: Creates a GCP Metric + name: gcp_logging_metric + namespace: '' + version_added: null + gcp_logging_metric_info: + description: Gather info for GCP Metric + name: gcp_logging_metric_info + namespace: '' + version_added: null + gcp_mlengine_model: + description: Creates a GCP Model + name: gcp_mlengine_model + namespace: '' + version_added: null + gcp_mlengine_model_info: + description: Gather info for GCP Model + name: gcp_mlengine_model_info + namespace: '' + version_added: null + gcp_mlengine_version: + description: Creates a GCP Version + name: gcp_mlengine_version + namespace: '' + version_added: null + gcp_mlengine_version_info: + description: Gather info for GCP Version + name: gcp_mlengine_version_info + namespace: '' + version_added: null + gcp_pubsub_subscription: + description: Creates a GCP Subscription + name: gcp_pubsub_subscription + namespace: '' + version_added: null + gcp_pubsub_subscription_info: + description: Gather info for GCP Subscription + name: gcp_pubsub_subscription_info + namespace: '' + version_added: null + gcp_pubsub_topic: + description: Creates a GCP Topic + name: gcp_pubsub_topic + namespace: '' + version_added: null + gcp_pubsub_topic_info: + description: Gather info for GCP Topic + name: gcp_pubsub_topic_info + namespace: '' + version_added: null + gcp_redis_instance: + description: Creates a GCP Instance + name: gcp_redis_instance + namespace: '' + version_added: null + gcp_redis_instance_info: + description: Gather info for GCP Instance + name: gcp_redis_instance_info + namespace: '' + version_added: null + gcp_resourcemanager_project: + description: Creates a GCP Project + name: gcp_resourcemanager_project + namespace: '' + version_added: null + gcp_resourcemanager_project_info: + description: Gather info for GCP Project + name: gcp_resourcemanager_project_info + namespace: '' + version_added: null + gcp_runtimeconfig_config: + description: Creates a GCP Config + name: gcp_runtimeconfig_config + namespace: '' + version_added: null + gcp_runtimeconfig_config_info: + description: Gather info for GCP Config + name: gcp_runtimeconfig_config_info + namespace: '' + version_added: null + gcp_runtimeconfig_variable: + description: Creates a GCP Variable + name: gcp_runtimeconfig_variable + namespace: '' + version_added: null + gcp_runtimeconfig_variable_info: + description: Gather info for GCP Variable + name: gcp_runtimeconfig_variable_info + namespace: '' + version_added: null + gcp_serviceusage_service: + description: Creates a GCP Service + name: gcp_serviceusage_service + namespace: '' + version_added: null + gcp_serviceusage_service_info: + description: Gather info for GCP Service + name: gcp_serviceusage_service_info + namespace: '' + version_added: null + gcp_sourcerepo_repository: + description: Creates a GCP Repository + name: gcp_sourcerepo_repository + namespace: '' + version_added: null + gcp_sourcerepo_repository_info: + description: Gather info for GCP Repository + name: gcp_sourcerepo_repository_info + namespace: '' + version_added: null + gcp_spanner_database: + description: Creates a GCP Database + name: gcp_spanner_database + namespace: '' + version_added: null + gcp_spanner_database_info: + description: Gather info for GCP Database + name: gcp_spanner_database_info + namespace: '' + version_added: null + gcp_spanner_instance: + description: Creates a GCP Instance + name: gcp_spanner_instance + namespace: '' + version_added: null + gcp_spanner_instance_info: + description: Gather info for GCP Instance + name: gcp_spanner_instance_info + namespace: '' + version_added: null + gcp_sql_database: + description: Creates a GCP Database + name: gcp_sql_database + namespace: '' + version_added: null + gcp_sql_database_info: + description: Gather info for GCP Database + name: gcp_sql_database_info + namespace: '' + version_added: null + gcp_sql_instance: + description: Creates a GCP Instance + name: gcp_sql_instance + namespace: '' + version_added: null + gcp_sql_instance_info: + description: Gather info for GCP Instance + name: gcp_sql_instance_info + namespace: '' + version_added: null + gcp_sql_ssl_cert: + description: Creates a GCP SslCert + name: gcp_sql_ssl_cert + namespace: '' + version_added: null + gcp_sql_user: + description: Creates a GCP User + name: gcp_sql_user + namespace: '' + version_added: null + gcp_sql_user_info: + description: Gather info for GCP User + name: gcp_sql_user_info + namespace: '' + version_added: null + gcp_storage_bucket: + description: Creates a GCP Bucket + name: gcp_storage_bucket + namespace: '' + version_added: null + gcp_storage_bucket_access_control: + description: Creates a GCP BucketAccessControl + name: gcp_storage_bucket_access_control + namespace: '' + version_added: null + gcp_storage_default_object_acl: + description: Creates a GCP DefaultObjectACL + name: gcp_storage_default_object_acl + namespace: '' + version_added: null + gcp_storage_object: + description: Creates a GCP Object + name: gcp_storage_object + namespace: '' + version_added: null + gcp_tpu_node: + description: Creates a GCP Node + name: gcp_tpu_node + namespace: '' + version_added: null + gcp_tpu_node_info: + description: Gather info for GCP Node + name: gcp_tpu_node_info + namespace: '' + version_added: null + netconf: {} + shell: {} + strategy: {} + vars: {} +version: 1.1.0-beta.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..3230bd9 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,25 @@ +ancestor: null +releases: + 1.1.0-beta.0: + changes: + bugfixes: + - Disk has been fixed to send the sourceSnapshot parameter. + - gcp_cloudtasks_queue - was not functional before, and is now functional. + - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) + as the domain, no longer erroneously reporting changes after an execution. + - gcp_compute_backend_service - no longer erroneously reports changes after + an execution for ``capacity_scaler``. + - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot + use basic-auth. + - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. + - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as + absent. + - gcp_spanner_database - recognize a non-existent resource as absent. + - gcp_storage_object - fix for correct version of dependency requirement. + minor_changes: + - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the + name parameter. + fragments: + - 0001_disk.yml + - bugfixes.yaml + release_date: '2022-12-03' diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..9f7513d --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,32 @@ +changelog_filename_template: ../CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +sanitize_changelog: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Google.Cloud +trivial_section_name: trivial +use_fqcn: true diff --git a/changelogs/fragments/0001_disk.yml b/changelogs/fragments/0001_disk.yml deleted file mode 100644 index 2fccc03..0000000 --- a/changelogs/fragments/0001_disk.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - Disk has been fixed to send the sourceSnapshot parameter. diff --git a/galaxy.yml b/galaxy.yml index f47d2f5..60ec021 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: 1.0.2 +version: 1.1.0-beta.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -18,6 +18,7 @@ readme: README.md # @nicks:irc/im.site#channel' authors: - Google +- Google ### OPTIONAL but strongly recommended diff --git a/meta/runtime.yml b/meta/runtime.yml index 31ab772..d28681a 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.9' +requires_ansible: '>=2.9.10' action_groups: gcp: From eab8b1fb7b609eabf8258832dfe68b9703ac27f8 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 4 Dec 2022 05:35:13 +0000 Subject: [PATCH 051/138] disable spanner_database_info tests, python to 3.9 The client's List continues to be flakey. disabling until the endpoint is stable. Switching tests to use ansible 2.14, as 2.13 has issues with spawning a docker container. Upgrading the base python version as a consequence. Removing the need for docker from unit tests, since that was failing and also non-critical to run unit tests. --- .../workflows/ansible-integration-tests.yml | 4 +-- .github/workflows/ansible-test.yml | 9 ++++--- requirements-test.txt | 3 +++ .../gcp_spanner_database/tasks/autogen.yml | 26 +++++++++---------- 4 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 requirements-test.txt diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index 5d55523..e4bd87e 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.8' # this is the minimum version required for Ansible 2.13 + python-version: '3.9' # this is the minimum version required for Ansible 2.13 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) @@ -62,4 +62,4 @@ jobs: # run tests - name: Run integration tests # Add the -vvv flag to print out more output - run: ansible-test integration -v --color --python 3.8 --venv-system-site-packages \ No newline at end of file + run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages \ No newline at end of file diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 87e315b..ecec485 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -37,9 +37,8 @@ jobs: strategy: matrix: ansible_version: - - stable-2.13 + - stable-2.14 - stable-2.11 - - stable-2.9 steps: - name: check out code uses: actions/checkout@v2 @@ -48,10 +47,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.8' # this is the minimum version required for Ansible 2.11 + python-version: '3.9' # this is the minimum version required for Ansible 2.14 - name: Install dependencies run: pip install -r requirements.txt + - name: Install test dependencies + run: pip install -r requirements-test.txt - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run unit tests - run: ansible-test units --docker -v --color --python 3.8 \ No newline at end of file + run: ansible-test units -v --color --python 3.9 \ No newline at end of file diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..ce44d15 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,3 @@ +pytest +pytest-forked +pytest-xdist \ No newline at end of file diff --git a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml index 5287f5d..cf1b808 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml @@ -48,19 +48,19 @@ assert: that: - result.changed == true -- name: verify that database was created - google.cloud.gcp_spanner_database_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1 +# - name: verify that database was created +# google.cloud.gcp_spanner_database_info: +# instance: "{{ instance }}" +# project: "{{ gcp_project }}" +# auth_kind: "{{ gcp_cred_kind }}" +# service_account_file: "{{ gcp_cred_file }}" +# scopes: +# - https://www.googleapis.com/auth/spanner.admin +# register: results +# - name: verify that command succeeded +# assert: +# that: +# - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a database that already exists google.cloud.gcp_spanner_database: From 4c90fac19f81d5231a053319c28f3e12dbb178b8 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 4 Dec 2022 20:07:26 +0000 Subject: [PATCH 052/138] tests: fix integration tests not running on push The integration test filter syntax was restrictive and disabled running them on push. --- .github/workflows/ansible-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index e4bd87e..a921653 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -11,7 +11,7 @@ jobs: # NOTE: GitHub does not allow secrets to be used # in PRs sent from forks. As such, this configuration is for # PRs that the maintainers would like to send to test. - if: github.event.pull_request.head.repo.full_name == github.repository + if: github.event.push != null || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest defaults: run: From f87e7f47b4b01cacefd645ee3c2d21418633ab9c Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sun, 4 Dec 2022 20:12:50 +0000 Subject: [PATCH 053/138] tests: fix integration tests 2 the previous fix had invalid syntax (hard to test against the master branch until after push). This syntax is documented as correct: https://github.com/actions/runner/issues/950 --- .github/workflows/ansible-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index a921653..fbd44e6 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -11,7 +11,7 @@ jobs: # NOTE: GitHub does not allow secrets to be used # in PRs sent from forks. As such, this configuration is for # PRs that the maintainers would like to send to test. - if: github.event.push != null || github.event.pull_request.head.repo.full_name == github.repository + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest defaults: run: From 3fb4763e3774ef53d4ad3cdffad786c342116b48 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Mon, 5 Dec 2022 17:01:31 +0000 Subject: [PATCH 054/138] fix automation hub workflow The automation hub workflow was passing an incorrect API key. --- .github/workflows/automationhub.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automationhub.yml b/.github/workflows/automationhub.yml index 969904c..29e1262 100644 --- a/.github/workflows/automationhub.yml +++ b/.github/workflows/automationhub.yml @@ -22,4 +22,4 @@ jobs: ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} run: | ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_GALAXY_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ + ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ From a9545c77a4b032fd7c493b67d2838529ef2a4230 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Tue, 6 Dec 2022 22:06:02 -0800 Subject: [PATCH 055/138] fix linting and updating maintenance guide Updating the maintainers guide with updated intructions from Ansible engineers. Fixing linting issues, and adding the linter as a GitHub workflow to ensure there are no regressions. --- .github/workflows/ansible-test.yml | 61 ++++++++++--------- .gitignore | 1 + MAINTAINING.md | 20 ++++-- plugins/inventory/gcp_compute.py | 2 +- .../modules/gcp_compute_backend_service.py | 2 +- plugins/modules/gcp_compute_region_url_map.py | 4 +- .../gcp_compute_region_url_map_info.py | 2 +- plugins/modules/gcp_compute_url_map.py | 12 ++-- plugins/modules/gcp_compute_url_map_info.py | 2 +- plugins/modules/gcp_compute_vpn_tunnel.py | 4 +- plugins/modules/gcp_iam_role.py | 12 ++-- roles/google_cloud_ops_agents | 1 - scripts/cleanup-project.sh | 39 ++++++------ .../build-function-zip.sh | 2 +- test-fixtures/cloud-function-source/main.py | 1 + 15 files changed, 91 insertions(+), 74 deletions(-) delete mode 160000 roles/google_cloud_ops_agents diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index ecec485..d342d2a 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -1,34 +1,35 @@ name: "Run tests for the cloud.google collection" on: [pull_request] +env: + PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 jobs: - # sanity tests cannot be turned on until #498 is resolved. - # sanity: - # runs-on: ubuntu-latest - # defaults: - # run: - # working-directory: ansible_collections/google/cloud - # strategy: - # matrix: - # ansible_version: - # - stable-2.13 - # - stable-2.11 - # steps: - # - name: check out code - # uses: actions/checkout@v2 - # with: - # path: ansible_collections/google/cloud - # - name: Set up Python - # uses: actions/setup-python@v1 - # with: - # python-version: '3.8' # this is the minimum version required for Ansible 2.11 - # - name: Install ansible-base (${{ matrix.ansible_version }}) - # uses: nick-invision/retry@v2 - # with: - # timeout_minutes: 3 - # max_attempts: 3 - # command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - # - name: Run sanity tests - # run: ansible-test sanity --docker -v --color --python 3.8 + sanity: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + - stable-2.14 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{ env.PYTHON_VERSION }} + - name: Install ansible-base (${{ matrix.ansible_version }}) + uses: nick-invision/retry@v2 + with: + timeout_minutes: 3 + max_attempts: 3 + command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Run sanity tests + # validate-modules cannot be turned on until #498 is resolved. + run: ansible-test sanity -v --color --python "$PYTHON_VERSION" --skip validate-modules unit: runs-on: ubuntu-latest defaults: @@ -47,7 +48,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.9' # this is the minimum version required for Ansible 2.14 + python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: pip install -r requirements.txt - name: Install test dependencies @@ -55,4 +56,4 @@ jobs: - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run unit tests - run: ansible-test units -v --color --python 3.9 \ No newline at end of file + run: ansible-test units -v --color --python "$PYTHON_VERSION" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2277278..c466a16 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tests/integration/cloud-config-gcp.ini tests/integration/inventory tests/output/ __pycache__ +*.tar.gz diff --git a/MAINTAINING.md b/MAINTAINING.md index 6b0e208..97cc5e3 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -58,11 +58,23 @@ antsibull-changelog release This will remove all the changelog fragments from ./changelogs/fragments and merge them into CHANGELOG.rst. -### Tag a release +### Create a new GitHub release -The release process is mostly automated, relying on GitHub releases and the following -workflows: +Creating - [publish to Ansible Galaxy](./.github/workflows/pythonpublish.yml). -- [publish to Automation Hub](./.github/workflows/automationhub.yml). +### Publish to Automation Hub + +*note*: As automation Hub only accepts production releases, this step +is only required for new full releases. + +This step does not use GitHub actions, as API keys for Automation Hub +expire after 30 days of no use, and a maintainer may find themselves +refreshing tokens every time anyway. + +Steps: + +1. Build the package locally: `ansible-galaxy collection build .` +1. [Go to the Automation Hub my-namespaces page, then click on Google](https://console.redhat.com/ansible/automation-hub/repo/published/my-namespaces/google/) +1. Publish the package \ No newline at end of file diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 26ddeb5..d5d435a 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -521,7 +521,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): return self._return_if_object(module, response) def projects_for_folder(self, config_data, folder): - link = 'https://cloudresourcemanager.googleapis.com/v1/projects'.format() + link = 'https://cloudresourcemanager.googleapis.com/v1/projects' query = 'parent.id = {0}'.format(folder) projects = [] config_data['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index 3cff36d..a637a9e 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -1433,7 +1433,7 @@ def main(): elements="dict", options=dict( balancing_mode=dict(default="UTILIZATION", type="str"), - # TODO: capacity_scaler does some value normalization + # TODO: capacity_scaler does some value normalization # server-side, so there needs to be a way to do proper # value comparison. capacity_scaler=dict(default="1", type="str"), diff --git a/plugins/modules/gcp_compute_region_url_map.py b/plugins/modules/gcp_compute_region_url_map.py index d1ce756..ac46b1c 100644 --- a/plugins/modules/gcp_compute_region_url_map.py +++ b/plugins/modules/gcp_compute_region_url_map.py @@ -961,7 +961,7 @@ options: paths: description: - 'The list of path patterns to match. Each must start with / and the - only place a \* is allowed is at the end following a /. The string fed + only place a \\ * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' elements: str @@ -2522,7 +2522,7 @@ pathMatchers: paths: description: - 'The list of path patterns to match. Each must start with / and the only - place a \* is allowed is at the end following a /. The string fed to the + place a \\* is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' returned: success diff --git a/plugins/modules/gcp_compute_region_url_map_info.py b/plugins/modules/gcp_compute_region_url_map_info.py index 55df4e9..ae5f174 100644 --- a/plugins/modules/gcp_compute_region_url_map_info.py +++ b/plugins/modules/gcp_compute_region_url_map_info.py @@ -991,7 +991,7 @@ resources: paths: description: - 'The list of path patterns to match. Each must start with / and the - only place a \* is allowed is at the end following a /. The string + only place a \\* is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' returned: success diff --git a/plugins/modules/gcp_compute_url_map.py b/plugins/modules/gcp_compute_url_map.py index b27d41a..ed35cfc 100644 --- a/plugins/modules/gcp_compute_url_map.py +++ b/plugins/modules/gcp_compute_url_map.py @@ -325,7 +325,7 @@ options: paths: description: - 'The list of path patterns to match. Each must start with / and the - only place a \* is allowed is at the end following a /. The string fed + only place a \\* is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' elements: str @@ -2899,7 +2899,7 @@ pathMatchers: paths: description: - 'The list of path patterns to match. Each must start with / and the only - place a \* is allowed is at the end following a /. The string fed to the + place a \\* is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' returned: success @@ -5489,10 +5489,10 @@ def main(): if fetch: module.params['fingerprint'] = fetch['fingerprint'] if state == 'present': - if is_different(module, fetch): - update(module, self_link(module), kind) - fetch = fetch_resource(module, self_link(module), kind) - changed = True + if is_different(module, fetch): + update(module, self_link(module), kind) + fetch = fetch_resource(module, self_link(module), kind) + changed = True else: delete(module, self_link(module), kind) fetch = {} diff --git a/plugins/modules/gcp_compute_url_map_info.py b/plugins/modules/gcp_compute_url_map_info.py index 88d1dd7..0bbc262 100644 --- a/plugins/modules/gcp_compute_url_map_info.py +++ b/plugins/modules/gcp_compute_url_map_info.py @@ -382,7 +382,7 @@ resources: paths: description: - 'The list of path patterns to match. Each must start with / and the - only place a \* is allowed is at the end following a /. The string + only place a \\* is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.' returned: success diff --git a/plugins/modules/gcp_compute_vpn_tunnel.py b/plugins/modules/gcp_compute_vpn_tunnel.py index d91717c..60705a6 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel.py +++ b/plugins/modules/gcp_compute_vpn_tunnel.py @@ -535,14 +535,14 @@ def is_different(module, response): response_vals = {} for k, v in response.items(): if k in keys_to_ignore: - continue + continue if k in request: response_vals[k] = v request_vals = {} for k, v in request.items(): if k in keys_to_ignore: - continue + continue if k in response: request_vals[k] = v diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index 3600ab6..74c6050 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -219,9 +219,9 @@ def main(): fetch = fetch_resource(module, self_link(module)) changed = True elif not fetch.get("deleted"): - delete(module, self_link(module)) - fetch = {} - changed = True + delete(module, self_link(module)) + fetch = {} + changed = True else: if state == "present": fetch = create(module, collection(module)) @@ -242,7 +242,7 @@ def create(module, link): def undelete(module, link, etag): auth = GcpSession(module, "iam") return return_if_object(module, auth.post(link + ":undelete", { - "etag": etag + "etag": etag })) @@ -322,8 +322,8 @@ def return_if_object(module, response, allow_not_found=False): # catches and edge case specific to IAM roles where the role not # existing returns 400. - if (allow_not_found and response.status_code == 400 - and "You can't delete role_id" in response.text): + if (allow_not_found and response.status_code == 400 + and "You can't delete role_id" in response.text): return None try: diff --git a/roles/google_cloud_ops_agents b/roles/google_cloud_ops_agents deleted file mode 160000 index 9a36582..0000000 --- a/roles/google_cloud_ops_agents +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9a36582f0d762e386a56e698d896c22bebf6d904 diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 1394b42..8c78e5f 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -8,42 +8,45 @@ # - google-cloud-sdk (gcloudgcloud ) set -e PROJECT_ID="${1}" -SERVICE_ACCOUNT_NAME="${2}" +# service account is unused today +# SERVICE_ACCOUNT_NAME="${2}" ZONE="us-central1-a" main() { # note: the ordering here is deliberate, to start with # leaf resources and work upwards to parent resources. - cleanup_resource_per_region "compute vpn-tunnels" - cleanup_resource "compute instances" "" "--zone=$ZONE" - cleanup_resource_per_region "compute addresses" - cleanup_resource "compute target-http-proxies" "" "--global" - cleanup_resource "compute forwarding-rules" "--global" "--global" - cleanup_resource "compute forwarding-rules" \ + cleanup_resource_per_region "compute" "vpn-tunnels" + cleanup_resource "compute" "instances" "" "--zone=$ZONE" + cleanup_resource_per_region "compute" "addresses" + cleanup_resource "compute" "target-http-proxies" "" "--global" + cleanup_resource "compute" "forwarding-rules" "--global" "--global" + cleanup_resource "compute" "forwarding-rules" \ "--regions=us-central1" "--region=us-central1" - cleanup_resource "compute url-maps" "--global" "--global" - cleanup_resource "compute url-maps" \ + cleanup_resource "compute" "url-maps" "--global" "--global" + cleanup_resource "compute" "url-maps" \ "--regions=us-central1" "--region=us-central1" - cleanup_resource "compute backend-services" "--global" "--global" - cleanup_resource "compute backend-services" \ + cleanup_resource "compute" "backend-services" "--global" "--global" + cleanup_resource "compute" "backend-services" \ "--regions=us-central1" "--region=us-central1" } cleanup_resource() { resource_group="$1" - extra_list_args="$2" - extra_delete_args="$3" + resource="$2" + extra_list_arg="$3" + extra_delete_arg="$4" - for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)" $extra_list_args); do - gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q $extra_delete_args + for resource_id in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do + gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" done } cleanup_resource_per_region() { resource_group="$1" - for resource_and_region in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do - read -r resource region < <(echo "$resource_and_region" | tr "," " ") - gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q --region="${region}" + resource="$2" + for resource_and_region in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do + read -r resource_id region < <(echo "$resource_and_region" | tr "," " ") + gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q --region="${region}" done } diff --git a/test-fixtures/cloud-function-source/build-function-zip.sh b/test-fixtures/cloud-function-source/build-function-zip.sh index 626b80c..2ff2577 100755 --- a/test-fixtures/cloud-function-source/build-function-zip.sh +++ b/test-fixtures/cloud-function-source/build-function-zip.sh @@ -4,4 +4,4 @@ if [ -f ../cloud-function.zip ]; then rm ../cloud-function.zip fi -zip ../cloud-function.zip * \ No newline at end of file +zip ../cloud-function.zip ./* \ No newline at end of file diff --git a/test-fixtures/cloud-function-source/main.py b/test-fixtures/cloud-function-source/main.py index 980996a..2578c41 100644 --- a/test-fixtures/cloud-function-source/main.py +++ b/test-fixtures/cloud-function-source/main.py @@ -1,5 +1,6 @@ import functions_framework + # Register an HTTP function with the Functions Framework @functions_framework.http def helloGET(request): From 4907356bbad1d0dde4ac9e53ed96ed1e4dc4be28 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 10 Dec 2022 09:54:28 -0800 Subject: [PATCH 056/138] fixing ansible-lint errors, fix gcsfuse Ansible-lint is required for Ansible collection certification for Automation Hub. gcsfuse had no metadata associated with it, failing the Ansible Hub upload. --- .github/workflows/ansible-test.yml | 14 ++++++------- molecule/gcloud/archive_playbook.yml | 2 +- molecule/gcloud/converge.yml | 7 ++++--- molecule/gcloud/package_playbook.yml | 2 +- molecule/gcsfuse/converge.yml | 3 ++- roles/gcloud/meta/main.yml | 2 +- .../gcloud/tasks/archive/archive_install.yml | 7 +++++-- .../tasks/archive/command_completion.yml | 3 ++- roles/gcloud/tasks/archive/main.yml | 11 +++++----- roles/gcloud/tasks/main.yml | 4 ++-- roles/gcloud/tasks/package/debian.yml | 8 ++++++-- roles/gcloud/tasks/package/main.yml | 2 +- roles/gcloud/tasks/package/redhat.yml | 8 ++++++-- roles/gcsfuse/meta/main.yml | 20 +++++++++++++++++++ roles/gcsfuse/tasks/debian.yml | 7 +++++-- roles/gcsfuse/tasks/main.yml | 4 ++-- 16 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 roles/gcsfuse/meta/main.yml diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index d342d2a..5b58831 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -3,7 +3,7 @@ on: [pull_request] env: PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 jobs: - sanity: + sanity-and-lint: runs-on: ubuntu-latest defaults: run: @@ -22,14 +22,14 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - name: Install ansible-base (${{ matrix.ansible_version }}) - uses: nick-invision/retry@v2 - with: - timeout_minutes: 3 - max_attempts: 3 - command: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - - name: Run sanity tests + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Run ansible-test sanity # validate-modules cannot be turned on until #498 is resolved. run: ansible-test sanity -v --color --python "$PYTHON_VERSION" --skip validate-modules + - name: Install ansible-lint + run: pip install ansible-lint + - name: Run ansible-lint + run: ansible-lint unit: runs-on: ubuntu-latest defaults: diff --git a/molecule/gcloud/archive_playbook.yml b/molecule/gcloud/archive_playbook.yml index 5f64954..97c84af 100644 --- a/molecule/gcloud/archive_playbook.yml +++ b/molecule/gcloud/archive_playbook.yml @@ -6,7 +6,7 @@ ansible.builtin.apt: name: gnupg update_cache: true - when: ansible_os_family|lower == "debian" + when: ansible_os_family | lower == "debian" roles: - role: google.cloud.gcloud gcloud_install_type: archive diff --git a/molecule/gcloud/converge.yml b/molecule/gcloud/converge.yml index eb1bceb..8694745 100644 --- a/molecule/gcloud/converge.yml +++ b/molecule/gcloud/converge.yml @@ -3,19 +3,20 @@ hosts: all pre_tasks: - name: Update package cache - ansible.builtin.package: update_cache=yes + ansible.builtin.package: + update_cache: "yes" changed_when: false register: task_result until: task_result is success retries: 10 delay: 2 - - name: create containerd folder + - name: Create containerd folder ansible.builtin.file: path: /etc/systemd/system/containerd.service.d state: directory mode: 0755 when: ansible_service_mgr == "systemd" - - name: override file for containerd + - name: Override file for containerd ansible.builtin.copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf diff --git a/molecule/gcloud/package_playbook.yml b/molecule/gcloud/package_playbook.yml index fe18f65..68af24e 100644 --- a/molecule/gcloud/package_playbook.yml +++ b/molecule/gcloud/package_playbook.yml @@ -6,7 +6,7 @@ ansible.builtin.apt: name: gnupg update_cache: true - when: ansible_os_family|lower == "debian" + when: ansible_os_family | lower == "debian" roles: - role: google.cloud.gcloud gcloud_additional_components: diff --git a/molecule/gcsfuse/converge.yml b/molecule/gcsfuse/converge.yml index 69d9cf8..d24daf0 100644 --- a/molecule/gcsfuse/converge.yml +++ b/molecule/gcsfuse/converge.yml @@ -3,7 +3,8 @@ hosts: all pre_tasks: - name: Update package cache - ansible.builtin.package: update_cache=yes + ansible.builtin.package: + update_cache: "yes" changed_when: false register: task_result until: task_result is success diff --git a/roles/gcloud/meta/main.yml b/roles/gcloud/meta/main.yml index 8c8e784..049ed0e 100644 --- a/roles/gcloud/meta/main.yml +++ b/roles/gcloud/meta/main.yml @@ -4,7 +4,7 @@ galaxy_info: author: Eric Anderson description: Ansible role to install google-cloud-sdk license: GPL-3.0 - min_ansible_version: 2.9 + min_ansible_version: "2.9" platforms: - name: Ubuntu versions: diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index 126bc45..9216563 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -1,6 +1,9 @@ --- - name: gcloud | Archive | Ensure temp path exists - ansible.builtin.file: path={{ gcloud_archive_path }} state=directory mode=0755 + ansible.builtin.file: + path: "{{ gcloud_archive_path }}" + state: "directory" + mode: "0755" - name: gcloud | Archive | Extract Cloud SDK archive ansible.builtin.unarchive: @@ -37,7 +40,7 @@ --path-update {{ gcloud_update_path | lower }} {% if gcloud_override_components | length > 0 %}--override-components {% for component in gcloud_override_components %}{{ component }} - {% if loop.index < gcloud_override_components | length %} + {% if loop.index < gcloud_override_components | length %} {% endif %} {% endfor %} {% endif %} diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index 28c6b48..61e7653 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -1,7 +1,8 @@ --- # task file to configure bash completion for gcloud - name: gcloud | Archive | Debian | Ensure bash completion is installed - ansible.builtin.apt: name=bash-completion + ansible.builtin.apt: + name: "bash-completion" register: task_result until: task_result is success retries: 10 diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 143c2c7..0397fc6 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -6,9 +6,11 @@ register: gcloud_status - name: gcloud | Archive | Get gcloud_status - ansible.builtin.debug: var=gcloud_status + ansible.builtin.debug: + var: "gcloud_status" - name: gcloud | Archive | Set installed version if installation exists + when: gcloud_status.stat.exists block: - name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }} ansible.builtin.slurp: @@ -16,22 +18,21 @@ register: gcloud_installed_version_data - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact ansible.builtin.set_fact: - gcloud_installed_version: "{{ (gcloud_installed_version_data.content|b64decode|trim) }}" + gcloud_installed_version: "{{ (gcloud_installed_version_data.content | b64decode | trim) }}" - name: gcloud | Archive | get the gcloud_installed_version ansible.builtin.debug: msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" - name: gcloud | Archive | Version already installed + when: gcloud_version == gcloud_installed_version ansible.builtin.debug: msg: >- Skipping installation of google-cloud-sdk version {{ gcloud_version }} when {{ gcloud_installed_version }} is already installed. - when: gcloud_version == gcloud_installed_version - when: gcloud_status.stat.exists - name: gcloud | Archive | Start installation - ansible.builtin.include_tasks: archive_install.yml when: gcloud_installed_version is undefined or gcloud_version is version(gcloud_installed_version, '>') + ansible.builtin.include_tasks: archive_install.yml - name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 ansible.builtin.command: gcloud components install {{ item }} diff --git a/roles/gcloud/tasks/main.yml b/roles/gcloud/tasks/main.yml index 22caaeb..577cbb9 100644 --- a/roles/gcloud/tasks/main.yml +++ b/roles/gcloud/tasks/main.yml @@ -5,8 +5,8 @@ vars: params: files: - - "os/{{ ansible_distribution|lower }}.yml" - - "os/{{ ansible_os_family|lower }}.yml" + - "os/{{ ansible_distribution | lower }}.yml" + - "os/{{ ansible_os_family | lower }}.yml" - main.yml paths: - 'vars' diff --git a/roles/gcloud/tasks/package/debian.yml b/roles/gcloud/tasks/package/debian.yml index c6790c9..fcc7bf2 100644 --- a/roles/gcloud/tasks/package/debian.yml +++ b/roles/gcloud/tasks/package/debian.yml @@ -12,14 +12,18 @@ filename: google-cloud-sdk - name: gcloud | Debian | Install the google-cloud-sdk package - ansible.builtin.apt: name=google-cloud-sdk update_cache=yes + ansible.builtin.apt: + name: "google-cloud-sdk" + update_cache: "yes" register: task_result until: task_result is success retries: 10 delay: 2 - name: gcloud | Debian | Install the google-cloud-sdk additional components - ansible.builtin.apt: name=google-cloud-sdk-{{ item }} update_cache=yes + ansible.builtin.apt: + name: "google-cloud-sdk-{{ item }}" + update_cache: "yes" register: task_result until: task_result is success retries: 10 diff --git a/roles/gcloud/tasks/package/main.yml b/roles/gcloud/tasks/package/main.yml index f375917..ae8a4f7 100644 --- a/roles/gcloud/tasks/package/main.yml +++ b/roles/gcloud/tasks/package/main.yml @@ -2,4 +2,4 @@ # tasks file for gcloud - name: gcloud | Start package installation for specific distro - ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" + ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index e2b731e..3b358d0 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -13,14 +13,18 @@ - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - name: gcloud | RHEL | Install the google-cloud-sdk package - ansible.builtin.yum: name=google-cloud-sdk update_cache=yes + ansible.builtin.yum: + name: "google-cloud-sdk" + update_cache: "yes" register: task_result until: task_result is success retries: 10 delay: 2 - name: gcloud | Debian | Install the google-cloud-sdk additional components - ansible.builtin.yum: name=google-cloud-sdk-{{ item }} update_cache=yes + ansible.builtin.yum: + name: "google-cloud-sdk-{{ item }}" + update_cache: "yes" register: task_result until: task_result is success retries: 10 diff --git a/roles/gcsfuse/meta/main.yml b/roles/gcsfuse/meta/main.yml new file mode 100644 index 0000000..05c5764 --- /dev/null +++ b/roles/gcsfuse/meta/main.yml @@ -0,0 +1,20 @@ +--- +galaxy_info: + role_name: gcsfuse + author: Eric Anderson + description: Ansible role to install gcsfuse + license: GPL-3.0 + min_ansible_version: "2.9" + platforms: + - name: Ubuntu + versions: + - precise + - trusty + - xenial + - bionic + galaxy_tags: + - gcloud + - google + - gcsfuse + - fuse +dependencies: [] diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index 4ae759b..dc46c50 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -1,6 +1,7 @@ --- - name: gcsfuse | Ensure gpg is installed - ansible.builtin.apt: name=gnupg + ansible.builtin.apt: + name: "gnupg" register: task_result until: task_result is success retries: 10 @@ -18,7 +19,9 @@ filename: gcsfuse - name: gcsfuse | Install gcsfuse - ansible.builtin.apt: name=gcsfuse update_cache=yes + ansible.builtin.apt: + name: "gcsfuse" + update_cache: "yes" register: task_result until: task_result is success retries: 10 diff --git a/roles/gcsfuse/tasks/main.yml b/roles/gcsfuse/tasks/main.yml index be0a1a4..b7989f9 100644 --- a/roles/gcsfuse/tasks/main.yml +++ b/roles/gcsfuse/tasks/main.yml @@ -1,4 +1,4 @@ --- # tasks file for google.cloud.gcsfuse -- name: main - ansible.builtin.include_tasks: "{{ ansible_os_family|lower }}.yml" +- name: Main + ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" From d063d44b7322b160d72e03d2185f2a60b1828877 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Tue, 13 Dec 2022 06:17:00 +0000 Subject: [PATCH 057/138] fixing gcp_resourcemanager_project delete gcp_resourcemanager_project was not properly deleting projects. fixing gcp_resourcemanager_project as well. fixes #530. --- .../workflows/ansible-integration-tests.yml | 4 +- CONTRIBUTING.md | 4 +- .../modules/gcp_resourcemanager_project.py | 6 +- .../gcp_resourcemanager_project_info.py | 15 ++++- scripts/cleanup-project.sh | 9 +++ .../tasks/autogen.yml | 56 +++++++++++-------- 6 files changed, 64 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index fbd44e6..7fb920f 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -6,6 +6,7 @@ on: env: GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" GCP_PROJECT: "ansible-gcp-ci" + GCP_FOLDER_ID: "542027184392" jobs: integration: # NOTE: GitHub does not allow secrets to be used @@ -44,6 +45,7 @@ jobs: gcp_cred_file: /tmp/service-account-key.json gcp_cred_kind: serviceaccount gcp_cred_email: $GCP_SERVICE_ACCOUNT + gcp_folder_id: $GCP_FOLDER_ID " > ./tests/integration/cloud-config-gcp.ini # cleanup test environment - name: Auth to Gcloud @@ -58,7 +60,7 @@ jobs: - name: Run cleanup run: | ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT - ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT + ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_FOLDER_ID # run tests - name: Run integration tests # Add the -vvv flag to print out more output diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 79f6cb5..716d767 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,6 +40,7 @@ gcp_project: @PROJECT_ID gcp_cred_file: @CRED_FILE gcp_cred_kind: @CRED_KIND gcp_cred_email: @EMAIL +gcp_folder_id: @TEST_FOLDER (to create test projects) ``` #### Setting up the project for testing @@ -97,5 +98,4 @@ the codebase. ### Updating the supported ansible-core version 1. modify the [ansible-integration-tests.yaml](.github/workflows/ansible-integration-tests.yml) to the version of ansible-core that you would like to test against. -1. (optional) update the version of ansible-core version required in [meta/runtime.yaml](meta/runtime.yml). - +1. (optional) update the version of ansible-core version required in [meta/runtime.yaml](meta/runtime.yml). \ No newline at end of file diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index 9cae5f0..045ec6e 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -203,6 +203,8 @@ id: type: str ''' +ACTIVE = "ACTIVE" + ################################################################################ # Imports ################################################################################ @@ -250,7 +252,7 @@ def main(): update(module, self_link(module)) fetch = fetch_resource(module, self_link(module)) changed = True - else: + elif fetch.get("lifecycleState") == ACTIVE: delete(module, self_link(module)) fetch = {} changed = True @@ -375,7 +377,7 @@ def async_op_url(module, extra_data=None): def wait_for_operation(module, response): op_result = return_if_object(module, response) - if op_result is None: + if not op_result: return {} status = navigate_hash(op_result, ['done']) wait_done = wait_for_completion(status, op_result, module) diff --git a/plugins/modules/gcp_resourcemanager_project_info.py b/plugins/modules/gcp_resourcemanager_project_info.py index ab7981e..a803b64 100644 --- a/plugins/modules/gcp_resourcemanager_project_info.py +++ b/plugins/modules/gcp_resourcemanager_project_info.py @@ -77,6 +77,11 @@ options: - This should not be set unless you know what you're doing. - This only alters the User Agent string for any API requests. type: str + page_size: + description: + - Indicates the number of projects that should be returned by the API + request + type: str notes: - for authentication, you can set service_account_file using the C(GCP_SERVICE_ACCOUNT_FILE) env variable. @@ -96,6 +101,7 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" + page_size: 100 ''' RETURN = ''' @@ -175,7 +181,9 @@ import json def main(): - module = GcpModule(argument_spec=dict()) + module = GcpModule(argument_spec=dict( + page_size=dict(type='int') + )) if not module.params['scopes']: module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] @@ -190,7 +198,10 @@ def collection(module): def fetch_list(module, link): auth = GcpSession(module, 'resourcemanager') - return auth.list(link, return_if_object, array_name='projects') + params = {} + if "page_size" in module.params: + params["pageSize"] = module.params.get("page_size") + return auth.list(link, return_if_object, array_name='projects', params=params) def return_if_object(module, response): diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 8c78e5f..21f9e46 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -8,6 +8,7 @@ # - google-cloud-sdk (gcloudgcloud ) set -e PROJECT_ID="${1}" +FOLDER_ID="${2}" # service account is unused today # SERVICE_ACCOUNT_NAME="${2}" ZONE="us-central1-a" @@ -28,6 +29,9 @@ main() { cleanup_resource "compute" "backend-services" "--global" "--global" cleanup_resource "compute" "backend-services" \ "--regions=us-central1" "--region=us-central1" + for resource in $(gcloud projects list --filter="parent.id:$FOLDER_ID" --format="csv[no-heading](PROJECT_ID)"); do + gcloud projects delete "${resource}" -q + done } cleanup_resource() { @@ -35,9 +39,14 @@ cleanup_resource() { resource="$2" extra_list_arg="$3" extra_delete_arg="$4" +<<<<<<< HEAD for resource_id in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" +======= + for resource in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do + gcloud "${resource_group}" "${resource}" delete "${resource}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" +>>>>>>> 78c2743 (fixing gcp_resourcemanager_project delete) done } diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 5e02c41..539b3ac 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -15,52 +15,57 @@ # Pre-test setup - name: delete a project google.cloud.gcp_resourcemanager_project: - name: My Sample Project - id: ansible-test-{{ 10000000000 | random }} + name: "{{ resource_prefix[0:30] }}" + id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: - type: organization - id: 636173955921 + type: folder + id: "{{ gcp_folder_id }}" state: absent #---------------------------------------------------------- - name: create a project google.cloud.gcp_resourcemanager_project: - name: My Sample Project - id: ansible-test-{{ 10000000000 | random }} + name: "{{ resource_prefix[0:30] }}" + id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: - type: organization - id: 636173955921 + type: folder + id: "{{ gcp_folder_id }}" state: present register: result - name: assert changed is true assert: that: - result.changed == true +- name: Pause for 2 minutes for project to appear + ansible.builtin.pause: + minutes: 2 - name: verify that project was created google.cloud.gcp_resourcemanager_project_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 scopes: - https://www.googleapis.com/auth/cloud-platform register: results - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | length == 1 + - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a project that already exists google.cloud.gcp_resourcemanager_project: - name: My Sample Project - id: ansible-test-{{ 10000000000 | random }} + name: "{{ resource_prefix[0:30] }}" + id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: - type: organization - id: 636173955921 + type: folder + id: "{{ gcp_folder_id }}" state: present register: result - name: assert changed is false @@ -70,41 +75,46 @@ #---------------------------------------------------------- - name: delete a project google.cloud.gcp_resourcemanager_project: - name: My Sample Project - id: ansible-test-{{ 10000000000 | random }} + name: "{{ resource_prefix[0:30] }}" + id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: - type: organization - id: 636173955921 + type: folder + id: "{{ gcp_folder_id }}" state: absent register: result - name: assert changed is true assert: that: - result.changed == true +- name: Pause for 2 minutes for project to appear + ansible.builtin.pause: + minutes: 2 - name: verify that project was deleted google.cloud.gcp_resourcemanager_project_info: - project: "{{ gcp_project }}" + project: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 scopes: - https://www.googleapis.com/auth/cloud-platform register: results - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*My Sample Project.*") | list | length == 0 + - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: delete a project that does not exist google.cloud.gcp_resourcemanager_project: - name: My Sample Project - id: ansible-test-{{ 10000000000 | random }} + name: "{{ resource_prefix[0:30] }}" + id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: - type: organization - id: 636173955921 + type: folder + id: "{{ gcp_folder_id }}" state: absent register: result - name: assert changed is false From 2db181d084ad673cf7f975f0247648b801f99b06 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 16 Dec 2022 00:29:24 +0000 Subject: [PATCH 058/138] fix gcp_iam_role not updating gcp_iam_role was not updating previously. The API uses a PATCH and not a PUT. Also fixing an accidental leftover diff from a bad merge. fixes #236. --- changelogs/changelog.yaml | 1 + plugins/module_utils/gcp_utils.py | 13 +++++-- plugins/modules/gcp_iam_role.py | 2 +- .../gcp_resourcemanager_project_info.py | 4 +-- scripts/cleanup-project.sh | 5 --- .../targets/gcp_iam_role/tasks/autogen.yml | 34 +++++++++++++++---- 6 files changed, 41 insertions(+), 18 deletions(-) diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 3230bd9..f37bc47 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -16,6 +16,7 @@ releases: absent. - gcp_spanner_database - recognize a non-existent resource as absent. - gcp_storage_object - fix for correct version of dependency requirement. + - gcp_iam_role - update of a role is functional (GitHub #236). minor_changes: - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 2dc0668..948fc48 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -107,12 +107,12 @@ class GcpSession(object): kwargs = {'json': body} return self.full_delete(url, **kwargs) - def put(self, url, body=None): + def put(self, url, body=None, params=None): """ This method should be avoided in favor of full_put """ kwargs = {'json': body} - return self.full_put(url, **kwargs) + return self.full_put(url, **kwargs, params=params) def patch(self, url, body=None, **kwargs): """ @@ -305,7 +305,14 @@ class GcpModule(AnsibleModule): try: response.raise_for_status() except getattr(requests.exceptions, 'RequestException') as inst: - self.fail_json(msg="GCP returned error: %s" % response.json()) + self.fail_json( + msg="GCP returned error: %s" % response.json(), + request={ + "url": response.request.url, + "body": response.request.body, + "method": response.request.method, + } + ) def _merge_dictionaries(self, a, b): new = a.copy() diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index 74c6050..a87aa58 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -255,7 +255,7 @@ def update(module, link, fetch): } request = resource_to_request(module) del request["name"] - return return_if_object(module, auth.put(link, request, params=params)) + return return_if_object(module, auth.patch(link, request, params=params)) def updateMask(request, response): diff --git a/plugins/modules/gcp_resourcemanager_project_info.py b/plugins/modules/gcp_resourcemanager_project_info.py index a803b64..1df3864 100644 --- a/plugins/modules/gcp_resourcemanager_project_info.py +++ b/plugins/modules/gcp_resourcemanager_project_info.py @@ -182,7 +182,7 @@ import json def main(): module = GcpModule(argument_spec=dict( - page_size=dict(type='int') + page_size=dict(type='int') )) if not module.params['scopes']: @@ -200,7 +200,7 @@ def fetch_list(module, link): auth = GcpSession(module, 'resourcemanager') params = {} if "page_size" in module.params: - params["pageSize"] = module.params.get("page_size") + params["pageSize"] = module.params.get("page_size") return auth.list(link, return_if_object, array_name='projects', params=params) diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 21f9e46..4dd4ddb 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -39,14 +39,9 @@ cleanup_resource() { resource="$2" extra_list_arg="$3" extra_delete_arg="$4" -<<<<<<< HEAD for resource_id in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" -======= - for resource in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do - gcloud "${resource_group}" "${resource}" delete "${resource}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" ->>>>>>> 78c2743 (fixing gcp_resourcemanager_project delete) done } diff --git a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml index c565d47..b78a3df 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a role google.cloud.gcp_iam_role: - name: role_{{ resource_name.split("-")[-1] }} + name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: @@ -29,7 +29,7 @@ #---------------------------------------------------------- - name: create a role google.cloud.gcp_iam_role: - name: role_{{ resource_name.split("-")[-1] }} + name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: @@ -56,11 +56,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*role_{{ resource_name.split("-")[-1] }}.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a role that already exists google.cloud.gcp_iam_role: - name: role_{{ resource_name.split("-")[-1] }} + name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: @@ -76,10 +76,30 @@ assert: that: - result.changed == false +# ---------------------------------------------------------------------------- +- name: modify an IAM role that already exists + google.cloud.gcp_iam_role: + name: "{{ resource_prefix[0:30].replace('-', '_') }}" + title: My Custom Role + description: My custom role description + included_permissions: + - storage.buckets.get + - storage.buckets.list + - storage.objects.get + - storage.objects.list + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true #---------------------------------------------------------- - name: delete a role google.cloud.gcp_iam_role: - name: role_{{ resource_name.split("-")[-1] }} + name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: @@ -106,11 +126,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*role_{{ resource_name.split("-")[-1] }}.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a role that does not exist google.cloud.gcp_iam_role: - name: role_{{ resource_name.split("-")[-1] }} + name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: From 1ff057fd1c03de6dce44780f78a20dd9d2ed46e4 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 16 Dec 2022 16:03:54 +0000 Subject: [PATCH 059/138] release 1.1.0 Updating changelong and dates to match 1.1.0 release. --- CHANGELOG.rst | 6 +++--- changelogs/changelog.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b1fc26b..a962436 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,8 @@ Google.Cloud Release Notes .. contents:: Topics -v1.1.0-beta.0 -============= +v1.1.0 +====== Minor Changes ------------- @@ -24,4 +24,4 @@ Bugfixes - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. - gcp_spanner_database - recognize a non-existent resource as absent. -- gcp_storage_object - fix for correct version of dependency requirement. +- gcp_storage_object - fix for correct version of dependency requirement. \ No newline at end of file diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index f37bc47..52fcc95 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1,6 +1,6 @@ ancestor: null releases: - 1.1.0-beta.0: + 1.1.0: changes: bugfixes: - Disk has been fixed to send the sourceSnapshot parameter. @@ -23,4 +23,4 @@ releases: fragments: - 0001_disk.yml - bugfixes.yaml - release_date: '2022-12-03' + release_date: '2022-12-16' From cbae062c98ec52a8876988249aa19210707b1afd Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 16 Dec 2022 16:16:46 +0000 Subject: [PATCH 060/138] updating galaxy.yml file to 1.1.0 required for publishing a new release --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index 60ec021..70b766b 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: 1.1.0-beta.0 +version: "1.1.0" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From 509e0207fffa17bee1031a96311b5aa3cb6a0628 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 16 Dec 2022 16:34:31 +0000 Subject: [PATCH 061/138] tests: add sanity tests for python 2.7 Automation Hub still runs sanity tests on python 2.7 updating release to 1.1.1 to publish a new version. --- .github/workflows/ansible-test.yml | 13 +++++++++++-- CHANGELOG.rst | 11 ++++++++++- changelogs/.plugin-cache.yaml | 4 +++- changelogs/changelog.yaml | 9 ++++++++- galaxy.yml | 2 +- plugins/module_utils/gcp_utils.py | 2 +- 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 5b58831..0562b29 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -21,11 +21,20 @@ jobs: uses: actions/setup-python@v1 with: python-version: ${{ env.PYTHON_VERSION }} + # Automation-hub requires python2.7 sanity tests + - name: setup python2.7 + run: | + sudo apt-add-repository universe + sudo apt update + sudo apt install python2.7 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo /usr/bin/python2.7 get-pip.py + pip2 install virtualenv - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run ansible-test sanity # validate-modules cannot be turned on until #498 is resolved. - run: ansible-test sanity -v --color --python "$PYTHON_VERSION" --skip validate-modules + run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint run: pip install ansible-lint - name: Run ansible-lint @@ -48,7 +57,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: "${{ env.PYTHON_VERSION }}" - name: Install dependencies run: pip install -r requirements.txt - name: Install test dependencies diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a962436..38d5bf3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Google.Cloud Release Notes .. contents:: Topics +v1.1.1 +====== + +Bugfixes +-------- + +- fix collection to work with Python 2.7 + v1.1.0 ====== @@ -23,5 +31,6 @@ Bugfixes - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth. - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. +- gcp_iam_role - update of a role is functional (GitHub - gcp_spanner_database - recognize a non-existent resource as absent. -- gcp_storage_object - fix for correct version of dependency requirement. \ No newline at end of file +- gcp_storage_object - fix for correct version of dependency requirement. diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index fdbf2ed..5b8fc6c 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -6,6 +6,7 @@ plugins: callback: {} cliconf: {} connection: {} + filter: {} httpapi: {} inventory: gcp_compute: @@ -867,5 +868,6 @@ plugins: netconf: {} shell: {} strategy: {} + test: {} vars: {} -version: 1.1.0-beta.0 +version: 1.1.1 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 52fcc95..b0a3b0e 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -14,9 +14,9 @@ releases: - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. + - gcp_iam_role - update of a role is functional (GitHub - gcp_spanner_database - recognize a non-existent resource as absent. - gcp_storage_object - fix for correct version of dependency requirement. - - gcp_iam_role - update of a role is functional (GitHub #236). minor_changes: - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. @@ -24,3 +24,10 @@ releases: - 0001_disk.yml - bugfixes.yaml release_date: '2022-12-16' + 1.1.1: + changes: + bugfixes: + - fix collection to work with Python 2.7 + fragments: + - fix-2.7.yml + release_date: '2022-12-16' diff --git a/galaxy.yml b/galaxy.yml index 70b766b..507474e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.0" +version: "1.1.1" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 948fc48..fd43027 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -112,7 +112,7 @@ class GcpSession(object): This method should be avoided in favor of full_put """ kwargs = {'json': body} - return self.full_put(url, **kwargs, params=params) + return self.full_put(url, params=params, **kwargs) def patch(self, url, body=None, **kwargs): """ From 0ed49af7df0fe2e249932bab0ba5f374df558aec Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Wed, 21 Dec 2022 17:11:22 +0000 Subject: [PATCH 062/138] re-add gcp_compute as a valid plugin name commit ccbde5f93e76404a5165a675a38cf2e1b83b4794 introduced a backwards-incompatible change which made ansible-inventory no longer recognize `gcp_compute` as a valid package name. This would break users who are use `gcp_compute` (instead of the new `google.cloud.gcp_compute`). Accepting both until at least a major version change. fixes #536. --- CHANGELOG.rst | 8 ++++++++ changelogs/.plugin-cache.yaml | 2 +- changelogs/changelog.yaml | 7 +++++++ galaxy.yml | 2 +- plugins/inventory/gcp_compute.py | 2 +- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 38d5bf3..1b8ff86 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Google.Cloud Release Notes .. contents:: Topics +v1.1.2 +====== + +Bugfixes +-------- + +- fix `gcp_compute` no longer being a valid name of the inventory plugin + v1.1.1 ====== diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index 5b8fc6c..f9bcfd9 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -870,4 +870,4 @@ plugins: strategy: {} test: {} vars: {} -version: 1.1.1 +version: 1.1.2 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index b0a3b0e..072436a 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -31,3 +31,10 @@ releases: fragments: - fix-2.7.yml release_date: '2022-12-16' + 1.1.2: + changes: + bugfixes: + - fix `gcp_compute` no longer being a valid name of the inventory plugin + fragments: + - fix-inventory-plugin.yml + release_date: '2022-12-21' diff --git a/galaxy.yml b/galaxy.yml index 507474e..6887735 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.1" +version: "1.1.2" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index d5d435a..3442a64 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -22,7 +22,7 @@ DOCUMENTATION = """ plugin: description: token that ensures this is a source file for the 'gcp_compute' plugin. required: True - choices: ['google.cloud.gcp_compute'] + choices: ['google.cloud.gcp_compute', 'gcp_compute'] zones: description: A list of regions in which to describe GCE instances. If none provided, it defaults to all zones available to a given project. From 226ec3dd3fb2eb3b2131014816240298126400fc Mon Sep 17 00:00:00 2001 From: "S. Shuck" Date: Fri, 23 Dec 2022 14:33:47 -0500 Subject: [PATCH 063/138] Improve error handling for auth_kind 'serviceaccount' Fixes ansible-collections/google.cloud#538. --- .gitignore | 1 + plugins/module_utils/gcp_utils.py | 39 ++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index c466a16..d1aae87 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ tests/integration/inventory tests/output/ __pycache__ *.tar.gz +venv/ diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index fd43027..cb4b56e 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -215,27 +215,40 @@ class GcpSession(object): def _credentials(self): cred_type = self.module.params['auth_kind'] + if cred_type == 'application': credentials, project_id = google.auth.default(scopes=self.module.params['scopes']) return credentials - if cred_type == 'serviceaccount' and self.module.params.get('service_account_file'): - path = os.path.realpath(os.path.expanduser(self.module.params['service_account_file'])) - if not os.path.exists(path): + + if cred_type == 'serviceaccount': + service_account_file = self.module.params.get('service_account_file') + service_account_contents = self.module.params.get('service_account_contents') + if service_account_file is not None: + path = os.path.realpath(os.path.expanduser(service_account_file)) + try: + svc_acct_creds = service_account.Credentials.from_service_account_file(path) + except OSError as e: + self.module.fail_json( + msg="Unable to read service_account_file at %s: %s" % (path, e.strerror) + ) + elif service_account_contents is not None: + try: + info = json.loads(service_account_contents) + except json.decoder.JSONDecodeError as e: + self.module.fail_json( + msg="Unable to decode service_account_contents as JSON: %s" % e + ) + svc_acct_creds = service_account.Credentials.from_service_account_info(info) + else: self.module.fail_json( - msg="Unable to find service_account_file at '%s'" % path + msg='Service Account authentication requires setting either service_account_file or service_account_contents' ) - return service_account.Credentials.from_service_account_file(path).with_scopes(self.module.params['scopes']) - if cred_type == 'serviceaccount' and self.module.params.get('service_account_contents'): - try: - cred = json.loads(self.module.params.get('service_account_contents')) - except json.decoder.JSONDecodeError as e: - self.module.fail_json( - msg="Unable to decode service_account_contents as JSON" - ) - return service_account.Credentials.from_service_account_info(cred).with_scopes(self.module.params['scopes']) + return svc_acct_creds.with_scopes(self.module.params['scopes']) + if cred_type == 'machineaccount': return google.auth.compute_engine.Credentials( self.module.params['service_account_email']) + self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type) def _headers(self): From 30c2bbd84eb42fb0214e426616e609837f078e14 Mon Sep 17 00:00:00 2001 From: nkakouros Date: Sun, 22 Jan 2023 00:37:58 +0100 Subject: [PATCH 064/138] Fixes GcpRequest comparison for boolean parameters Fixes #402 . --- plugins/module_utils/gcp_utils.py | 6 +++--- tests/unit/plugins/test_gcp_utils.py | 31 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index cb4b56e..203000c 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -362,7 +362,7 @@ class GcpRequest(object): def _compare_dicts(self, req_dict, resp_dict): difference = {} for key in req_dict: - if resp_dict.get(key): + if resp_dict.get(key) is not None: difference[key] = self._compare_value(req_dict.get(key), resp_dict.get(key)) # Remove all empty values from difference. @@ -408,7 +408,7 @@ class GcpRequest(object): diff = None # If a None is found, a difference does not exist. # Only differing values matter. - if not resp_value: + if resp_value is None: return None # Can assume non-None types at this point. @@ -444,7 +444,7 @@ class GcpRequest(object): # Value1 False, resp_value 'false' if not req_value and to_text(resp_value) == 'false': return None - return resp_value + return True # to_text may throw UnicodeErrors. # These errors shouldn't crash Ansible and should be hidden. diff --git a/tests/unit/plugins/test_gcp_utils.py b/tests/unit/plugins/test_gcp_utils.py index 51b1fff..457ed11 100644 --- a/tests/unit/plugins/test_gcp_utils.py +++ b/tests/unit/plugins/test_gcp_utils.py @@ -143,3 +143,34 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): request2 = GcpRequest(value2) self.assertNotEquals(request1, request2) self.assertEqual(request1.difference(request2), difference) + + def test_dicts_boolean_with_difference(self): + value1 = { + "foo": True, + "bar": False, + "baz": True, + "qux": False, + } + + value2 = { + "foo": True, + "bar": False, + "baz": False, + "qux": True, + } + + value2 = { + "foo": True, + "bar": False, + "baz": False, + "qux": True, + } + + difference = { + "baz": True, + "qux": True, + } + request1 = GcpRequest(value1) + request2 = GcpRequest(value2) + self.assertNotEquals(request1, request2) + self.assertEqual(request1.difference(request2), difference) From 286dcaed5608c575d19f58abc14eff49979be5cb Mon Sep 17 00:00:00 2001 From: Nikolaos Kakouros Date: Mon, 23 Jan 2023 22:03:24 +0000 Subject: [PATCH 065/138] Removes duplicate lines --- tests/unit/plugins/test_gcp_utils.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/unit/plugins/test_gcp_utils.py b/tests/unit/plugins/test_gcp_utils.py index 457ed11..4956fe5 100644 --- a/tests/unit/plugins/test_gcp_utils.py +++ b/tests/unit/plugins/test_gcp_utils.py @@ -159,13 +159,6 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): "qux": True, } - value2 = { - "foo": True, - "bar": False, - "baz": False, - "qux": True, - } - difference = { "baz": True, "qux": True, From c99ecc511fb477596910a502bb4da2904d86c211 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 21 Jan 2023 18:23:55 +0000 Subject: [PATCH 066/138] gcp_storage_object asserts for dest on upload The `dest` field is required for upload and delete. This was not explicitly documented nor asserted. Fixes #235. --- plugins/modules/gcp_storage_object.py | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index 72227cc..6d497bd 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -43,11 +43,12 @@ options: src: description: - Source location of file (may be local machine or cloud depending on action). Cloud locations need to be urlencoded including slashes. - required: false + required: true type: path dest: description: - Destination location of file (may be local machine or cloud depending on action). Cloud location need to be urlencoded including slashes. + Required for upload and download. required: false type: path bucket: @@ -183,6 +184,11 @@ def main(): ) ) + if module.params["action"] == "upload" and module.params["dest"] is None: + module.fail_json( + msg="`dest` parameter is None: `dest` is required for the upload operation" + ) + if not HAS_GOOGLE_STORAGE_LIBRARY: module.fail_json(msg="Please install the google-cloud-storage Python library") @@ -193,11 +199,12 @@ def main(): creds = GcpSession(module, "storage")._credentials() client = storage.Client( - project=module.params['project'], - credentials=creds, client_info=ClientInfo(user_agent="Google-Ansible-MM-object") + project=module.params["project"], + credentials=creds, + client_info=ClientInfo(user_agent="Google-Ansible-MM-object"), ) - bucket = client.get_bucket(module.params['bucket']) + bucket = client.get_bucket(module.params["bucket"]) remote_file_exists = Blob(remote_file_path(module), bucket).exists() local_file_exists = os.path.isfile(local_file_path(module)) @@ -237,7 +244,7 @@ def main(): def download_file(module, client, name, dest): try: - bucket = client.get_bucket(module.params['bucket']) + bucket = client.get_bucket(module.params["bucket"]) blob = Blob(name, bucket) with open(dest, "wb") as file_obj: blob.download_to_file(file_obj) @@ -248,7 +255,7 @@ def download_file(module, client, name, dest): def upload_file(module, client, src, dest): try: - bucket = client.get_bucket(module.params['bucket']) + bucket = client.get_bucket(module.params["bucket"]) blob = Blob(dest, bucket) with open(src, "rb") as file_obj: blob.upload_from_file(file_obj) @@ -259,7 +266,7 @@ def upload_file(module, client, src, dest): def delete_file(module, client, name): try: - bucket = client.get_bucket(module.params['bucket']) + bucket = client.get_bucket(module.params["bucket"]) blob = Blob(name, bucket) blob.delete() return {} @@ -285,14 +292,12 @@ def remote_file_path(module): def blob_to_dict(blob): return { - 'bucket': { - 'name': blob.bucket.path - }, - 'cache_control': blob.cache_control, - 'chunk_size': blob.chunk_size, - 'media_link': blob.media_link, - 'self_link': blob.self_link, - 'storage_class': blob.storage_class + "bucket": {"name": blob.bucket.path}, + "cache_control": blob.cache_control, + "chunk_size": blob.chunk_size, + "media_link": blob.media_link, + "self_link": blob.self_link, + "storage_class": blob.storage_class, } From 5d56d3f2d266909fd1c3856d8e3773604d28b9dd Mon Sep 17 00:00:00 2001 From: laithalissa <887720+laithalissa@users.noreply.github.com> Date: Wed, 8 Feb 2023 21:36:14 +0000 Subject: [PATCH 067/138] Update example inventory filter Update the example inventory filter to not use a machineType filter. The existing machineType filter example is erroneous, see https://github.com/ansible-collections/google.cloud/issues/421#issuecomment-1361680826 Change the filter to use "status = RUNNING" --- plugins/inventory/gcp_compute.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 3442a64..733cd3f 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -125,8 +125,8 @@ projects: - gcp-prod-gke-100 - gcp-cicd-101 filters: - - machineType = n1-standard-1 - - scheduling.automaticRestart = true AND machineType = n1-standard-1 + - status = RUNNING + - scheduling.automaticRestart = true AND status = RUNNING service_account_file: /tmp/service_account.json auth_kind: serviceaccount scopes: From 75d4ded7362ca13e99de740e5b2d8f0c1dc5d76c Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 14 Jan 2023 19:57:41 +0000 Subject: [PATCH 068/138] tests: updating the route test validating the update of a route works as per concerns raised in #542 --- .../gcp_compute_route/tasks/autogen.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml index b687de9..bc32b37 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml @@ -87,6 +87,25 @@ assert: that: - result.changed == false +# --- +- name: update a route + google.cloud.gcp_compute_route: + name: "{{ resource_name }}" + dest_range: 192.168.6.0/28 + next_hop_gateway: global/gateways/default-internet-gateway + network: "{{ network }}" + tags: + - backends + - foobar + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true #---------------------------------------------------------- - name: delete a route google.cloud.gcp_compute_route: From 791e11d45dd26ac905522cff04bc84424a7b2f42 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 18 Feb 2023 19:23:35 +0000 Subject: [PATCH 069/138] chore: pin ansible-lint to 6.13.1 ansible-lint was updated and the GitHub action did not pin the dependency, resulting in the repository to fail sanity tests. Updating the repository to adhere to new fatal linter rules, but also pinning the linter to prevent failures that may be unrelated to the particular commit. Updating usages for python3.8 to 3.9 as ansible-lint is dropping support for 3.8. --- .github/workflows/ansible-test.yml | 2 +- .github/workflows/gcloud.yml | 4 ++-- .github/workflows/gcsfuse.yml | 4 ++-- roles/gcloud/tasks/archive/archive_install.yml | 11 ++++++----- .../tasks/archive/command_completion.yml | 8 ++++---- roles/gcloud/tasks/archive/main.yml | 18 +++++++++--------- roles/gcloud/tasks/main.yml | 4 ++-- roles/gcloud/tasks/package/debian.yml | 8 ++++---- roles/gcloud/tasks/package/main.yml | 2 +- roles/gcloud/tasks/package/redhat.yml | 7 +++---- roles/gcsfuse/tasks/debian.yml | 8 ++++---- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 0562b29..5ccdd14 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -36,7 +36,7 @@ jobs: # validate-modules cannot be turned on until #498 is resolved. run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint - run: pip install ansible-lint + run: pip install ansible-lint==6.13.1 - name: Run ansible-lint run: ansible-lint unit: diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 61ad651..8100e1e 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -30,10 +30,10 @@ jobs: with: path: ansible_collections/google/cloud - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index a9c3a63..a58e6a3 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -25,10 +25,10 @@ jobs: with: path: ansible_collections/google/cloud - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.9 - name: Install dependencies run: | diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index 9216563..8f6a52a 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -1,18 +1,18 @@ --- -- name: gcloud | Archive | Ensure temp path exists +- name: Gcloud | Archive | Ensure temp path exists ansible.builtin.file: path: "{{ gcloud_archive_path }}" state: "directory" mode: "0755" -- name: gcloud | Archive | Extract Cloud SDK archive +- name: Gcloud | Archive | Extract Cloud SDK archive ansible.builtin.unarchive: src: "{{ gcloud_archive_url }}" dest: "{{ gcloud_archive_path }}" remote_src: yes creates: "{{ gcloud_library_path }}" -- name: gcloud | Archive | Link binaries to /usr/bin (like package install) +- name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: src: "{{ gcloud_library_path }}/bin/{{ item }}" dest: "/usr/bin/{{ item }}" @@ -25,11 +25,12 @@ - gsutil when: not gcloud_install_script -- name: gcloud | Archive | Add command completion +- name: Gcloud | Archive | Add command completion ansible.builtin.include_tasks: command_completion.yml when: gcloud_command_completion -- name: gcloud | Archive | Install into Path +- name: Gcloud | Archive | Install into Path + changed_when: false ansible.builtin.command: >- {{ gcloud_archive_path }}/install.sh --quiet --usage-reporting {{ gcloud_usage_reporting | lower }} diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index 61e7653..d457c09 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -1,6 +1,6 @@ --- # task file to configure bash completion for gcloud -- name: gcloud | Archive | Debian | Ensure bash completion is installed +- name: Gcloud | Archive | Debian | Ensure bash completion is installed ansible.builtin.apt: name: "bash-completion" register: task_result @@ -9,7 +9,7 @@ delay: 2 when: ansible_os_family == "Debian" -- name: gcloud | Archive | RedHat | Ensure bash completion is installed +- name: Gcloud | Archive | RedHat | Ensure bash completion is installed ansible.builtin.yum: name: - bash-completion @@ -19,7 +19,7 @@ delay: 2 when: ansible_os_family == "RedHat" -- name: gcloud | Archive | Ensure bash_completion.d directory exists +- name: Gcloud | Archive | Ensure bash_completion.d directory exists ansible.builtin.file: path: /etc/bash_completion.d owner: root @@ -27,7 +27,7 @@ state: directory mode: 0755 -- name: gcloud | Archive | Link binaries to /usr/bin (like package install) +- name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: src: "{{ gcloud_library_path }}/completion.bash.inc" dest: /etc/bash_completion.d/gcloud diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 0397fc6..989c89b 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -1,40 +1,40 @@ --- # tasks to install gcloud via archive -- name: gcloud | Archive | Look for existing Google Cloud SDK installation +- name: Gcloud | Archive | Look for existing Google Cloud SDK installation ansible.builtin.stat: path: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" register: gcloud_status -- name: gcloud | Archive | Get gcloud_status +- name: Gcloud | Archive | Get gcloud_status ansible.builtin.debug: var: "gcloud_status" -- name: gcloud | Archive | Set installed version if installation exists +- name: Gcloud | Archive | Set installed version if installation exists when: gcloud_status.stat.exists block: - - name: gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }} + - name: Gcloud | Archive | Importing contents of ./google-cloud-sdk/VERSION in {{ gcloud_archive_path }} ansible.builtin.slurp: src: "{{ gcloud_archive_path }}/google-cloud-sdk/VERSION" register: gcloud_installed_version_data - - name: gcloud | Archive | Setting the gcloud_installed_version variable/fact + - name: Gcloud | Archive | Setting the gcloud_installed_version variable/fact ansible.builtin.set_fact: gcloud_installed_version: "{{ (gcloud_installed_version_data.content | b64decode | trim) }}" - - name: gcloud | Archive | get the gcloud_installed_version + - name: Gcloud | Archive | get the gcloud_installed_version ansible.builtin.debug: msg: "google-cloud-sdk: {{ gcloud_installed_version }} is installed" - - name: gcloud | Archive | Version already installed + - name: Gcloud | Archive | Version already installed when: gcloud_version == gcloud_installed_version ansible.builtin.debug: msg: >- Skipping installation of google-cloud-sdk version {{ gcloud_version }} when {{ gcloud_installed_version }} is already installed. -- name: gcloud | Archive | Start installation +- name: Gcloud | Archive | Start installation when: gcloud_installed_version is undefined or gcloud_version is version(gcloud_installed_version, '>') ansible.builtin.include_tasks: archive_install.yml -- name: gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 +- name: Gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 ansible.builtin.command: gcloud components install {{ item }} register: gcloud_install_comp_status changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines" diff --git a/roles/gcloud/tasks/main.yml b/roles/gcloud/tasks/main.yml index 577cbb9..bdbd347 100644 --- a/roles/gcloud/tasks/main.yml +++ b/roles/gcloud/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: gcloud | Load Distro and OS specific variables +- name: Gcloud | Load Distro and OS specific variables ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: @@ -11,5 +11,5 @@ paths: - 'vars' -- name: gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} +- name: Gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/roles/gcloud/tasks/package/debian.yml b/roles/gcloud/tasks/package/debian.yml index fcc7bf2..6b0bf70 100644 --- a/roles/gcloud/tasks/package/debian.yml +++ b/roles/gcloud/tasks/package/debian.yml @@ -1,17 +1,17 @@ --- # tasks that install gcloud on debian -- name: gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL +- name: Gcloud | Debian | Add an Apt signing key, uses whichever key is at the URL ansible.builtin.apt_key: url: "{{ gcloud_apt_key }}" state: present -- name: gcloud | Debian | Add the gcloud repository +- name: Gcloud | Debian | Add the gcloud repository ansible.builtin.apt_repository: repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main" state: present filename: google-cloud-sdk -- name: gcloud | Debian | Install the google-cloud-sdk package +- name: Gcloud | Debian | Install the google-cloud-sdk package ansible.builtin.apt: name: "google-cloud-sdk" update_cache: "yes" @@ -20,7 +20,7 @@ retries: 10 delay: 2 -- name: gcloud | Debian | Install the google-cloud-sdk additional components +- name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.apt: name: "google-cloud-sdk-{{ item }}" update_cache: "yes" diff --git a/roles/gcloud/tasks/package/main.yml b/roles/gcloud/tasks/package/main.yml index ae8a4f7..61bf28a 100644 --- a/roles/gcloud/tasks/package/main.yml +++ b/roles/gcloud/tasks/package/main.yml @@ -1,5 +1,5 @@ --- # tasks file for gcloud -- name: gcloud | Start package installation for specific distro +- name: Gcloud | Start package installation for specific distro ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index 3b358d0..50cdac5 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -1,9 +1,8 @@ --- -- name: gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL +- name: Gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL ansible.builtin.yum_repository: name: google-cloud-sdk description: Google Cloud SDK - ansible.builtin.file: google-cloud-sdk baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 enabled: yes gpgcheck: yes @@ -12,7 +11,7 @@ - https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg -- name: gcloud | RHEL | Install the google-cloud-sdk package +- name: Gcloud | RHEL | Install the google-cloud-sdk package ansible.builtin.yum: name: "google-cloud-sdk" update_cache: "yes" @@ -21,7 +20,7 @@ retries: 10 delay: 2 -- name: gcloud | Debian | Install the google-cloud-sdk additional components +- name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.yum: name: "google-cloud-sdk-{{ item }}" update_cache: "yes" diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index dc46c50..941f3bd 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -1,5 +1,5 @@ --- -- name: gcsfuse | Ensure gpg is installed +- name: Gcsfuse | Ensure gpg is installed ansible.builtin.apt: name: "gnupg" register: task_result @@ -7,18 +7,18 @@ retries: 10 delay: 2 -- name: gcsfuse | Add an apt signing key +- name: Gcsfuse | Add an apt signing key ansible.builtin.apt_key: url: https://packages.cloud.google.com/apt/doc/apt-key.gpg state: present -- name: gcsfuse | Add the apt repository +- name: Gcsfuse | Add the apt repository ansible.builtin.apt_repository: repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main state: present filename: gcsfuse -- name: gcsfuse | Install gcsfuse +- name: Gcsfuse | Install gcsfuse ansible.builtin.apt: name: "gcsfuse" update_cache: "yes" From 252f215f2ceacfe201f0163705a0769e4f39f663 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 18 Feb 2023 19:08:46 +0000 Subject: [PATCH 070/138] fix: remove version_added in gcp_compute The version_added field is documented for a very small set of fields, specifically in gcp_compute today. Removing these values as they are specifying the ansible-core version which is confusing for those who are installing via ansible-galaxy, and the value is not set for any other module. fixes #550. --- plugins/inventory/gcp_compute.py | 95 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 733cd3f..d380acd 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -60,23 +60,19 @@ DOCUMENTATION = """ choices: ['application', 'serviceaccount', 'machineaccount'] env: - name: GCP_AUTH_KIND - version_added: "2.8.2" scopes: description: list of authentication scopes type: list default: ['https://www.googleapis.com/auth/compute'] env: - name: GCP_SCOPES - version_added: "2.8.2" service_account_file: description: - The path of a Service Account JSON file if serviceaccount is selected as type. type: path env: - name: GCP_SERVICE_ACCOUNT_FILE - version_added: "2.8.2" - name: GCE_CREDENTIALS_FILE_PATH - version_added: "2.8" service_account_contents: description: - A string representing the contents of a Service Account JSON file. This should not be passed in as a dictionary, @@ -84,14 +80,12 @@ DOCUMENTATION = """ type: string env: - name: GCP_SERVICE_ACCOUNT_CONTENTS - version_added: "2.8.2" service_account_email: description: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. env: - name: GCP_SERVICE_ACCOUNT_EMAIL - version_added: "2.8.2" vars_prefix: description: prefix to apply to host variables, does not include facts nor params default: '' @@ -105,7 +99,6 @@ DOCUMENTATION = """ which group names end up being used as. type: bool default: False - version_added: '2.8' retrieve_image_info: description: - Populate the C(image) host fact for the instances returned with the GCP image name @@ -114,7 +107,6 @@ DOCUMENTATION = """ - Unless this option is enabled, the C(image) host variable will be C(null) type: bool default: False - version_added: '2.8' """ EXAMPLES = """ @@ -170,7 +162,9 @@ class GcpMockModule(object): class GcpInstance(object): - def __init__(self, json, hostname_ordering, project_disks, should_format=True, name_suffix=""): + def __init__( + self, json, hostname_ordering, project_disks, should_format=True, name_suffix="" + ): self.hostname_ordering = hostname_ordering self.project_disks = project_disks self.name_suffix = name_suffix @@ -210,8 +204,8 @@ class GcpInstance(object): def _format_network_info(self, address): """ - :param address: A GCP network address - :return a dict with network shortname and region + :param address: A GCP network address + :return a dict with network shortname and region """ split = address.split("/") region = "" @@ -223,8 +217,8 @@ class GcpInstance(object): def _format_metadata(self, metadata): """ - :param metadata: A list of dicts where each dict has keys "key" and "value" - :return a dict with key/value pairs for each in list. + :param metadata: A list of dicts where each dict has keys "key" and "value" + :return a dict with key/value pairs for each in list. """ new_metadata = {} for pair in metadata: @@ -233,18 +227,18 @@ class GcpInstance(object): def hostname(self): """ - :return the hostname of this instance + :return the hostname of this instance """ for order in self.hostname_ordering: name = None if order.startswith("labels."): - name = self.json[u"labels"].get(order[7:]) + name = self.json["labels"].get(order[7:]) elif order == "public_ip": name = self._get_publicip() elif order == "private_ip": name = self._get_privateip() elif order == "name": - name = self.json[u"name"] + self.name_suffix + name = self.json["name"] + self.name_suffix else: raise AnsibleParserError("%s is not a valid hostname precedent" % order) @@ -255,20 +249,20 @@ class GcpInstance(object): def _get_publicip(self): """ - :return the publicIP of this instance or None + :return the publicIP of this instance or None """ # Get public IP if exists for interface in self.json["networkInterfaces"]: if "accessConfigs" in interface: for accessConfig in interface["accessConfigs"]: if "natIP" in accessConfig: - return accessConfig[u"natIP"] + return accessConfig["natIP"] return None def _get_image(self): """ - :param instance: A instance response from GCP - :return the image of this instance or None + :param instance: A instance response from GCP + :return the image of this instance or None """ image = None if self.project_disks and "disks" in self.json: @@ -279,13 +273,13 @@ class GcpInstance(object): def _get_privateip(self): """ - :param item: A host response from GCP - :return the privateIP of this instance or None + :param item: A host response from GCP + :return the privateIP of this instance or None """ # Fallback: Get private IP - for interface in self.json[u"networkInterfaces"]: + for interface in self.json["networkInterfaces"]: if "networkIP" in interface: - return interface[u"networkIP"] + return interface["networkIP"] class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): @@ -303,7 +297,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _populate_host(self, item): """ - :param item: A GCP instance + :param item: A GCP instance """ hostname = item.hostname() self.inventory.add_host(hostname) @@ -321,8 +315,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def verify_file(self, path): """ - :param path: the path to the inventory config file - :return the contents of the config file + :param path: the path to the inventory config file + :return the contents of the config file """ if super(InventoryModule, self).verify_file(path): if path.endswith(("gcp.yml", "gcp.yaml")): @@ -333,10 +327,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def fetch_list(self, params, link, query): """ - :param params: a dict containing all of the fields relevant to build URL - :param link: a formatted URL - :param query: a formatted query string - :return the JSON response containing a list of instances. + :param params: a dict containing all of the fields relevant to build URL + :param link: a formatted URL + :param query: a formatted query string + :return the JSON response containing a list of instances. """ lists = [] resp = self._return_if_object( @@ -349,7 +343,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): self.fake_module, self.auth_session.get( link, - params={"filter": query, "pageToken": resp.get("nextPageToken")}, + params={ + "filter": query, + "pageToken": resp.get("nextPageToken"), + }, ), ) lists.append(resp.get("items")) @@ -370,8 +367,8 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _get_query_options(self, filters): """ - :param config_data: contents of the inventory config file - :return A fully built query string + :param config_data: contents of the inventory config file + :return A fully built query string """ if not filters: return "" @@ -391,9 +388,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _return_if_object(self, module, response): """ - :param module: A GcpModule - :param response: A Requests response object - :return JSON response + :param module: A GcpModule + :param response: A Requests response object + :return JSON response """ # If not found, return nothing. if response.status_code == 404: @@ -418,9 +415,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _add_hosts(self, items, config_data, format_items=True, project_disks=None): """ - :param items: A list of hosts - :param config_data: configuration data - :param format_items: format items or not + :param items: A list of hosts + :param config_data: configuration data + :param format_items: format items or not """ if not items: return @@ -450,7 +447,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _get_project_disks(self, config_data, query): """ - project space disk images + project space disk images """ try: @@ -516,20 +513,20 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def fetch_projects(self, params, link, query): module = GcpMockModule(params) - auth = GcpSession(module, 'cloudresourcemanager') - response = auth.get(link, params={'filter': query}) + auth = GcpSession(module, "cloudresourcemanager") + response = auth.get(link, params={"filter": query}) return self._return_if_object(module, response) def projects_for_folder(self, config_data, folder): - link = 'https://cloudresourcemanager.googleapis.com/v1/projects' - query = 'parent.id = {0}'.format(folder) + link = "https://cloudresourcemanager.googleapis.com/v1/projects" + query = "parent.id = {0}".format(folder) projects = [] - config_data['scopes'] = ['https://www.googleapis.com/auth/cloud-platform'] + config_data["scopes"] = ["https://www.googleapis.com/auth/cloud-platform"] projects_response = self.fetch_projects(config_data, link, query) - if 'projects' in projects_response: - for item in projects_response.get('projects'): - projects.append(item['projectId']) + if "projects" in projects_response: + for item in projects_response.get("projects"): + projects.append(item["projectId"]) return projects def parse(self, inventory, loader, path, cache=True): From 12438f9bfbf4a606a9d0156031bcd65fb70003e4 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 18 Feb 2023 18:58:31 +0000 Subject: [PATCH 071/138] fix: correct gcp_compute_instance_info filter docs The link for filter documentation was pointing to gcloud, which isn't correct as gcp_compute_instance_info communicates with the API. fixes #549 --- changelogs/fragments/gce-changelog.yaml | 5 ++ plugins/modules/gcp_compute_instance_info.py | 68 +++++++++++++------- 2 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 changelogs/fragments/gce-changelog.yaml diff --git a/changelogs/fragments/gce-changelog.yaml b/changelogs/fragments/gce-changelog.yaml new file mode 100644 index 0000000..e055d12 --- /dev/null +++ b/changelogs/fragments/gce-changelog.yaml @@ -0,0 +1,5 @@ +# https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#changelog-fragment-categories +bugfixes: +- > + gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly + pointed to the gcloud filter logic rather than the API (fixes #549) \ No newline at end of file diff --git a/plugins/modules/gcp_compute_instance_info.py b/plugins/modules/gcp_compute_instance_info.py index 5b402fc..45ff875 100644 --- a/plugins/modules/gcp_compute_instance_info.py +++ b/plugins/modules/gcp_compute_instance_info.py @@ -25,9 +25,13 @@ __metaclass__ = type # Documentation ################################################################################ -ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "community", +} -DOCUMENTATION = ''' +DOCUMENTATION = """ --- module: gcp_compute_instance_info description: @@ -41,7 +45,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters). + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/compute/docs/reference/rest/v1/instances/list) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list @@ -100,9 +104,9 @@ notes: - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. - The I(service_account_email) and I(service_account_file) options are mutually exclusive. -''' +""" -EXAMPLES = ''' +EXAMPLES = """ - name: get info on an instance gcp_compute_instance_info: zone: us-central1-a @@ -111,9 +115,9 @@ EXAMPLES = ''' project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" -''' +""" -RETURN = ''' +RETURN = """ resources: description: List of resources returned: always @@ -588,12 +592,17 @@ resources: - A reference to the zone where the machine resides. returned: success type: str -''' +""" ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( + navigate_hash, + GcpSession, + GcpModule, + GcpRequest, +) import json ################################################################################ @@ -602,27 +611,40 @@ import json def main(): - module = GcpModule(argument_spec=dict(filters=dict(type='list', elements='str'), zone=dict(required=True, type='str'))) + module = GcpModule( + argument_spec=dict( + filters=dict(type="list", elements="str"), + zone=dict(required=True, type="str"), + ) + ) - if not module.params['scopes']: - module.params['scopes'] = ['https://www.googleapis.com/auth/compute'] + if not module.params["scopes"]: + module.params["scopes"] = ["https://www.googleapis.com/auth/compute"] - return_value = {'resources': fetch_list(module, collection(module), query_options(module.params['filters']))} + return_value = { + "resources": fetch_list( + module, collection(module), query_options(module.params["filters"]) + ) + } module.exit_json(**return_value) def collection(module): - return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format(**module.params) + return "https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances".format( + **module.params + ) def fetch_list(module, link, query): - auth = GcpSession(module, 'compute') - return auth.list(link, return_if_object, array_name='items', params={'filter': query}) + auth = GcpSession(module, "compute") + return auth.list( + link, return_if_object, array_name="items", params={"filter": query} + ) def query_options(filters): if not filters: - return '' + return "" if len(filters) == 1: return filters[0] @@ -630,12 +652,12 @@ def query_options(filters): queries = [] for f in filters: # For multiple queries, all queries should have () - if f[0] != '(' and f[-1] != ')': - queries.append("(%s)" % ''.join(f)) + if f[0] != "(" and f[-1] != ")": + queries.append("(%s)" % "".join(f)) else: queries.append(f) - return ' '.join(queries) + return " ".join(queries) def return_if_object(module, response): @@ -650,11 +672,11 @@ def return_if_object(module, response): try: module.raise_for_status(response) result = response.json() - except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst: + except getattr(json.decoder, "JSONDecodeError", ValueError) as inst: module.fail_json(msg="Invalid JSON response with error: %s" % inst) - if navigate_hash(result, ['error', 'errors']): - module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + if navigate_hash(result, ["error", "errors"]): + module.fail_json(msg=navigate_hash(result, ["error", "errors"])) return result From 0ad88dc39d33c1ee6c1293705616f5f9a79130e3 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 18 Feb 2023 18:48:22 +0000 Subject: [PATCH 072/138] test: disable gcp_bigtable_instance test The test is still flakey currently. A few attempts have been made to fix it, but it seems that the bigtable API does not consistently return the resource after is has been created. While exploring ways to make it more robust, disabling the test to keep the CI tests from being unreliable to the point of useless. --- tests/integration/targets/gcp_bigtable_instance/aliases | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/gcp_bigtable_instance/aliases b/tests/integration/targets/gcp_bigtable_instance/aliases index 0e4419e..3575898 100644 --- a/tests/integration/targets/gcp_bigtable_instance/aliases +++ b/tests/integration/targets/gcp_bigtable_instance/aliases @@ -1 +1,3 @@ -cloud/gcp \ No newline at end of file +cloud/gcp +# the test is still flakey currently +unsupported \ No newline at end of file From db81dcd5d57c71305843b7889b332c34336c377a Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Mon, 20 Feb 2023 05:41:17 +0000 Subject: [PATCH 073/138] test: disable flakey spanner test The test continually fails due to an existing database being created, hich implies the GET isn't returning the proper response. --- tests/integration/targets/gcp_spanner_database/aliases | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/targets/gcp_spanner_database/aliases b/tests/integration/targets/gcp_spanner_database/aliases index 0e4419e..5e0135c 100644 --- a/tests/integration/targets/gcp_spanner_database/aliases +++ b/tests/integration/targets/gcp_spanner_database/aliases @@ -1 +1,3 @@ -cloud/gcp \ No newline at end of file +cloud/gcp +# tests can be flakey +unsupported \ No newline at end of file From 15c36acbf000b468c34706a047316adff399d8ea Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 4 Mar 2023 18:14:17 +0000 Subject: [PATCH 074/138] release: 1.1.3 changes needed to release ansible 1.1.3. --- CHANGELOG.rst | 8 ++++++++ changelogs/.plugin-cache.yaml | 4 +--- changelogs/changelog.yaml | 8 ++++++++ changelogs/fragments/gce-changelog.yaml | 5 ----- galaxy.yml | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) delete mode 100644 changelogs/fragments/gce-changelog.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1b8ff86..7951534 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Google.Cloud Release Notes .. contents:: Topics +v1.1.3 +====== + +Bugfixes +-------- + +- gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly pointed to the gcloud filter logic rather than the API (fixes #549) + v1.1.2 ====== diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index f9bcfd9..3febdd4 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -6,7 +6,6 @@ plugins: callback: {} cliconf: {} connection: {} - filter: {} httpapi: {} inventory: gcp_compute: @@ -868,6 +867,5 @@ plugins: netconf: {} shell: {} strategy: {} - test: {} vars: {} -version: 1.1.2 +version: 1.1.3 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 072436a..0094543 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -38,3 +38,11 @@ releases: fragments: - fix-inventory-plugin.yml release_date: '2022-12-21' + 1.1.3: + changes: + bugfixes: + - 'gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly + pointed to the gcloud filter logic rather than the API (fixes #549)' + fragments: + - gce-changelog.yaml + release_date: '2023-03-04' diff --git a/changelogs/fragments/gce-changelog.yaml b/changelogs/fragments/gce-changelog.yaml deleted file mode 100644 index e055d12..0000000 --- a/changelogs/fragments/gce-changelog.yaml +++ /dev/null @@ -1,5 +0,0 @@ -# https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelogs.rst#changelog-fragment-categories -bugfixes: -- > - gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly - pointed to the gcloud filter logic rather than the API (fixes #549) \ No newline at end of file diff --git a/galaxy.yml b/galaxy.yml index 6887735..4569bae 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.2" +version: "1.1.3" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From cd35f3bce61b991b9d891252b494acecf174899f Mon Sep 17 00:00:00 2001 From: Samir Faci Date: Thu, 9 Mar 2023 13:50:38 -0500 Subject: [PATCH 075/138] Adding DataPlane V2 support. fix for #566 --- galaxy.yml | 9 ++++----- plugins/modules/gcp_container_cluster.py | 11 ++++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 4569bae..91695a5 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.3" +version: "1.1.4" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -17,9 +17,8 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Google -- Google - + - Google + - Google ### OPTIONAL but strongly recommended @@ -29,7 +28,7 @@ description: The Google Cloud Platform collection. # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- GPL-2.0-or-later + - GPL-2.0-or-later # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index 968dfb3..b46bd5a 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -628,6 +628,11 @@ options: required: false type: dict suboptions: + datapath_provider: + description: + - The datapath provider selects the implementation of the Kubernetes networking model for service resolution and network policy enforcement. + required: false + type: str enable_intra_node_visibility: description: - Whether Intra-node visibility is enabled for this cluster. This makes same @@ -1572,7 +1577,7 @@ def main(): binary_authorization=dict(type='dict', options=dict(enabled=dict(type='bool'))), release_channel=dict(type='dict', options=dict(channel=dict(type='str'))), shielded_nodes=dict(type='dict', options=dict(enabled=dict(type='bool'))), - network_config=dict(type='dict', options=dict(enable_intra_node_visibility=dict(type='bool'), default_snat_status=dict(type='bool'))), + network_config=dict(type='dict', options=dict(enable_intra_node_visibility=dict(type='bool'), default_snat_status=dict(type='bool'), datapath_provider=dict(type='str'))), enable_kubernetes_alpha=dict(type='bool'), location=dict(required=True, type='str', aliases=['zone']), kubectl_path=dict(type='str'), @@ -2422,12 +2427,12 @@ class ClusterNetworkconfig(object): def to_request(self): return remove_nones_from_dict( - {u'enableIntraNodeVisibility': self.request.get('enable_intra_node_visibility'), u'defaultSnatStatus': self.request.get('default_snat_status')} + {u'enableIntraNodeVisibility': self.request.get('enable_intra_node_visibility'), u'defaultSnatStatus': self.request.get('default_snat_status'), u'datapathProvider': self.request.get('datapath_provider')} ) def from_response(self): return remove_nones_from_dict( - {u'enableIntraNodeVisibility': self.request.get(u'enableIntraNodeVisibility'), u'defaultSnatStatus': self.request.get(u'defaultSnatStatus')} + {u'enableIntraNodeVisibility': self.request.get(u'enableIntraNodeVisibility'), u'defaultSnatStatus': self.request.get(u'defaultSnatStatus'), u'datapathProvider': self.request.get('datapath_provider') } ) From 86e0cef208995b8963e46c9b1464881f0d605d18 Mon Sep 17 00:00:00 2001 From: Samir Faci Date: Fri, 10 Mar 2023 11:45:12 -0500 Subject: [PATCH 076/138] Adding support for ip_allocation_policy->stack_type --- galaxy.yml | 9 +++++---- plugins/modules/gcp_container_cluster.py | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 91695a5..4569bae 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.4" +version: "1.1.3" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -17,8 +17,9 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: - - Google - - Google +- Google +- Google + ### OPTIONAL but strongly recommended @@ -28,7 +29,7 @@ description: The Google Cloud Platform collection. # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: - - GPL-2.0-or-later +- GPL-2.0-or-later # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index b46bd5a..ee059a1 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -552,6 +552,11 @@ options: - Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. required: false type: str + stack_type: + description: + - The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6) + required: false + type: str initial_cluster_version: description: - The software version of the master endpoint and kubelets used in the cluster @@ -1257,6 +1262,11 @@ ipAllocationPolicy: - Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. returned: success type: str + stackType: + description: + - The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6) + type: str + returned: success endpoint: description: - The IP address of this cluster's master endpoint. @@ -1564,6 +1574,7 @@ def main(): node_ipv4_cidr_block=dict(type='str'), services_ipv4_cidr_block=dict(type='str'), tpu_ipv4_cidr_block=dict(type='str'), + stack_type=dict(type='str'), ), ), initial_cluster_version=dict(type='str'), @@ -2253,6 +2264,7 @@ class ClusterIpallocationpolicy(object): u'nodeIpv4CidrBlock': self.request.get('node_ipv4_cidr_block'), u'servicesIpv4CidrBlock': self.request.get('services_ipv4_cidr_block'), u'tpuIpv4CidrBlock': self.request.get('tpu_ipv4_cidr_block'), + u'stackType': self.request.get('stack_type'), } ) From 203961b04511ebe828ad66b8a6961f8669007ad3 Mon Sep 17 00:00:00 2001 From: Shlomo Shuck Date: Sat, 10 Jun 2023 14:20:57 -0400 Subject: [PATCH 077/138] feat: add auth support for GCP access tokens (#574) Introduce choice "accesstoken" for auth_kind for modules Introduce optional access_token string param that falls back to GCP_ACCESS_TOKEN env var --- plugins/filter/gcp_kms_filters.py | 1 + plugins/inventory/gcp_compute.py | 8 ++++- plugins/module_utils/gcp_utils.py | 22 ++++++++++-- .../modules/gcp_appengine_firewall_rule.py | 7 ++++ .../gcp_appengine_firewall_rule_info.py | 7 ++++ plugins/modules/gcp_bigquery_dataset.py | 7 ++++ plugins/modules/gcp_bigquery_dataset_info.py | 7 ++++ plugins/modules/gcp_bigquery_table.py | 5 +++ plugins/modules/gcp_bigquery_table_info.py | 7 ++++ plugins/modules/gcp_bigtable_instance.py | 5 +++ plugins/modules/gcp_bigtable_instance_info.py | 7 ++++ plugins/modules/gcp_cloudbuild_trigger.py | 7 ++++ .../modules/gcp_cloudbuild_trigger_info.py | 7 ++++ .../gcp_cloudfunctions_cloud_function.py | 5 +++ .../gcp_cloudfunctions_cloud_function_info.py | 7 ++++ plugins/modules/gcp_cloudscheduler_job.py | 7 ++++ .../modules/gcp_cloudscheduler_job_info.py | 7 ++++ plugins/modules/gcp_cloudtasks_queue.py | 5 +++ plugins/modules/gcp_cloudtasks_queue_info.py | 7 ++++ plugins/modules/gcp_compute_address.py | 7 ++++ plugins/modules/gcp_compute_address_info.py | 7 ++++ plugins/modules/gcp_compute_autoscaler.py | 7 ++++ .../modules/gcp_compute_autoscaler_info.py | 7 ++++ plugins/modules/gcp_compute_backend_bucket.py | 7 ++++ .../gcp_compute_backend_bucket_info.py | 7 ++++ .../modules/gcp_compute_backend_service.py | 7 ++++ .../gcp_compute_backend_service_info.py | 7 ++++ plugins/modules/gcp_compute_disk.py | 7 ++++ plugins/modules/gcp_compute_disk_info.py | 7 ++++ .../gcp_compute_external_vpn_gateway.py | 7 ++++ .../gcp_compute_external_vpn_gateway_info.py | 7 ++++ plugins/modules/gcp_compute_firewall.py | 7 ++++ plugins/modules/gcp_compute_firewall_info.py | 7 ++++ .../modules/gcp_compute_forwarding_rule.py | 7 ++++ .../gcp_compute_forwarding_rule_info.py | 7 ++++ plugins/modules/gcp_compute_global_address.py | 7 ++++ .../gcp_compute_global_address_info.py | 7 ++++ .../gcp_compute_global_forwarding_rule.py | 5 +++ ...gcp_compute_global_forwarding_rule_info.py | 7 ++++ plugins/modules/gcp_compute_health_check.py | 7 ++++ .../modules/gcp_compute_health_check_info.py | 7 ++++ .../modules/gcp_compute_http_health_check.py | 7 ++++ .../gcp_compute_http_health_check_info.py | 7 ++++ .../modules/gcp_compute_https_health_check.py | 7 ++++ .../gcp_compute_https_health_check_info.py | 7 ++++ plugins/modules/gcp_compute_image.py | 7 ++++ plugins/modules/gcp_compute_image_info.py | 7 ++++ plugins/modules/gcp_compute_instance.py | 5 +++ plugins/modules/gcp_compute_instance_group.py | 5 +++ .../gcp_compute_instance_group_info.py | 7 ++++ .../gcp_compute_instance_group_manager.py | 5 +++ ...gcp_compute_instance_group_manager_info.py | 7 ++++ plugins/modules/gcp_compute_instance_info.py | 7 ++++ .../modules/gcp_compute_instance_template.py | 5 +++ .../gcp_compute_instance_template_info.py | 7 ++++ .../gcp_compute_interconnect_attachment.py | 5 +++ ...cp_compute_interconnect_attachment_info.py | 7 ++++ plugins/modules/gcp_compute_network.py | 7 ++++ .../gcp_compute_network_endpoint_group.py | 7 ++++ ...gcp_compute_network_endpoint_group_info.py | 7 ++++ plugins/modules/gcp_compute_network_info.py | 7 ++++ plugins/modules/gcp_compute_node_group.py | 7 ++++ .../modules/gcp_compute_node_group_info.py | 7 ++++ plugins/modules/gcp_compute_node_template.py | 7 ++++ .../modules/gcp_compute_node_template_info.py | 7 ++++ .../modules/gcp_compute_region_autoscaler.py | 7 ++++ .../gcp_compute_region_autoscaler_info.py | 7 ++++ .../gcp_compute_region_backend_service.py | 7 ++++ ...gcp_compute_region_backend_service_info.py | 7 ++++ plugins/modules/gcp_compute_region_disk.py | 7 ++++ .../modules/gcp_compute_region_disk_info.py | 7 ++++ .../gcp_compute_region_health_check.py | 7 ++++ .../gcp_compute_region_health_check_info.py | 7 ++++ ...p_compute_region_instance_group_manager.py | 5 +++ ...pute_region_instance_group_manager_info.py | 7 ++++ .../gcp_compute_region_target_http_proxy.py | 7 ++++ ...p_compute_region_target_http_proxy_info.py | 7 ++++ .../gcp_compute_region_target_https_proxy.py | 7 ++++ ..._compute_region_target_https_proxy_info.py | 7 ++++ plugins/modules/gcp_compute_region_url_map.py | 5 +++ .../gcp_compute_region_url_map_info.py | 7 ++++ plugins/modules/gcp_compute_reservation.py | 7 ++++ .../modules/gcp_compute_reservation_info.py | 7 ++++ .../modules/gcp_compute_resource_policy.py | 5 +++ .../gcp_compute_resource_policy_info.py | 7 ++++ plugins/modules/gcp_compute_route.py | 7 ++++ plugins/modules/gcp_compute_route_info.py | 7 ++++ plugins/modules/gcp_compute_router.py | 7 ++++ plugins/modules/gcp_compute_router_info.py | 7 ++++ plugins/modules/gcp_compute_snapshot.py | 7 ++++ plugins/modules/gcp_compute_snapshot_info.py | 7 ++++ .../modules/gcp_compute_ssl_certificate.py | 7 ++++ .../gcp_compute_ssl_certificate_info.py | 7 ++++ plugins/modules/gcp_compute_ssl_policy.py | 7 ++++ .../modules/gcp_compute_ssl_policy_info.py | 7 ++++ plugins/modules/gcp_compute_subnetwork.py | 7 ++++ .../modules/gcp_compute_subnetwork_info.py | 7 ++++ .../modules/gcp_compute_target_http_proxy.py | 7 ++++ .../gcp_compute_target_http_proxy_info.py | 7 ++++ .../modules/gcp_compute_target_https_proxy.py | 7 ++++ .../gcp_compute_target_https_proxy_info.py | 7 ++++ .../modules/gcp_compute_target_instance.py | 7 ++++ .../gcp_compute_target_instance_info.py | 7 ++++ plugins/modules/gcp_compute_target_pool.py | 7 ++++ .../modules/gcp_compute_target_pool_info.py | 7 ++++ .../modules/gcp_compute_target_ssl_proxy.py | 7 ++++ .../gcp_compute_target_ssl_proxy_info.py | 7 ++++ .../modules/gcp_compute_target_tcp_proxy.py | 7 ++++ .../gcp_compute_target_tcp_proxy_info.py | 7 ++++ .../modules/gcp_compute_target_vpn_gateway.py | 7 ++++ .../gcp_compute_target_vpn_gateway_info.py | 7 ++++ plugins/modules/gcp_compute_url_map.py | 7 ++++ plugins/modules/gcp_compute_url_map_info.py | 7 ++++ plugins/modules/gcp_compute_vpn_tunnel.py | 7 ++++ .../modules/gcp_compute_vpn_tunnel_info.py | 7 ++++ plugins/modules/gcp_container_cluster.py | 36 +++++++++++++------ plugins/modules/gcp_container_cluster_info.py | 7 ++++ plugins/modules/gcp_container_node_pool.py | 5 +++ .../modules/gcp_container_node_pool_info.py | 7 ++++ plugins/modules/gcp_dns_managed_zone.py | 7 ++++ plugins/modules/gcp_dns_managed_zone_info.py | 7 ++++ .../modules/gcp_dns_resource_record_set.py | 5 +++ .../gcp_dns_resource_record_set_info.py | 7 ++++ plugins/modules/gcp_filestore_instance.py | 7 ++++ .../modules/gcp_filestore_instance_info.py | 7 ++++ plugins/modules/gcp_iam_role.py | 5 +++ plugins/modules/gcp_iam_role_info.py | 7 ++++ plugins/modules/gcp_iam_service_account.py | 5 +++ .../modules/gcp_iam_service_account_info.py | 7 ++++ .../modules/gcp_iam_service_account_key.py | 5 +++ plugins/modules/gcp_kms_crypto_key.py | 7 ++++ plugins/modules/gcp_kms_crypto_key_info.py | 7 ++++ plugins/modules/gcp_kms_key_ring.py | 7 ++++ plugins/modules/gcp_kms_key_ring_info.py | 7 ++++ plugins/modules/gcp_logging_metric.py | 7 ++++ plugins/modules/gcp_logging_metric_info.py | 7 ++++ plugins/modules/gcp_mlengine_model.py | 7 ++++ plugins/modules/gcp_mlengine_model_info.py | 7 ++++ plugins/modules/gcp_mlengine_version.py | 5 +++ plugins/modules/gcp_mlengine_version_info.py | 7 ++++ plugins/modules/gcp_pubsub_subscription.py | 7 ++++ .../modules/gcp_pubsub_subscription_info.py | 7 ++++ plugins/modules/gcp_pubsub_topic.py | 7 ++++ plugins/modules/gcp_pubsub_topic_info.py | 7 ++++ plugins/modules/gcp_redis_instance.py | 7 ++++ plugins/modules/gcp_redis_instance_info.py | 7 ++++ .../modules/gcp_resourcemanager_project.py | 5 +++ .../gcp_resourcemanager_project_info.py | 7 ++++ plugins/modules/gcp_runtimeconfig_config.py | 5 +++ .../modules/gcp_runtimeconfig_config_info.py | 7 ++++ plugins/modules/gcp_runtimeconfig_variable.py | 5 +++ .../gcp_runtimeconfig_variable_info.py | 7 ++++ plugins/modules/gcp_serviceusage_service.py | 7 ++++ .../modules/gcp_serviceusage_service_info.py | 7 ++++ plugins/modules/gcp_sourcerepo_repository.py | 7 ++++ .../modules/gcp_sourcerepo_repository_info.py | 7 ++++ plugins/modules/gcp_spanner_database.py | 7 ++++ plugins/modules/gcp_spanner_database_info.py | 7 ++++ plugins/modules/gcp_spanner_instance.py | 7 ++++ plugins/modules/gcp_spanner_instance_info.py | 7 ++++ plugins/modules/gcp_sql_database.py | 5 +++ plugins/modules/gcp_sql_database_info.py | 7 ++++ plugins/modules/gcp_sql_instance.py | 5 +++ plugins/modules/gcp_sql_instance_info.py | 7 ++++ plugins/modules/gcp_sql_ssl_cert.py | 5 +++ plugins/modules/gcp_sql_user.py | 5 +++ plugins/modules/gcp_sql_user_info.py | 7 ++++ plugins/modules/gcp_storage_bucket.py | 5 +++ .../gcp_storage_bucket_access_control.py | 7 ++++ .../modules/gcp_storage_default_object_acl.py | 7 ++++ plugins/modules/gcp_storage_object.py | 5 +++ plugins/modules/gcp_tpu_node.py | 7 ++++ plugins/modules/gcp_tpu_node_info.py | 7 ++++ 173 files changed, 1181 insertions(+), 13 deletions(-) diff --git a/plugins/filter/gcp_kms_filters.py b/plugins/filter/gcp_kms_filters.py index 9be0be0..44ae8d0 100644 --- a/plugins/filter/gcp_kms_filters.py +++ b/plugins/filter/gcp_kms_filters.py @@ -39,6 +39,7 @@ class GcpKmsFilter(): 'auth_kind': kwargs.get('auth_kind', None), 'service_account_file': kwargs.get('service_account_file', None), 'service_account_email': kwargs.get('service_account_email', None), + 'access_token': kwargs.get('access_token', None), } if not params['scopes']: params['scopes'] = ['https://www.googleapis.com/auth/cloudkms'] diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index d380acd..d98d9c9 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -57,7 +57,7 @@ DOCUMENTATION = """ description: - The type of credential used. required: True - choices: ['application', 'serviceaccount', 'machineaccount'] + choices: ['application', 'serviceaccount', 'machineaccount', 'accesstoken'] env: - name: GCP_AUTH_KIND scopes: @@ -86,6 +86,11 @@ DOCUMENTATION = """ and the user does not wish to use the default email. env: - name: GCP_SERVICE_ACCOUNT_EMAIL + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + env: + - name: GCP_ACCESS_TOKEN vars_prefix: description: prefix to apply to host variables, does not include facts nor params default: '' @@ -558,6 +563,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): "service_account_file": self.get_option("service_account_file"), "service_account_contents": self.get_option("service_account_contents"), "service_account_email": self.get_option("service_account_email"), + "access_token": self.get_option("access_token"), } self.fake_module = GcpMockModule(params) diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 203000c..2023362 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -18,7 +18,7 @@ except ImportError: try: import google.auth import google.auth.compute_engine - from google.oauth2 import service_account + from google.oauth2 import service_account, credentials as oauth2 from google.auth.transport.requests import AuthorizedSession HAS_GOOGLE_LIBRARIES = True except ImportError: @@ -213,6 +213,11 @@ class GcpSession(object): msg="Service Account File only works with Service Account-based authentication" ) + if self.module.params.get('access_token') is not None and self.module.params['auth_kind'] != 'accesstoken': + self.module.fail_json( + msg='Supplying access_token requires auth_kind set to accesstoken' + ) + def _credentials(self): cred_type = self.module.params['auth_kind'] @@ -249,6 +254,14 @@ class GcpSession(object): return google.auth.compute_engine.Credentials( self.module.params['service_account_email']) + if cred_type == 'accesstoken': + access_token = self.module.params['access_token'] + if access_token is None: + self.module.fail_json( + msg='An access token must be supplied when auth_kind is accesstoken' + ) + return oauth2.Credentials(access_token, scopes=self.module.params['scopes']) + self.module.fail_json(msg="Credential type '%s' not implemented" % cred_type) def _headers(self): @@ -279,7 +292,7 @@ class GcpModule(AnsibleModule): auth_kind=dict( required=True, fallback=(env_fallback, ['GCP_AUTH_KIND']), - choices=['machineaccount', 'serviceaccount', 'application'], + choices=['machineaccount', 'serviceaccount', 'accesstoken', 'application'], type='str'), service_account_email=dict( required=False, @@ -294,6 +307,11 @@ class GcpModule(AnsibleModule): fallback=(env_fallback, ['GCP_SERVICE_ACCOUNT_CONTENTS']), no_log=True, type='jsonarg'), + access_token=dict( + required=False, + fallback=(env_fallback, ['GCP_ACCESS_TOKEN']), + no_log=True, + type='str'), scopes=dict( required=False, fallback=(env_fallback, ['GCP_SCOPES']), diff --git a/plugins/modules/gcp_appengine_firewall_rule.py b/plugins/modules/gcp_appengine_firewall_rule.py index 508189f..fbd8af2 100644 --- a/plugins/modules/gcp_appengine_firewall_rule.py +++ b/plugins/modules/gcp_appengine_firewall_rule.py @@ -87,6 +87,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -101,6 +102,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -121,6 +126,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_appengine_firewall_rule_info.py b/plugins/modules/gcp_appengine_firewall_rule_info.py index 639e16f..adfeaf0 100644 --- a/plugins/modules/gcp_appengine_firewall_rule_info.py +++ b/plugins/modules/gcp_appengine_firewall_rule_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_bigquery_dataset.py b/plugins/modules/gcp_bigquery_dataset.py index 85ad276..99bdb9d 100644 --- a/plugins/modules/gcp_bigquery_dataset.py +++ b/plugins/modules/gcp_bigquery_dataset.py @@ -224,6 +224,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -238,6 +239,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -258,6 +263,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_bigquery_dataset_info.py b/plugins/modules/gcp_bigquery_dataset_info.py index cc48521..c4f6a65 100644 --- a/plugins/modules/gcp_bigquery_dataset_info.py +++ b/plugins/modules/gcp_bigquery_dataset_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_bigquery_table.py b/plugins/modules/gcp_bigquery_table.py index d02d220..8d7c1e2 100644 --- a/plugins/modules/gcp_bigquery_table.py +++ b/plugins/modules/gcp_bigquery_table.py @@ -475,6 +475,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -489,6 +490,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_bigquery_table_info.py b/plugins/modules/gcp_bigquery_table_info.py index 99b89ac..45669a6 100644 --- a/plugins/modules/gcp_bigquery_table_info.py +++ b/plugins/modules/gcp_bigquery_table_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_bigtable_instance.py b/plugins/modules/gcp_bigtable_instance.py index b70b004..d314e67 100644 --- a/plugins/modules/gcp_bigtable_instance.py +++ b/plugins/modules/gcp_bigtable_instance.py @@ -117,6 +117,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -131,6 +132,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_bigtable_instance_info.py b/plugins/modules/gcp_bigtable_instance_info.py index deefad0..a8a2938 100644 --- a/plugins/modules/gcp_bigtable_instance_info.py +++ b/plugins/modules/gcp_bigtable_instance_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudbuild_trigger.py b/plugins/modules/gcp_cloudbuild_trigger.py index da506a0..a266d95 100644 --- a/plugins/modules/gcp_cloudbuild_trigger.py +++ b/plugins/modules/gcp_cloudbuild_trigger.py @@ -727,6 +727,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -741,6 +742,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -761,6 +766,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudbuild_trigger_info.py b/plugins/modules/gcp_cloudbuild_trigger_info.py index 78c4990..ebbf557 100644 --- a/plugins/modules/gcp_cloudbuild_trigger_info.py +++ b/plugins/modules/gcp_cloudbuild_trigger_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function.py b/plugins/modules/gcp_cloudfunctions_cloud_function.py index 0b3c38c..3a33f2d 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function.py @@ -174,6 +174,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -188,6 +189,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py index 36fc753..2c4df68 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudscheduler_job.py b/plugins/modules/gcp_cloudscheduler_job.py index 40559ff..c103741 100644 --- a/plugins/modules/gcp_cloudscheduler_job.py +++ b/plugins/modules/gcp_cloudscheduler_job.py @@ -310,6 +310,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -324,6 +325,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -344,6 +349,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudscheduler_job_info.py b/plugins/modules/gcp_cloudscheduler_job_info.py index 4ab155e..fda52e2 100644 --- a/plugins/modules/gcp_cloudscheduler_job_info.py +++ b/plugins/modules/gcp_cloudscheduler_job_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_cloudtasks_queue.py b/plugins/modules/gcp_cloudtasks_queue.py index b285859..90dbd65 100644 --- a/plugins/modules/gcp_cloudtasks_queue.py +++ b/plugins/modules/gcp_cloudtasks_queue.py @@ -188,6 +188,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -202,6 +203,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_cloudtasks_queue_info.py b/plugins/modules/gcp_cloudtasks_queue_info.py index 95f306b..59a742b 100644 --- a/plugins/modules/gcp_cloudtasks_queue_info.py +++ b/plugins/modules/gcp_cloudtasks_queue_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_address.py b/plugins/modules/gcp_compute_address.py index 122db49..55fd596 100644 --- a/plugins/modules/gcp_compute_address.py +++ b/plugins/modules/gcp_compute_address.py @@ -153,6 +153,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -167,6 +168,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -188,6 +193,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_address_info.py b/plugins/modules/gcp_compute_address_info.py index bbd8c2c..6e47a99 100644 --- a/plugins/modules/gcp_compute_address_info.py +++ b/plugins/modules/gcp_compute_address_info.py @@ -65,6 +65,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -79,6 +80,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -97,6 +102,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_autoscaler.py b/plugins/modules/gcp_compute_autoscaler.py index d3acc78..267116f 100644 --- a/plugins/modules/gcp_compute_autoscaler.py +++ b/plugins/modules/gcp_compute_autoscaler.py @@ -260,6 +260,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -274,6 +275,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -294,6 +299,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_autoscaler_info.py b/plugins/modules/gcp_compute_autoscaler_info.py index f8df9f4..2ec9264 100644 --- a/plugins/modules/gcp_compute_autoscaler_info.py +++ b/plugins/modules/gcp_compute_autoscaler_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_backend_bucket.py b/plugins/modules/gcp_compute_backend_bucket.py index 5746a0b..d996e7d 100644 --- a/plugins/modules/gcp_compute_backend_bucket.py +++ b/plugins/modules/gcp_compute_backend_bucket.py @@ -174,6 +174,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -188,6 +189,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -208,6 +213,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_backend_bucket_info.py b/plugins/modules/gcp_compute_backend_bucket_info.py index 31d0983..e05c011 100644 --- a/plugins/modules/gcp_compute_backend_bucket_info.py +++ b/plugins/modules/gcp_compute_backend_bucket_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index a637a9e..3a096ac 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -702,6 +702,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -716,6 +717,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -736,6 +741,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_backend_service_info.py b/plugins/modules/gcp_compute_backend_service_info.py index 415b28f..52079d5 100644 --- a/plugins/modules/gcp_compute_backend_service_info.py +++ b/plugins/modules/gcp_compute_backend_service_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_disk.py b/plugins/modules/gcp_compute_disk.py index 0dd36e2..8409cac 100644 --- a/plugins/modules/gcp_compute_disk.py +++ b/plugins/modules/gcp_compute_disk.py @@ -238,6 +238,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -252,6 +253,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -272,6 +277,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_disk_info.py b/plugins/modules/gcp_compute_disk_info.py index 1abc5c4..4d2ff40 100644 --- a/plugins/modules/gcp_compute_disk_info.py +++ b/plugins/modules/gcp_compute_disk_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_external_vpn_gateway.py b/plugins/modules/gcp_compute_external_vpn_gateway.py index 4847150..46051fb 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway.py @@ -104,6 +104,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -118,6 +119,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -137,6 +142,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_external_vpn_gateway_info.py b/plugins/modules/gcp_compute_external_vpn_gateway_info.py index cb47726..69453c2 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_firewall.py b/plugins/modules/gcp_compute_firewall.py index 08f0444..cee64bc 100644 --- a/plugins/modules/gcp_compute_firewall.py +++ b/plugins/modules/gcp_compute_firewall.py @@ -263,6 +263,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -277,6 +278,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -297,6 +302,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_firewall_info.py b/plugins/modules/gcp_compute_firewall_info.py index 6b90c57..b0336b1 100644 --- a/plugins/modules/gcp_compute_firewall_info.py +++ b/plugins/modules/gcp_compute_firewall_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_forwarding_rule.py b/plugins/modules/gcp_compute_forwarding_rule.py index f1c13cc..8141605 100644 --- a/plugins/modules/gcp_compute_forwarding_rule.py +++ b/plugins/modules/gcp_compute_forwarding_rule.py @@ -237,6 +237,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -251,6 +252,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -271,6 +276,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_forwarding_rule_info.py b/plugins/modules/gcp_compute_forwarding_rule_info.py index f13135d..de175c6 100644 --- a/plugins/modules/gcp_compute_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_forwarding_rule_info.py @@ -65,6 +65,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -79,6 +80,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -97,6 +102,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_global_address.py b/plugins/modules/gcp_compute_global_address.py index d1f02bd..2281535 100644 --- a/plugins/modules/gcp_compute_global_address.py +++ b/plugins/modules/gcp_compute_global_address.py @@ -124,6 +124,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -138,6 +139,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -158,6 +163,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_global_address_info.py b/plugins/modules/gcp_compute_global_address_info.py index a6cc0b8..bd61fdd 100644 --- a/plugins/modules/gcp_compute_global_address_info.py +++ b/plugins/modules/gcp_compute_global_address_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_global_forwarding_rule.py b/plugins/modules/gcp_compute_global_forwarding_rule.py index a9bb647..158caab 100644 --- a/plugins/modules/gcp_compute_global_forwarding_rule.py +++ b/plugins/modules/gcp_compute_global_forwarding_rule.py @@ -217,6 +217,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -231,6 +232,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_global_forwarding_rule_info.py b/plugins/modules/gcp_compute_global_forwarding_rule_info.py index 292489c..57ba3b0 100644 --- a/plugins/modules/gcp_compute_global_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_global_forwarding_rule_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_health_check.py b/plugins/modules/gcp_compute_health_check.py index e48b07c..0b70c6e 100644 --- a/plugins/modules/gcp_compute_health_check.py +++ b/plugins/modules/gcp_compute_health_check.py @@ -472,6 +472,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -486,6 +487,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -506,6 +511,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_health_check_info.py b/plugins/modules/gcp_compute_health_check_info.py index 3f323c7..e7c3941 100644 --- a/plugins/modules/gcp_compute_health_check_info.py +++ b/plugins/modules/gcp_compute_health_check_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_http_health_check.py b/plugins/modules/gcp_compute_http_health_check.py index c5da843..cee7e5d 100644 --- a/plugins/modules/gcp_compute_http_health_check.py +++ b/plugins/modules/gcp_compute_http_health_check.py @@ -125,6 +125,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -139,6 +140,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -159,6 +164,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_http_health_check_info.py b/plugins/modules/gcp_compute_http_health_check_info.py index 2c77d12..8c3fe24 100644 --- a/plugins/modules/gcp_compute_http_health_check_info.py +++ b/plugins/modules/gcp_compute_http_health_check_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_https_health_check.py b/plugins/modules/gcp_compute_https_health_check.py index 8a60ce1..d714835 100644 --- a/plugins/modules/gcp_compute_https_health_check.py +++ b/plugins/modules/gcp_compute_https_health_check.py @@ -122,6 +122,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -136,6 +137,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -156,6 +161,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_https_health_check_info.py b/plugins/modules/gcp_compute_https_health_check_info.py index 0ff6514..42162bb 100644 --- a/plugins/modules/gcp_compute_https_health_check_info.py +++ b/plugins/modules/gcp_compute_https_health_check_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_image.py b/plugins/modules/gcp_compute_image.py index c708056..66d897a 100644 --- a/plugins/modules/gcp_compute_image.py +++ b/plugins/modules/gcp_compute_image.py @@ -229,6 +229,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -243,6 +244,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -263,6 +268,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_image_info.py b/plugins/modules/gcp_compute_image_info.py index afd3962..ff16be2 100644 --- a/plugins/modules/gcp_compute_image_info.py +++ b/plugins/modules/gcp_compute_image_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py index 703ec4c..1d7f56e 100644 --- a/plugins/modules/gcp_compute_instance.py +++ b/plugins/modules/gcp_compute_instance.py @@ -522,6 +522,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -536,6 +537,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_instance_group.py b/plugins/modules/gcp_compute_instance_group.py index 419e788..8f65b4b 100644 --- a/plugins/modules/gcp_compute_instance_group.py +++ b/plugins/modules/gcp_compute_instance_group.py @@ -138,6 +138,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -152,6 +153,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_instance_group_info.py b/plugins/modules/gcp_compute_instance_group_info.py index 6a3ec0c..c290c87 100644 --- a/plugins/modules/gcp_compute_instance_group_info.py +++ b/plugins/modules/gcp_compute_instance_group_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_instance_group_manager.py b/plugins/modules/gcp_compute_instance_group_manager.py index 6b6c05f..776503d 100644 --- a/plugins/modules/gcp_compute_instance_group_manager.py +++ b/plugins/modules/gcp_compute_instance_group_manager.py @@ -136,6 +136,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -150,6 +151,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_instance_group_manager_info.py b/plugins/modules/gcp_compute_instance_group_manager_info.py index 47ec986..0936888 100644 --- a/plugins/modules/gcp_compute_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_instance_group_manager_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_instance_info.py b/plugins/modules/gcp_compute_instance_info.py index 45ff875..254d414 100644 --- a/plugins/modules/gcp_compute_instance_info.py +++ b/plugins/modules/gcp_compute_instance_info.py @@ -68,6 +68,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -82,6 +83,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -100,6 +105,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_instance_template.py b/plugins/modules/gcp_compute_instance_template.py index 0785692..ce4a8eb 100644 --- a/plugins/modules/gcp_compute_instance_template.py +++ b/plugins/modules/gcp_compute_instance_template.py @@ -485,6 +485,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -499,6 +500,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_instance_template_info.py b/plugins/modules/gcp_compute_instance_template_info.py index b08cdfa..0c57eef 100644 --- a/plugins/modules/gcp_compute_instance_template_info.py +++ b/plugins/modules/gcp_compute_instance_template_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_interconnect_attachment.py b/plugins/modules/gcp_compute_interconnect_attachment.py index 7a2c803..5deac09 100644 --- a/plugins/modules/gcp_compute_interconnect_attachment.py +++ b/plugins/modules/gcp_compute_interconnect_attachment.py @@ -194,6 +194,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -208,6 +209,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_interconnect_attachment_info.py b/plugins/modules/gcp_compute_interconnect_attachment_info.py index 933bdec..5b4b05d 100644 --- a/plugins/modules/gcp_compute_interconnect_attachment_info.py +++ b/plugins/modules/gcp_compute_interconnect_attachment_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_network.py b/plugins/modules/gcp_compute_network.py index acaf59d..843cb36 100644 --- a/plugins/modules/gcp_compute_network.py +++ b/plugins/modules/gcp_compute_network.py @@ -108,6 +108,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -122,6 +123,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -142,6 +147,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_network_endpoint_group.py b/plugins/modules/gcp_compute_network_endpoint_group.py index 9712c42..d6350de 100644 --- a/plugins/modules/gcp_compute_network_endpoint_group.py +++ b/plugins/modules/gcp_compute_network_endpoint_group.py @@ -124,6 +124,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -138,6 +139,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -158,6 +163,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_network_endpoint_group_info.py b/plugins/modules/gcp_compute_network_endpoint_group_info.py index 8f9d1a8..4968ad8 100644 --- a/plugins/modules/gcp_compute_network_endpoint_group_info.py +++ b/plugins/modules/gcp_compute_network_endpoint_group_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_network_info.py b/plugins/modules/gcp_compute_network_info.py index f2b7c49..accf074 100644 --- a/plugins/modules/gcp_compute_network_info.py +++ b/plugins/modules/gcp_compute_network_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_node_group.py b/plugins/modules/gcp_compute_node_group.py index e8bf725..c423110 100644 --- a/plugins/modules/gcp_compute_node_group.py +++ b/plugins/modules/gcp_compute_node_group.py @@ -141,6 +141,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -155,6 +156,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -175,6 +180,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_node_group_info.py b/plugins/modules/gcp_compute_node_group_info.py index 68f3409..1a883cf 100644 --- a/plugins/modules/gcp_compute_node_group_info.py +++ b/plugins/modules/gcp_compute_node_group_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_node_template.py b/plugins/modules/gcp_compute_node_template.py index 5db26ea..013cab9 100644 --- a/plugins/modules/gcp_compute_node_template.py +++ b/plugins/modules/gcp_compute_node_template.py @@ -135,6 +135,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -149,6 +150,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -169,6 +174,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_node_template_info.py b/plugins/modules/gcp_compute_node_template_info.py index 6859ca8..fd343c2 100644 --- a/plugins/modules/gcp_compute_node_template_info.py +++ b/plugins/modules/gcp_compute_node_template_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_autoscaler.py b/plugins/modules/gcp_compute_region_autoscaler.py index 06cadd3..d7eae16 100644 --- a/plugins/modules/gcp_compute_region_autoscaler.py +++ b/plugins/modules/gcp_compute_region_autoscaler.py @@ -237,6 +237,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -251,6 +252,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -271,6 +276,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_autoscaler_info.py b/plugins/modules/gcp_compute_region_autoscaler_info.py index f53968e..0acd6a1 100644 --- a/plugins/modules/gcp_compute_region_autoscaler_info.py +++ b/plugins/modules/gcp_compute_region_autoscaler_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_backend_service.py b/plugins/modules/gcp_compute_region_backend_service.py index 0ad1bcc..557e92d 100644 --- a/plugins/modules/gcp_compute_region_backend_service.py +++ b/plugins/modules/gcp_compute_region_backend_service.py @@ -718,6 +718,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -732,6 +733,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -752,6 +757,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_backend_service_info.py b/plugins/modules/gcp_compute_region_backend_service_info.py index 74bea5c..7c1a2e6 100644 --- a/plugins/modules/gcp_compute_region_backend_service_info.py +++ b/plugins/modules/gcp_compute_region_backend_service_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_disk.py b/plugins/modules/gcp_compute_region_disk.py index 17d1285..ae04b62 100644 --- a/plugins/modules/gcp_compute_region_disk.py +++ b/plugins/modules/gcp_compute_region_disk.py @@ -176,6 +176,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -190,6 +191,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -210,6 +215,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_disk_info.py b/plugins/modules/gcp_compute_region_disk_info.py index 648b4b8..820ef29 100644 --- a/plugins/modules/gcp_compute_region_disk_info.py +++ b/plugins/modules/gcp_compute_region_disk_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_health_check.py b/plugins/modules/gcp_compute_region_health_check.py index 745f9a5..c67bf6f 100644 --- a/plugins/modules/gcp_compute_region_health_check.py +++ b/plugins/modules/gcp_compute_region_health_check.py @@ -472,6 +472,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -486,6 +487,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -506,6 +511,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_health_check_info.py b/plugins/modules/gcp_compute_region_health_check_info.py index d9d4276..24cd440 100644 --- a/plugins/modules/gcp_compute_region_health_check_info.py +++ b/plugins/modules/gcp_compute_region_health_check_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_instance_group_manager.py b/plugins/modules/gcp_compute_region_instance_group_manager.py index c2f77b8..267e7f1 100644 --- a/plugins/modules/gcp_compute_region_instance_group_manager.py +++ b/plugins/modules/gcp_compute_region_instance_group_manager.py @@ -154,6 +154,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -168,6 +169,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_region_instance_group_manager_info.py b/plugins/modules/gcp_compute_region_instance_group_manager_info.py index b320149..a99e3ff 100644 --- a/plugins/modules/gcp_compute_region_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_region_instance_group_manager_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_target_http_proxy.py b/plugins/modules/gcp_compute_region_target_http_proxy.py index ec27095..c409f58 100644 --- a/plugins/modules/gcp_compute_region_target_http_proxy.py +++ b/plugins/modules/gcp_compute_region_target_http_proxy.py @@ -92,6 +92,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -106,6 +107,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -126,6 +131,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_target_http_proxy_info.py b/plugins/modules/gcp_compute_region_target_http_proxy_info.py index 3ef0366..77852f6 100644 --- a/plugins/modules/gcp_compute_region_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_http_proxy_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_target_https_proxy.py b/plugins/modules/gcp_compute_region_target_https_proxy.py index 4785633..91dfd3c 100644 --- a/plugins/modules/gcp_compute_region_target_https_proxy.py +++ b/plugins/modules/gcp_compute_region_target_https_proxy.py @@ -100,6 +100,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -114,6 +115,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -134,6 +139,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_target_https_proxy_info.py b/plugins/modules/gcp_compute_region_target_https_proxy_info.py index 0af2890..29fed35 100644 --- a/plugins/modules/gcp_compute_region_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_https_proxy_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_region_url_map.py b/plugins/modules/gcp_compute_region_url_map.py index ac46b1c..1d8c9c3 100644 --- a/plugins/modules/gcp_compute_region_url_map.py +++ b/plugins/modules/gcp_compute_region_url_map.py @@ -1602,6 +1602,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -1616,6 +1617,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_region_url_map_info.py b/plugins/modules/gcp_compute_region_url_map_info.py index ae5f174..4fdcfba 100644 --- a/plugins/modules/gcp_compute_region_url_map_info.py +++ b/plugins/modules/gcp_compute_region_url_map_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_reservation.py b/plugins/modules/gcp_compute_reservation.py index 8c82f84..93a5f6a 100644 --- a/plugins/modules/gcp_compute_reservation.py +++ b/plugins/modules/gcp_compute_reservation.py @@ -162,6 +162,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -176,6 +177,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -196,6 +201,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_reservation_info.py b/plugins/modules/gcp_compute_reservation_info.py index ee9ae46..aa9acf2 100644 --- a/plugins/modules/gcp_compute_reservation_info.py +++ b/plugins/modules/gcp_compute_reservation_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_resource_policy.py b/plugins/modules/gcp_compute_resource_policy.py index 5a668ce..cfb0043 100644 --- a/plugins/modules/gcp_compute_resource_policy.py +++ b/plugins/modules/gcp_compute_resource_policy.py @@ -274,6 +274,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -288,6 +289,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_compute_resource_policy_info.py b/plugins/modules/gcp_compute_resource_policy_info.py index 1aeb547..5e6dfd2 100644 --- a/plugins/modules/gcp_compute_resource_policy_info.py +++ b/plugins/modules/gcp_compute_resource_policy_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_route.py b/plugins/modules/gcp_compute_route.py index 3da7d0f..12b8bec 100644 --- a/plugins/modules/gcp_compute_route.py +++ b/plugins/modules/gcp_compute_route.py @@ -174,6 +174,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -188,6 +189,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -208,6 +213,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_route_info.py b/plugins/modules/gcp_compute_route_info.py index 034a315..4dc7ced 100644 --- a/plugins/modules/gcp_compute_route_info.py +++ b/plugins/modules/gcp_compute_route_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_router.py b/plugins/modules/gcp_compute_router.py index 77efcbc..d64d212 100644 --- a/plugins/modules/gcp_compute_router.py +++ b/plugins/modules/gcp_compute_router.py @@ -141,6 +141,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -155,6 +156,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -175,6 +180,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_router_info.py b/plugins/modules/gcp_compute_router_info.py index 25e148d..d847e05 100644 --- a/plugins/modules/gcp_compute_router_info.py +++ b/plugins/modules/gcp_compute_router_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_snapshot.py b/plugins/modules/gcp_compute_snapshot.py index 7f2a616..5759fbf 100644 --- a/plugins/modules/gcp_compute_snapshot.py +++ b/plugins/modules/gcp_compute_snapshot.py @@ -157,6 +157,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -171,6 +172,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -191,6 +196,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_snapshot_info.py b/plugins/modules/gcp_compute_snapshot_info.py index e1d9895..cfa1694 100644 --- a/plugins/modules/gcp_compute_snapshot_info.py +++ b/plugins/modules/gcp_compute_snapshot_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_ssl_certificate.py b/plugins/modules/gcp_compute_ssl_certificate.py index 15ddaba..d51055f 100644 --- a/plugins/modules/gcp_compute_ssl_certificate.py +++ b/plugins/modules/gcp_compute_ssl_certificate.py @@ -89,6 +89,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -103,6 +104,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -123,6 +128,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_ssl_certificate_info.py b/plugins/modules/gcp_compute_ssl_certificate_info.py index e030ce8..658d532 100644 --- a/plugins/modules/gcp_compute_ssl_certificate_info.py +++ b/plugins/modules/gcp_compute_ssl_certificate_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_ssl_policy.py b/plugins/modules/gcp_compute_ssl_policy.py index 57cda0d..d9f0e6d 100644 --- a/plugins/modules/gcp_compute_ssl_policy.py +++ b/plugins/modules/gcp_compute_ssl_policy.py @@ -99,6 +99,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -113,6 +114,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -133,6 +138,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_ssl_policy_info.py b/plugins/modules/gcp_compute_ssl_policy_info.py index a194ebe..a2de79f 100644 --- a/plugins/modules/gcp_compute_ssl_policy_info.py +++ b/plugins/modules/gcp_compute_ssl_policy_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_subnetwork.py b/plugins/modules/gcp_compute_subnetwork.py index 3fc7438..7642dc2 100644 --- a/plugins/modules/gcp_compute_subnetwork.py +++ b/plugins/modules/gcp_compute_subnetwork.py @@ -151,6 +151,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -165,6 +166,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -186,6 +191,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_subnetwork_info.py b/plugins/modules/gcp_compute_subnetwork_info.py index 428e35d..0d1870d 100644 --- a/plugins/modules/gcp_compute_subnetwork_info.py +++ b/plugins/modules/gcp_compute_subnetwork_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_http_proxy.py b/plugins/modules/gcp_compute_target_http_proxy.py index 647a9c4..5e92ee6 100644 --- a/plugins/modules/gcp_compute_target_http_proxy.py +++ b/plugins/modules/gcp_compute_target_http_proxy.py @@ -93,6 +93,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -107,6 +108,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -127,6 +132,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_http_proxy_info.py b/plugins/modules/gcp_compute_target_http_proxy_info.py index 42fbfce..cf1228e 100644 --- a/plugins/modules/gcp_compute_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_target_http_proxy_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_https_proxy.py b/plugins/modules/gcp_compute_target_https_proxy.py index fa15ab9..c692730 100644 --- a/plugins/modules/gcp_compute_target_https_proxy.py +++ b/plugins/modules/gcp_compute_target_https_proxy.py @@ -121,6 +121,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -135,6 +136,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -155,6 +160,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_https_proxy_info.py b/plugins/modules/gcp_compute_target_https_proxy_info.py index 197237c..dda7693 100644 --- a/plugins/modules/gcp_compute_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_target_https_proxy_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_instance.py b/plugins/modules/gcp_compute_target_instance.py index e3fd58e..686886d 100644 --- a/plugins/modules/gcp_compute_target_instance.py +++ b/plugins/modules/gcp_compute_target_instance.py @@ -104,6 +104,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -118,6 +119,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -138,6 +143,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_instance_info.py b/plugins/modules/gcp_compute_target_instance_info.py index 106f0ce..5bd62e8 100644 --- a/plugins/modules/gcp_compute_target_instance_info.py +++ b/plugins/modules/gcp_compute_target_instance_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_pool.py b/plugins/modules/gcp_compute_target_pool.py index b5643af..48118c1 100644 --- a/plugins/modules/gcp_compute_target_pool.py +++ b/plugins/modules/gcp_compute_target_pool.py @@ -146,6 +146,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -160,6 +161,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -180,6 +185,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_pool_info.py b/plugins/modules/gcp_compute_target_pool_info.py index f619651..928de1b 100644 --- a/plugins/modules/gcp_compute_target_pool_info.py +++ b/plugins/modules/gcp_compute_target_pool_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_ssl_proxy.py b/plugins/modules/gcp_compute_target_ssl_proxy.py index 33bf107..cd95c17 100644 --- a/plugins/modules/gcp_compute_target_ssl_proxy.py +++ b/plugins/modules/gcp_compute_target_ssl_proxy.py @@ -111,6 +111,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -125,6 +126,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -145,6 +150,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_ssl_proxy_info.py b/plugins/modules/gcp_compute_target_ssl_proxy_info.py index b6f17d8..6f2158d 100644 --- a/plugins/modules/gcp_compute_target_ssl_proxy_info.py +++ b/plugins/modules/gcp_compute_target_ssl_proxy_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_tcp_proxy.py b/plugins/modules/gcp_compute_target_tcp_proxy.py index 29793bb..945cb9c 100644 --- a/plugins/modules/gcp_compute_target_tcp_proxy.py +++ b/plugins/modules/gcp_compute_target_tcp_proxy.py @@ -98,6 +98,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -112,6 +113,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -132,6 +137,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_tcp_proxy_info.py b/plugins/modules/gcp_compute_target_tcp_proxy_info.py index 785f1ae..58c2717 100644 --- a/plugins/modules/gcp_compute_target_tcp_proxy_info.py +++ b/plugins/modules/gcp_compute_target_tcp_proxy_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_vpn_gateway.py b/plugins/modules/gcp_compute_target_vpn_gateway.py index 0c5e733..e76bd40 100644 --- a/plugins/modules/gcp_compute_target_vpn_gateway.py +++ b/plugins/modules/gcp_compute_target_vpn_gateway.py @@ -91,6 +91,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -105,6 +106,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -124,6 +129,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_target_vpn_gateway_info.py b/plugins/modules/gcp_compute_target_vpn_gateway_info.py index 24644af..f0f7ab6 100644 --- a/plugins/modules/gcp_compute_target_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_target_vpn_gateway_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_url_map.py b/plugins/modules/gcp_compute_url_map.py index ed35cfc..2856e59 100644 --- a/plugins/modules/gcp_compute_url_map.py +++ b/plugins/modules/gcp_compute_url_map.py @@ -2547,6 +2547,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -2561,6 +2562,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -2580,6 +2585,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_url_map_info.py b/plugins/modules/gcp_compute_url_map_info.py index 0bbc262..e8e8837 100644 --- a/plugins/modules/gcp_compute_url_map_info.py +++ b/plugins/modules/gcp_compute_url_map_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_vpn_tunnel.py b/plugins/modules/gcp_compute_vpn_tunnel.py index 60705a6..a59e469 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel.py +++ b/plugins/modules/gcp_compute_vpn_tunnel.py @@ -178,6 +178,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -192,6 +193,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -213,6 +218,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_compute_vpn_tunnel_info.py b/plugins/modules/gcp_compute_vpn_tunnel_info.py index e0ee1f9..ac4f6cc 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel_info.py +++ b/plugins/modules/gcp_compute_vpn_tunnel_info.py @@ -64,6 +64,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -78,6 +79,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -96,6 +101,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index ee059a1..0a03999 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -554,7 +554,7 @@ options: type: str stack_type: description: - - The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6) + - 'The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6)' required: false type: str initial_cluster_version: @@ -633,7 +633,7 @@ options: required: false type: dict suboptions: - datapath_provider: + datapath_provider: description: - The datapath provider selects the implementation of the Kubernetes networking model for service resolution and network policy enforcement. required: false @@ -691,6 +691,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -705,6 +706,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -1264,7 +1269,7 @@ ipAllocationPolicy: type: str stackType: description: - - The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6) + - 'The IP stack type of the cluster, possible values: (STACK_TYPE_UNSPECIFIED, IPV4, IPV4_IPV6)' type: str returned: success endpoint: @@ -1588,7 +1593,14 @@ def main(): binary_authorization=dict(type='dict', options=dict(enabled=dict(type='bool'))), release_channel=dict(type='dict', options=dict(channel=dict(type='str'))), shielded_nodes=dict(type='dict', options=dict(enabled=dict(type='bool'))), - network_config=dict(type='dict', options=dict(enable_intra_node_visibility=dict(type='bool'), default_snat_status=dict(type='bool'), datapath_provider=dict(type='str'))), + network_config=dict( + type='dict', + options=dict( + enable_intra_node_visibility=dict(type='bool'), + default_snat_status=dict(type='bool'), + datapath_provider=dict(type='str'), + ), + ), enable_kubernetes_alpha=dict(type='bool'), location=dict(required=True, type='str', aliases=['zone']), kubectl_path=dict(type='str'), @@ -2438,14 +2450,18 @@ class ClusterNetworkconfig(object): self.request = {} def to_request(self): - return remove_nones_from_dict( - {u'enableIntraNodeVisibility': self.request.get('enable_intra_node_visibility'), u'defaultSnatStatus': self.request.get('default_snat_status'), u'datapathProvider': self.request.get('datapath_provider')} - ) + return remove_nones_from_dict({ + u'enableIntraNodeVisibility': self.request.get('enable_intra_node_visibility'), + u'defaultSnatStatus': self.request.get('default_snat_status'), + u'datapathProvider': self.request.get('datapath_provider'), + }) def from_response(self): - return remove_nones_from_dict( - {u'enableIntraNodeVisibility': self.request.get(u'enableIntraNodeVisibility'), u'defaultSnatStatus': self.request.get(u'defaultSnatStatus'), u'datapathProvider': self.request.get('datapath_provider') } - ) + return remove_nones_from_dict({ + u'enableIntraNodeVisibility': self.request.get(u'enableIntraNodeVisibility'), + u'defaultSnatStatus': self.request.get(u'defaultSnatStatus'), + u'datapathProvider': self.request.get('datapath_provider'), + }) if __name__ == '__main__': diff --git a/plugins/modules/gcp_container_cluster_info.py b/plugins/modules/gcp_container_cluster_info.py index 77d5779..bb9d8f7 100644 --- a/plugins/modules/gcp_container_cluster_info.py +++ b/plugins/modules/gcp_container_cluster_info.py @@ -60,6 +60,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -74,6 +75,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -92,6 +97,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_container_node_pool.py b/plugins/modules/gcp_container_node_pool.py index 82091a6..1740837 100644 --- a/plugins/modules/gcp_container_node_pool.py +++ b/plugins/modules/gcp_container_node_pool.py @@ -358,6 +358,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -372,6 +373,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_container_node_pool_info.py b/plugins/modules/gcp_container_node_pool_info.py index 03c7ccd..d990e5b 100644 --- a/plugins/modules/gcp_container_node_pool_info.py +++ b/plugins/modules/gcp_container_node_pool_info.py @@ -70,6 +70,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -84,6 +85,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -102,6 +107,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_dns_managed_zone.py b/plugins/modules/gcp_dns_managed_zone.py index 5f45580..91824e7 100644 --- a/plugins/modules/gcp_dns_managed_zone.py +++ b/plugins/modules/gcp_dns_managed_zone.py @@ -234,6 +234,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -248,6 +249,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -268,6 +273,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_dns_managed_zone_info.py b/plugins/modules/gcp_dns_managed_zone_info.py index c0905ab..f23c2f1 100644 --- a/plugins/modules/gcp_dns_managed_zone_info.py +++ b/plugins/modules/gcp_dns_managed_zone_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_dns_resource_record_set.py b/plugins/modules/gcp_dns_resource_record_set.py index cfa2058..c982205 100644 --- a/plugins/modules/gcp_dns_resource_record_set.py +++ b/plugins/modules/gcp_dns_resource_record_set.py @@ -94,6 +94,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -108,6 +109,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_dns_resource_record_set_info.py b/plugins/modules/gcp_dns_resource_record_set_info.py index 5fafd64..48b2bc9 100644 --- a/plugins/modules/gcp_dns_resource_record_set_info.py +++ b/plugins/modules/gcp_dns_resource_record_set_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_filestore_instance.py b/plugins/modules/gcp_filestore_instance.py index 7028ffe..4cd602b 100644 --- a/plugins/modules/gcp_filestore_instance.py +++ b/plugins/modules/gcp_filestore_instance.py @@ -131,6 +131,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -145,6 +146,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -167,6 +172,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_filestore_instance_info.py b/plugins/modules/gcp_filestore_instance_info.py index 713fcc6..fa7d118 100644 --- a/plugins/modules/gcp_filestore_instance_info.py +++ b/plugins/modules/gcp_filestore_instance_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index a87aa58..04248ba 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -93,6 +93,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -107,6 +108,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_iam_role_info.py b/plugins/modules/gcp_iam_role_info.py index de791b2..c88bdf9 100644 --- a/plugins/modules/gcp_iam_role_info.py +++ b/plugins/modules/gcp_iam_role_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_iam_service_account.py b/plugins/modules/gcp_iam_service_account.py index fa93014..dc27174 100644 --- a/plugins/modules/gcp_iam_service_account.py +++ b/plugins/modules/gcp_iam_service_account.py @@ -70,6 +70,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -84,6 +85,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_iam_service_account_info.py b/plugins/modules/gcp_iam_service_account_info.py index 5a0d94e..9b045f2 100644 --- a/plugins/modules/gcp_iam_service_account_info.py +++ b/plugins/modules/gcp_iam_service_account_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_iam_service_account_key.py b/plugins/modules/gcp_iam_service_account_key.py index 633fd74..8972875 100644 --- a/plugins/modules/gcp_iam_service_account_key.py +++ b/plugins/modules/gcp_iam_service_account_key.py @@ -89,6 +89,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -103,6 +104,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_kms_crypto_key.py b/plugins/modules/gcp_kms_crypto_key.py index bdd6fbc..1d69966 100644 --- a/plugins/modules/gcp_kms_crypto_key.py +++ b/plugins/modules/gcp_kms_crypto_key.py @@ -118,6 +118,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -132,6 +133,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -152,6 +157,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_kms_crypto_key_info.py b/plugins/modules/gcp_kms_crypto_key_info.py index 24e98a9..9337f5e 100644 --- a/plugins/modules/gcp_kms_crypto_key_info.py +++ b/plugins/modules/gcp_kms_crypto_key_info.py @@ -58,6 +58,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -72,6 +73,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -90,6 +95,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_kms_key_ring.py b/plugins/modules/gcp_kms_key_ring.py index 23bab15..4c2b0bf 100644 --- a/plugins/modules/gcp_kms_key_ring.py +++ b/plugins/modules/gcp_kms_key_ring.py @@ -72,6 +72,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -86,6 +87,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -106,6 +111,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_kms_key_ring_info.py b/plugins/modules/gcp_kms_key_ring_info.py index 01e8fad..5b7ba43 100644 --- a/plugins/modules/gcp_kms_key_ring_info.py +++ b/plugins/modules/gcp_kms_key_ring_info.py @@ -59,6 +59,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -73,6 +74,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -91,6 +96,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_logging_metric.py b/plugins/modules/gcp_logging_metric.py index 5d4740c..88d3dc2 100644 --- a/plugins/modules/gcp_logging_metric.py +++ b/plugins/modules/gcp_logging_metric.py @@ -239,6 +239,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -253,6 +254,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -273,6 +278,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_logging_metric_info.py b/plugins/modules/gcp_logging_metric_info.py index 482a840..244784b 100644 --- a/plugins/modules/gcp_logging_metric_info.py +++ b/plugins/modules/gcp_logging_metric_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_mlengine_model.py b/plugins/modules/gcp_mlengine_model.py index d143c98..f807037 100644 --- a/plugins/modules/gcp_mlengine_model.py +++ b/plugins/modules/gcp_mlengine_model.py @@ -107,6 +107,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -121,6 +122,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -141,6 +146,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_mlengine_model_info.py b/plugins/modules/gcp_mlengine_model_info.py index cdd2330..e82c175 100644 --- a/plugins/modules/gcp_mlengine_model_info.py +++ b/plugins/modules/gcp_mlengine_model_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_mlengine_version.py b/plugins/modules/gcp_mlengine_version.py index 5bb0620..e19fbe7 100644 --- a/plugins/modules/gcp_mlengine_version.py +++ b/plugins/modules/gcp_mlengine_version.py @@ -170,6 +170,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -184,6 +185,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_mlengine_version_info.py b/plugins/modules/gcp_mlengine_version_info.py index da88e7b..9f8e945 100644 --- a/plugins/modules/gcp_mlengine_version_info.py +++ b/plugins/modules/gcp_mlengine_version_info.py @@ -62,6 +62,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -76,6 +77,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -94,6 +99,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_pubsub_subscription.py b/plugins/modules/gcp_pubsub_subscription.py index 08edb64..f39583b 100644 --- a/plugins/modules/gcp_pubsub_subscription.py +++ b/plugins/modules/gcp_pubsub_subscription.py @@ -273,6 +273,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -287,6 +288,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -307,6 +312,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_pubsub_subscription_info.py b/plugins/modules/gcp_pubsub_subscription_info.py index ee5cf64..e9541ed 100644 --- a/plugins/modules/gcp_pubsub_subscription_info.py +++ b/plugins/modules/gcp_pubsub_subscription_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_pubsub_topic.py b/plugins/modules/gcp_pubsub_topic.py index 673df49..47968e4 100644 --- a/plugins/modules/gcp_pubsub_topic.py +++ b/plugins/modules/gcp_pubsub_topic.py @@ -117,6 +117,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -131,6 +132,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -151,6 +156,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_pubsub_topic_info.py b/plugins/modules/gcp_pubsub_topic_info.py index fa19401..c4cccf7 100644 --- a/plugins/modules/gcp_pubsub_topic_info.py +++ b/plugins/modules/gcp_pubsub_topic_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_redis_instance.py b/plugins/modules/gcp_redis_instance.py index fe817c2..285a663 100644 --- a/plugins/modules/gcp_redis_instance.py +++ b/plugins/modules/gcp_redis_instance.py @@ -162,6 +162,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -176,6 +177,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -196,6 +201,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_redis_instance_info.py b/plugins/modules/gcp_redis_instance_info.py index 86b7d1c..349778f 100644 --- a/plugins/modules/gcp_redis_instance_info.py +++ b/plugins/modules/gcp_redis_instance_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index 045ec6e..51f1a37 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -103,6 +103,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -117,6 +118,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_resourcemanager_project_info.py b/plugins/modules/gcp_resourcemanager_project_info.py index 1df3864..bd06067 100644 --- a/plugins/modules/gcp_resourcemanager_project_info.py +++ b/plugins/modules/gcp_resourcemanager_project_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_runtimeconfig_config.py b/plugins/modules/gcp_runtimeconfig_config.py index cad3c57..6f386f9 100644 --- a/plugins/modules/gcp_runtimeconfig_config.py +++ b/plugins/modules/gcp_runtimeconfig_config.py @@ -71,6 +71,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -85,6 +86,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_runtimeconfig_config_info.py b/plugins/modules/gcp_runtimeconfig_config_info.py index c1aa11b..154896a 100644 --- a/plugins/modules/gcp_runtimeconfig_config_info.py +++ b/plugins/modules/gcp_runtimeconfig_config_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_runtimeconfig_variable.py b/plugins/modules/gcp_runtimeconfig_variable.py index 6d8de23..9e922c1 100644 --- a/plugins/modules/gcp_runtimeconfig_variable.py +++ b/plugins/modules/gcp_runtimeconfig_variable.py @@ -80,6 +80,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -94,6 +95,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_runtimeconfig_variable_info.py b/plugins/modules/gcp_runtimeconfig_variable_info.py index 7c882f6..c786cb1 100644 --- a/plugins/modules/gcp_runtimeconfig_variable_info.py +++ b/plugins/modules/gcp_runtimeconfig_variable_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_serviceusage_service.py b/plugins/modules/gcp_serviceusage_service.py index fff0d73..49e803e 100644 --- a/plugins/modules/gcp_serviceusage_service.py +++ b/plugins/modules/gcp_serviceusage_service.py @@ -71,6 +71,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -85,6 +86,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -104,6 +109,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_serviceusage_service_info.py b/plugins/modules/gcp_serviceusage_service_info.py index 7c57233..e18a7ac 100644 --- a/plugins/modules/gcp_serviceusage_service_info.py +++ b/plugins/modules/gcp_serviceusage_service_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_sourcerepo_repository.py b/plugins/modules/gcp_sourcerepo_repository.py index 4e902c1..c1f8486 100644 --- a/plugins/modules/gcp_sourcerepo_repository.py +++ b/plugins/modules/gcp_sourcerepo_repository.py @@ -67,6 +67,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -81,6 +82,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -101,6 +106,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_sourcerepo_repository_info.py b/plugins/modules/gcp_sourcerepo_repository_info.py index a534ade..5c8387f 100644 --- a/plugins/modules/gcp_sourcerepo_repository_info.py +++ b/plugins/modules/gcp_sourcerepo_repository_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_spanner_database.py b/plugins/modules/gcp_spanner_database.py index 4d7356f..6c6bce9 100644 --- a/plugins/modules/gcp_spanner_database.py +++ b/plugins/modules/gcp_spanner_database.py @@ -97,6 +97,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -111,6 +112,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -131,6 +136,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_spanner_database_info.py b/plugins/modules/gcp_spanner_database_info.py index 2f11f1c..589198d 100644 --- a/plugins/modules/gcp_spanner_database_info.py +++ b/plugins/modules/gcp_spanner_database_info.py @@ -62,6 +62,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -76,6 +77,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -94,6 +99,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_spanner_instance.py b/plugins/modules/gcp_spanner_instance.py index 8458042..fce17d8 100644 --- a/plugins/modules/gcp_spanner_instance.py +++ b/plugins/modules/gcp_spanner_instance.py @@ -100,6 +100,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -114,6 +115,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -134,6 +139,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_spanner_instance_info.py b/plugins/modules/gcp_spanner_instance_info.py index 1fc5fce..5488691 100644 --- a/plugins/modules/gcp_spanner_instance_info.py +++ b/plugins/modules/gcp_spanner_instance_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_sql_database.py b/plugins/modules/gcp_sql_database.py index c43673d..99fc423 100644 --- a/plugins/modules/gcp_sql_database.py +++ b/plugins/modules/gcp_sql_database.py @@ -87,6 +87,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -101,6 +102,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_sql_database_info.py b/plugins/modules/gcp_sql_database_info.py index 4938076..f2267b1 100644 --- a/plugins/modules/gcp_sql_database_info.py +++ b/plugins/modules/gcp_sql_database_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_sql_instance.py b/plugins/modules/gcp_sql_instance.py index bb19ecf..b43ad29 100644 --- a/plugins/modules/gcp_sql_instance.py +++ b/plugins/modules/gcp_sql_instance.py @@ -370,6 +370,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -384,6 +385,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_sql_instance_info.py b/plugins/modules/gcp_sql_instance_info.py index 71d09d2..3e14f27 100644 --- a/plugins/modules/gcp_sql_instance_info.py +++ b/plugins/modules/gcp_sql_instance_info.py @@ -52,6 +52,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -66,6 +67,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -84,6 +89,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_sql_ssl_cert.py b/plugins/modules/gcp_sql_ssl_cert.py index 96e9cc1..b08eede 100644 --- a/plugins/modules/gcp_sql_ssl_cert.py +++ b/plugins/modules/gcp_sql_ssl_cert.py @@ -103,6 +103,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -117,6 +118,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_sql_user.py b/plugins/modules/gcp_sql_user.py index d7e211a..ca2cbf4 100644 --- a/plugins/modules/gcp_sql_user.py +++ b/plugins/modules/gcp_sql_user.py @@ -87,6 +87,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -101,6 +102,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_sql_user_info.py b/plugins/modules/gcp_sql_user_info.py index dfb3e08..948808d 100644 --- a/plugins/modules/gcp_sql_user_info.py +++ b/plugins/modules/gcp_sql_user_info.py @@ -62,6 +62,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -76,6 +77,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -94,6 +99,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_storage_bucket.py b/plugins/modules/gcp_storage_bucket.py index f9bad46..18645d9 100644 --- a/plugins/modules/gcp_storage_bucket.py +++ b/plugins/modules/gcp_storage_bucket.py @@ -414,6 +414,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -428,6 +429,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_storage_bucket_access_control.py b/plugins/modules/gcp_storage_bucket_access_control.py index c6d36a8..b2b1ea7 100644 --- a/plugins/modules/gcp_storage_bucket_access_control.py +++ b/plugins/modules/gcp_storage_bucket_access_control.py @@ -95,6 +95,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -109,6 +110,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -129,6 +134,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_storage_default_object_acl.py b/plugins/modules/gcp_storage_default_object_acl.py index 8a3b538..abcf2c9 100644 --- a/plugins/modules/gcp_storage_default_object_acl.py +++ b/plugins/modules/gcp_storage_default_object_acl.py @@ -99,6 +99,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -113,6 +114,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -133,6 +138,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index 6d497bd..f6fcb01 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -69,6 +69,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -83,6 +84,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used diff --git a/plugins/modules/gcp_tpu_node.py b/plugins/modules/gcp_tpu_node.py index 8a7e11f..d5c6289 100644 --- a/plugins/modules/gcp_tpu_node.py +++ b/plugins/modules/gcp_tpu_node.py @@ -130,6 +130,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -144,6 +145,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -164,6 +169,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. diff --git a/plugins/modules/gcp_tpu_node_info.py b/plugins/modules/gcp_tpu_node_info.py index cd27a67..60c81b7 100644 --- a/plugins/modules/gcp_tpu_node_info.py +++ b/plugins/modules/gcp_tpu_node_info.py @@ -57,6 +57,7 @@ options: - application - machineaccount - serviceaccount + - accesstoken service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a @@ -71,6 +72,10 @@ options: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + type: str scopes: description: - Array of scopes to be used @@ -89,6 +94,8 @@ notes: env variable. - For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) env variable. +- For authentication, you can set access_token using the C(GCP_ACCESS_TOKEN) + env variable. - For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. - For authentication, you can set scopes using the C(GCP_SCOPES) env variable. - Environment variables values will only be used if the playbook values are not set. From 30a4e6636325a68a9946054eea95b0eb6bfd20de Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Sat, 10 Jun 2023 11:39:44 -0700 Subject: [PATCH 078/138] fix: use default service account if unset (#572) `service_account_email` defaults to None if one is not set. For gcp_compute_instance_info, this results in an invalid request as the service account is populated directly in the path. Populating `default` when a value is not set fixes the error. fixes #568 --- plugins/module_utils/gcp_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index 2023362..bff15f8 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -251,8 +251,9 @@ class GcpSession(object): return svc_acct_creds.with_scopes(self.module.params['scopes']) if cred_type == 'machineaccount': - return google.auth.compute_engine.Credentials( - self.module.params['service_account_email']) + email = self.module.params['service_account_email'] + email = email if email is not None else "default" + return google.auth.compute_engine.Credentials(email) if cred_type == 'accesstoken': access_token = self.module.params['access_token'] From 76eb024c250af3b7ff8adec909bef06667833509 Mon Sep 17 00:00:00 2001 From: Dave Costakos Date: Wed, 21 Jun 2023 16:24:14 -0700 Subject: [PATCH 079/138] Adding support for Google Secret Manager for issue 543 --- plugins/lookup/gcp_secret_manager.py | 213 +++++++++++++ plugins/modules/gcp_secret_manager.py | 413 ++++++++++++++++++++++++++ 2 files changed, 626 insertions(+) create mode 100644 plugins/lookup/gcp_secret_manager.py create mode 100644 plugins/modules/gcp_secret_manager.py diff --git a/plugins/lookup/gcp_secret_manager.py b/plugins/lookup/gcp_secret_manager.py new file mode 100644 index 0000000..56b11ac --- /dev/null +++ b/plugins/lookup/gcp_secret_manager.py @@ -0,0 +1,213 @@ +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +DOCUMENTATION = ''' + author: + - Dave Costakos + name: gcp_secret_manager + short_description: Get Secrets from Google Cloud as a Lookup plugin + description: + - retrieve secret keys in Secret Manager for use in playbooks + - see https://cloud.google.com/iam/docs/service-account-creds for details on creating + credentials for Google Cloud and the format of such credentials + - once a secret value is retreived, it is returned decoded. It is up to the developer + to maintain secrecy of this value once returned. + + options: + key: + description: + - the key of the secret to look up in Secret Manager + type: str + required: True + project: + description: + - The name of the google cloud project + - defaults to OS env variable GCP_PROJECT if not present + type: str + auth_kind: + description: + - the type of authentication to use with Google Cloud (i.e. serviceaccount or machineaccount) + - defaults to OS env variable GCP_AUTH_KIND if not present + type: str + version: + description: + - the version name of your secret to retrieve + type: str + default: latest + required: False + service_account_email: + description: + - email associated with the service account + - defaults to OS env variable GCP_SERVICE_ACCOUNT_EMAIL if not present + type: str + required: False + service_account_file: + description: + - JSON Credential file obtained from Google Cloud + - defaults to OS env variable GCP_SERVICE_ACCOUNT_FILE if not present + - see https://cloud.google.com/iam/docs/service-account-creds for details + type: str + required: False + service_account_info: + description: + - JSON Object representing the contents of a service_account_file obtained from Google Cloud + - defaults to OS env variable GCP_SERVICE_ACCOUNT_INFO if not present + type: jsonarg + required: False + errors: + description: + - how to handle errors + choices: ['strict','warn','ignore'] + default: strict +''' + +EXAMPLES = ''' +- name: Test secret using env variables for credentials + ansible.builtin.debug: + msg: "{{ lookup('google.cloud.gcp_secret_manager', key='secret_key') }}" + +- name: Test secret using explicit credentials + ansible.builtin.debug: + msg: "{{ lookup('google.cloud.gcp_secret_manager', key='secret_key', project='project', auth_kind='serviceaccount', service_account_file='file.json') }}" + +- name: Test getting specific version of a secret (old version) + ansible.builtin.debug: + msg: "{{ lookup('google.cloud.gcp_secret_manager', key='secret_key', version='1') }}" + +- name: Test getting specific version of a secret (new version) + ansible.builtin.debug: + msg: "{{ lookup('google.cloud.gcp_secret_manager', key='secret_key', version='2') }}" +''' + +RETURN = ''' + _raw: + description: the contents of the secret requested (please use "no_log" to not expose this secret) + type: list + elements: str +''' + +################################################################################ +# Imports +################################################################################ + +import json +import os +import base64 + + +from ansible.plugins.lookup import LookupBase + +try: + import requests + HAS_REQUESTS = True +except ImportError: + HAS_REQUESTS = False + +try: + import google.auth + from google.oauth2 import service_account + from google.auth.transport.requests import AuthorizedSession + HAS_GOOGLE_LIBRARIES = True +except ImportError: + HAS_GOOGLE_LIBRARIES = False + +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import GcpSession, GcpRequest +from ansible.errors import AnsibleError + +class GcpLookupException(Exception): + pass + +class LookupModule(LookupBase): + def run(self, terms, variables, **kwargs): + self.set_options(var_options=variables, direct=kwargs) + self.scopes = ["https://www.googleapis.com/auth/cloud-platform"] + self._validate() + self.service_acct_creds = self._credentials() + session = AuthorizedSession(self.service_acct_creds) + response = session.get("https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{key}/versions/{version}:access".format(**self.get_options())) + if response.status_code == 200: + result_data = response.json() + secret_value = base64.b64decode(result_data['payload']['data']) + return [ secret_value ] + else: + if self.get_option('errors') == 'warn': + self.warn(f"secret request returned bad status: {response.status_code} {response.json()}") + return [ '' ] + elif self.get_option('error') == 'ignore': + return [ '' ] + else: + raise AnsibleError(f"secret request returned bad status: {response.status_code} {response.json()}") + + def _validate(self): + if HAS_GOOGLE_LIBRARIES == False: + raise AnsibleError("Please install the google-auth library") + + if HAS_REQUESTS == False: + raise AnsibleError("Please install the requests library") + + if self.get_option('key') == None: + raise AnsibleError("'key' is a required parameter") + + if self.get_option('version') == None: + self.set_option('version', 'latest') + + self._set_from_env('project', 'GCP_PROJECT', True) + self._set_from_env('auth_kind', 'GCP_AUTH_KIND', True) + self._set_from_env('service_account_email', 'GCP_SERVICE_ACCOUNT_EMAIL') + self._set_from_env('service_account_file', 'GCP_SERVICE_ACCOUNT_FILE') + self._set_from_env('service_account_info', 'GCP_SERVICE_ACCOUNT_INFO') + + def _set_from_env(self, var=None, env_name=None, raise_on_empty=False): + if self.get_option(var) == None: + if env_name is not None and env_name in os.environ: + fallback = os.environ[env_name] + self.set_option(var, fallback) + + if self.get_option(var) == None and raise_on_empty: + msg = f"No key '{var}' provided" + if env_name is not None: + msg += f" and no fallback to env['{env_name}'] available" + raise AnsibleError(msg) + + def _credentials(self): + cred_type = self.get_option('auth_kind') + + if cred_type == 'application': + credentials, project_id = google.auth.default(scopes=self.scopes) + return credentials + + if cred_type == 'serviceaccount': + if self.get_option('service_account_file') is not None: + path = os.path.realpath(os.path.expanduser(self.get_option('service_account_file'))) + try: + svc_acct_creds = service_account.Credentials.from_service_account_file(path) + except OSError as e: + raise GcpLookupException("Unable to read service_account_file at %s: %s" % (path, e.strerror)) + + elif self.get_option('service_account_contents') is not None: + try: + info = json.loads(self.get_option('service_account_contents')) + except json.decoder.JSONDecodeError as e: + raise GcpLookupException("Unable to decode service_account_contents as JSON: %s" % e) + + svc_acct_creds = service_account.Credentials.from_service_account_info(info) + else: + raise GcpLookupException('Service Account authentication requires setting either service_account_file or service_account_contents') + + return svc_acct_creds.with_scopes(self.scopes) + + if cred_type == 'machineaccount': + self.svc_acct_creds = google.auth.compute_engine.Credentials(self.service_account_email) + return self.svc_acct_creds + + raise GcpLookupException("Credential type '%s' not implemented" % cred_type) + + + + + + + diff --git a/plugins/modules/gcp_secret_manager.py b/plugins/modules/gcp_secret_manager.py new file mode 100644 index 0000000..b8bf30b --- /dev/null +++ b/plugins/modules/gcp_secret_manager.py @@ -0,0 +1,413 @@ +#!/usr/bin/env python + +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later +################################################################################ +# Documentation +################################################################################ + +ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} + +DOCUMENTATION=''' +--- +module: gcp_secret_manager +description: +- Simple create/delete of secrets +- add or delete secret versions +- other features like etags, replication, annontation expected to be managed outside of Ansible +requirements: +- python >= 2.6 +- requests >= 2.18.4 +- google-auth >= 1.3.0 +options: +options: + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + elements: str + name: + description: + - Name of the secret to be used + type: str + value: + description: + - The secret value that the secret should have + - this will be set upon create + - If the secret value is not this, a new version will be added with this value + type: str + state: + description: + - 'absent' or 'present': whether the secret should exist + type: str + return_value: + description: + - if true, the value of the secret will be returned unencrypted to Ansible + - if false, no value will be returned or decrypted + type: bool + default: true + version: + description: + - A version label to apply to the secret + - Default is "latest" which is the newest version of the secret + - "all" is also acceptable on delete (which will delete all versions of a secret) + type: str + default: 'latest' +''' + +EXAMPLES=''' +- name: Create a new secret + google.cloud.gcp_secret_manager: + name: secret_key + value: super_secret + state: present + auth_kind: serviceaccount + service_account_file: service_account_creds.json + +- name: Ensure the secretexists, fail otherwise and return the value + google.cloud.gcp_secret_manager: + name: secret_key + state: present + +- name: Ensure secret exists but don't return the value + google.cloud.gcp_secret_manager: + name: secret_key + state: present + return_value: false + +- name: Add a new version of a secret + google.cloud.gcp_secret_manager: + name: secret_key + value: updated super secret + state: present + +- name: Delete version 1 of a secret (but not the secret itself) + google.cloud.gcp_secret_manager: + name: secret_key + version: 1 + state: absent + +- name: Delete all versions of a secret + google.cloud.gcp_secret_manager: + name: secret_key + version: all + state: absent + +- name: Get +''' + +RETURN = ''' +resources: + description: List of resources + returned: always + type: complex + name: + description: + - The name of the secret + returned: success + type: str + version: + description: + - the version number of the secret returned + returned: success + type: str + url: + description: + - the Google Cloud URL used to make the request + returned: success + type: str + status_code: + description: + - the HTTP status code of the response to Google Cloud + returned: success + type: str + msg: + description: + - A message indicating what was done (or not done) + returned: success, failure + type: str + value: + description: + - The decrypted secret value, please use care with this + returned: success + type: str + payload: + description: + - The base 64 secret payload including CRC for validation + retunred: success + type: dict +''' + +################################################################################ +# Imports +################################################################################ + +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( + navigate_hash, + GcpSession, + GcpModule, + GcpRequest, + remove_nones_from_dict, + replace_resource_dict, +) + +import json +# for decoding and validating secrets +import base64 +import binascii + + +def get_auth(module): + return GcpSession(module, 'secret-manager') + +def self_access_link(module): + return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}:access".format(**module.params) + +def self_get_link(module): + return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}".format(**module.params) + +def self_update_link(module): + return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version:version}".format(**module.params) + +def self_list_link(module): + return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions?filter=state:ENABLED".format(**module.params) + +def self_delete_link(module): + return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}".format(**module.params) + + +def fetch_resource(module, allow_not_found=True): + auth = get_auth(module) + # set version to the latest version because + # we can't be sure that "latest" is always going + # to be set if secret versions get disabled + # see https://issuetracker.google.com/issues/286489671 + if module.params['version'] == "latest" or module.params['version'] == 'all': + version_list = list_secret_versions(module) + latest_version = None + if version_list is None: + return None + + if "versions" in version_list: + latest_version = sorted(version_list['versions'], key=lambda d: d['name'])[-1]['name'].split('/')[-1] + module.params['calc_version'] = latest_version + else: + # if this occurs, there are no available secret versions + # handle the corner case that we tried to delete + # a secret version that doesn't exist + if module.params['state'] == "absent": + return { "action": "delete_secret" } + + link = self_access_link(module) + access_obj = return_if_object(module, auth.get(link), allow_not_found) + if access_obj is None: + return None + link = self_get_link(module) + get_obj = return_if_object(module, auth.get(link), allow_not_found) + if get_obj is None: + return None + return merge_dicts(get_obj, access_obj) + +def merge_dicts(x, y): + z = x.copy() + z.update(y) + return z + +def snake_to_camel(snake): + result = '' + capitalize_next = False + for char in snake: + if char == '_': + capitalize_next = True + else: + if capitalize_next: + result += char.upper() + capitalize_next = False + else: + result += char + return str(result) + +# create secret is a create call + an add version call +def create_secret(module): + # build the payload + payload = { "replication": { "automatic": {} } } + + url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets".format(**module.params) + auth = get_auth(module) + post_response = auth.post(url, body=payload, params={'secretId': module.params['name']}) + return update_secret(module) + +def update_secret(module): + # build the payload + b64_value = base64.b64encode(module.params['value'].encode("utf-8")).decode("utf-8") + payload = { + u'payload': { + u'data': b64_value + } + } + auth = get_auth(module) + url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}:addVersion".format(**module.params) + return return_if_object(module, auth.post(url, payload), False) + +def list_secret_versions(module): + # filter by only enabled secrets + url = self_list_link(module) + auth = get_auth(module) + return return_if_object(module, auth.get(url), True) + +# technically we're destroying the version +def delete_secret(module, destroy_all=False): + # delete secret does not take "latest" as a default version + # get the latest version if it doesn't exist in the request + version = module.params['version'] + auth = get_auth(module) + if version.lower() == "all" or destroy_all: + url = self_delete_link(module) + return return_if_object(module, auth.delete(url)) + else: + url = self_get_link(module) + ":destroy" + return return_if_object(module, auth.post(url, {}), False) + +def return_if_object(module, response, allow_not_found=False): + # If not found, return nothing. + if allow_not_found and response.status_code == 404: + return None + + if response.status_code == 409: + module.params['info'] = "exists already" + return None; + + # probably a code error + if response.status_code == 400: + module.fail_json(msg=f"unexpected REST failure: {response.json()['error']}") + + # If no content, return nothing. + if response.status_code == 204: + return None + + try: + module.raise_for_status(response) + result = response.json() + result['url'] = response.request.url + result['status_code'] = response.status_code + if "name" in result: + result['version'] = result['name'].split("/")[-1] + result['name'] = result['name'].split("/")[3] + + # base64 decode the value + if "payload" in result and "data" in result['payload']: + result['value'] = base64.b64decode(result['payload']['data']).decode("utf-8") + + except getattr(json.decoder, 'JSONDecodeError', ValueError): + module.fail_json(msg="Invalid JSON response with error: %s" % response.text) + + if navigate_hash(result, ['error', 'errors']): + module.fail_json(msg=navigate_hash(result, ['error', 'errors'])) + + return result + + +def main(): + # limited support for parameters described in the "Secret" resource + # in order to simplify and deploy primary use cases + # expectation is customers needing to support additional capabilities + # in the SecretPayload will do so outside of Ansible. + # ref: https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets#Secret + module = GcpModule( + argument_spec=dict( + state=dict(default='present', choices=['present', 'absent'], type='str'), + name=dict(required=True, type='str', aliases=['key', 'secret']), + value=dict(required=False, type='str'), + version=dict(required=False, type='str', default='latest'), + return_value=dict(required=False, type='bool', default=True) + ) + ) + + if not module.params['scopes']: + module.params['scopes'] = ["https://www.googleapis.com/auth/cloud-platform"] + + module.params['calc_version'] = module.params['version'] + + state = module.params['state'] + fetch = fetch_resource(module, allow_not_found=True) + changed = False + + # nothing came back, so the secret doesn't exist + if not fetch: + # doesn't exist, must create + if module.params.get('value') and state == 'present': + # create a new secret + fetch = create_secret(module) + changed = True + # specified present but no value + # fail, let the user know + # that no secret could be created without a value to encrypt + elif state == 'present': + module.fail_json(msg="secret '{name}' not present in '{project}' and no value for the secret is provided".format(**module.params)), + + # secret is absent, success + else: + fetch = { "msg": "secret '{name}' in project '{project}' not present".format(**module.params)} + + else: + # delete the secret version (latest if no version is specified) + if state == "absent": + # delete the secret + fetch = delete_secret(module, ("action" in fetch)) + fetch['msg'] = "Secret Destroyed, it may take time to propagate" + changed = True + + # check to see if the values are the same, and update if neede + if "value" in fetch and module.params.get('value') is not None: + # Update secret + if fetch['value'] != module.params['value']: + update = update_secret(module) + changed = True + else: + fetch['msg'] = "values identical, no need to update secret" + + # pop value data if return_value == false + if module.params['return_value'] == False: + fetch.pop('value') + fetch.pop('payload') + if "msg" in fetch: + fetch['msg'] = f"{fetch['msg']} | not returning secret value since 'return_value is set to false" + else: + fetch['msg'] = "not returning secret value since 'return_value is set to false" + + fetch['changed'] = changed + fetch['name'] = module.params['name'] + + module.exit_json(**fetch) + + +if __name__ == "__main__": + main() + \ No newline at end of file From 953b06ff0599a080ccce0aefe9f112b09fd004e8 Mon Sep 17 00:00:00 2001 From: Dave Costakos Date: Thu, 22 Jun 2023 14:36:55 -0700 Subject: [PATCH 080/138] updated lookuup plugin based on comment https://github.com/ansible-collections/google.cloud/pull/578/files/76eb024c250af3b7ff8adec909bef06667833509# --- plugins/lookup/gcp_secret_manager.py | 215 +++++++++++++++----------- plugins/modules/gcp_secret_manager.py | 22 ++- 2 files changed, 146 insertions(+), 91 deletions(-) diff --git a/plugins/lookup/gcp_secret_manager.py b/plugins/lookup/gcp_secret_manager.py index 56b11ac..aa38da1 100644 --- a/plugins/lookup/gcp_secret_manager.py +++ b/plugins/lookup/gcp_secret_manager.py @@ -19,9 +19,13 @@ DOCUMENTATION = ''' options: key: description: - - the key of the secret to look up in Secret Manager + - the name of the secret to look up in Secret Manager type: str required: True + aliases: + - name + - secret + - secret_id project: description: - The name of the google cloud project @@ -57,11 +61,30 @@ DOCUMENTATION = ''' - defaults to OS env variable GCP_SERVICE_ACCOUNT_INFO if not present type: jsonarg required: False - errors: + access_token: + description: + - support for GCP Access Token + - defaults to OS env variable GCP_ACCESS_TOKEN if not present + type: str + required: False + on_error: description: - how to handle errors - choices: ['strict','warn','ignore'] - default: strict + - strict means raise an exception + - warn means warn, and return none + - ignore means just return none + type: str + required: False + choices: + - 'strict' + - 'warn' + - 'ignore' + default: 'strict' + scopes: + description: + - Authenticaiton scopes for Google Secret Manager + type: list + default: ["https://www.googleapis.com/auth/cloud-platform"] ''' EXAMPLES = ''' @@ -99,6 +122,8 @@ import base64 from ansible.plugins.lookup import LookupBase +from ansible.errors import AnsibleError +from ansible.utils.display import Display try: import requests @@ -107,103 +132,117 @@ except ImportError: HAS_REQUESTS = False try: - import google.auth - from google.oauth2 import service_account - from google.auth.transport.requests import AuthorizedSession - HAS_GOOGLE_LIBRARIES = True + from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( + GcpSession, + ) + HAS_GOOGLE_CLOUD_COLLECTION = True except ImportError: - HAS_GOOGLE_LIBRARIES = False + HAS_GOOGLE_CLOUD_COLLECTION = False -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import GcpSession, GcpRequest from ansible.errors import AnsibleError +from ansible.utils.display import Display class GcpLookupException(Exception): pass +class GcpMockModule(object): + def __init__(self, params): + self.params = params + + def fail_json(self, *args, **kwargs): + raise AnsibleError(kwargs["msg"]) + + def raise_for_status(self, response): + try: + response.raise_for_status() + except getattr(requests.exceptions, "RequestException"): + self.fail_json(msg="GCP returned error: %s" % response.json()) + class LookupModule(LookupBase): - def run(self, terms, variables, **kwargs): + def run(self, terms=None, variables=None, **kwargs): + self._display = Display() + if not HAS_GOOGLE_CLOUD_COLLECTION: + raise AnsibleError( + "gcp_secret lookup needs a supported version of the google.cloud collection installed. Use `ansible-galaxy collection install google.cloud` to install it" + ) self.set_options(var_options=variables, direct=kwargs) - self.scopes = ["https://www.googleapis.com/auth/cloud-platform"] - self._validate() - self.service_acct_creds = self._credentials() - session = AuthorizedSession(self.service_acct_creds) - response = session.get("https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{key}/versions/{version}:access".format(**self.get_options())) - if response.status_code == 200: - result_data = response.json() - secret_value = base64.b64decode(result_data['payload']['data']) - return [ secret_value ] + params = { + "key": self.get_option("key"), + "version": self.get_option("version"), + "access_token": self.get_option("access_token"), + "scopes": self.get_option("scopes"), + "on_error": self.get_option("on_error") + } + + params['name'] = params['key'] + + # support GCP_* env variables for some parameters + for param in ["project", "auth_kind", "service_account_file", "service_account_info", "service_account_email", "access_token"]: + params[param] = self.fallback_from_env(param) + + self._display.vvv(msg=f"Module Parameters: {params}") + fake_module = GcpMockModule(params) + result = self.get_secret(fake_module) + return [base64.b64decode(result)] + + def fallback_from_env(self, arg): + if self.get_option(arg): + return self.get_option(arg) else: - if self.get_option('errors') == 'warn': - self.warn(f"secret request returned bad status: {response.status_code} {response.json()}") - return [ '' ] - elif self.get_option('error') == 'ignore': - return [ '' ] - else: - raise AnsibleError(f"secret request returned bad status: {response.status_code} {response.json()}") + env_name = f"GCP_{arg.upper()}" + if env_name in os.environ: + self.set_option(arg, os.environ[env_name]) + return self.get_option(arg) + - def _validate(self): - if HAS_GOOGLE_LIBRARIES == False: - raise AnsibleError("Please install the google-auth library") - - if HAS_REQUESTS == False: - raise AnsibleError("Please install the requests library") - - if self.get_option('key') == None: - raise AnsibleError("'key' is a required parameter") - - if self.get_option('version') == None: - self.set_option('version', 'latest') + # set version to the latest version because + # we can't be sure that "latest" is always going + # to be set if secret versions get disabled + # see https://issuetracker.google.com/issues/286489671 + def get_latest_version(self, module, auth): + url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions?filter=state:ENABLED".format( + **module.params + ) + response = auth.get(url) + self._display.vvv(msg=f"List Version Response: {response.status_code} for {response.request.url}: {response.json()}") + if response.status_code != 200: + self.raise_error(module, f"unable to list versions of secret {response.status_code}") + version_list = response.json() + if "versions" in version_list: + return sorted(version_list['versions'], key=lambda d: d['name'])[-1]['name'].split('/')[-1] + else: + self.raise_error(module, f"Unable to list secret versions via {response.request.url}: {response.json()}") - self._set_from_env('project', 'GCP_PROJECT', True) - self._set_from_env('auth_kind', 'GCP_AUTH_KIND', True) - self._set_from_env('service_account_email', 'GCP_SERVICE_ACCOUNT_EMAIL') - self._set_from_env('service_account_file', 'GCP_SERVICE_ACCOUNT_FILE') - self._set_from_env('service_account_info', 'GCP_SERVICE_ACCOUNT_INFO') + + def raise_error(self, module, msg): + if module.params['on_error'] == 'strict': + raise GcpLookupException(msg) + elif module.params['on_error'] == 'warn': + self._display.warning(msg) + + return None + + def get_secret(self, module): + auth = GcpSession(module, "secretmanager") + if module.params['version'] == "latest": + module.params['calc_version'] = self.get_latest_version(module, auth) + else: + module.params['calc_version'] = module.params['version'] + + # there was an error listing secret versions + if module.params['calc_version'] is None: + return '' + + url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}:access".format( + **module.params + ) + response = auth.get(url) + self._display.vvv(msg=f"Response: {response.status_code} for {response.request.url}: {response.json()}") + if response.status_code != 200: + self.raise_error(module, f"Failed to lookup secret value via {response.request.url} {response.status_code}") + return '' - def _set_from_env(self, var=None, env_name=None, raise_on_empty=False): - if self.get_option(var) == None: - if env_name is not None and env_name in os.environ: - fallback = os.environ[env_name] - self.set_option(var, fallback) - - if self.get_option(var) == None and raise_on_empty: - msg = f"No key '{var}' provided" - if env_name is not None: - msg += f" and no fallback to env['{env_name}'] available" - raise AnsibleError(msg) - - def _credentials(self): - cred_type = self.get_option('auth_kind') - - if cred_type == 'application': - credentials, project_id = google.auth.default(scopes=self.scopes) - return credentials - - if cred_type == 'serviceaccount': - if self.get_option('service_account_file') is not None: - path = os.path.realpath(os.path.expanduser(self.get_option('service_account_file'))) - try: - svc_acct_creds = service_account.Credentials.from_service_account_file(path) - except OSError as e: - raise GcpLookupException("Unable to read service_account_file at %s: %s" % (path, e.strerror)) - - elif self.get_option('service_account_contents') is not None: - try: - info = json.loads(self.get_option('service_account_contents')) - except json.decoder.JSONDecodeError as e: - raise GcpLookupException("Unable to decode service_account_contents as JSON: %s" % e) - - svc_acct_creds = service_account.Credentials.from_service_account_info(info) - else: - raise GcpLookupException('Service Account authentication requires setting either service_account_file or service_account_contents') - - return svc_acct_creds.with_scopes(self.scopes) - - if cred_type == 'machineaccount': - self.svc_acct_creds = google.auth.compute_engine.Credentials(self.service_account_email) - return self.svc_acct_creds - - raise GcpLookupException("Credential type '%s' not implemented" % cred_type) + return response.json()['payload']['data'] diff --git a/plugins/modules/gcp_secret_manager.py b/plugins/modules/gcp_secret_manager.py index b8bf30b..af5d5bd 100644 --- a/plugins/modules/gcp_secret_manager.py +++ b/plugins/modules/gcp_secret_manager.py @@ -57,6 +57,10 @@ options: description: - Name of the secret to be used type: str + aliases: + - key + - secret + - secret_id value: description: - The secret value that the secret should have @@ -80,6 +84,13 @@ options: - "all" is also acceptable on delete (which will delete all versions of a secret) type: str default: 'latest' + labels: + description: + - A set of key-value pairs to assign as labels to asecret + - only used in creation + - Note that the "value" piece of a label must contain only readable chars + type: dict + required: False ''' EXAMPLES=''' @@ -120,7 +131,6 @@ EXAMPLES=''' version: all state: absent -- name: Get ''' RETURN = ''' @@ -258,10 +268,14 @@ def snake_to_camel(snake): def create_secret(module): # build the payload payload = { "replication": { "automatic": {} } } + if module.params['labels']: + payload['labels'] = module.params['labels'] url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets".format(**module.params) auth = get_auth(module) post_response = auth.post(url, body=payload, params={'secretId': module.params['name']}) + # validate create + module.raise_for_status(post_response) return update_secret(module) def update_secret(module): @@ -343,13 +357,15 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - name=dict(required=True, type='str', aliases=['key', 'secret']), + name=dict(required=True, type='str', aliases=['key', 'secret', 'secret_id']), value=dict(required=False, type='str'), version=dict(required=False, type='str', default='latest'), - return_value=dict(required=False, type='bool', default=True) + return_value=dict(required=False, type='bool', default=True), + labels=dict(required=False, type='dict', default=dict()) ) ) + if not module.params['scopes']: module.params['scopes'] = ["https://www.googleapis.com/auth/cloud-platform"] From d1277f829b6ea72726bd38198dd24ddefa92b5a7 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 7 Jul 2023 22:05:09 +0000 Subject: [PATCH 081/138] fix: iam service account key path must not exist (#576) Update docs to explain that the json secret key must not already exist, or the module will try to read it. fixes #370 --- plugins/modules/gcp_iam_service_account_key.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/modules/gcp_iam_service_account_key.py b/plugins/modules/gcp_iam_service_account_key.py index 8972875..7ada408 100644 --- a/plugins/modules/gcp_iam_service_account_key.py +++ b/plugins/modules/gcp_iam_service_account_key.py @@ -71,8 +71,9 @@ options: type: dict path: description: - - The full name of the file that will hold the service account private key. The - management of this file will depend on the value of sync_file parameter. + - The full name of the file that will hold the service account private key. + - If the file already exists, it will attempt to be read. Ensure the file does + not exist or is alreay a valid key. - File path must be absolute. required: false type: path @@ -192,8 +193,9 @@ serviceAccount: type: dict path: description: - - The full name of the file that will hold the service account private key. The - management of this file will depend on the value of sync_file parameter. + - The full name of the file that will hold the service account private key. + - If the file already exists, it will attempt to be read. Ensure the file does + not exist or is alreay a valid key. - File path must be absolute. returned: success type: str From 75f31986059645daeaf398d0e24e6bbf4b290570 Mon Sep 17 00:00:00 2001 From: Irfan <41751162+syedirfan23@users.noreply.github.com> Date: Sat, 8 Jul 2023 04:01:15 +0530 Subject: [PATCH 082/138] Fix typo in documentation (#577) --- plugins/inventory/gcp_compute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index d98d9c9..355f768 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -39,7 +39,7 @@ DOCUMENTATION = """ description: > A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/compute/docs/reference/rest/v1/instances/aggregatedList). - Each additional filter in the list will act be added as an AND condition + Each additional filter in the list will be added as an AND condition (filter1 and filter2) type: list hostnames: From e0fc6bab838c13ec234851d5b4349dc422205f0b Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 7 Jul 2023 23:03:17 +0000 Subject: [PATCH 083/138] chore: update changelog to 1.2.0 (#583) --- CHANGELOG.rst | 3 +++ MAINTAINING.md | 4 ++++ changelogs/.plugin-cache.yaml | 4 +++- changelogs/changelog.yaml | 9 +++++++++ galaxy.yml | 2 +- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7951534..1fb6e62 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ Google.Cloud Release Notes .. contents:: Topics +v1.2.0 +====== + v1.1.3 ====== diff --git a/MAINTAINING.md b/MAINTAINING.md index 97cc5e3..de14b75 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -58,6 +58,10 @@ antsibull-changelog release This will remove all the changelog fragments from ./changelogs/fragments and merge them into CHANGELOG.rst. +### Send a PR and merge + +Send a PR with these changes and merge them. + ### Create a new GitHub release Creating diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index 3febdd4..e8eb24c 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -6,6 +6,7 @@ plugins: callback: {} cliconf: {} connection: {} + filter: {} httpapi: {} inventory: gcp_compute: @@ -867,5 +868,6 @@ plugins: netconf: {} shell: {} strategy: {} + test: {} vars: {} -version: 1.1.3 +version: 1.2.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 0094543..206d93a 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -46,3 +46,12 @@ releases: fragments: - gce-changelog.yaml release_date: '2023-03-04' + 1.2.0: + changes: + bugfixes: + - Use default service account if `service_account_email` is unset. + minor_changes: + - Add DataPlane V2 Support. + - Add support for ip_allocation_policy->stack_type. + - Add auth support for GCP access tokens (#574). + release_date: '2023-07-07' diff --git a/galaxy.yml b/galaxy.yml index 4569bae..b53950d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.1.3" +version: "1.2.0" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From 3da1c3462ef9e0d49d8e4e00596b82bbe5f91d18 Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 7 Jul 2023 23:06:35 +0000 Subject: [PATCH 084/138] chore: fully update 1.2.0 changelog (#584) missed an antsibull-release. --- CHANGELOG.rst | 12 ++++++++++++ changelogs/changelog.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1fb6e62..9bc9c27 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,18 @@ Google.Cloud Release Notes v1.2.0 ====== +Minor Changes +------------- + +- Add DataPlane V2 Support. +- Add auth support for GCP access tokens (#574). +- Add support for ip_allocation_policy->stack_type. + +Bugfixes +-------- + +- Use default service account if `service_account_email` is unset. + v1.1.3 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 206d93a..09e7657 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -52,6 +52,6 @@ releases: - Use default service account if `service_account_email` is unset. minor_changes: - Add DataPlane V2 Support. - - Add support for ip_allocation_policy->stack_type. - Add auth support for GCP access tokens (#574). + - Add support for ip_allocation_policy->stack_type. release_date: '2023-07-07' From 3ce29db3ee94835364e806cf0bcb48cea1b49d08 Mon Sep 17 00:00:00 2001 From: Dave Costakos Date: Fri, 14 Jul 2023 10:31:52 -0700 Subject: [PATCH 085/138] updated plugsins based on feedback, fixed linting and documentation errors. --- plugins/lookup/gcp_secret_manager.py | 43 +++++++++++----------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/plugins/lookup/gcp_secret_manager.py b/plugins/lookup/gcp_secret_manager.py index aa38da1..bd9ca55 100644 --- a/plugins/lookup/gcp_secret_manager.py +++ b/plugins/lookup/gcp_secret_manager.py @@ -14,7 +14,7 @@ DOCUMENTATION = ''' - see https://cloud.google.com/iam/docs/service-account-creds for details on creating credentials for Google Cloud and the format of such credentials - once a secret value is retreived, it is returned decoded. It is up to the developer - to maintain secrecy of this value once returned. + to maintain secrecy of this value once returned. options: key: @@ -62,7 +62,7 @@ DOCUMENTATION = ''' type: jsonarg required: False access_token: - description: + description: - support for GCP Access Token - defaults to OS env variable GCP_ACCESS_TOKEN if not present type: str @@ -116,11 +116,9 @@ RETURN = ''' # Imports ################################################################################ -import json import os import base64 - from ansible.plugins.lookup import LookupBase from ansible.errors import AnsibleError from ansible.utils.display import Display @@ -139,12 +137,11 @@ try: except ImportError: HAS_GOOGLE_CLOUD_COLLECTION = False -from ansible.errors import AnsibleError -from ansible.utils.display import Display class GcpLookupException(Exception): pass + class GcpMockModule(object): def __init__(self, params): self.params = params @@ -158,20 +155,23 @@ class GcpMockModule(object): except getattr(requests.exceptions, "RequestException"): self.fail_json(msg="GCP returned error: %s" % response.json()) + class LookupModule(LookupBase): def run(self, terms=None, variables=None, **kwargs): self._display = Display() if not HAS_GOOGLE_CLOUD_COLLECTION: raise AnsibleError( - "gcp_secret lookup needs a supported version of the google.cloud collection installed. Use `ansible-galaxy collection install google.cloud` to install it" - ) + """gcp_secret lookup needs a supported version of the google.cloud + collection installed. Use `ansible-galaxy collection install google.cloud` + to install it""" + ) self.set_options(var_options=variables, direct=kwargs) params = { - "key": self.get_option("key"), - "version": self.get_option("version"), + "key": self.get_option("key"), + "version": self.get_option("version"), "access_token": self.get_option("access_token"), - "scopes": self.get_option("scopes"), - "on_error": self.get_option("on_error") + "scopes": self.get_option("scopes"), + "on_error": self.get_option("on_error") } params['name'] = params['key'] @@ -184,7 +184,7 @@ class LookupModule(LookupBase): fake_module = GcpMockModule(params) result = self.get_secret(fake_module) return [base64.b64decode(result)] - + def fallback_from_env(self, arg): if self.get_option(arg): return self.get_option(arg) @@ -193,10 +193,9 @@ class LookupModule(LookupBase): if env_name in os.environ: self.set_option(arg, os.environ[env_name]) return self.get_option(arg) - # set version to the latest version because - # we can't be sure that "latest" is always going + # we can't be sure that "latest" is always going # to be set if secret versions get disabled # see https://issuetracker.google.com/issues/286489671 def get_latest_version(self, module, auth): @@ -213,15 +212,14 @@ class LookupModule(LookupBase): else: self.raise_error(module, f"Unable to list secret versions via {response.request.url}: {response.json()}") - def raise_error(self, module, msg): if module.params['on_error'] == 'strict': raise GcpLookupException(msg) elif module.params['on_error'] == 'warn': self._display.warning(msg) - + return None - + def get_secret(self, module): auth = GcpSession(module, "secretmanager") if module.params['version'] == "latest": @@ -241,12 +239,5 @@ class LookupModule(LookupBase): if response.status_code != 200: self.raise_error(module, f"Failed to lookup secret value via {response.request.url} {response.status_code}") return '' - + return response.json()['payload']['data'] - - - - - - - From 40d2c9a7d581105636d466e236180c8a5152e6c6 Mon Sep 17 00:00:00 2001 From: Dave Costakos Date: Fri, 14 Jul 2023 10:33:15 -0700 Subject: [PATCH 086/138] updated plugsins based on feedback, fixed linting and documentation errors. --- plugins/modules/gcp_secret_manager.py | 143 +++++++++++++++----------- 1 file changed, 84 insertions(+), 59 deletions(-) diff --git a/plugins/modules/gcp_secret_manager.py b/plugins/modules/gcp_secret_manager.py index af5d5bd..f8d5623 100644 --- a/plugins/modules/gcp_secret_manager.py +++ b/plugins/modules/gcp_secret_manager.py @@ -1,25 +1,35 @@ -#!/usr/bin/env python +#!/usr/bin/python -# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt +# or https://www.gnu.org/licenses/gpl-3.0.txt) # SPDX-License-Identifier: GPL-3.0-or-later + ################################################################################ # Documentation ################################################################################ + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'} -DOCUMENTATION=''' +DOCUMENTATION = ''' --- module: gcp_secret_manager description: -- Simple create/delete of secrets -- add or delete secret versions -- other features like etags, replication, annontation expected to be managed outside of Ansible +- Access secrets stored in Google Secrets Manager. +- Create new secrets. +- Create new secret values. +- Add/remove versions of secrets. +- Please note that other features like etags, replication, annontation expected to be managed outside of Ansible. +short_description: Access and Update Google Cloud Secrets Manager objects +author: Dave Costakos @RedHat requirements: - python >= 2.6 - requests >= 2.18.4 - google-auth >= 1.3.0 -options: options: project: description: @@ -57,6 +67,7 @@ options: description: - Name of the secret to be used type: str + required: true aliases: - key - secret @@ -69,7 +80,11 @@ options: type: str state: description: - - 'absent' or 'present': whether the secret should exist + - whether the secret should exist + default: present + choices: + - absent + - present type: str return_value: description: @@ -81,19 +96,31 @@ options: description: - A version label to apply to the secret - Default is "latest" which is the newest version of the secret - - "all" is also acceptable on delete (which will delete all versions of a secret) + - The special "all" is also acceptable on delete (which will delete all versions of a secret) type: str - default: 'latest' + default: latest labels: description: - A set of key-value pairs to assign as labels to asecret - only used in creation - Note that the "value" piece of a label must contain only readable chars type: dict - required: False +notes: +- 'API Reference: U(https://cloud.google.com/secret-manager/docs/reference/rests)' +- 'Official Documentation: U(https://cloud.google.com/secret-manager/docs/overview)' +- for authentication, you can set service_account_file using the C(GCP_SERVICE_ACCOUNT_FILE) + env variable. +- for authentication, you can set service_account_contents using the C(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' -EXAMPLES=''' +EXAMPLES = r''' - name: Create a new secret google.cloud.gcp_secret_manager: name: secret_key @@ -110,7 +137,7 @@ EXAMPLES=''' - name: Ensure secret exists but don't return the value google.cloud.gcp_secret_manager: name: secret_key - state: present + state: present return_value: false - name: Add a new version of a secret @@ -131,9 +158,15 @@ EXAMPLES=''' version: all state: absent +- name: Create a secret with labels + google.cloud.gcp_secret_manager: + name: secret_key + value: super_secret + labels: + key_name: "ansible_rox" ''' -RETURN = ''' +RETURN = r''' resources: description: List of resources returned: always @@ -182,33 +215,35 @@ resources: from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( navigate_hash, GcpSession, - GcpModule, - GcpRequest, - remove_nones_from_dict, - replace_resource_dict, + GcpModule ) -import json # for decoding and validating secrets +import json import base64 -import binascii +import copy def get_auth(module): return GcpSession(module, 'secret-manager') + def self_access_link(module): return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}:access".format(**module.params) + def self_get_link(module): return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version}".format(**module.params) + def self_update_link(module): return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions/{calc_version:version}".format(**module.params) + def self_list_link(module): return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}/versions?filter=state:ENABLED".format(**module.params) + def self_delete_link(module): return "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}".format(**module.params) @@ -216,7 +251,7 @@ def self_delete_link(module): def fetch_resource(module, allow_not_found=True): auth = get_auth(module) # set version to the latest version because - # we can't be sure that "latest" is always going + # we can't be sure that "latest" is always going # to be set if secret versions get disabled # see https://issuetracker.google.com/issues/286489671 if module.params['version'] == "latest" or module.params['version'] == 'all': @@ -224,7 +259,7 @@ def fetch_resource(module, allow_not_found=True): latest_version = None if version_list is None: return None - + if "versions" in version_list: latest_version = sorted(version_list['versions'], key=lambda d: d['name'])[-1]['name'].split('/')[-1] module.params['calc_version'] = latest_version @@ -233,7 +268,7 @@ def fetch_resource(module, allow_not_found=True): # handle the corner case that we tried to delete # a secret version that doesn't exist if module.params['state'] == "absent": - return { "action": "delete_secret" } + return {"action": "delete_secret"} link = self_access_link(module) access_obj = return_if_object(module, auth.get(link), allow_not_found) @@ -245,29 +280,17 @@ def fetch_resource(module, allow_not_found=True): return None return merge_dicts(get_obj, access_obj) + def merge_dicts(x, y): - z = x.copy() + z = copy.deepcopy(x) z.update(y) return z -def snake_to_camel(snake): - result = '' - capitalize_next = False - for char in snake: - if char == '_': - capitalize_next = True - else: - if capitalize_next: - result += char.upper() - capitalize_next = False - else: - result += char - return str(result) # create secret is a create call + an add version call def create_secret(module): # build the payload - payload = { "replication": { "automatic": {} } } + payload = {"replication": {"automatic": {}}} if module.params['labels']: payload['labels'] = module.params['labels'] @@ -278,6 +301,7 @@ def create_secret(module): module.raise_for_status(post_response) return update_secret(module) + def update_secret(module): # build the payload b64_value = base64.b64encode(module.params['value'].encode("utf-8")).decode("utf-8") @@ -290,12 +314,14 @@ def update_secret(module): url = "https://secretmanager.googleapis.com/v1/projects/{project}/secrets/{name}:addVersion".format(**module.params) return return_if_object(module, auth.post(url, payload), False) + def list_secret_versions(module): # filter by only enabled secrets url = self_list_link(module) auth = get_auth(module) return return_if_object(module, auth.get(url), True) + # technically we're destroying the version def delete_secret(module, destroy_all=False): # delete secret does not take "latest" as a default version @@ -303,24 +329,25 @@ def delete_secret(module, destroy_all=False): version = module.params['version'] auth = get_auth(module) if version.lower() == "all" or destroy_all: - url = self_delete_link(module) - return return_if_object(module, auth.delete(url)) + url = self_delete_link(module) + return return_if_object(module, auth.delete(url)) else: - url = self_get_link(module) + ":destroy" - return return_if_object(module, auth.post(url, {}), False) + url = self_get_link(module) + ":destroy" + return return_if_object(module, auth.post(url, {}), False) + def return_if_object(module, response, allow_not_found=False): # If not found, return nothing. if allow_not_found and response.status_code == 404: return None - + if response.status_code == 409: module.params['info'] = "exists already" - return None; + return None # probably a code error if response.status_code == 400: - module.fail_json(msg=f"unexpected REST failure: {response.json()['error']}") + module.fail_json(msg="unexpected REST failure: %s" % response.json()['error']) # If no content, return nothing. if response.status_code == 204: @@ -334,11 +361,11 @@ def return_if_object(module, response, allow_not_found=False): if "name" in result: result['version'] = result['name'].split("/")[-1] result['name'] = result['name'].split("/")[3] - + # base64 decode the value if "payload" in result and "data" in result['payload']: result['value'] = base64.b64decode(result['payload']['data']).decode("utf-8") - + except getattr(json.decoder, 'JSONDecodeError', ValueError): module.fail_json(msg="Invalid JSON response with error: %s" % response.text) @@ -351,7 +378,7 @@ def return_if_object(module, response, allow_not_found=False): def main(): # limited support for parameters described in the "Secret" resource # in order to simplify and deploy primary use cases - # expectation is customers needing to support additional capabilities + # expectation is customers needing to support additional capabilities # in the SecretPayload will do so outside of Ansible. # ref: https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets#Secret module = GcpModule( @@ -365,7 +392,6 @@ def main(): ) ) - if not module.params['scopes']: module.params['scopes'] = ["https://www.googleapis.com/auth/cloud-platform"] @@ -386,11 +412,11 @@ def main(): # fail, let the user know # that no secret could be created without a value to encrypt elif state == 'present': - module.fail_json(msg="secret '{name}' not present in '{project}' and no value for the secret is provided".format(**module.params)), + module.fail_json(msg="secret '{name}' not present in '{project}' and no value for the secret is provided".format(**module.params)) # secret is absent, success else: - fetch = { "msg": "secret '{name}' in project '{project}' not present".format(**module.params)} + fetch = {"msg": "secret '{name}' in project '{project}' not present".format(**module.params)} else: # delete the secret version (latest if no version is specified) @@ -404,26 +430,25 @@ def main(): if "value" in fetch and module.params.get('value') is not None: # Update secret if fetch['value'] != module.params['value']: - update = update_secret(module) + update_secret(module) changed = True else: fetch['msg'] = "values identical, no need to update secret" - - # pop value data if return_value == false - if module.params['return_value'] == False: + + # pop value data if return_value == false + if module.params['return_value'] is False: fetch.pop('value') fetch.pop('payload') if "msg" in fetch: fetch['msg'] = f"{fetch['msg']} | not returning secret value since 'return_value is set to false" else: fetch['msg'] = "not returning secret value since 'return_value is set to false" - + fetch['changed'] = changed fetch['name'] = module.params['name'] module.exit_json(**fetch) - - + + if __name__ == "__main__": main() - \ No newline at end of file From 84503b793078353546937ccdb95bfee2b768f034 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Sat, 22 Jul 2023 02:31:54 +0200 Subject: [PATCH 087/138] Fix doc_fragments/gcp.py (#587) Signed-off-by: Alina Buzachis --- plugins/doc_fragments/gcp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/doc_fragments/gcp.py b/plugins/doc_fragments/gcp.py index 5dfeb00..a2d5212 100644 --- a/plugins/doc_fragments/gcp.py +++ b/plugins/doc_fragments/gcp.py @@ -47,7 +47,7 @@ options: type: str notes: - for authentication, you can set service_account_file using the - c(gcp_service_account_file) env variable. + c(GCP_SERVICE_ACCOUNT_FILE) env variable. - for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) env variable. - For authentication, you can set service_account_email using the From 3714be293601c38e7ace543193946b22ed95f049 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Fri, 18 Aug 2023 13:55:50 +0200 Subject: [PATCH 088/138] fix: check for labels in json dict --- plugins/inventory/gcp_compute.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/inventory/gcp_compute.py b/plugins/inventory/gcp_compute.py index 355f768..f4743b2 100644 --- a/plugins/inventory/gcp_compute.py +++ b/plugins/inventory/gcp_compute.py @@ -237,7 +237,8 @@ class GcpInstance(object): for order in self.hostname_ordering: name = None if order.startswith("labels."): - name = self.json["labels"].get(order[7:]) + if "labels" in self.json: + name = self.json["labels"].get(order[7:]) elif order == "public_ip": name = self._get_publicip() elif order == "private_ip": From dce75efa9ec5e57b93e465ca76bfac9c24fa2d23 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 31 Aug 2023 15:00:38 -0700 Subject: [PATCH 089/138] fix: don't send empty arguments to gcloud in the cleanup script --- scripts/cleanup-project.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 4dd4ddb..e45ddd5 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -40,8 +40,20 @@ cleanup_resource() { extra_list_arg="$3" extra_delete_arg="$4" - for resource_id in $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}"); do - gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" + if [ -z "$extra_list_arg" ] + then + resources=( $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)") ) + else + resources=( $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}") ) + fi + + for resource_id in $resources; do + if [ -z "$extra_delete_arg" ] + then + gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q + else + gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q "${extra_delete_arg}" + fi done } From 779f171793cf41ad5b5efcd17b91d052596cdd71 Mon Sep 17 00:00:00 2001 From: Jeff Erbrecht Date: Tue, 5 Sep 2023 14:12:40 -0400 Subject: [PATCH 090/138] Update roles/google_cloud_ops_agents submodule to 1.0.7. --- roles/google_cloud_ops_agents | 1 + 1 file changed, 1 insertion(+) create mode 160000 roles/google_cloud_ops_agents diff --git a/roles/google_cloud_ops_agents b/roles/google_cloud_ops_agents new file mode 160000 index 0000000..99adb1e --- /dev/null +++ b/roles/google_cloud_ops_agents @@ -0,0 +1 @@ +Subproject commit 99adb1edafb02c3573eaf680266205295ba7f159 From d0028188df9d37c9bc271513412dd2325e85100b Mon Sep 17 00:00:00 2001 From: Jeff Erbrecht Date: Tue, 12 Sep 2023 09:22:16 -0400 Subject: [PATCH 091/138] Checkout submodules during lint workflow --- .github/workflows/ansible-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 5ccdd14..6840d63 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v2 with: path: ansible_collections/google/cloud + submodules: 'true' - name: Set up Python uses: actions/setup-python@v1 with: From bf74697b3f2134d3607bde42c7ec3dca00421a88 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 9 Nov 2023 16:34:51 -0800 Subject: [PATCH 092/138] feat: add support for using application default credentials when running integration tests --- CONTRIBUTING.md | 80 ++++++++++++++++--- changelogs/fragments/app-default-creds.yml | 2 + scripts/bootstrap-project.sh | 15 ++-- .../defaults/main.yml | 2 +- .../tasks/autogen.yml | 14 ++-- .../gcp_bigquery_dataset/tasks/autogen.yml | 14 ++-- .../gcp_bigquery_table/tasks/autogen.yml | 18 ++--- .../gcp_bigtable_instance/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../gcp_cloudscheduler_job/tasks/autogen.yml | 14 ++-- .../gcp_cloudtasks_queue/tasks/autogen.yml | 14 ++-- .../gcp_compute_address/tasks/autogen.yml | 14 ++-- .../gcp_compute_autoscaler/tasks/autogen.yml | 30 +++---- .../tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 22 ++--- .../gcp_compute_disk/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../gcp_compute_firewall/tasks/autogen.yml | 14 ++-- .../gcp_compute_firewall/tasks/update.yml | 16 ++-- .../tasks/autogen.yml | 22 ++--- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 38 ++++----- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../gcp_compute_image/tasks/autogen.yml | 18 ++--- .../gcp_compute_instance/tasks/autogen.yml | 26 +++--- .../tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 26 +++--- .../tasks/autogen.yml | 22 ++--- .../gcp_compute_network/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 22 ++--- .../gcp_compute_node_group/tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 30 +++---- .../tasks/autogen.yml | 18 ++--- .../gcp_compute_region_disk/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 26 +++--- .../tasks/autogen.yml | 22 ++--- .../tasks/autogen.yml | 34 ++++---- .../tasks/autogen.yml | 18 ++--- .../gcp_compute_reservation/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../gcp_compute_route/tasks/autogen.yml | 20 ++--- .../gcp_compute_router/tasks/autogen.yml | 18 ++--- .../gcp_compute_snapshot/tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 14 ++-- .../gcp_compute_ssl_policy/tasks/autogen.yml | 14 ++-- .../gcp_compute_subnetwork/tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 30 +++---- .../tasks/autogen.yml | 34 ++++---- .../tasks/autogen.yml | 22 ++--- .../gcp_compute_target_pool/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 30 +++---- .../tasks/autogen.yml | 26 +++--- .../tasks/autogen.yml | 22 ++--- .../gcp_compute_url_map/tasks/autogen.yml | 26 +++--- .../gcp_compute_vpn_tunnel/tasks/autogen.yml | 52 ++++++------ .../gcp_container_cluster/tasks/autogen.yml | 14 ++-- .../gcp_container_node_pool/tasks/autogen.yml | 18 ++--- .../gcp_dns_managed_zone/tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 18 ++--- .../gcp_filestore_instance/tasks/autogen.yml | 14 ++-- .../targets/gcp_iam_role/tasks/autogen.yml | 16 ++-- .../gcp_iam_service_account/tasks/autogen.yml | 14 ++-- .../gcp_kms_crypto_key/tasks/autogen.yml | 10 +-- .../gcp_kms_key_ring/tasks/autogen.yml | 8 +- .../gcp_logging_metric/tasks/autogen.yml | 14 ++-- .../gcp_mlengine_model/tasks/autogen.yml | 14 ++-- .../gcp_mlengine_version/tasks/autogen.yml | 18 ++--- .../gcp_pubsub_subscription/tasks/autogen.yml | 18 ++--- .../gcp_pubsub_topic/tasks/autogen.yml | 14 ++-- .../gcp_redis_instance/tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 18 ++--- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../gcp_spanner_database/tasks/autogen.yml | 18 ++--- .../gcp_spanner_instance/tasks/autogen.yml | 14 ++-- .../gcp_sql_database/tasks/autogen.yml | 18 ++--- .../gcp_sql_instance/tasks/autogen.yml | 14 ++-- .../gcp_sql_ssl_cert/tasks/autogen.yml | 10 +-- .../targets/gcp_sql_user/tasks/autogen.yml | 18 ++--- .../gcp_storage_bucket/tasks/autogen.yml | 10 +-- .../tasks/autogen.yml | 14 ++-- .../tasks/autogen.yml | 14 ++-- .../targets/gcp_storage_object/tasks/main.yml | 10 +-- .../targets/gcp_tpu_node/tasks/autogen.yml | 14 ++-- 90 files changed, 856 insertions(+), 793 deletions(-) create mode 100644 changelogs/fragments/app-default-creds.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 716d767..d821948 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,13 +15,25 @@ under a directory `ansible_collections`. Clone ensuring that hierarchy: ```shell mkdir -p $TARGET_DIR/ansible_collections/google -git clone $TARGET_DIR/collections/google/cloud +git clone $TARGET_DIR/ansible_collections/google/cloud +``` + +Then set up your Python virtual environment: + +```shell +cd $TARGET_DIR/ansible_collections/google +python3 -m venv venv +. ./venv/bin/activate +pip3 install -r requirements.txt +pip3 install -r requirements-test.txt +pip3 install ansible ``` ## Running tests -### prequisites for all tests +### Prequisites for all tests +- Install `gcloud` following [these instructions](https://cloud.google.com/sdk/docs/install). - Install the `ansible` package. - Some container runtime is necessary (e.g. `podman` or `docker`). The instructions use podman. @@ -29,18 +41,63 @@ git clone $TARGET_DIR/collections/google/cloud ### Integration testing prequisites -#### Installing personal GCP credentials +#### Authentication with personal GCP credentials + +If you are running the integration tests locally the easiest way to +authenticate to GCP is using [application default credentials](https://cloud.google.com/sdk/docs/authorizing#adc). +Once you have installed `gcloud` and performed basic initialization (via `gcloud init`) run: + +```shell +gcloud auth application-default login +``` + +#### Authentication with service account credentials + +A service account may also be used to run the integration tests. You can create one using `gcloud`: + +```shell +gcloud iam service-accounts create ansible-test-account \ + --description="For running Anisble integration tests" \ + --display-name="Ansible Test Account" +``` + +You'll also need to export a key file. Here and below `$SERVICE_ACCOUNT_NAME` +is the full email address of the service account, in the form +`EMAIL@PROJECT_ID.iam.gserviceaccount.com`, e.g., if you used the +account name `ansible-test-account` as suggested above and your project +ID is `my-test-project`, use `ansible-test-account@my-test-project.iam.gserviceaccount.com`. + +```shell +gcloud iam service-accounts keys create /path/to/cred/file.json \ + --iam-account=ansible-test-account@my-test-project.iam.gserviceaccount.com +chmod 0600 /path/to/cred/file.json +``` + +Read the [best practices for managing service account keys](https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys) +to learn how to keep your service account key and your GCP resources safe. + +#### Configuring test credentials The integration tests for this module require the use of real GCP credentials, and must provide -ansible-test those values. They can be added by authoring the following in `tests/integration/cloud-config-gcp.ini`: +ansible-test those values. They can be added by creating the file `tests/integration/cloud-config-gcp.ini`. + +If you are using personal (i.e., application default) credentials, add: ``` [default] -gcp_project: @PROJECT_ID -gcp_cred_file: @CRED_FILE -gcp_cred_kind: @CRED_KIND -gcp_cred_email: @EMAIL -gcp_folder_id: @TEST_FOLDER (to create test projects) +gcp_project: $PROJECT_ID +gcp_cred_kind: application +gcp_folder_id: $TEST_FOLDER (to create test projects) +``` + +If you are using a service account for credentials, add: + +``` +[default] +gcp_project: $PROJECT_ID +gcp_cred_file: /path/to/cred/file.json +gcp_cred_kind: serviceaccount +gcp_folder_id: $TEST_FOLDER (to create test projects) ``` #### Setting up the project for testing @@ -51,7 +108,8 @@ and is expected to be configured beforehand. For convenience, a bootstrap script is provided. NOTE: running this script will make irreversible changes in your -GCP project (e.g. create an AppEngine project): +GCP project (e.g. create an AppEngine project). You can omit +`$SERVICE_ACCOUNT_NAME` is you are using application default credentials. ```bash bash ./scripts/bootstrap-project.sh $PROJECT_ID $SERVICE_ACCOUNT_NAME @@ -92,7 +150,7 @@ ansible-lint ## Specific Tasks -The following enumerates detailed documentation for specific tasks related tot +The following enumerates detailed documentation for specific tasks related to the codebase. ### Updating the supported ansible-core version diff --git a/changelogs/fragments/app-default-creds.yml b/changelogs/fragments/app-default-creds.yml new file mode 100644 index 0000000..7a02ea2 --- /dev/null +++ b/changelogs/fragments/app-default-creds.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). \ No newline at end of file diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 8dd2b2d..a28f42c 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -40,12 +40,15 @@ for SERVICE in "${SERVICE_LIST[@]}"; do gcloud services enable "$SERVICE" --project="$PROJECT_ID" done -for ROLE in "${REQUIRED_ROLE_LIST[@]}"; do - echo "enabling role $ROLE..." - gcloud projects add-iam-policy-binding "$PROJECT_ID" \ - --member="serviceAccount:$SERVICE_ACCOUNT_NAME" \ - --role="$ROLE" -done +if [ -n "$SERVICE_ACCOUNT_NAME" ] +then + for ROLE in "${REQUIRED_ROLE_LIST[@]}"; do + echo "enabling role $ROLE..." + gcloud projects add-iam-policy-binding "$PROJECT_ID" \ + --member="serviceAccount:$SERVICE_ACCOUNT_NAME" \ + --role="$ROLE" + done +fi if ! gcloud app describe --project="$PROJECT_ID" > /dev/null; then echo "creating appengine project..." diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml index ba66644..63f4b0a 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml @@ -1,2 +1,2 @@ --- -resource_name: "{{ resource_prefix }}" +resource_name: "{{ resource_prefix }}" \ No newline at end of file diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml index 4441d53..af2774e 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml @@ -20,7 +20,7 @@ action: ALLOW project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a firewall rule @@ -30,7 +30,7 @@ action: ALLOW project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -41,7 +41,7 @@ google.cloud.gcp_appengine_firewall_rule_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -57,7 +57,7 @@ action: ALLOW project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -72,7 +72,7 @@ action: ALLOW project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -83,7 +83,7 @@ google.cloud.gcp_appengine_firewall_rule_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -101,7 +101,7 @@ action: ALLOW project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml index 1f97074..64d8e60 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml @@ -20,7 +20,7 @@ dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a dataset @@ -30,7 +30,7 @@ dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -41,7 +41,7 @@ google.cloud.gcp_bigquery_dataset_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/bigquery register: results @@ -57,7 +57,7 @@ dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -72,7 +72,7 @@ dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -83,7 +83,7 @@ google.cloud.gcp_bigquery_dataset_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/bigquery register: results @@ -99,7 +99,7 @@ dataset_id: my_example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml index b795dbe..c8b8409 100644 --- a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml @@ -20,7 +20,7 @@ dataset_id: example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: dataset - name: delete a table @@ -33,7 +33,7 @@ table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a table @@ -46,7 +46,7 @@ table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -58,7 +58,7 @@ dataset: example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/bigquery register: results @@ -77,7 +77,7 @@ table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -95,7 +95,7 @@ table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -107,7 +107,7 @@ dataset: example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/bigquery register: results @@ -126,7 +126,7 @@ table_id: example_table project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -143,7 +143,7 @@ dataset_id: example_dataset project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: dataset ignore_errors: true diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml index 23dccf5..e5cf02b 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml @@ -23,7 +23,7 @@ serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -36,7 +36,7 @@ serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -47,7 +47,7 @@ google.cloud.gcp_bigtable_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results - name: verify that command succeeded assert: @@ -64,7 +64,7 @@ serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -82,7 +82,7 @@ serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -93,7 +93,7 @@ google.cloud.gcp_bigtable_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results - name: verify that command succeeded assert: @@ -110,7 +110,7 @@ serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml index 530ac70..e803c4c 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml @@ -23,7 +23,7 @@ project: "{{ gcp_project }}" runtime: "python310" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a cloud function @@ -36,7 +36,7 @@ project: "{{ gcp_project }}" runtime: "python310" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -48,7 +48,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -69,7 +69,7 @@ # runtime is not sent as it is optional for # existing functions. # runtime: "python310" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -86,7 +86,7 @@ trigger_http: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -98,7 +98,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -116,7 +116,7 @@ trigger_http: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml index 3a1884c..078bd2b 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml @@ -30,7 +30,7 @@ relative_uri: "/ping" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a job @@ -50,7 +50,7 @@ relative_uri: "/ping" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -62,7 +62,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -88,7 +88,7 @@ relative_uri: "/ping" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -113,7 +113,7 @@ relative_uri: "/ping" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -125,7 +125,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -151,7 +151,7 @@ relative_uri: "/ping" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml index c0f0e60..2fa585c 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml @@ -19,7 +19,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a queue @@ -28,7 +28,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -40,7 +40,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -55,7 +55,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -69,7 +69,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -81,7 +81,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -96,7 +96,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml index 7a12e69..5fdd5d5 100644 --- a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml @@ -19,7 +19,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a address @@ -28,7 +28,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -42,7 +42,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -57,7 +57,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -71,7 +71,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -85,7 +85,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -100,7 +100,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml index 5182fa9..79b05de 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -28,7 +28,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a instance template @@ -49,7 +49,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate - name: create a instance group manager @@ -61,7 +61,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igm - name: delete a autoscaler @@ -77,7 +77,7 @@ utilization_target: 0.5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a autoscaler @@ -93,7 +93,7 @@ utilization_target: 0.5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -107,7 +107,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -129,7 +129,7 @@ utilization_target: 0.5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -150,7 +150,7 @@ utilization_target: 0.5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -164,7 +164,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -186,7 +186,7 @@ utilization_target: 0.5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -205,7 +205,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: igm ignore_errors: true @@ -227,7 +227,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true @@ -237,7 +237,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -246,7 +246,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml index 48f2ee1..018a749 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml @@ -18,7 +18,7 @@ name: bucket-backendbucket project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket - name: delete a backend bucket @@ -29,7 +29,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a backend bucket @@ -40,7 +40,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -53,7 +53,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -70,7 +70,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -86,7 +86,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -99,7 +99,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -116,7 +116,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -131,7 +131,7 @@ name: bucket-backendbucket project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: bucket ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml index fbe4b69..38de23f 100644 --- a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a HTTP health check @@ -31,7 +31,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: delete a backend service @@ -44,7 +44,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a backend service @@ -57,7 +57,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -70,7 +70,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -89,7 +89,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -107,7 +107,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -120,7 +120,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -139,7 +139,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -158,7 +158,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -168,7 +168,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml index 5f81dd0..79ef475 100644 --- a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml @@ -22,7 +22,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a disk @@ -34,7 +34,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -48,7 +48,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -66,7 +66,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -83,7 +83,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -97,7 +97,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -115,7 +115,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml index a2cd623..91c87db 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml @@ -23,7 +23,7 @@ ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a external vpn gateway @@ -36,7 +36,7 @@ ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -49,7 +49,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -68,7 +68,7 @@ ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -86,7 +86,7 @@ ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -99,7 +99,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -118,7 +118,7 @@ ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml index 42d0f12..04393db 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml @@ -27,7 +27,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a firewall @@ -44,7 +44,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -57,7 +57,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -80,7 +80,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -102,7 +102,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -115,7 +115,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -138,7 +138,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml index 3ebbd21..0eda283 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml @@ -40,7 +40,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a firewall @@ -57,7 +57,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -70,7 +70,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -93,7 +93,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -107,7 +107,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -134,7 +134,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -147,7 +147,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -170,7 +170,7 @@ - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml index 38c67df..ebde3dd 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml @@ -19,7 +19,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a target pool @@ -28,7 +28,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: targetpool - name: delete a forwarding rule @@ -41,7 +41,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a forwarding rule @@ -54,7 +54,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -68,7 +68,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -87,7 +87,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -105,7 +105,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -119,7 +119,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -138,7 +138,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -154,7 +154,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: targetpool ignore_errors: true @@ -164,7 +164,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml index ac99653..4276aa6 100644 --- a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a global address @@ -26,7 +26,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -39,7 +39,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -53,7 +53,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -66,7 +66,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -79,7 +79,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -93,7 +93,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml index 38d5d85..d6df59d 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml @@ -18,7 +18,7 @@ name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: globaladdress - name: create a instance group @@ -27,7 +27,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a HTTP health check @@ -39,7 +39,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -52,7 +52,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: create a URL map @@ -61,7 +61,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap - name: create a target HTTP proxy @@ -70,7 +70,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: httpproxy - name: delete a global forwarding rule @@ -82,7 +82,7 @@ target: "{{ httpproxy.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a global forwarding rule @@ -94,7 +94,7 @@ target: "{{ httpproxy.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -107,7 +107,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -125,7 +125,7 @@ target: "{{ httpproxy.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -142,7 +142,7 @@ target: "{{ httpproxy.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -155,7 +155,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -173,7 +173,7 @@ target: "{{ httpproxy.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -189,7 +189,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: httpproxy ignore_errors: true @@ -199,7 +199,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: urlmap ignore_errors: true @@ -213,7 +213,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -226,7 +226,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -236,7 +236,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true @@ -245,7 +245,7 @@ name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: globaladdress ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml index a2374c5..b4bc374 100644 --- a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml @@ -26,7 +26,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a health check @@ -42,7 +42,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -55,7 +55,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -77,7 +77,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -98,7 +98,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -111,7 +111,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -133,7 +133,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml index cbf8123..5f25a06 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml @@ -22,7 +22,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a HTTP health check @@ -34,7 +34,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -47,7 +47,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -65,7 +65,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -82,7 +82,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -95,7 +95,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -113,7 +113,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml index b53fb1d..ebb89d6 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml @@ -22,7 +22,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a HTTPS health check @@ -34,7 +34,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -47,7 +47,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -65,7 +65,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -82,7 +82,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -95,7 +95,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -113,7 +113,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml index 40fa870..89c5fef 100644 --- a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk - name: delete a image @@ -28,7 +28,7 @@ source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a image @@ -37,7 +37,7 @@ source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -50,7 +50,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -65,7 +65,7 @@ source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -79,7 +79,7 @@ source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -92,7 +92,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -107,7 +107,7 @@ source_disk: "{{ disk }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -123,7 +123,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: disk ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index 5c19f7b..02d95cc 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -21,7 +21,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk - name: create a network @@ -29,7 +29,7 @@ name: "{{ resource_prefix }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -39,7 +39,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: delete a instance @@ -68,7 +68,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -97,7 +97,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -111,7 +111,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -146,7 +146,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -180,7 +180,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -194,7 +194,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -229,7 +229,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -245,7 +245,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -254,7 +254,7 @@ name: "{{ resource_prefix }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network @@ -267,7 +267,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: disk ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml index 30893e4..c13b4a5 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancegroup project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -32,7 +32,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance group @@ -45,7 +45,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -59,7 +59,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -78,7 +78,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -96,7 +96,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -110,7 +110,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -129,7 +129,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -144,7 +144,7 @@ name: network-instancegroup project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml index 8ce7668..be3c227 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -28,7 +28,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a instance template @@ -49,7 +49,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate - name: delete a instance group manager @@ -61,7 +61,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance group manager @@ -73,7 +73,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -87,7 +87,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -105,7 +105,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -122,7 +122,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -136,7 +136,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -154,7 +154,7 @@ zone: us-west1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -182,7 +182,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true @@ -192,7 +192,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -201,7 +201,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml index 441a455..6cb8d64 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -28,7 +28,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: delete a instance template @@ -49,7 +49,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance template @@ -70,7 +70,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -83,7 +83,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -110,7 +110,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -136,7 +136,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -149,7 +149,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -176,7 +176,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -192,7 +192,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -201,7 +201,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml index 74dae78..9219386 100644 --- a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml @@ -19,7 +19,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a network @@ -28,7 +28,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -41,7 +41,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -56,7 +56,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -70,7 +70,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -83,7 +83,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -98,7 +98,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml index 8bf90de..a613f09 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml @@ -19,7 +19,7 @@ auto_create_subnetworks: 'false' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network - name: create a subnetwork @@ -30,7 +30,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: subnetwork - name: delete a network endpoint group @@ -42,7 +42,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a network endpoint group @@ -54,7 +54,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -68,7 +68,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -86,7 +86,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -103,7 +103,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -117,7 +117,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -135,7 +135,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -153,7 +153,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: subnetwork ignore_errors: true @@ -163,7 +163,7 @@ auto_create_subnetworks: 'false' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml index b5b07a2..4b55d97 100644 --- a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml @@ -20,7 +20,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: node_template - name: delete a node group @@ -32,7 +32,7 @@ node_template: "{{ node_template }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a node group @@ -44,7 +44,7 @@ node_template: "{{ node_template }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -58,7 +58,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -76,7 +76,7 @@ node_template: "{{ node_template }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -93,7 +93,7 @@ node_template: "{{ node_template }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -107,7 +107,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -125,7 +125,7 @@ node_template: "{{ node_template }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -142,7 +142,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: node_template ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml index cacc40b..8297027 100644 --- a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml @@ -20,7 +20,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a node template @@ -30,7 +30,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -44,7 +44,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -60,7 +60,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -75,7 +75,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -89,7 +89,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -105,7 +105,7 @@ node_type: n1-node-96-624 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml index ba64d6f..933c110 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -28,7 +28,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a instance template @@ -49,7 +49,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate - name: create a region instance group manager @@ -61,7 +61,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igrm - name: delete a region autoscaler @@ -77,7 +77,7 @@ target: "{{igrm.selfLink}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region autoscaler @@ -93,7 +93,7 @@ target: "{{igrm.selfLink}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -107,7 +107,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -129,7 +129,7 @@ target: "{{igrm.selfLink}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -150,7 +150,7 @@ target: "{{igrm.selfLink}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -164,7 +164,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -186,7 +186,7 @@ target: "{{igrm.selfLink}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -205,7 +205,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: igrm ignore_errors: true @@ -227,7 +227,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true @@ -237,7 +237,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -246,7 +246,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml index 6fdb3fa..cd3e21e 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml @@ -23,7 +23,7 @@ timeout_sec: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: delete a region backend service @@ -37,7 +37,7 @@ session_affinity: CLIENT_IP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region backend service @@ -51,7 +51,7 @@ session_affinity: CLIENT_IP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -65,7 +65,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -85,7 +85,7 @@ session_affinity: CLIENT_IP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -104,7 +104,7 @@ session_affinity: CLIENT_IP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -118,7 +118,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -138,7 +138,7 @@ session_affinity: CLIENT_IP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -158,7 +158,7 @@ timeout_sec: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml index 7a2e2e2..8e30419 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml @@ -25,7 +25,7 @@ - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region disk @@ -40,7 +40,7 @@ - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -54,7 +54,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -75,7 +75,7 @@ - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -95,7 +95,7 @@ - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -109,7 +109,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -130,7 +130,7 @@ - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml index 498e018..268eda1 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml @@ -27,7 +27,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region health check @@ -44,7 +44,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -58,7 +58,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -81,7 +81,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -103,7 +103,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -117,7 +117,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -140,7 +140,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml index 8c7f188..1a8b07a 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -28,7 +28,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a instance template @@ -49,7 +49,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate - name: delete a region instance group manager @@ -61,7 +61,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region instance group manager @@ -73,7 +73,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -87,7 +87,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -105,7 +105,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -122,7 +122,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -136,7 +136,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -154,7 +154,7 @@ target_size: 3 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -182,7 +182,7 @@ nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true @@ -192,7 +192,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true @@ -201,7 +201,7 @@ name: network-instancetemplate project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml index 9dcd753..88ff1e4 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml @@ -21,7 +21,7 @@ protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" load_balancing_scheme: "EXTERNAL" state: present register: backendservice @@ -32,7 +32,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap - name: delete a region target HTTP proxy @@ -42,7 +42,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region target HTTP proxy @@ -52,7 +52,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -66,7 +66,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -82,7 +82,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -97,7 +97,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -111,7 +111,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -127,7 +127,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -144,7 +144,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent ignore_errors: true - name: delete a backend service @@ -155,7 +155,7 @@ protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" load_balancing_scheme: "EXTERNAL" state: present ignore_errors: true \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml index 9b52b77..89e91e4 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a region health check @@ -32,7 +32,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a region backend service @@ -45,7 +45,7 @@ - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: create a region URL map @@ -55,7 +55,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap - name: create a SSL certificate @@ -88,7 +88,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert - name: delete a region target HTTPS proxy @@ -100,7 +100,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region target HTTPS proxy @@ -112,7 +112,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -126,7 +126,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -144,7 +144,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -161,7 +161,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -175,7 +175,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -193,7 +193,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -233,7 +233,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: sslcert ignore_errors: true @@ -244,7 +244,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: urlmap ignore_errors: true @@ -258,7 +258,7 @@ - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -272,7 +272,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -282,7 +282,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml index 75e998c..06ccec0 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml @@ -20,7 +20,7 @@ protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" load_balancing_scheme: "EXTERNAL" state: present register: backendservice @@ -31,7 +31,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a region URL map @@ -41,7 +41,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -55,7 +55,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -71,7 +71,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -86,7 +86,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -100,7 +100,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -116,7 +116,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -133,7 +133,7 @@ protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" load_balancing_scheme: "EXTERNAL" state: absent register: backendservice diff --git a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml index 8cf3a25..145f378 100644 --- a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml @@ -24,7 +24,7 @@ machine_type: n2-standard-2 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a reservation @@ -38,7 +38,7 @@ machine_type: n2-standard-2 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -52,7 +52,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -72,7 +72,7 @@ machine_type: n2-standard-2 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -91,7 +91,7 @@ machine_type: n2-standard-2 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -105,7 +105,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -125,7 +125,7 @@ machine_type: n2-standard-2 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml index 0910e5b..161e7a8 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml @@ -24,7 +24,7 @@ start_time: '04:00' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a resource policy @@ -38,7 +38,7 @@ start_time: '04:00' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -52,7 +52,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -72,7 +72,7 @@ start_time: '04:00' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -91,7 +91,7 @@ start_time: '04:00' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -105,7 +105,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -125,7 +125,7 @@ start_time: '04:00' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml index bc32b37..aab6cd9 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-route project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -33,7 +33,7 @@ - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a route @@ -47,7 +47,7 @@ - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -60,7 +60,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -80,7 +80,7 @@ - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -99,7 +99,7 @@ - foobar project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -118,7 +118,7 @@ - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -131,7 +131,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -151,7 +151,7 @@ - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -166,7 +166,7 @@ name: network-route project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml index 0be0d14..6003e78 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-router project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -37,7 +37,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a router @@ -55,7 +55,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -69,7 +69,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -93,7 +93,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -116,7 +116,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -130,7 +130,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -154,7 +154,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -169,7 +169,7 @@ name: network-router project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml index 64b4cb2..ffbdb24 100644 --- a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk - name: delete a snapshot @@ -31,7 +31,7 @@ my_label: value project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a snapshot @@ -43,7 +43,7 @@ my_label: value project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -56,7 +56,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -74,7 +74,7 @@ my_label: value project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -91,7 +91,7 @@ my_label: value project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -104,7 +104,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -122,7 +122,7 @@ my_label: value project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -138,7 +138,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: disk ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml index a8346cd..871715c 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml @@ -43,7 +43,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a SSL certificate @@ -76,7 +76,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -89,7 +89,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -128,7 +128,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -166,7 +166,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -179,7 +179,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -218,7 +218,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml index 22bc04d..551af9a 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml @@ -23,7 +23,7 @@ - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a SSL policy @@ -36,7 +36,7 @@ - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -49,7 +49,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -68,7 +68,7 @@ - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -86,7 +86,7 @@ - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -99,7 +99,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -118,7 +118,7 @@ - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml index 3ea1330..74917a3 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml @@ -19,7 +19,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network - name: delete a subnetwork @@ -30,7 +30,7 @@ ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a subnetwork @@ -41,7 +41,7 @@ ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -55,7 +55,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -72,7 +72,7 @@ ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -88,7 +88,7 @@ ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -102,7 +102,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -119,7 +119,7 @@ ip_cidr_range: 172.16.0.0/16 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -135,7 +135,7 @@ auto_create_subnetworks: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml index 6e25237..a64c03a 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a HTTP health check @@ -31,7 +31,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -44,7 +44,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: create a URL map @@ -53,7 +53,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap - name: delete a target HTTP proxy @@ -62,7 +62,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target HTTP proxy @@ -71,7 +71,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -84,7 +84,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -99,7 +99,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -113,7 +113,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -126,7 +126,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -141,7 +141,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -157,7 +157,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: urlmap ignore_errors: true @@ -171,7 +171,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -184,7 +184,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -194,7 +194,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml index 29b3ae0..62500b4 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a HTTP health check @@ -31,7 +31,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -44,7 +44,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: create a URL map @@ -53,7 +53,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap - name: create a SSL certificate @@ -86,7 +86,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert - name: delete a target HTTPS proxy @@ -97,7 +97,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target HTTPS proxy @@ -108,7 +108,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -121,7 +121,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -138,7 +138,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -154,7 +154,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -167,7 +167,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -184,7 +184,7 @@ url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -224,7 +224,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: sslcert ignore_errors: true @@ -234,7 +234,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: urlmap ignore_errors: true @@ -248,7 +248,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -261,7 +261,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -271,7 +271,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml index 5341856..6f55e0d 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instance project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -38,7 +38,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a target instance @@ -48,7 +48,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target instance @@ -58,7 +58,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -72,7 +72,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -88,7 +88,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -103,7 +103,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -117,7 +117,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -133,7 +133,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -159,7 +159,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true @@ -168,7 +168,7 @@ name: network-instance project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml index 6fd6091..712ea70 100644 --- a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml @@ -19,7 +19,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target pool @@ -28,7 +28,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -42,7 +42,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -57,7 +57,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -71,7 +71,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -85,7 +85,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -100,7 +100,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml index 056e1f5..fad23db 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a health check @@ -35,7 +35,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -48,7 +48,7 @@ protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: create a SSL certificate @@ -81,7 +81,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert - name: delete a target SSL proxy @@ -92,7 +92,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target SSL proxy @@ -103,7 +103,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -116,7 +116,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -133,7 +133,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -149,7 +149,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -162,7 +162,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -179,7 +179,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -219,7 +219,7 @@ -----END EC PRIVATE KEY----- project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: sslcert ignore_errors: true @@ -233,7 +233,7 @@ protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -250,7 +250,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -260,7 +260,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml index 08a3ab4..47844d0 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a health check @@ -35,7 +35,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -48,7 +48,7 @@ protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: delete a target TCP proxy @@ -58,7 +58,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target TCP proxy @@ -68,7 +68,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -81,7 +81,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -97,7 +97,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -112,7 +112,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -125,7 +125,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -141,7 +141,7 @@ service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -161,7 +161,7 @@ protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -178,7 +178,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -188,7 +188,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml index 818f885..a23158d 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml @@ -19,7 +19,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a network @@ -27,7 +27,7 @@ name: network-vpngateway project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -38,7 +38,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a target vpn gateway @@ -48,7 +48,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -62,7 +62,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -78,7 +78,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -93,7 +93,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -107,7 +107,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -123,7 +123,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -138,7 +138,7 @@ name: network-vpngateway project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network @@ -149,7 +149,7 @@ region: us-west1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml index 8993b9e..68b8fe4 100644 --- a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml @@ -19,7 +19,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup - name: create a HTTP health check @@ -31,7 +31,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck - name: create a backend service @@ -44,7 +44,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice - name: delete a URL map @@ -53,7 +53,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a URL map @@ -62,7 +62,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -75,7 +75,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -90,7 +90,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -104,7 +104,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -117,7 +117,7 @@ - name = {{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -132,7 +132,7 @@ default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -152,7 +152,7 @@ enable_cdn: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true @@ -165,7 +165,7 @@ unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: healthcheck ignore_errors: true @@ -175,7 +175,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancegroup ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml index 21c4c69..7f86903 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml @@ -19,7 +19,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address - name: create a forward address @@ -28,7 +28,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address_forwardingrule - name: create a network @@ -36,7 +36,7 @@ name: network-vpn-tunnel project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -48,7 +48,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk - name: create a instance @@ -77,7 +77,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: create a router @@ -95,7 +95,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: router - name: create a target vpn gateway @@ -105,7 +105,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: gateway - name: create a forwarding rule @@ -117,7 +117,7 @@ ip_address: "{{ address_forwardingrule.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: create a UDP-500 forwarding rule @@ -130,7 +130,7 @@ ip_address: "{{ address_forwardingrule.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: create a UDP-4500 forwarding rule @@ -143,7 +143,7 @@ ip_address: "{{ address_forwardingrule.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: delete a vpn tunnel @@ -155,7 +155,7 @@ shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" peer_ip: "{{address.address}}" state: absent #---------------------------------------------------------- @@ -168,7 +168,7 @@ shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" peer_ip: "{{address.address}}" state: present register: result @@ -183,7 +183,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -202,7 +202,7 @@ shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -220,7 +220,7 @@ shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -234,7 +234,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/compute register: results @@ -253,7 +253,7 @@ shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -272,7 +272,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent ignore_errors: true register: result @@ -286,7 +286,7 @@ ip_address: "{{ address.address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent ignore_errors: true register: result @@ -299,7 +299,7 @@ ip_address: "104.197.5.203" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent ignore_errors: true register: result @@ -311,7 +311,7 @@ network: "{{ network }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: gateway ignore_errors: true @@ -330,7 +330,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: router ignore_errors: true @@ -360,7 +360,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent - name: delete a disk google.cloud.gcp_compute_disk: @@ -370,7 +370,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: disk ignore_errors: true @@ -379,7 +379,7 @@ name: network-vpn-tunnel project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network @@ -390,7 +390,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address ignore_errors: true \ No newline at end of file diff --git a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml index b8dedbe..2443696 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -23,7 +23,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a cluster @@ -36,7 +36,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -48,7 +48,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -67,7 +67,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -85,7 +85,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -97,7 +97,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -116,7 +116,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml index e452515..f3f5849 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml @@ -20,7 +20,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: cluster - name: delete a node pool @@ -31,7 +31,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a node pool @@ -42,7 +42,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -55,7 +55,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -72,7 +72,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -88,7 +88,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -101,7 +101,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -118,7 +118,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -135,7 +135,7 @@ location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: cluster ignore_errors: true diff --git a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml index 9c73f77..70d72cc 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml @@ -20,7 +20,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a managed zone @@ -30,7 +30,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -42,7 +42,7 @@ dns_name: test.somewild2.example.com. project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results @@ -58,7 +58,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -73,7 +73,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -85,7 +85,7 @@ dns_name: test.somewild2.example.com. project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results @@ -101,7 +101,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml index a2b4d34..b446727 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml @@ -20,7 +20,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: managed_zone - name: delete a resource record set @@ -34,7 +34,7 @@ - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a resource record set @@ -48,7 +48,7 @@ - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -60,7 +60,7 @@ managed_zone: "{{ managed_zone }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results @@ -80,7 +80,7 @@ - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -99,7 +99,7 @@ - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -111,7 +111,7 @@ managed_zone: "{{ managed_zone }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results @@ -131,7 +131,7 @@ - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -148,7 +148,7 @@ description: test zone project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: managed_zone ignore_errors: true diff --git a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml index 9617679..4a4769d 100644 --- a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml @@ -27,7 +27,7 @@ - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -44,7 +44,7 @@ - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -56,7 +56,7 @@ zone: us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -79,7 +79,7 @@ - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -101,7 +101,7 @@ - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -113,7 +113,7 @@ zone: us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -136,7 +136,7 @@ - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml index b78a3df..d754203 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml @@ -24,7 +24,7 @@ - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a role @@ -38,7 +38,7 @@ - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -49,7 +49,7 @@ google.cloud.gcp_iam_role_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/iam register: results @@ -69,7 +69,7 @@ - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -89,7 +89,7 @@ - storage.objects.list project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -108,7 +108,7 @@ - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -119,7 +119,7 @@ google.cloud.gcp_iam_role_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/iam register: results @@ -139,7 +139,7 @@ - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index 367c9d8..ec14f78 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -19,7 +19,7 @@ display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a service account @@ -28,7 +28,7 @@ display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -39,7 +39,7 @@ google.cloud.gcp_iam_service_account_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/iam register: results @@ -54,7 +54,7 @@ display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -68,7 +68,7 @@ display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -79,7 +79,7 @@ google.cloud.gcp_iam_service_account_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/iam register: results @@ -94,7 +94,7 @@ display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml index ef2252c..dd7ed17 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml @@ -19,7 +19,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: keyring - name: delete a crypto key @@ -28,7 +28,7 @@ key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a crypto key @@ -37,7 +37,7 @@ key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -49,7 +49,7 @@ key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudkms register: results @@ -64,7 +64,7 @@ key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml index 34999ab..0c52609 100644 --- a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml @@ -18,7 +18,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a key ring @@ -27,7 +27,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -39,7 +39,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudkms register: results @@ -54,7 +54,7 @@ location: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml index bc4de15..8d0f6c0 100644 --- a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml +++ b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml @@ -35,7 +35,7 @@ offset: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a metric @@ -60,7 +60,7 @@ offset: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -71,7 +71,7 @@ google.cloud.gcp_logging_metric_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -102,7 +102,7 @@ offset: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -132,7 +132,7 @@ offset: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -143,7 +143,7 @@ google.cloud.gcp_logging_metric_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -174,7 +174,7 @@ offset: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml index 8b15c3d..1f115aa 100644 --- a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml @@ -21,7 +21,7 @@ - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a model @@ -32,7 +32,7 @@ - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -43,7 +43,7 @@ google.cloud.gcp_mlengine_model_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -60,7 +60,7 @@ - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -76,7 +76,7 @@ - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -87,7 +87,7 @@ google.cloud.gcp_mlengine_model_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -104,7 +104,7 @@ - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml index 2a9da56..fc0bff2 100644 --- a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml @@ -23,7 +23,7 @@ online_prediction_console_logging: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: model - name: delete a version @@ -36,7 +36,7 @@ deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a version @@ -49,7 +49,7 @@ deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -61,7 +61,7 @@ model: "{{ model }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -80,7 +80,7 @@ deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -98,7 +98,7 @@ deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -110,7 +110,7 @@ model: "{{ model }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -129,7 +129,7 @@ deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -149,7 +149,7 @@ online_prediction_console_logging: 'true' project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: model ignore_errors: true diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml index be58520..5aa60ee 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml @@ -18,7 +18,7 @@ name: topic-subscription project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: topic - name: delete a subscription @@ -28,7 +28,7 @@ ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a subscription @@ -38,7 +38,7 @@ ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -49,7 +49,7 @@ google.cloud.gcp_pubsub_subscription_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/pubsub register: results @@ -65,7 +65,7 @@ ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -80,7 +80,7 @@ ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -91,7 +91,7 @@ google.cloud.gcp_pubsub_subscription_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/pubsub register: results @@ -107,7 +107,7 @@ ack_deadline_seconds: 300 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -122,7 +122,7 @@ name: topic-subscription project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: topic ignore_errors: true diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml index 5d811a1..4e5d438 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml @@ -18,7 +18,7 @@ name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a topic @@ -26,7 +26,7 @@ name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -37,7 +37,7 @@ google.cloud.gcp_pubsub_topic_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/pubsub register: results @@ -51,7 +51,7 @@ name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -64,7 +64,7 @@ name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -75,7 +75,7 @@ google.cloud.gcp_pubsub_topic_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/pubsub register: results @@ -89,7 +89,7 @@ name: test-topic1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml index 9980558..1155fbd 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml @@ -18,7 +18,7 @@ name: network-instance project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: present register: network @@ -37,7 +37,7 @@ other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -55,7 +55,7 @@ other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -67,7 +67,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -91,7 +91,7 @@ other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -114,7 +114,7 @@ other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -126,7 +126,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -150,7 +150,7 @@ other_key: other_val project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -165,7 +165,7 @@ name: network-instance project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" auto_create_subnetworks: true state: absent register: network diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 539b3ac..0c92900 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" parent: type: folder id: "{{ gcp_folder_id }}" @@ -29,7 +29,7 @@ name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" parent: type: folder id: "{{ gcp_folder_id }}" @@ -46,7 +46,7 @@ google.cloud.gcp_resourcemanager_project_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" # choose 1000 projects so iterate past the deleted ones. page_size: 1000 scopes: @@ -62,7 +62,7 @@ name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" parent: type: folder id: "{{ gcp_folder_id }}" @@ -78,7 +78,7 @@ name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" parent: type: folder id: "{{ gcp_folder_id }}" @@ -95,7 +95,7 @@ google.cloud.gcp_resourcemanager_project_info: project: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" # choose 1000 projects so iterate past the deleted ones. page_size: 1000 scopes: @@ -111,7 +111,7 @@ name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" parent: type: folder id: "{{ gcp_folder_id }}" diff --git a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml index b14ef65..08bba39 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml @@ -19,7 +19,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a config @@ -28,7 +28,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -39,7 +39,7 @@ google.cloud.gcp_runtimeconfig_config_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudruntimeconfig register: results @@ -54,7 +54,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -68,7 +68,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -79,7 +79,7 @@ google.cloud.gcp_runtimeconfig_config_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudruntimeconfig register: results @@ -94,7 +94,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml index fcfefb3..5ea7d80 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml @@ -19,7 +19,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: config - name: delete a variable @@ -29,7 +29,7 @@ text: example.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a variable @@ -39,7 +39,7 @@ text: example.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -51,7 +51,7 @@ config: my-config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudruntimeconfig register: results @@ -67,7 +67,7 @@ text: example.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -82,7 +82,7 @@ text: example.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -94,7 +94,7 @@ config: my-config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloudruntimeconfig register: results @@ -110,7 +110,7 @@ text: example.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -126,7 +126,7 @@ description: My config project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: config ignore_errors: true diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml index 6db1573..c5f7f1e 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml @@ -18,7 +18,7 @@ name: spanner.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a service @@ -26,7 +26,7 @@ name: spanner.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -37,7 +37,7 @@ google.cloud.gcp_serviceusage_service_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -51,7 +51,7 @@ name: spanner.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -64,7 +64,7 @@ name: spanner.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -80,7 +80,7 @@ google.cloud.gcp_serviceusage_service_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -94,7 +94,7 @@ name: spanner.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml index adeff08..da4942a 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a repository @@ -26,7 +26,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -37,7 +37,7 @@ google.cloud.gcp_sourcerepo_repository_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -51,7 +51,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -64,7 +64,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -75,7 +75,7 @@ google.cloud.gcp_sourcerepo_repository_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -89,7 +89,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml index cf1b808..a3d8678 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml @@ -23,7 +23,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a database @@ -32,7 +32,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a database @@ -41,7 +41,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -53,7 +53,7 @@ # instance: "{{ instance }}" # project: "{{ gcp_project }}" # auth_kind: "{{ gcp_cred_kind }}" -# service_account_file: "{{ gcp_cred_file }}" +# service_account_file: "{{ gcp_cred_file | default(omit) }}" # scopes: # - https://www.googleapis.com/auth/spanner.admin # register: results @@ -68,7 +68,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -82,7 +82,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -98,7 +98,7 @@ # instance: "{{ instance }}" # project: "{{ gcp_project }}" # auth_kind: "{{ gcp_cred_kind }}" -# service_account_file: "{{ gcp_cred_file }}" +# service_account_file: "{{ gcp_cred_file | default(omit) }}" # scopes: # - https://www.googleapis.com/auth/spanner.admin # register: results @@ -113,7 +113,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -133,7 +133,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true diff --git a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml index fdf82dd..8993c72 100644 --- a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml @@ -23,7 +23,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -36,7 +36,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -47,7 +47,7 @@ google.cloud.gcp_spanner_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/spanner.admin register: results @@ -66,7 +66,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -84,7 +84,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -95,7 +95,7 @@ google.cloud.gcp_spanner_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/spanner.admin register: results @@ -114,7 +114,7 @@ config: regional-us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index 1661f83..f6fa6ea 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -25,7 +25,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a database @@ -35,7 +35,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a database @@ -45,7 +45,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -57,7 +57,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -73,7 +73,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -88,7 +88,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -100,7 +100,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -116,7 +116,7 @@ instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -138,7 +138,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true diff --git a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml index cb1a475..7e49adb 100644 --- a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml @@ -25,7 +25,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a instance @@ -40,7 +40,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -51,7 +51,7 @@ google.cloud.gcp_sql_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -72,7 +72,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -92,7 +92,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -103,7 +103,7 @@ google.cloud.gcp_sql_instance_info: project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -124,7 +124,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml index cc22adc..78528c8 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml @@ -25,7 +25,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a SSL cert @@ -34,7 +34,7 @@ instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a SSL cert @@ -43,7 +43,7 @@ instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -58,7 +58,7 @@ instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -81,7 +81,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true diff --git a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml index c5aace2..c655c5e 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml @@ -25,7 +25,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a user @@ -36,7 +36,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a user @@ -47,7 +47,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -59,7 +59,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -76,7 +76,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -92,7 +92,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -104,7 +104,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results @@ -121,7 +121,7 @@ instance: "{{ instance }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -143,7 +143,7 @@ region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml index b6d83e4..d2f58c9 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a bucket @@ -26,7 +26,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -39,7 +39,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -52,7 +52,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -65,7 +65,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml index ebde9a3..a037a46 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket - name: delete a bucket access control @@ -28,7 +28,7 @@ role: WRITER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a bucket access control @@ -38,7 +38,7 @@ role: WRITER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -53,7 +53,7 @@ role: WRITER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -68,7 +68,7 @@ role: WRITER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -83,7 +83,7 @@ role: WRITER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -98,7 +98,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: bucket ignore_errors: true diff --git a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml index 6f091e9..77197a0 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml @@ -18,7 +18,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket - name: delete a default object acl @@ -27,7 +27,7 @@ entity: OWNER:user-alexstephen@google.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a default object acl @@ -36,7 +36,7 @@ entity: OWNER:user-alexstephen@google.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -50,7 +50,7 @@ entity: OWNER:user-alexstephen@google.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -64,7 +64,7 @@ entity: OWNER:user-alexstephen@google.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -78,7 +78,7 @@ entity: OWNER:user-alexstephen@google.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false @@ -93,7 +93,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: bucket ignore_errors: true diff --git a/tests/integration/targets/gcp_storage_object/tasks/main.yml b/tests/integration/targets/gcp_storage_object/tasks/main.yml index 497d425..e96adcd 100644 --- a/tests/integration/targets/gcp_storage_object/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_object/tasks/main.yml @@ -17,7 +17,7 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket #---------------------------------------------------------- @@ -29,7 +29,7 @@ dest: "ansible/{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result - name: assert changed is true assert: @@ -44,7 +44,7 @@ dest: "{{ download_temp.path }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result - name: assert changed is true assert: @@ -58,7 +58,7 @@ src: "ansible/{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result - name: assert changed is true assert: @@ -70,6 +70,6 @@ name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: bucket diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index e44d632..140d1f2 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -22,7 +22,7 @@ cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a node @@ -34,7 +34,7 @@ cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is true @@ -46,7 +46,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -64,7 +64,7 @@ cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false @@ -81,7 +81,7 @@ cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is true @@ -93,7 +93,7 @@ zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/cloud-platform register: results @@ -111,7 +111,7 @@ cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result - name: assert changed is false From 92eb9c814befc9484700da2a8d80594caaa9997a Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 12:57:09 -0800 Subject: [PATCH 093/138] chore: update GitHub actions to their latest versions --- .github/workflows/ansible-integration-tests.yml | 6 +++--- .github/workflows/ansible-test.yml | 10 +++++----- .github/workflows/automationhub.yml | 4 ++-- .github/workflows/gcloud.yml | 4 ++-- .github/workflows/gcsfuse.yml | 4 ++-- .github/workflows/pythonpublish.yml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index 7fb920f..9a83f39 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -23,13 +23,13 @@ jobs: - stable-2.13 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: - python-version: '3.9' # this is the minimum version required for Ansible 2.13 + python-version: '3.9' # this is the minimum version required for Ansible 2.15 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 5ccdd14..52053b0 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -1,7 +1,7 @@ name: "Run tests for the cloud.google collection" on: [pull_request] env: - PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 + PYTHON_VERSION: "3.9" # minimum version for Ansible 2.15 jobs: sanity-and-lint: runs-on: ubuntu-latest @@ -14,11 +14,11 @@ jobs: - stable-2.14 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} # Automation-hub requires python2.7 sanity tests @@ -51,11 +51,11 @@ jobs: - stable-2.11 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: "${{ env.PYTHON_VERSION }}" - name: Install dependencies diff --git a/.github/workflows/automationhub.yml b/.github/workflows/automationhub.yml index 29e1262..bc3e61c 100644 --- a/.github/workflows/automationhub.yml +++ b/.github/workflows/automationhub.yml @@ -8,9 +8,9 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 8100e1e..99b04b0 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -26,12 +26,12 @@ jobs: - gcloud steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.9 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index a58e6a3..46c60b7 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -21,12 +21,12 @@ jobs: - gcsfuse steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.9 diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 0318edf..d58d4ee 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -8,9 +8,9 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies From f1fe6f91456ceba9f3b11c7b657dd5b1843bef28 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 13:50:56 -0800 Subject: [PATCH 094/138] chore: update ubuntu to latest; 18.04 is no more --- .github/workflows/gcloud.yml | 2 +- .github/workflows/gcsfuse.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 99b04b0..f7765ec 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -12,7 +12,7 @@ on: - 'molecule/gcloud/**' jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 46c60b7..59d18e6 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -10,7 +10,7 @@ on: - .github/workflows/gcsfuse.yml jobs: gcsfuse: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 From d13c4d6b0f49e5480a31acc020f11bebe5d1e135 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 14:23:27 -0800 Subject: [PATCH 095/138] chore: use the correct molecule driver package --- .github/workflows/gcloud.yml | 2 +- .github/workflows/gcsfuse.yml | 2 +- CONTRIBUTING.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index f7765ec..20e800a 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -47,7 +47,7 @@ jobs: sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule[docker] yamllint ansible ansible-lint docker + pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 59d18e6..d431abc 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -42,7 +42,7 @@ jobs: sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule[docker] yamllint ansible ansible-lint docker + pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d821948..7111abb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,10 +124,10 @@ Run `ansible-test integration`. Currently some tests are disabled as [test are b ### Prequisites for role tests If you would like to use podman, you must -install the `molecule[podman]` package in PyPI: +install the `molecule-plugins[podman]` package in PyPI: ``` -pip install --upgrade molecule[podman] +pip install --upgrade molecule-plugins[podman] ``` ### Running role tests From 4b76e12c88c11aae59b0dbcbe07ac03862ec0eaf Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 14:40:44 -0800 Subject: [PATCH 096/138] chore: cd to the repo root when running role tests --- .github/workflows/gcloud.yml | 1 + .github/workflows/gcsfuse.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 20e800a..3a13863 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -50,6 +50,7 @@ jobs: pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test + working-directory: ansible_collections/google/cloud run: >- molecule --version && ansible --version && diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index d431abc..30ac726 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -45,6 +45,7 @@ jobs: pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test + working-directory: ansible_collections/google/cloud run: >- molecule --version && ansible --version && From 38932afee9746c729a567d4f42e24eb8073f0ee4 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 15:44:49 -0800 Subject: [PATCH 097/138] chore: update container versions for molecule tests --- molecule/gcloud/molecule.yml | 4 ++-- molecule/gcsfuse/molecule.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule/gcloud/molecule.yml b/molecule/gcloud/molecule.yml index 7b7ab54..7bdbe2f 100644 --- a/molecule/gcloud/molecule.yml +++ b/molecule/gcloud/molecule.yml @@ -9,13 +9,13 @@ lint: | ansible-lint platforms: - name: instance - image: ubuntu:18.04 + image: ubuntu:20.04 privileged: true ansible.builtin.command: "/lib/systemd/systemd" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance - image: debian:9 + image: debian:10 privileged: true ansible.builtin.command: "/lib/systemd/systemd" volumes: diff --git a/molecule/gcsfuse/molecule.yml b/molecule/gcsfuse/molecule.yml index 7b7ab54..7bdbe2f 100644 --- a/molecule/gcsfuse/molecule.yml +++ b/molecule/gcsfuse/molecule.yml @@ -9,13 +9,13 @@ lint: | ansible-lint platforms: - name: instance - image: ubuntu:18.04 + image: ubuntu:20.04 privileged: true ansible.builtin.command: "/lib/systemd/systemd" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance - image: debian:9 + image: debian:10 privileged: true ansible.builtin.command: "/lib/systemd/systemd" volumes: From 1dc5166ca0f0762e13dfd3547fd0853ea1669f68 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 16:45:40 -0800 Subject: [PATCH 098/138] chore: use https when adding the gcsfuse apt repo --- roles/gcsfuse/tasks/debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index 941f3bd..c9a9322 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -14,7 +14,7 @@ - name: Gcsfuse | Add the apt repository ansible.builtin.apt_repository: - repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main + repo: deb https://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main state: present filename: gcsfuse From 0074be1248c86974f9d906e0c047b7af31790038 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 13 Nov 2023 11:54:09 -0800 Subject: [PATCH 099/138] chore: address cleanup script linter warnings --- scripts/cleanup-project.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index e45ddd5..b05a2f1 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -42,12 +42,13 @@ cleanup_resource() { if [ -z "$extra_list_arg" ] then - resources=( $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)") ) + mapfile -t resources < <(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)") else - resources=( $(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}") ) + mapfile -t resources < <(gcloud "${resource_group}" "${resource}" list --project="${PROJECT_ID}" --format="csv[no-heading](name)" "${extra_list_arg}") fi - for resource_id in $resources; do + for resource_id in "${resources[@]}" + do if [ -z "$extra_delete_arg" ] then gcloud "${resource_group}" "${resource}" delete "${resource_id}" --project="${PROJECT_ID}" -q From 3f44909f92c74ff68dc70a3c89e5d7d0b146ac6d Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 13 Nov 2023 14:29:05 -0800 Subject: [PATCH 100/138] chore: fix gcp_sql_database integration test --- .../targets/gcp_sql_database/tasks/autogen.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index f6fa6ea..5171771 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -31,7 +31,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -41,7 +41,7 @@ - name: create a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -69,7 +69,7 @@ - name: create a database that already exists google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -84,7 +84,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -112,7 +112,7 @@ - name: delete a database that does not exist google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From bda318efba630aa9291d92332c75e5770fc4adc7 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 13 Nov 2023 14:30:29 -0800 Subject: [PATCH 101/138] Revert "chore: fix gcp_sql_database integration test" This reverts commit 3f44909f92c74ff68dc70a3c89e5d7d0b146ac6d. --- .../targets/gcp_sql_database/tasks/autogen.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index 5171771..f6fa6ea 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -31,7 +31,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8mb4 + charset: utf8 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -41,7 +41,7 @@ - name: create a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8mb4 + charset: utf8 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -69,7 +69,7 @@ - name: create a database that already exists google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8mb4 + charset: utf8 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -84,7 +84,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8mb4 + charset: utf8 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -112,7 +112,7 @@ - name: delete a database that does not exist google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8mb4 + charset: utf8 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From b64af489ea0d1137a98f2057a329f3bca3e37557 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 13 Nov 2023 14:31:26 -0800 Subject: [PATCH 102/138] chore: fix gcp_sql_database integration test --- .../targets/gcp_sql_database/tasks/autogen.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index f6fa6ea..5171771 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -31,7 +31,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -41,7 +41,7 @@ - name: create a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -69,7 +69,7 @@ - name: create a database that already exists google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -84,7 +84,7 @@ - name: delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -112,7 +112,7 @@ - name: delete a database that does not exist google.cloud.gcp_sql_database: name: "{{ resource_name }}" - charset: utf8 + charset: utf8mb4 instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" From 13af84c3dbbbab23281e6f27fb0814bcd2e74f0d Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Tue, 14 Nov 2023 12:43:01 -0800 Subject: [PATCH 103/138] chore: bump ansible versions --- .github/workflows/ansible-integration-tests.yml | 4 +++- .github/workflows/ansible-test.yml | 3 ++- meta/runtime.yml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index 7fb920f..bbb7ca3 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -18,9 +18,11 @@ jobs: run: working-directory: ansible_collections/google/cloud strategy: + max-parallel: 1 matrix: ansible_version: - - stable-2.13 + - stable-2.14 + - stable-2.15 steps: - name: check out code uses: actions/checkout@v2 diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 5ccdd14..f158258 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -12,6 +12,7 @@ jobs: matrix: ansible_version: - stable-2.14 + - stable-2.15 steps: - name: check out code uses: actions/checkout@v2 @@ -48,7 +49,7 @@ jobs: matrix: ansible_version: - stable-2.14 - - stable-2.11 + - stable-2.15 steps: - name: check out code uses: actions/checkout@v2 diff --git a/meta/runtime.yml b/meta/runtime.yml index d28681a..83ae41c 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.9.10' +requires_ansible: '>=2.14' action_groups: gcp: From c15b47250d1efcb93dd2f4d31caa87d0ea3b95d2 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Tue, 14 Nov 2023 13:03:58 -0800 Subject: [PATCH 104/138] chore: fix minimum version format, upgrade ansible-lint --- .github/workflows/ansible-test.yml | 2 +- meta/runtime.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index f158258..664db28 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -37,7 +37,7 @@ jobs: # validate-modules cannot be turned on until #498 is resolved. run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint - run: pip install ansible-lint==6.13.1 + run: pip install ansible-lint==6.22.0 - name: Run ansible-lint run: ansible-lint unit: diff --git a/meta/runtime.yml b/meta/runtime.yml index 83ae41c..4ed2cf6 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.14' +requires_ansible: '>=2.14.0' action_groups: gcp: From 08ada5354d9e05f98738b8633ea5eb84e4cdca55 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 17 Nov 2023 16:39:42 -0800 Subject: [PATCH 105/138] fix: upgrade ansible version, address test and lint errors --- .../workflows/ansible-integration-tests.yml | 17 +- .github/workflows/ansible-test.yml | 7 +- .github/workflows/automationhub.yml | 32 +- .github/workflows/gcloud.yml | 15 +- .github/workflows/gcsfuse.yml | 3 +- .github/workflows/pythonpublish.yml | 32 +- CONTRIBUTING.md | 2 +- changelogs/.plugin-cache.yaml | 683 +++++++++--------- changelogs/changelog.yaml | 65 +- changelogs/config.yaml | 33 +- changelogs/fragments/app-default-creds.yml | 3 +- .../fragments/gcp_serviceusage_service.yml | 4 + changelogs/fragments/gcp_sql_ssl_cert.yml | 3 + .../gcp_storage_default_object_acl.yml | 3 + changelogs/fragments/upgrade-versions.yml | 6 + galaxy.yml | 20 +- meta/runtime.yml | 2 +- molecule/gcloud/converge.yml | 4 +- molecule/gcloud/molecule.yml | 4 +- molecule/gcloud/verify.yml | 6 +- molecule/gcsfuse/molecule.yml | 4 +- molecule/gcsfuse/verify.yml | 6 +- plugins/modules/gcp_serviceusage_service.py | 6 +- plugins/modules/gcp_sql_ssl_cert.py | 45 +- .../modules/gcp_storage_default_object_acl.py | 33 +- .../gcloud/tasks/archive/archive_install.yml | 6 +- .../tasks/archive/command_completion.yml | 4 +- roles/gcloud/tasks/archive/main.yml | 7 +- roles/gcloud/tasks/main.yml | 7 +- roles/gcloud/tasks/package/debian.yml | 6 +- roles/gcloud/tasks/package/redhat.yml | 10 +- roles/gcp_http_lb/README.md | 4 +- roles/gcp_http_lb/defaults/main.yml | 16 +- roles/gcp_http_lb/meta/main.yml | 15 +- roles/gcp_http_lb/tasks/main.yml | 112 +-- roles/gcp_http_lb/tests/test.yml | 3 +- roles/gcp_http_lb/vars/main.yml | 20 +- roles/gcsfuse/tasks/debian.yml | 4 +- .../defaults/main.yml | 2 +- .../tasks/autogen.yml | 58 +- .../tasks/main.yml | 3 +- .../gcp_bigquery_dataset/tasks/autogen.yml | 58 +- .../gcp_bigquery_dataset/tasks/main.yml | 3 +- .../gcp_bigquery_table/tasks/autogen.yml | 66 +- .../targets/gcp_bigquery_table/tasks/main.yml | 3 +- .../gcp_bigtable_instance/tasks/autogen.yml | 80 +- .../gcp_bigtable_instance/tasks/main.yml | 3 +- .../gcp_cloudbuild_trigger/defaults/main.yml | 2 +- .../tasks/autogen.yml | 76 +- .../tasks/main.yml | 3 +- .../gcp_cloudscheduler_job/tasks/autogen.yml | 72 +- .../gcp_cloudscheduler_job/tasks/main.yml | 3 +- .../gcp_cloudtasks_queue/tasks/autogen.yml | 62 +- .../gcp_cloudtasks_queue/tasks/main.yml | 3 +- .../gcp_compute_address/tasks/autogen.yml | 70 +- .../gcp_compute_address/tasks/main.yml | 3 +- .../gcp_compute_autoscaler/tasks/autogen.yml | 132 ++-- .../gcp_compute_autoscaler/tasks/main.yml | 3 +- .../tasks/autogen.yml | 80 +- .../gcp_compute_backend_bucket/tasks/main.yml | 3 +- .../tasks/autogen.yml | 104 +-- .../tasks/main.yml | 3 +- .../gcp_compute_disk/tasks/autogen.yml | 70 +- .../targets/gcp_compute_disk/tasks/main.yml | 3 +- .../tasks/autogen.yml | 86 +-- .../tasks/main.yml | 3 +- .../gcp_compute_firewall/tasks/autogen.yml | 126 ++-- .../gcp_compute_firewall/tasks/main.yml | 6 +- .../gcp_compute_firewall/tasks/update.yml | 150 ++-- .../tasks/autogen.yml | 78 +- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../gcp_compute_global_address/tasks/main.yml | 3 +- .../tasks/autogen.yml | 102 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../gcp_compute_health_check/tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../tasks/main.yml | 3 +- .../gcp_compute_image/tasks/autogen.yml | 70 +- .../targets/gcp_compute_image/tasks/main.yml | 3 +- .../gcp_compute_instance/tasks/autogen.yml | 222 +++--- .../gcp_compute_instance/tasks/main.yml | 3 +- .../tasks/autogen.yml | 94 +-- .../gcp_compute_instance_group/tasks/main.yml | 3 +- .../tasks/autogen.yml | 118 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 164 ++--- .../tasks/main.yml | 3 +- .../defaults/main.yml | 2 +- .../defaults/main.yml | 2 +- .../gcp_compute_network/tasks/autogen.yml | 76 +- .../gcp_compute_network/tasks/main.yml | 3 +- .../tasks/autogen.yml | 82 +-- .../tasks/main.yml | 3 +- .../gcp_compute_node_group/tasks/autogen.yml | 74 +- .../gcp_compute_node_group/tasks/main.yml | 3 +- .../tasks/autogen.yml | 70 +- .../gcp_compute_node_template/tasks/main.yml | 3 +- .../tasks/autogen.yml | 142 ++-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 84 +-- .../tasks/main.yml | 3 +- .../gcp_compute_region_disk/tasks/autogen.yml | 90 +-- .../gcp_compute_region_disk/tasks/main.yml | 3 +- .../tasks/autogen.yml | 70 +- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 118 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 90 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 108 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 80 +- .../gcp_compute_region_url_map/tasks/main.yml | 3 +- .../gcp_compute_reservation/tasks/autogen.yml | 70 +- .../gcp_compute_reservation/tasks/main.yml | 3 +- .../tasks/autogen.yml | 80 +- .../tasks/main.yml | 3 +- .../gcp_compute_route/tasks/autogen.yml | 100 +-- .../targets/gcp_compute_route/tasks/main.yml | 3 +- .../gcp_compute_router/tasks/autogen.yml | 104 +-- .../targets/gcp_compute_router/tasks/main.yml | 3 +- .../gcp_compute_snapshot/tasks/autogen.yml | 70 +- .../gcp_compute_snapshot/tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../tasks/main.yml | 3 +- .../gcp_compute_ssl_policy/tasks/autogen.yml | 86 +-- .../gcp_compute_ssl_policy/tasks/main.yml | 3 +- .../gcp_compute_subnetwork/tasks/autogen.yml | 78 +- .../gcp_compute_subnetwork/tasks/main.yml | 3 +- .../tasks/autogen.yml | 94 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 108 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 98 +-- .../tasks/main.yml | 3 +- .../gcp_compute_target_pool/tasks/autogen.yml | 70 +- .../gcp_compute_target_pool/tasks/main.yml | 3 +- .../tasks/autogen.yml | 100 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 86 +-- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 78 +- .../tasks/main.yml | 3 +- .../gcp_compute_url_map/tasks/autogen.yml | 90 +-- .../gcp_compute_url_map/tasks/main.yml | 3 +- .../gcp_compute_vpn_tunnel/tasks/autogen.yml | 190 ++--- .../gcp_compute_vpn_tunnel/tasks/main.yml | 3 +- .../gcp_container_cluster/tasks/autogen.yml | 72 +- .../gcp_container_cluster/tasks/main.yml | 3 +- .../gcp_container_node_pool/tasks/autogen.yml | 70 +- .../gcp_container_node_pool/tasks/main.yml | 3 +- .../gcp_dns_managed_zone/tasks/autogen.yml | 62 +- .../gcp_dns_managed_zone/tasks/main.yml | 3 +- .../tasks/autogen.yml | 86 +-- .../tasks/main.yml | 3 +- .../gcp_filestore_instance/tasks/autogen.yml | 112 +-- .../gcp_filestore_instance/tasks/main.yml | 3 +- .../targets/gcp_iam_role/tasks/autogen.yml | 102 +-- .../targets/gcp_iam_role/tasks/main.yml | 3 +- .../gcp_iam_service_account/tasks/autogen.yml | 64 +- .../gcp_iam_service_account/tasks/main.yml | 3 +- .../defaults/main.yml | 2 +- .../gcp_kms_crypto_key/tasks/autogen.yml | 44 +- .../targets/gcp_kms_crypto_key/tasks/main.yml | 3 +- .../gcp_kms_key_ring/tasks/autogen.yml | 41 +- .../targets/gcp_kms_key_ring/tasks/main.yml | 3 +- .../gcp_logging_metric/tasks/autogen.yml | 98 +-- .../targets/gcp_logging_metric/tasks/main.yml | 3 +- .../gcp_mlengine_model/tasks/autogen.yml | 68 +- .../targets/gcp_mlengine_model/tasks/main.yml | 3 +- .../gcp_mlengine_version/tasks/autogen.yml | 88 +-- .../gcp_mlengine_version/tasks/main.yml | 3 +- .../gcp_pubsub_subscription/tasks/autogen.yml | 66 +- .../gcp_pubsub_subscription/tasks/main.yml | 3 +- .../gcp_pubsub_topic/tasks/autogen.yml | 58 +- .../targets/gcp_pubsub_topic/tasks/main.yml | 3 +- .../gcp_redis_instance/tasks/autogen.yml | 66 +- .../targets/gcp_redis_instance/tasks/main.yml | 3 +- .../tasks/autogen.yml | 72 +- .../tasks/main.yml | 3 +- .../tasks/autogen.yml | 58 +- .../gcp_runtimeconfig_config/tasks/main.yml | 3 +- .../tasks/autogen.yml | 66 +- .../gcp_runtimeconfig_variable/tasks/main.yml | 3 +- .../targets/gcp_serviceusage_service/aliases | 1 - .../tasks/autogen.yml | 72 +- .../gcp_serviceusage_service/tasks/main.yml | 3 +- .../tasks/autogen.yml | 58 +- .../gcp_sourcerepo_repository/tasks/main.yml | 3 +- .../gcp_spanner_database/tasks/autogen.yml | 30 +- .../gcp_spanner_database/tasks/main.yml | 3 +- .../gcp_spanner_instance/tasks/autogen.yml | 58 +- .../gcp_spanner_instance/tasks/main.yml | 3 +- .../gcp_sql_database/tasks/autogen.yml | 82 +-- .../targets/gcp_sql_database/tasks/main.yml | 3 +- .../gcp_sql_instance/tasks/autogen.yml | 92 +-- .../targets/gcp_sql_instance/tasks/main.yml | 3 +- .../targets/gcp_sql_ssl_cert/aliases | 5 +- .../gcp_sql_ssl_cert/tasks/autogen.yml | 81 ++- .../targets/gcp_sql_ssl_cert/tasks/main.yml | 3 +- .../targets/gcp_sql_user/tasks/autogen.yml | 78 +- .../targets/gcp_sql_user/tasks/main.yml | 3 +- .../gcp_storage_bucket/tasks/autogen.yml | 26 +- .../targets/gcp_storage_bucket/tasks/main.yml | 3 +- .../tasks/autogen.yml | 30 +- .../tasks/main.yml | 3 +- .../gcp_storage_default_object_acl/aliases | 3 +- .../tasks/autogen.yml | 45 +- .../tasks/main.yml | 3 +- .../targets/gcp_storage_object/tasks/main.yml | 49 +- .../targets/gcp_tpu_node/tasks/autogen.yml | 82 +-- .../targets/gcp_tpu_node/tasks/main.yml | 3 +- 216 files changed, 4394 insertions(+), 4262 deletions(-) create mode 100644 changelogs/fragments/gcp_serviceusage_service.yml create mode 100644 changelogs/fragments/gcp_sql_ssl_cert.yml create mode 100644 changelogs/fragments/gcp_storage_default_object_acl.yml create mode 100644 changelogs/fragments/upgrade-versions.yml diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index bbb7ca3..e71730a 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -1,11 +1,12 @@ -name: "Run integration tests for the cloud.google collection" +--- +name: Run integration tests for the cloud.google collection on: pull_request: {} push: branches: master env: - GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" - GCP_PROJECT: "ansible-gcp-ci" + GCP_SERVICE_ACCOUNT: github-ci@ansible-gcp-ci.iam.gserviceaccount.com + GCP_PROJECT: ansible-gcp-ci GCP_FOLDER_ID: "542027184392" jobs: integration: @@ -31,7 +32,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.9' # this is the minimum version required for Ansible 2.13 + python-version: "3.9" # this is the minimum version required for Ansible 2.13 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) @@ -55,15 +56,15 @@ jobs: env: CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} with: - service_account: "$GCP_SERVICE_ACCOUNT" - credentials_json: "${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}" + service_account: $GCP_SERVICE_ACCOUNT + credentials_json: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v1 - name: Run cleanup - run: | + run: | ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_FOLDER_ID # run tests - name: Run integration tests # Add the -vvv flag to print out more output - run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages \ No newline at end of file + run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 664db28..eb6ee9c 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -1,4 +1,5 @@ -name: "Run tests for the cloud.google collection" +--- +name: Run tests for the cloud.google collection on: [pull_request] env: PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 @@ -58,7 +59,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: "${{ env.PYTHON_VERSION }}" + python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: pip install -r requirements.txt - name: Install test dependencies @@ -66,4 +67,4 @@ jobs: - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run unit tests - run: ansible-test units -v --color --python "$PYTHON_VERSION" \ No newline at end of file + run: ansible-test units -v --color --python "$PYTHON_VERSION" diff --git a/.github/workflows/automationhub.yml b/.github/workflows/automationhub.yml index 29e1262..d309614 100644 --- a/.github/workflows/automationhub.yml +++ b/.github/workflows/automationhub.yml @@ -1,25 +1,25 @@ +--- name: Upload release to Automation Hub on: release: types: [created] - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.x + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 8100e1e..f4fc7d3 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -1,15 +1,16 @@ -name: "google.cloud.gcloud" +--- +name: google.cloud.gcloud on: push: paths: - - 'roles/gcloud/**' - - '.github/workflows/gcloud.yml' - - 'molecule/gcloud/**' + - roles/gcloud/** + - .github/workflows/gcloud.yml + - molecule/gcloud/** pull_request: paths: - - 'roles/gcloud/**' - - '.github/workflows/gcloud.yml' - - 'molecule/gcloud/**' + - roles/gcloud/** + - .github/workflows/gcloud.yml + - molecule/gcloud/** jobs: molecule: runs-on: ubuntu-18.04 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index a58e6a3..0109925 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -1,4 +1,5 @@ -name: "google.cloud.gcsfuse" +--- +name: google.cloud.gcsfuse on: push: paths: diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 0318edf..42d663f 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -1,25 +1,25 @@ +--- name: Upload release to Galaxy on: release: types: [created] - jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.x + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d821948..6a71671 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ git clone $TARGET_DIR/ansible_collections/google/cloud Then set up your Python virtual environment: ```shell -cd $TARGET_DIR/ansible_collections/google +cd $TARGET_DIR/ansible_collections/google/cloud python3 -m venv venv . ./venv/bin/activate pip3 install -r requirements.txt diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index e8eb24c..d7f9cec 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -1,3 +1,4 @@ +--- objects: role: {} plugins: @@ -12,859 +13,859 @@ plugins: gcp_compute: description: Google Cloud Compute Engine inventory source name: gcp_compute - version_added: null + version_added: lookup: {} module: gcp_appengine_firewall_rule: description: Creates a GCP FirewallRule name: gcp_appengine_firewall_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_appengine_firewall_rule_info: description: Gather info for GCP FirewallRule name: gcp_appengine_firewall_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_dataset: description: Creates a GCP Dataset name: gcp_bigquery_dataset - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_dataset_info: description: Gather info for GCP Dataset name: gcp_bigquery_dataset_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_table: description: Creates a GCP Table name: gcp_bigquery_table - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigquery_table_info: description: Gather info for GCP Table name: gcp_bigquery_table_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigtable_instance: description: Creates a GCP Instance name: gcp_bigtable_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_bigtable_instance_info: description: Gather info for GCP Instance name: gcp_bigtable_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudbuild_trigger: description: Creates a GCP Trigger name: gcp_cloudbuild_trigger - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudbuild_trigger_info: description: Gather info for GCP Trigger name: gcp_cloudbuild_trigger_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudfunctions_cloud_function: description: Creates a GCP CloudFunction name: gcp_cloudfunctions_cloud_function - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudfunctions_cloud_function_info: description: Gather info for GCP CloudFunction name: gcp_cloudfunctions_cloud_function_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudscheduler_job: description: Creates a GCP Job name: gcp_cloudscheduler_job - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudscheduler_job_info: description: Gather info for GCP Job name: gcp_cloudscheduler_job_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudtasks_queue: description: Creates a GCP Queue name: gcp_cloudtasks_queue - namespace: '' - version_added: null + namespace: "" + version_added: gcp_cloudtasks_queue_info: description: Gather info for GCP Queue name: gcp_cloudtasks_queue_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_address: description: Creates a GCP Address name: gcp_compute_address - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_address_info: description: Gather info for GCP Address name: gcp_compute_address_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_autoscaler: description: Creates a GCP Autoscaler name: gcp_compute_autoscaler - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_autoscaler_info: description: Gather info for GCP Autoscaler name: gcp_compute_autoscaler_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_bucket: description: Creates a GCP BackendBucket name: gcp_compute_backend_bucket - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_bucket_info: description: Gather info for GCP BackendBucket name: gcp_compute_backend_bucket_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_service: description: Creates a GCP BackendService name: gcp_compute_backend_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_backend_service_info: description: Gather info for GCP BackendService name: gcp_compute_backend_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_disk: description: Creates a GCP Disk name: gcp_compute_disk - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_disk_info: description: Gather info for GCP Disk name: gcp_compute_disk_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_external_vpn_gateway: description: Creates a GCP ExternalVpnGateway name: gcp_compute_external_vpn_gateway - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_external_vpn_gateway_info: description: Gather info for GCP ExternalVpnGateway name: gcp_compute_external_vpn_gateway_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_firewall: description: Creates a GCP Firewall name: gcp_compute_firewall - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_firewall_info: description: Gather info for GCP Firewall name: gcp_compute_firewall_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_forwarding_rule: description: Creates a GCP ForwardingRule name: gcp_compute_forwarding_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_forwarding_rule_info: description: Gather info for GCP ForwardingRule name: gcp_compute_forwarding_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_address: description: Creates a GCP GlobalAddress name: gcp_compute_global_address - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_address_info: description: Gather info for GCP GlobalAddress name: gcp_compute_global_address_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_forwarding_rule: description: Creates a GCP GlobalForwardingRule name: gcp_compute_global_forwarding_rule - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_global_forwarding_rule_info: description: Gather info for GCP GlobalForwardingRule name: gcp_compute_global_forwarding_rule_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_health_check: description: Creates a GCP HealthCheck name: gcp_compute_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_health_check_info: description: Gather info for GCP HealthCheck name: gcp_compute_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_http_health_check: description: Creates a GCP HttpHealthCheck name: gcp_compute_http_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_http_health_check_info: description: Gather info for GCP HttpHealthCheck name: gcp_compute_http_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_https_health_check: description: Creates a GCP HttpsHealthCheck name: gcp_compute_https_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_https_health_check_info: description: Gather info for GCP HttpsHealthCheck name: gcp_compute_https_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_image: description: Creates a GCP Image name: gcp_compute_image - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_image_info: description: Gather info for GCP Image name: gcp_compute_image_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance: description: Creates a GCP Instance name: gcp_compute_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group: description: Creates a GCP InstanceGroup name: gcp_compute_instance_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_info: description: Gather info for GCP InstanceGroup name: gcp_compute_instance_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_manager: description: Creates a GCP InstanceGroupManager name: gcp_compute_instance_group_manager - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_group_manager_info: description: Gather info for GCP InstanceGroupManager name: gcp_compute_instance_group_manager_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_info: description: Gather info for GCP Instance name: gcp_compute_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_template: description: Creates a GCP InstanceTemplate name: gcp_compute_instance_template - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_instance_template_info: description: Gather info for GCP InstanceTemplate name: gcp_compute_instance_template_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_interconnect_attachment: description: Creates a GCP InterconnectAttachment name: gcp_compute_interconnect_attachment - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_interconnect_attachment_info: description: Gather info for GCP InterconnectAttachment name: gcp_compute_interconnect_attachment_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network: description: Creates a GCP Network name: gcp_compute_network - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_endpoint_group: description: Creates a GCP NetworkEndpointGroup name: gcp_compute_network_endpoint_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_endpoint_group_info: description: Gather info for GCP NetworkEndpointGroup name: gcp_compute_network_endpoint_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_network_info: description: Gather info for GCP Network name: gcp_compute_network_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_group: description: Creates a GCP NodeGroup name: gcp_compute_node_group - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_group_info: description: Gather info for GCP NodeGroup name: gcp_compute_node_group_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_template: description: Creates a GCP NodeTemplate name: gcp_compute_node_template - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_node_template_info: description: Gather info for GCP NodeTemplate name: gcp_compute_node_template_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_autoscaler: description: Creates a GCP RegionAutoscaler name: gcp_compute_region_autoscaler - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_autoscaler_info: description: Gather info for GCP RegionAutoscaler name: gcp_compute_region_autoscaler_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_backend_service: description: Creates a GCP RegionBackendService name: gcp_compute_region_backend_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_backend_service_info: description: Gather info for GCP RegionBackendService name: gcp_compute_region_backend_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_disk: description: Creates a GCP RegionDisk name: gcp_compute_region_disk - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_disk_info: description: Gather info for GCP RegionDisk name: gcp_compute_region_disk_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_health_check: description: Creates a GCP RegionHealthCheck name: gcp_compute_region_health_check - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_health_check_info: description: Gather info for GCP RegionHealthCheck name: gcp_compute_region_health_check_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_instance_group_manager: description: Creates a GCP RegionInstanceGroupManager name: gcp_compute_region_instance_group_manager - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_instance_group_manager_info: description: Gather info for GCP RegionInstanceGroupManager name: gcp_compute_region_instance_group_manager_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_http_proxy: description: Creates a GCP RegionTargetHttpProxy name: gcp_compute_region_target_http_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_http_proxy_info: description: Gather info for GCP RegionTargetHttpProxy name: gcp_compute_region_target_http_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_https_proxy: description: Creates a GCP RegionTargetHttpsProxy name: gcp_compute_region_target_https_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_target_https_proxy_info: description: Gather info for GCP RegionTargetHttpsProxy name: gcp_compute_region_target_https_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_url_map: description: Creates a GCP RegionUrlMap name: gcp_compute_region_url_map - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_region_url_map_info: description: Gather info for GCP RegionUrlMap name: gcp_compute_region_url_map_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_reservation: description: Creates a GCP Reservation name: gcp_compute_reservation - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_reservation_info: description: Gather info for GCP Reservation name: gcp_compute_reservation_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_resource_policy: description: Creates a GCP ResourcePolicy name: gcp_compute_resource_policy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_resource_policy_info: description: Gather info for GCP ResourcePolicy name: gcp_compute_resource_policy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_route: description: Creates a GCP Route name: gcp_compute_route - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_route_info: description: Gather info for GCP Route name: gcp_compute_route_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_router: description: Creates a GCP Router name: gcp_compute_router - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_router_info: description: Gather info for GCP Router name: gcp_compute_router_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_snapshot: description: Creates a GCP Snapshot name: gcp_compute_snapshot - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_snapshot_info: description: Gather info for GCP Snapshot name: gcp_compute_snapshot_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_certificate: description: Creates a GCP SslCertificate name: gcp_compute_ssl_certificate - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_certificate_info: description: Gather info for GCP SslCertificate name: gcp_compute_ssl_certificate_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_policy: description: Creates a GCP SslPolicy name: gcp_compute_ssl_policy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_ssl_policy_info: description: Gather info for GCP SslPolicy name: gcp_compute_ssl_policy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_subnetwork: description: Creates a GCP Subnetwork name: gcp_compute_subnetwork - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_subnetwork_info: description: Gather info for GCP Subnetwork name: gcp_compute_subnetwork_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_http_proxy: description: Creates a GCP TargetHttpProxy name: gcp_compute_target_http_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_http_proxy_info: description: Gather info for GCP TargetHttpProxy name: gcp_compute_target_http_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_https_proxy: description: Creates a GCP TargetHttpsProxy name: gcp_compute_target_https_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_https_proxy_info: description: Gather info for GCP TargetHttpsProxy name: gcp_compute_target_https_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_instance: description: Creates a GCP TargetInstance name: gcp_compute_target_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_instance_info: description: Gather info for GCP TargetInstance name: gcp_compute_target_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_pool: description: Creates a GCP TargetPool name: gcp_compute_target_pool - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_pool_info: description: Gather info for GCP TargetPool name: gcp_compute_target_pool_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_ssl_proxy: description: Creates a GCP TargetSslProxy name: gcp_compute_target_ssl_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_ssl_proxy_info: description: Gather info for GCP TargetSslProxy name: gcp_compute_target_ssl_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_tcp_proxy: description: Creates a GCP TargetTcpProxy name: gcp_compute_target_tcp_proxy - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_tcp_proxy_info: description: Gather info for GCP TargetTcpProxy name: gcp_compute_target_tcp_proxy_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_vpn_gateway: description: Creates a GCP TargetVpnGateway name: gcp_compute_target_vpn_gateway - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_target_vpn_gateway_info: description: Gather info for GCP TargetVpnGateway name: gcp_compute_target_vpn_gateway_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_url_map: description: Creates a GCP UrlMap name: gcp_compute_url_map - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_url_map_info: description: Gather info for GCP UrlMap name: gcp_compute_url_map_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_vpn_tunnel: description: Creates a GCP VpnTunnel name: gcp_compute_vpn_tunnel - namespace: '' - version_added: null + namespace: "" + version_added: gcp_compute_vpn_tunnel_info: description: Gather info for GCP VpnTunnel name: gcp_compute_vpn_tunnel_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_cluster: description: Creates a GCP Cluster name: gcp_container_cluster - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_cluster_info: description: Gather info for GCP Cluster name: gcp_container_cluster_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_node_pool: description: Creates a GCP NodePool name: gcp_container_node_pool - namespace: '' - version_added: null + namespace: "" + version_added: gcp_container_node_pool_info: description: Gather info for GCP NodePool name: gcp_container_node_pool_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_managed_zone: description: Creates a GCP ManagedZone name: gcp_dns_managed_zone - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_managed_zone_info: description: Gather info for GCP ManagedZone name: gcp_dns_managed_zone_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_resource_record_set: description: Creates a GCP ResourceRecordSet name: gcp_dns_resource_record_set - namespace: '' - version_added: null + namespace: "" + version_added: gcp_dns_resource_record_set_info: description: Gather info for GCP ResourceRecordSet name: gcp_dns_resource_record_set_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_filestore_instance: description: Creates a GCP Instance name: gcp_filestore_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_filestore_instance_info: description: Gather info for GCP Instance name: gcp_filestore_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_role: description: Creates a GCP Role name: gcp_iam_role - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_role_info: description: Gather info for GCP Role name: gcp_iam_role_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account: description: Creates a GCP ServiceAccount name: gcp_iam_service_account - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account_info: description: Gather info for GCP ServiceAccount name: gcp_iam_service_account_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_iam_service_account_key: description: Creates a GCP ServiceAccountKey name: gcp_iam_service_account_key - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_crypto_key: description: Creates a GCP CryptoKey name: gcp_kms_crypto_key - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_crypto_key_info: description: Gather info for GCP CryptoKey name: gcp_kms_crypto_key_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_key_ring: description: Creates a GCP KeyRing name: gcp_kms_key_ring - namespace: '' - version_added: null + namespace: "" + version_added: gcp_kms_key_ring_info: description: Gather info for GCP KeyRing name: gcp_kms_key_ring_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_logging_metric: description: Creates a GCP Metric name: gcp_logging_metric - namespace: '' - version_added: null + namespace: "" + version_added: gcp_logging_metric_info: description: Gather info for GCP Metric name: gcp_logging_metric_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_model: description: Creates a GCP Model name: gcp_mlengine_model - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_model_info: description: Gather info for GCP Model name: gcp_mlengine_model_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_version: description: Creates a GCP Version name: gcp_mlengine_version - namespace: '' - version_added: null + namespace: "" + version_added: gcp_mlengine_version_info: description: Gather info for GCP Version name: gcp_mlengine_version_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_subscription: description: Creates a GCP Subscription name: gcp_pubsub_subscription - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_subscription_info: description: Gather info for GCP Subscription name: gcp_pubsub_subscription_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_topic: description: Creates a GCP Topic name: gcp_pubsub_topic - namespace: '' - version_added: null + namespace: "" + version_added: gcp_pubsub_topic_info: description: Gather info for GCP Topic name: gcp_pubsub_topic_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_redis_instance: description: Creates a GCP Instance name: gcp_redis_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_redis_instance_info: description: Gather info for GCP Instance name: gcp_redis_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_resourcemanager_project: description: Creates a GCP Project name: gcp_resourcemanager_project - namespace: '' - version_added: null + namespace: "" + version_added: gcp_resourcemanager_project_info: description: Gather info for GCP Project name: gcp_resourcemanager_project_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_config: description: Creates a GCP Config name: gcp_runtimeconfig_config - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_config_info: description: Gather info for GCP Config name: gcp_runtimeconfig_config_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_variable: description: Creates a GCP Variable name: gcp_runtimeconfig_variable - namespace: '' - version_added: null + namespace: "" + version_added: gcp_runtimeconfig_variable_info: description: Gather info for GCP Variable name: gcp_runtimeconfig_variable_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_serviceusage_service: description: Creates a GCP Service name: gcp_serviceusage_service - namespace: '' - version_added: null + namespace: "" + version_added: gcp_serviceusage_service_info: description: Gather info for GCP Service name: gcp_serviceusage_service_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sourcerepo_repository: description: Creates a GCP Repository name: gcp_sourcerepo_repository - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sourcerepo_repository_info: description: Gather info for GCP Repository name: gcp_sourcerepo_repository_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_database: description: Creates a GCP Database name: gcp_spanner_database - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_database_info: description: Gather info for GCP Database name: gcp_spanner_database_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_instance: description: Creates a GCP Instance name: gcp_spanner_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_spanner_instance_info: description: Gather info for GCP Instance name: gcp_spanner_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_database: description: Creates a GCP Database name: gcp_sql_database - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_database_info: description: Gather info for GCP Database name: gcp_sql_database_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_instance: description: Creates a GCP Instance name: gcp_sql_instance - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_instance_info: description: Gather info for GCP Instance name: gcp_sql_instance_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_ssl_cert: description: Creates a GCP SslCert name: gcp_sql_ssl_cert - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_user: description: Creates a GCP User name: gcp_sql_user - namespace: '' - version_added: null + namespace: "" + version_added: gcp_sql_user_info: description: Gather info for GCP User name: gcp_sql_user_info - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_bucket: description: Creates a GCP Bucket name: gcp_storage_bucket - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_bucket_access_control: description: Creates a GCP BucketAccessControl name: gcp_storage_bucket_access_control - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_default_object_acl: description: Creates a GCP DefaultObjectACL name: gcp_storage_default_object_acl - namespace: '' - version_added: null + namespace: "" + version_added: gcp_storage_object: description: Creates a GCP Object name: gcp_storage_object - namespace: '' - version_added: null + namespace: "" + version_added: gcp_tpu_node: description: Creates a GCP Node name: gcp_tpu_node - namespace: '' - version_added: null + namespace: "" + version_added: gcp_tpu_node_info: description: Gather info for GCP Node name: gcp_tpu_node_info - namespace: '' - version_added: null + namespace: "" + version_added: netconf: {} shell: {} strategy: {} diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 09e7657..29c7c50 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1,57 +1,52 @@ -ancestor: null +--- +ancestor: releases: 1.1.0: changes: bugfixes: - - Disk has been fixed to send the sourceSnapshot parameter. - - gcp_cloudtasks_queue - was not functional before, and is now functional. - - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) - as the domain, no longer erroneously reporting changes after an execution. - - gcp_compute_backend_service - no longer erroneously reports changes after - an execution for ``capacity_scaler``. - - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot - use basic-auth. - - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as - absent. - - gcp_iam_role - update of a role is functional (GitHub - - gcp_spanner_database - recognize a non-existent resource as absent. - - gcp_storage_object - fix for correct version of dependency requirement. + - Disk has been fixed to send the sourceSnapshot parameter. + - gcp_cloudtasks_queue - was not functional before, and is now functional. + - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) as the domain, no longer erroneously reporting changes after an execution. + - gcp_compute_backend_service - no longer erroneously reports changes after an execution for ``capacity_scaler``. + - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth. + - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. + - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. + - gcp_iam_role - update of a role is functional (GitHub + - gcp_spanner_database - recognize a non-existent resource as absent. + - gcp_storage_object - fix for correct version of dependency requirement. minor_changes: - - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the - name parameter. + - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. fragments: - - 0001_disk.yml - - bugfixes.yaml - release_date: '2022-12-16' + - "0001_disk.yml" + - bugfixes.yaml + release_date: "2022-12-16" 1.1.1: changes: bugfixes: - - fix collection to work with Python 2.7 + - fix collection to work with Python 2.7 fragments: - - fix-2.7.yml - release_date: '2022-12-16' + - fix-2.7.yml + release_date: "2022-12-16" 1.1.2: changes: bugfixes: - - fix `gcp_compute` no longer being a valid name of the inventory plugin + - fix `gcp_compute` no longer being a valid name of the inventory plugin fragments: - - fix-inventory-plugin.yml - release_date: '2022-12-21' + - fix-inventory-plugin.yml + release_date: "2022-12-21" 1.1.3: changes: bugfixes: - - 'gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly - pointed to the gcloud filter logic rather than the API (fixes #549)' + - "gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly pointed to the gcloud filter logic rather than the API (fixes #549)" fragments: - - gce-changelog.yaml - release_date: '2023-03-04' + - gce-changelog.yaml + release_date: "2023-03-04" 1.2.0: changes: bugfixes: - - Use default service account if `service_account_email` is unset. + - Use default service account if `service_account_email` is unset. minor_changes: - - Add DataPlane V2 Support. - - Add auth support for GCP access tokens (#574). - - Add support for ip_allocation_policy->stack_type. - release_date: '2023-07-07' + - Add DataPlane V2 Support. + - Add auth support for GCP access tokens (#574). + - Add support for ip_allocation_policy->stack_type. + release_date: "2023-07-07" diff --git a/changelogs/config.yaml b/changelogs/config.yaml index 9f7513d..0b86869 100644 --- a/changelogs/config.yaml +++ b/changelogs/config.yaml @@ -1,3 +1,4 @@ +--- changelog_filename_template: ../CHANGELOG.rst changelog_filename_version_depth: 0 changes_file: changelog.yaml @@ -11,22 +12,22 @@ prelude_section_name: release_summary prelude_section_title: Release Summary sanitize_changelog: true sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues title: Google.Cloud trivial_section_name: trivial use_fqcn: true diff --git a/changelogs/fragments/app-default-creds.yml b/changelogs/fragments/app-default-creds.yml index 7a02ea2..cacdcc4 100644 --- a/changelogs/fragments/app-default-creds.yml +++ b/changelogs/fragments/app-default-creds.yml @@ -1,2 +1,3 @@ +--- minor_changes: - - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). \ No newline at end of file + - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). diff --git a/changelogs/fragments/gcp_serviceusage_service.yml b/changelogs/fragments/gcp_serviceusage_service.yml new file mode 100644 index 0000000..e373ec7 --- /dev/null +++ b/changelogs/fragments/gcp_serviceusage_service.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - gcp_serviceusage_service - added backoff when checking for operation completion. + - gcp_serviceusage_service - use alloyb API for the integration test as spanner conflicts with other tests diff --git a/changelogs/fragments/gcp_sql_ssl_cert.yml b/changelogs/fragments/gcp_sql_ssl_cert.yml new file mode 100644 index 0000000..7e5b0ed --- /dev/null +++ b/changelogs/fragments/gcp_sql_ssl_cert.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource creation diff --git a/changelogs/fragments/gcp_storage_default_object_acl.yml b/changelogs/fragments/gcp_storage_default_object_acl.yml new file mode 100644 index 0000000..6642204 --- /dev/null +++ b/changelogs/fragments/gcp_storage_default_object_acl.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - gcp_storage_default_object_acl - removed non-existent fields; the resource is not usable. diff --git a/changelogs/fragments/upgrade-versions.yml b/changelogs/fragments/upgrade-versions.yml new file mode 100644 index 0000000..1c850cf --- /dev/null +++ b/changelogs/fragments/upgrade-versions.yml @@ -0,0 +1,6 @@ +--- +minor_changes: + - ansible - 2.14.0 is now the minimum version supported + - anisble-test - integration tests are now run against 2.14.0 and 2.15.0 + - ansible-lint - upgraded to 6.22 + - ansible-lint - fixed over a thousand reported errors diff --git a/galaxy.yml b/galaxy.yml index b53950d..e6e50a4 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,3 +1,4 @@ +--- ### REQUIRED # The namespace of the collection. This can be a company/brand/organization or product namespace under which all @@ -9,7 +10,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: "1.2.0" +version: 1.2.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -17,9 +18,8 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Google -- Google - + - Google + - Google ### OPTIONAL but strongly recommended @@ -29,7 +29,7 @@ description: The Google Cloud Platform collection. # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- GPL-2.0-or-later + - GPL-2.0-or-later # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' @@ -38,11 +38,11 @@ license: # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' tags: - - cloud - - gcsfuse - - stackdriver - - logging - - monitoring + - cloud + - gcsfuse + - stackdriver + - logging + - monitoring # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range diff --git a/meta/runtime.yml b/meta/runtime.yml index 4ed2cf6..ef34670 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: '>=2.14.0' +requires_ansible: ">=2.14.0" action_groups: gcp: diff --git a/molecule/gcloud/converge.yml b/molecule/gcloud/converge.yml index 8694745..7382cae 100644 --- a/molecule/gcloud/converge.yml +++ b/molecule/gcloud/converge.yml @@ -14,13 +14,13 @@ ansible.builtin.file: path: /etc/systemd/system/containerd.service.d state: directory - mode: 0755 + mode: "0755" when: ansible_service_mgr == "systemd" - name: Override file for containerd ansible.builtin.copy: src: files/override.conf dest: /etc/systemd/system/containerd.service.d/override.conf - mode: 0644 + mode: "0644" when: ansible_service_mgr == "systemd" roles: - role: google.cloud.gcloud diff --git a/molecule/gcloud/molecule.yml b/molecule/gcloud/molecule.yml index 7b7ab54..0bb3e5d 100644 --- a/molecule/gcloud/molecule.yml +++ b/molecule/gcloud/molecule.yml @@ -11,13 +11,13 @@ platforms: - name: instance image: ubuntu:18.04 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance image: debian:9 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcloud/verify.yml b/molecule/gcloud/verify.yml index 86afba4..6e148b1 100644 --- a/molecule/gcloud/verify.yml +++ b/molecule/gcloud/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/molecule/gcsfuse/molecule.yml b/molecule/gcsfuse/molecule.yml index 7b7ab54..0bb3e5d 100644 --- a/molecule/gcsfuse/molecule.yml +++ b/molecule/gcsfuse/molecule.yml @@ -11,13 +11,13 @@ platforms: - name: instance image: ubuntu:18.04 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance image: debian:9 privileged: true - ansible.builtin.command: "/lib/systemd/systemd" + ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: diff --git a/molecule/gcsfuse/verify.yml b/molecule/gcsfuse/verify.yml index 86afba4..6e148b1 100644 --- a/molecule/gcsfuse/verify.yml +++ b/molecule/gcsfuse/verify.yml @@ -4,6 +4,6 @@ - name: Verify hosts: all tasks: - - name: Example assertion - ansible.builtin.assert: - that: true + - name: Example assertion + ansible.builtin.assert: + that: true diff --git a/plugins/modules/gcp_serviceusage_service.py b/plugins/modules/gcp_serviceusage_service.py index 49e803e..58e26c6 100644 --- a/plugins/modules/gcp_serviceusage_service.py +++ b/plugins/modules/gcp_serviceusage_service.py @@ -382,9 +382,13 @@ def wait_for_operation(module, response): def wait_for_completion(status, op_result, module): op_id = navigate_hash(op_result, ['name']) op_uri = async_op_url(module, {'op_id': op_id}) + sleep_time = 1.0 while not status: raise_if_errors(op_result, ['error'], module) - time.sleep(1.0) + time.sleep(sleep_time) + sleep_time *= 2 + if sleep_time > 10.0: + sleep_time = 10.0 op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['done']) return op_result diff --git a/plugins/modules/gcp_sql_ssl_cert.py b/plugins/modules/gcp_sql_ssl_cert.py index b08eede..ff4022b 100644 --- a/plugins/modules/gcp_sql_ssl_cert.py +++ b/plugins/modules/gcp_sql_ssl_cert.py @@ -88,7 +88,10 @@ options: sha1_fingerprint: description: - The SHA-1 of the certificate. - required: true + type: str + private_key: + description: + - The private key associated with the certificate. type: str project: description: @@ -198,6 +201,11 @@ sha1Fingerprint: - The SHA-1 of the certificate. returned: success type: str +privateKey: + description: + - The private key associated with the certificate. + returned: success + type: str ''' ################################################################################ @@ -225,7 +233,8 @@ def main(): create_time=dict(type='str'), expiration_time=dict(type='str'), instance=dict(required=True, type='dict'), - sha1_fingerprint=dict(required=True, type='str'), + sha1_fingerprint=dict(type='str'), + private_key=dict(type='str'), ) ) @@ -262,12 +271,11 @@ def main(): def create(module, link, kind): auth = GcpSession(module, 'sql') - return wait_for_operation(module, auth.post(link, resource_to_request(module))) + return wait_for_create_operation(module, auth.post(link, resource_to_request(module))) def update(module, link, kind): - auth = GcpSession(module, 'sql') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="SQL certificates cannot be modified") def delete(module, link, kind): @@ -298,7 +306,7 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')} + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'sha1_fingerprint': module.params['sha1_fingerprint']} return "https://sqladmin.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}".format(**res) @@ -367,6 +375,31 @@ def async_op_url(module, extra_data=None): return url.format(**combined) +# The create response includes the certificate, but it's not usable until +# the operation completes. The create response is also the only place the +# private key is available, so return the newly created resource directly. +def wait_for_create_operation(module, response): + op_result = return_if_object(module, response, 'sql#operation') + if op_result is None: + return {} + status = navigate_hash(op_result, ['operation', 'status']) + wait_done = wait_for_create_completion(status, op_result, module) + res = navigate_hash(op_result, ['clientCert', 'certInfo']) + res.update({'privateKey': navigate_hash(op_result, ['clientCert', 'certPrivateKey'])}) + return res + + +def wait_for_create_completion(status, op_result, module): + op_id = navigate_hash(op_result, ['operation', 'name']) + op_uri = async_op_url(module, {'op_id': op_id}) + while status != 'DONE': + raise_if_errors(op_result, ['error', 'errors'], module) + time.sleep(1.0) + op_result = fetch_resource(module, op_uri, 'sql#operation', False) + status = navigate_hash(op_result, ['status']) + return op_result + + def wait_for_operation(module, response): op_result = return_if_object(module, response, 'sql#operation') if op_result is None: diff --git a/plugins/modules/gcp_storage_default_object_acl.py b/plugins/modules/gcp_storage_default_object_acl.py index abcf2c9..5bfea2f 100644 --- a/plugins/modules/gcp_storage_default_object_acl.py +++ b/plugins/modules/gcp_storage_default_object_acl.py @@ -60,11 +60,6 @@ options: bucket: description: - The name of the bucket. - - 'This field represents a link to a Bucket resource in GCP. It can be specified - in two ways. First, you can place a dictionary with key ''name'' and value of - your resource''s name Alternatively, you can add `register: name-of-resource` - to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource - }}"' required: true type: dict entity: @@ -75,11 +70,6 @@ options: * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' required: true type: str - object: - description: - - The name of the object, if applied to an object. - required: false - type: str role: description: - The access permission for the entity. @@ -195,21 +185,6 @@ entityId: - The ID for the entity. returned: success type: str -generation: - description: - - The content generation of the object, if applied to an object. - returned: success - type: int -id: - description: - - The ID of the access-control entry. - returned: success - type: str -object: - description: - - The name of the object, if applied to an object. - returned: success - type: str projectTeam: description: - The project team associated with the entity. @@ -271,10 +246,7 @@ def main(): state = module.params['state'] kind = 'storage#objectAccessControl' - if module.params['id']: - fetch = fetch_resource(module, self_link(module), kind) - else: - fetch = {} + fetch = fetch_resource(module, self_link(module), kind) changed = False if fetch: @@ -393,9 +365,6 @@ def response_to_hash(module, response): u'email': response.get(u'email'), u'entity': response.get(u'entity'), u'entityId': response.get(u'entityId'), - u'generation': response.get(u'generation'), - u'id': response.get(u'id'), - u'object': response.get(u'object'), u'projectTeam': DefaultObjectACLProjectteam(response.get(u'projectTeam', {}), module).from_response(), u'role': response.get(u'role'), } diff --git a/roles/gcloud/tasks/archive/archive_install.yml b/roles/gcloud/tasks/archive/archive_install.yml index 8f6a52a..5f06230 100644 --- a/roles/gcloud/tasks/archive/archive_install.yml +++ b/roles/gcloud/tasks/archive/archive_install.yml @@ -2,20 +2,20 @@ - name: Gcloud | Archive | Ensure temp path exists ansible.builtin.file: path: "{{ gcloud_archive_path }}" - state: "directory" + state: directory mode: "0755" - name: Gcloud | Archive | Extract Cloud SDK archive ansible.builtin.unarchive: src: "{{ gcloud_archive_url }}" dest: "{{ gcloud_archive_path }}" - remote_src: yes + remote_src: true creates: "{{ gcloud_library_path }}" - name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: src: "{{ gcloud_library_path }}/bin/{{ item }}" - dest: "/usr/bin/{{ item }}" + dest: /usr/bin/{{ item }} state: link loop: - bq diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index d457c09..2772101 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -2,7 +2,7 @@ # task file to configure bash completion for gcloud - name: Gcloud | Archive | Debian | Ensure bash completion is installed ansible.builtin.apt: - name: "bash-completion" + name: bash-completion register: task_result until: task_result is success retries: 10 @@ -25,7 +25,7 @@ owner: root group: root state: directory - mode: 0755 + mode: "0755" - name: Gcloud | Archive | Link binaries to /usr/bin (like package install) ansible.builtin.file: diff --git a/roles/gcloud/tasks/archive/main.yml b/roles/gcloud/tasks/archive/main.yml index 989c89b..49eb872 100644 --- a/roles/gcloud/tasks/archive/main.yml +++ b/roles/gcloud/tasks/archive/main.yml @@ -7,7 +7,7 @@ - name: Gcloud | Archive | Get gcloud_status ansible.builtin.debug: - var: "gcloud_status" + var: gcloud_status - name: Gcloud | Archive | Set installed version if installation exists when: gcloud_status.stat.exists @@ -30,11 +30,10 @@ {{ gcloud_installed_version }} is already installed. - name: Gcloud | Archive | Start installation - when: gcloud_installed_version is undefined or - gcloud_version is version(gcloud_installed_version, '>') + when: gcloud_installed_version is undefined or gcloud_version is version(gcloud_installed_version, '>') ansible.builtin.include_tasks: archive_install.yml -- name: Gcloud | Debian | Install the google-cloud-sdk additional components # noqa 301 +- name: Gcloud | Debian | Install the google-cloud-sdk additional components # noqa no-changed-when ansible.builtin.command: gcloud components install {{ item }} register: gcloud_install_comp_status changed_when: "'All components are up to date.' not in gcloud_install_comp_status.stderr_lines" diff --git a/roles/gcloud/tasks/main.yml b/roles/gcloud/tasks/main.yml index bdbd347..c7b646d 100644 --- a/roles/gcloud/tasks/main.yml +++ b/roles/gcloud/tasks/main.yml @@ -1,15 +1,14 @@ --- - - name: Gcloud | Load Distro and OS specific variables ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: files: - - "os/{{ ansible_distribution | lower }}.yml" - - "os/{{ ansible_os_family | lower }}.yml" + - os/{{ ansible_distribution | lower }}.yml + - os/{{ ansible_os_family | lower }}.yml - main.yml paths: - - 'vars' + - vars - name: Gcloud | Install the google-cloud-sdk from {{ gcloud_install_type }} ansible.builtin.include_tasks: "{{ gcloud_install_type }}/main.yml" diff --git a/roles/gcloud/tasks/package/debian.yml b/roles/gcloud/tasks/package/debian.yml index 6b0bf70..726c79e 100644 --- a/roles/gcloud/tasks/package/debian.yml +++ b/roles/gcloud/tasks/package/debian.yml @@ -7,13 +7,13 @@ - name: Gcloud | Debian | Add the gcloud repository ansible.builtin.apt_repository: - repo: "deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main" + repo: deb {{ gcloud_apt_url }} {{ gcloud_apt_repo }} main state: present filename: google-cloud-sdk - name: Gcloud | Debian | Install the google-cloud-sdk package ansible.builtin.apt: - name: "google-cloud-sdk" + name: google-cloud-sdk update_cache: "yes" register: task_result until: task_result is success @@ -22,7 +22,7 @@ - name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.apt: - name: "google-cloud-sdk-{{ item }}" + name: google-cloud-sdk-{{ item }} update_cache: "yes" register: task_result until: task_result is success diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index 50cdac5..8917561 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -4,16 +4,16 @@ name: google-cloud-sdk description: Google Cloud SDK baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 - enabled: yes - gpgcheck: yes - repo_gpgcheck: yes + enabled: true + gpgcheck: true + repo_gpgcheck: true gpgkey: - https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - name: Gcloud | RHEL | Install the google-cloud-sdk package ansible.builtin.yum: - name: "google-cloud-sdk" + name: google-cloud-sdk update_cache: "yes" register: task_result until: task_result is success @@ -22,7 +22,7 @@ - name: Gcloud | Debian | Install the google-cloud-sdk additional components ansible.builtin.yum: - name: "google-cloud-sdk-{{ item }}" + name: google-cloud-sdk-{{ item }} update_cache: "yes" register: task_result until: task_result is success diff --git a/roles/gcp_http_lb/README.md b/roles/gcp_http_lb/README.md index 901de6e..89cbf69 100644 --- a/roles/gcp_http_lb/README.md +++ b/roles/gcp_http_lb/README.md @@ -14,8 +14,8 @@ Role Variables ``` gcp_http_lb_backend: the selflink for the backend that this load balancer will be supporting - gcp_project: the name of your gcp project - service_account_file: the path to your service account JSON file + gcp_http_lb_gcp_project: the name of your gcp project + gcp_http_lb_service_account_file: the path to your service account JSON file ``` Example Playbook diff --git a/roles/gcp_http_lb/defaults/main.yml b/roles/gcp_http_lb/defaults/main.yml index f705f01..11f0870 100644 --- a/roles/gcp_http_lb/defaults/main.yml +++ b/roles/gcp_http_lb/defaults/main.yml @@ -2,13 +2,13 @@ # defaults file for gcp-http-lb gcp_http_lb_state: present gcp_http_lb_cdn: true -gcp_http_lb_name_prefix: 'gcp' +gcp_http_lb_name_prefix: gcp # Name schemes for resources being created -gcp_http_lb_globaladdress: "{{gcp_lb_name_prefix}}-globaladdress" -gcp_http_lb_instancegroup: "{{gcp_lb_name_prefix}}-instancegroup" -gcp_http_lb_healthcheck: "{{gcp_lb_name_prefix}}-healthcheck" -gcp_http_lb_backendservice: "{{gcp_lb_name_prefix}}-backendservice" -gcp_http_lb_urlmap: "{{gcp_lb_name_prefix}}-urlmap" -gcp_http_lb_httpproxy: "{{gcp_lb_name_prefix}}-httpproxy" -gcp_http_lb_forwardingrule: "{{gcp_lb_name_prefix}}-forwardingrule" +gcp_http_lb_globaladdress: "{{ gcp_lb_name_prefix }}-globaladdress" +gcp_http_lb_instancegroup: "{{ gcp_lb_name_prefix }}-instancegroup" +gcp_http_lb_healthcheck: "{{ gcp_lb_name_prefix }}-healthcheck" +gcp_http_lb_backendservice: "{{ gcp_lb_name_prefix }}-backendservice" +gcp_http_lb_urlmap: "{{ gcp_lb_name_prefix }}-urlmap" +gcp_http_lb_httpproxy: "{{ gcp_lb_name_prefix }}-httpproxy" +gcp_http_lb_forwardingrule: "{{ gcp_lb_name_prefix }}-forwardingrule" diff --git a/roles/gcp_http_lb/meta/main.yml b/roles/gcp_http_lb/meta/main.yml index 9ee9104..98cccc5 100644 --- a/roles/gcp_http_lb/meta/main.yml +++ b/roles/gcp_http_lb/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: googlecloudplatform description: Create a HTTP Load Balancer on GCP @@ -16,7 +17,7 @@ galaxy_info: # - CC-BY license: GPLv3 - min_ansible_version: 2.7 + min_ansible_version: "2.7" # If this a Container Enabled role, provide the minimum Ansible Container version. # min_ansible_container_version: @@ -47,12 +48,12 @@ galaxy_info: # - 99.99 galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. +# List tags for your role here, one per line. A tag is a keyword that describes +# and categorizes the role. Users find roles by searching for tags. Be sure to +# remove the '[]' above, if you add tags to this list. +# +# NOTE: A tag is limited to a single word comprised of alphanumeric characters. +# Maximum 20 tags per role. dependencies: [] # List your role dependencies here, one per line. Be sure to remove the '[]' above, diff --git a/roles/gcp_http_lb/tasks/main.yml b/roles/gcp_http_lb/tasks/main.yml index 8ed8f4d..67826df 100644 --- a/roles/gcp_http_lb/tasks/main.yml +++ b/roles/gcp_http_lb/tasks/main.yml @@ -1,65 +1,65 @@ --- -- name: create a global address for the load balancer. - gcp_compute_global_address: - name: "{{ gcp_http_lb_globaladdress }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a global address for the load balancer. + google.cloud.gcp_compute_global_address: + name: "{{ gcp_http_lb_globaladdress }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: globaladdress -- name: create a http health check to verify lb working - gcp_compute_http_health_check: - name: "{{ gcp_http_lb_healthcheck }}" - healthy_threshold: 10 - port: 80 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a http health check to verify lb working + google.cloud.gcp_compute_http_health_check: + name: "{{ gcp_http_lb_healthcheck }}" + healthy_threshold: 10 + port: 80 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: "{{ gcp_http_lb_backendservice }}" - backends: +- name: Create a backend service + google.cloud.gcp_compute_backend_service: + name: "{{ gcp_http_lb_backendservice }}" + backends: - group: "{{ gcp_http_lb_backend.selfLink }}" - health_checks: + health_checks: - "{{ healthcheck.selfLink }}" - enable_cdn: "{{ gcp_http_lb_cdn }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" + enable_cdn: "{{ gcp_http_lb_cdn }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: backendservice -- name: create a url map - gcp_compute_url_map: - name: "{{ gcp_http_lb_urlmap }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a url map + google.cloud.gcp_compute_url_map: + name: "{{ gcp_http_lb_urlmap }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: urlmap -- name: create a target http proxy - gcp_compute_target_http_proxy: - name: "{{ gcp_http_lb_httpproxy }}" - url_map: "{{ urlmap }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a target http proxy + google.cloud.gcp_compute_target_http_proxy: + name: "{{ gcp_http_lb_httpproxy }}" + url_map: "{{ urlmap }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: httpproxy -- name: create a global forwarding rule - gcp_compute_global_forwarding_rule: - name: "{{ gcp_http_lb_forwardingrule }}" - ip_address: "{{ globaladdress.address }}" - load_balancing_scheme: "EXTERNAL" - ip_protocol: TCP - port_range: 80-80 - target: "{{ httpproxy.selfLink }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: "{{ gcp_http_lb_state }}" +- name: Create a global forwarding rule + google.cloud.gcp_compute_global_forwarding_rule: + name: "{{ gcp_http_lb_forwardingrule }}" + ip_address: "{{ globaladdress.address }}" + load_balancing_scheme: EXTERNAL + ip_protocol: TCP + port_range: 80-80 + target: "{{ httpproxy.selfLink }}" + project: "{{ gcp_http_lb_gcp_project }}" + auth_kind: "{{ gcp_http_lb_auth_kind }}" + service_account_file: "{{ gcp_http_lb_service_account_file }}" + state: "{{ gcp_http_lb_state }}" register: result diff --git a/roles/gcp_http_lb/tests/test.yml b/roles/gcp_http_lb/tests/test.yml index 341c7a4..6f659ef 100644 --- a/roles/gcp_http_lb/tests/test.yml +++ b/roles/gcp_http_lb/tests/test.yml @@ -1,5 +1,6 @@ --- -- hosts: localhost +- name: Test gcp_http_lb role + hosts: localhost remote_user: root roles: - gcp_http_lb diff --git a/roles/gcp_http_lb/vars/main.yml b/roles/gcp_http_lb/vars/main.yml index ca9443f..f78469c 100644 --- a/roles/gcp_http_lb/vars/main.yml +++ b/roles/gcp_http_lb/vars/main.yml @@ -1,12 +1,12 @@ --- # vars file for gcp-http-lb -vars: - # The backend this LB will be supporting. This will typically be a Instance Group: - # example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group - gcp_http_lb_backend: your-backend - # The name of your GCP project - gcp_project: your-project - # The kind of authentication you will use (serviceaccount is recommended) - auth_kind: serviceaccount - # The path to your service account file (if using the serviceaccount auth kind) - service_account_file: path-to-service-account-file + +# The backend this LB will be supporting. This will typically be a Instance Group: +# example: projects/sample-project/zones/us-central1-c/instanceGroups/sample-instance-group +gcp_http_lb_backend: your-backend +# The name of your GCP project +gcp_http_lb_gcp_project: your-project +# The kind of authentication you will use (serviceaccount is recommended) +gcp_http_lb_auth_kind: serviceaccount +# The path to your service account file (if using the serviceaccount auth kind) +gcp_http_lb_service_account_file: path-to-service-account-file diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index 941f3bd..ecd698f 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -1,7 +1,7 @@ --- - name: Gcsfuse | Ensure gpg is installed ansible.builtin.apt: - name: "gnupg" + name: gnupg register: task_result until: task_result is success retries: 10 @@ -20,7 +20,7 @@ - name: Gcsfuse | Install gcsfuse ansible.builtin.apt: - name: "gcsfuse" + name: gcsfuse update_cache: "yes" register: task_result until: task_result is success diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml index 63f4b0a..ba66644 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/defaults/main.yml @@ -1,2 +1,2 @@ --- -resource_name: "{{ resource_prefix }}" \ No newline at end of file +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml index af2774e..a38d9a7 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall rule +- name: Delete a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall rule +- name: Create a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -33,24 +33,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall_rule was created +- name: Verify that firewall_rule was created google.cloud.gcp_appengine_firewall_rule_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length >= 1 # ---------------------------------------------------------------------------- -- name: create a firewall rule that already exists +- name: Create a firewall rule that already exists google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a firewall rule +- name: Delete a firewall rule google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -75,26 +75,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall_rule was deleted +- name: Verify that firewall_rule was deleted google.cloud.gcp_appengine_firewall_rule_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: # there is a default firewall rule that cannot be # deleted, so the length should be 1. - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: delete a firewall rule that does not exist +- name: Delete a firewall rule that does not exist google.cloud.gcp_appengine_firewall_rule: priority: 1000 source_range: 10.0.0.0 @@ -104,7 +104,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_appengine_firewall_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml index 64d8e60..71484a3 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a dataset +- name: Create a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -33,24 +33,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that dataset was created +- name: Verify that dataset was created google.cloud.gcp_bigquery_dataset_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a dataset that already exists +- name: Create a dataset that already exists google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -75,24 +75,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that dataset was deleted +- name: Verify that dataset was deleted google.cloud.gcp_bigquery_dataset_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a dataset that does not exist +- name: Delete a dataset that does not exist google.cloud.gcp_bigquery_dataset: name: my_example_dataset dataset_reference: @@ -102,7 +102,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml b/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml +++ b/tests/integration/targets/gcp_bigquery_dataset/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml index c8b8409..1e42d65 100644 --- a/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a dataset +- name: Create a dataset google.cloud.gcp_bigquery_dataset: name: example_dataset dataset_reference: @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: dataset -- name: delete a table +- name: Delete a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -36,7 +36,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a table +- name: Create a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -49,25 +49,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that table was created +- name: Verify that table was created google.cloud.gcp_bigquery_table_info: - dataset: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a table that already exists +- name: Create a table that already exists google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -80,12 +80,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a table +- name: Delete a table google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -98,25 +98,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that table was deleted +- name: Verify that table was deleted google.cloud.gcp_bigquery_table_info: - dataset: example_dataset - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/bigquery + dataset: example_dataset + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/bigquery register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a table that does not exist +- name: Delete a table that does not exist google.cloud.gcp_bigquery_table: name: example_table dataset: example_dataset @@ -129,14 +129,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a dataset +- name: Delete a dataset google.cloud.gcp_bigquery_dataset: name: example_dataset dataset_reference: diff --git a/tests/integration/targets/gcp_bigquery_table/tasks/main.yml b/tests/integration/targets/gcp_bigquery_table/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_bigquery_table/tasks/main.yml +++ b/tests/integration/targets/gcp_bigquery_table/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml index e5cf02b..7406950 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/autogen.yml @@ -13,107 +13,107 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_bigtable_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*my-instance.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_bigtable_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*my-instance.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_bigtable_instance: name: my-instance display_name: My Test Cluster clusters: - - name: mycluster - location: projects/{{ gcp_project }}/locations/us-central1-a - serve_nodes: 1 + - name: mycluster + location: projects/{{ gcp_project }}/locations/us-central1-a + serve_nodes: 1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml b/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_bigtable_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml b/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml index aa87a2a..aa65c31 100644 --- a/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml +++ b/tests/integration/targets/gcp_cloudbuild_trigger/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml index e803c4c..da43b21 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/autogen.yml @@ -13,57 +13,57 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a cloud function +- name: Delete a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" - runtime: "python310" + runtime: python310 auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a cloud function +- name: Create a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" - runtime: "python310" + runtime: python310 auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cloud_function was created +- name: Verify that cloud_function was created google.cloud.gcp_cloudfunctions_cloud_function_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a cloud function that already exists +- name: Create a cloud function that already exists google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" # runtime is not sent as it is optional for @@ -72,54 +72,54 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a cloud function +- name: Delete a cloud function google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cloud_function was deleted +- name: Verify that cloud_function was deleted google.cloud.gcp_cloudfunctions_cloud_function_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a cloud function that does not exist +- name: Delete a cloud function that does not exist google.cloud.gcp_cloudfunctions_cloud_function: name: "{{ resource_name }}" location: us-central1 entry_point: helloGET source_archive_url: gs://{{ gcp_project }}-ansible-testing/cloud-function.zip - trigger_http: 'true' + trigger_http: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudfunctions_cloud_function/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml index 078bd2b..917e323 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudscheduler_job/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a job +- name: Delete a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -27,13 +27,13 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a job +- name: Create a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -47,31 +47,31 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that job was created +- name: Verify that job was created google.cloud.gcp_cloudscheduler_job_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*job.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a job that already exists +- name: Create a job that already exists google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -85,18 +85,18 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a job +- name: Delete a job google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -110,31 +110,31 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that job was deleted +- name: Verify that job was deleted google.cloud.gcp_cloudscheduler_job_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*job.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a job that does not exist +- name: Delete a job that does not exist google.cloud.gcp_cloudscheduler_job: name: job region: us-central1 @@ -148,13 +148,13 @@ service: web version: prod instance: my-instance-001 - relative_uri: "/ping" + relative_uri: /ping project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml b/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudscheduler_job/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml index 2fa585c..6e1f70f 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml +++ b/tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a queue +- name: Delete a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a queue +- name: Create a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -31,25 +31,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that queue was created +- name: Verify that queue was created google.cloud.gcp_cloudtasks_queue_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a queue that already exists +- name: Create a queue that already exists google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -58,12 +58,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a queue +- name: Delete a queue google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -72,25 +72,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that queue was deleted +- name: Verify that queue was deleted google.cloud.gcp_cloudtasks_queue_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a queue that does not exist +- name: Delete a queue that does not exist google.cloud.gcp_cloudtasks_queue: name: "{{ resource_name }}" location: us-central1 @@ -99,7 +99,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml b/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml +++ b/tests/integration/targets/gcp_cloudtasks_queue/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml index 5fdd5d5..b4e9634 100644 --- a/tests/integration/targets/gcp_compute_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_address/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -31,27 +31,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that address was created +- name: Verify that address was created google.cloud.gcp_compute_address_info: - filters: - - name = test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a address that already exists +- name: Create a address that already exists google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -74,27 +74,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that address was deleted +- name: Verify that address was deleted google.cloud.gcp_compute_address_info: - filters: - - name = test-address1 - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = test-address1 + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a address that does not exist +- name: Delete a address that does not exist google.cloud.gcp_compute_address: name: test-address1 region: us-west1 @@ -103,7 +103,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_address/tasks/main.yml b/tests/integration/targets/gcp_compute_address/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_address/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_address/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml index 79b05de..4e1ad76 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: create a instance group manager +- name: Create a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igm -- name: delete a autoscaler +- name: Delete a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -74,13 +74,13 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a autoscaler +- name: Create a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -90,33 +90,33 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that autoscaler was created +- name: Verify that autoscaler was created google.cloud.gcp_compute_autoscaler_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a autoscaler that already exists +- name: Create a autoscaler that already exists google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -126,18 +126,18 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a autoscaler +- name: Delete a autoscaler google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -147,33 +147,33 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that autoscaler was deleted +- name: Verify that autoscaler was deleted google.cloud.gcp_compute_autoscaler_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a autoscaler that does not exist +- name: Delete a autoscaler that does not exist google.cloud.gcp_compute_autoscaler: name: "{{ resource_name }}" zone: us-central1-a @@ -183,20 +183,20 @@ min_num_replicas: 1 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 + utilization_target: !!float "0.5" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -209,29 +209,29 @@ state: absent register: igm ignore_errors: true -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -241,7 +241,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml b/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_autoscaler/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml index 018a749..c54b022 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_bucket/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: bucket-backendbucket project: "{{ gcp_project }}" @@ -21,112 +21,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a backend bucket +- name: Delete a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a backend bucket +- name: Create a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_bucket was created +- name: Verify that backend_bucket was created google.cloud.gcp_compute_backend_bucket_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a backend bucket that already exists +- name: Create a backend bucket that already exists google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a backend bucket +- name: Delete a backend bucket google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_bucket was deleted +- name: Verify that backend_bucket was deleted google.cloud.gcp_compute_backend_bucket_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a backend bucket that does not exist +- name: Delete a backend bucket that does not exist google.cloud.gcp_compute_backend_bucket: name: "{{ resource_name }}" bucket_name: "{{ bucket.name }}" description: A BackendBucket to connect LNB w/ Storage Bucket - enable_cdn: 'true' + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: bucket-backendbucket project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml b/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_backend_bucket/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml index 38de23f..011a5d4 100644 --- a/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_backend_service/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-backendservice zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-backendservice healthy_threshold: 10 @@ -34,122 +34,122 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_service was created +- name: Verify that backend_service was created google.cloud.gcp_compute_backend_service_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a backend service that already exists +- name: Create a backend service that already exists google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that backend_service was deleted +- name: Verify that backend_service was deleted google.cloud.gcp_compute_backend_service_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a backend service that does not exist +- name: Delete a backend service that does not exist google.cloud.gcp_compute_backend_service: name: "{{ resource_name }}" backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-backendservice healthy_threshold: 10 @@ -162,7 +162,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-backendservice zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml b/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_backend_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml index 79ef475..9637972 100644 --- a/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_disk/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -37,27 +37,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that disk was created +- name: Verify that disk was created google.cloud.gcp_compute_disk_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a disk that already exists +- name: Create a disk that already exists google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -69,12 +69,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -86,27 +86,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that disk was deleted +- name: Verify that disk was deleted google.cloud.gcp_compute_disk_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a disk that does not exist +- name: Delete a disk that does not exist google.cloud.gcp_compute_disk: name: "{{ resource_name }}" size_gb: 50 @@ -118,7 +118,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_disk/tasks/main.yml b/tests/integration/targets/gcp_compute_disk/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_disk/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_disk/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml index 91c87db..f6fd6da 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/autogen.yml @@ -13,115 +13,115 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a external vpn gateway +- name: Delete a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externaly managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a external vpn gateway +- name: Create a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that external_vpn_gateway was created +- name: Verify that external_vpn_gateway was created google.cloud.gcp_compute_external_vpn_gateway_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a external vpn gateway that already exists +- name: Create a external vpn gateway that already exists google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a external vpn gateway +- name: Delete a external vpn gateway google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that external_vpn_gateway was deleted +- name: Verify that external_vpn_gateway was deleted google.cloud.gcp_compute_external_vpn_gateway_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a external vpn gateway that does not exist +- name: Delete a external vpn gateway that does not exist google.cloud.gcp_compute_external_vpn_gateway: name: "{{ resource_name }}" redundancy_type: SINGLE_IP_INTERNALLY_REDUNDANT description: An externalyl managed VPN gateway interfaces: - - id: 0 - ip_address: 8.8.8.8 + - id: 0 + ip_address: 8.8.8.8 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_external_vpn_gateway/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml index 04393db..bf51839 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml @@ -13,135 +13,135 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall +- name: Create a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was created +- name: Verify that firewall was created google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a firewall that already exists +- name: Create a firewall that already exists google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was deleted +- name: Verify that firewall was deleted google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a firewall that does not exist +- name: Delete a firewall that does not exist google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/main.yml b/tests/integration/targets/gcp_compute_firewall/tasks/main.yml index 3cfb1cb..b266773 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/main.yml @@ -1,3 +1,5 @@ --- -- include_tasks: update.yml -- include_tasks: autogen.yml +- name: Update test + ansible.builtin.include_tasks: update.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml index 0eda283..3a2f73a 100644 --- a/tests/integration/targets/gcp_compute_firewall/tasks/update.yml +++ b/tests/integration/targets/gcp_compute_firewall/tasks/update.yml @@ -26,154 +26,154 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a firewall +- name: Create a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was created +- name: Verify that firewall was created google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: update the firewall +- name: Update the firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '55' + - ip_protocol: tcp + ports: + - "55" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: check firewall was updated. +- name: Check firewall was updated. google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 -- name: verify that update succeeded - assert: +- name: Verify that update succeeded + ansible.builtin.assert: that: - results['resources'][0]['allowed'][0]['ports'][0] == '55' #---------------------------------------------------------- -- name: delete a firewall +- name: Delete a firewall google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that firewall was deleted +- name: Verify that firewall was deleted google.cloud.gcp_compute_firewall_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a firewall that does not exist +- name: Delete a firewall that does not exist google.cloud.gcp_compute_firewall: name: "{{ resource_name }}" allowed: - - ip_protocol: tcp - ports: - - '22' + - ip_protocol: tcp + ports: + - "22" target_tags: - - test-ssh-server - - staging-ssh-server + - test-ssh-server + - staging-ssh-server source_tags: - - test-ssh-clients + - test-ssh-clients project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml index ebde3dd..c26206f 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a target pool +- name: Create a target pool google.cloud.gcp_compute_target_pool: name: targetpool-forwardingrule region: us-west1 @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: targetpool -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -44,7 +44,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a forwarding rule +- name: Create a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -57,27 +57,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that forwarding_rule was created +- name: Verify that forwarding_rule was created google.cloud.gcp_compute_forwarding_rule_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a forwarding rule that already exists +- name: Create a forwarding rule that already exists google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -90,12 +90,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -108,27 +108,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that forwarding_rule was deleted +- name: Verify that forwarding_rule was deleted google.cloud.gcp_compute_forwarding_rule_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a forwarding rule that does not exist +- name: Delete a forwarding rule that does not exist google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-west1 @@ -141,14 +141,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: targetpool-forwardingrule region: us-west1 @@ -158,7 +158,7 @@ state: absent register: targetpool ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-west1 diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_forwarding_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml index 4276aa6..3333e3f 100644 --- a/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_address/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a global address +- name: Create a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,26 +29,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_address was created +- name: Verify that global_address was created google.cloud.gcp_compute_global_address_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a global address that already exists +- name: Create a global address that already exists google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -56,12 +56,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -69,26 +69,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_address was deleted +- name: Verify that global_address was deleted google.cloud.gcp_compute_global_address_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a global address that does not exist +- name: Delete a global address that does not exist google.cloud.gcp_compute_global_address: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -96,7 +96,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_global_address/tasks/main.yml b/tests/integration/targets/gcp_compute_global_address/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_global_address/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_global_address/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml index d6df59d..93bab3a 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a global address +- name: Create a global address google.cloud.gcp_compute_global_address: name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: globaladdress -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-globalforwardingrule zone: us-central1-a @@ -30,7 +30,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-globalforwardingrule healthy_threshold: 10 @@ -42,20 +42,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-globalforwardingrule backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-globalforwardingrule default_service: "{{ backendservice }}" @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a target HTTP proxy +- name: Create a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: targethttpproxy-globalforwardingrule url_map: "{{ urlmap }}" @@ -73,7 +73,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: httpproxy -- name: delete a global forwarding rule +- name: Delete a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -85,7 +85,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a global forwarding rule +- name: Create a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -97,26 +97,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_forwarding_rule was created +- name: Verify that global_forwarding_rule was created google.cloud.gcp_compute_global_forwarding_rule_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a global forwarding rule that already exists +- name: Create a global forwarding rule that already exists google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -128,12 +128,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a global forwarding rule +- name: Delete a global forwarding rule google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -145,26 +145,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that global_forwarding_rule was deleted +- name: Verify that global_forwarding_rule was deleted google.cloud.gcp_compute_global_forwarding_rule_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a global forwarding rule that does not exist +- name: Delete a global forwarding rule that does not exist google.cloud.gcp_compute_global_forwarding_rule: name: "{{ resource_name }}" ip_address: "{{ globaladdress.address }}" @@ -176,14 +176,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: targethttpproxy-globalforwardingrule url_map: "{{ urlmap }}" @@ -193,7 +193,7 @@ state: absent register: httpproxy ignore_errors: true -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-globalforwardingrule default_service: "{{ backendservice }}" @@ -203,21 +203,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-globalforwardingrule backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-globalforwardingrule healthy_threshold: 10 @@ -230,7 +230,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-globalforwardingrule zone: us-central1-a @@ -240,7 +240,7 @@ state: absent register: instancegroup ignore_errors: true -- name: delete a global address +- name: Delete a global address google.cloud.gcp_compute_global_address: name: globaladdress-globalforwardingrule project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml index b4bc374..d529ec6 100644 --- a/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -29,7 +29,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -45,26 +45,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that health_check was created +- name: Verify that health_check was created google.cloud.gcp_compute_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a health check that already exists +- name: Create a health check that already exists google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -80,12 +80,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -101,26 +101,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that health_check was deleted +- name: Verify that health_check was deleted google.cloud.gcp_compute_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a health check that does not exist +- name: Delete a health check that does not exist google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -136,7 +136,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_health_check/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml index 5f25a06..1ff3b89 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_http_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -37,26 +37,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that http_health_check was created +- name: Verify that http_health_check was created google.cloud.gcp_compute_http_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a HTTP health check that already exists +- name: Create a HTTP health check that already exists google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -85,26 +85,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that http_health_check was deleted +- name: Verify that http_health_check was deleted google.cloud.gcp_compute_http_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a HTTP health check that does not exist +- name: Delete a HTTP health check that does not exist google.cloud.gcp_compute_http_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -116,7 +116,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_http_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml index ebb89d6..c79968c 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_https_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a HTTPS health check +- name: Delete a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -25,7 +25,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a HTTPS health check +- name: Create a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -37,26 +37,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that https_health_check was created +- name: Verify that https_health_check was created google.cloud.gcp_compute_https_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a HTTPS health check that already exists +- name: Create a HTTPS health check that already exists google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a HTTPS health check +- name: Delete a HTTPS health check google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -85,26 +85,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that https_health_check was deleted +- name: Verify that https_health_check was deleted google.cloud.gcp_compute_https_health_check_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a HTTPS health check that does not exist +- name: Delete a HTTPS health check that does not exist google.cloud.gcp_compute_https_health_check: name: "{{ resource_name }}" healthy_threshold: 10 @@ -116,7 +116,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_https_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml index 89c5fef..e44f010 100644 --- a/tests/integration/targets/gcp_compute_image/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_image/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: disk-image zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: delete a image +- name: Delete a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a image +- name: Create a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -40,26 +40,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that image was created +- name: Verify that image was created google.cloud.gcp_compute_image_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a image that already exists +- name: Create a image that already exists google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a image +- name: Delete a image google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -82,26 +82,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that image was deleted +- name: Verify that image was deleted google.cloud.gcp_compute_image_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a image that does not exist +- name: Delete a image that does not exist google.cloud.gcp_compute_image: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -110,14 +110,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: disk-image zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_image/tasks/main.yml b/tests/integration/targets/gcp_compute_image/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_image/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_image/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml index 02d95cc..fbec1e1 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -24,7 +24,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_prefix }}" project: "{{ gcp_project }}" @@ -33,7 +33,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instance region: us-central1 @@ -42,204 +42,204 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_compute_instance_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_compute_instance_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instance region: us-central1 @@ -249,7 +249,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_prefix }}" project: "{{ gcp_project }}" @@ -259,7 +259,7 @@ state: absent register: network ignore_errors: true -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 diff --git a/tests/integration/targets/gcp_compute_instance/tasks/main.yml b/tests/integration/targets/gcp_compute_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml index c13b4a5..340c8ca 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancegroup project: "{{ gcp_project }}" @@ -22,12 +22,12 @@ auto_create_subnetworks: true state: present register: network -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -35,12 +35,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -48,32 +48,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group was created +- name: Verify that instance_group was created google.cloud.gcp_compute_instance_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance group that already exists +- name: Create a instance group that already exists google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -81,17 +81,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -99,32 +99,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group was deleted +- name: Verify that instance_group was deleted google.cloud.gcp_compute_instance_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance group that does not exist +- name: Delete a instance group that does not exist google.cloud.gcp_compute_instance_group: name: "{{ resource_name }}" named_ports: - - name: ansible - port: 1234 + - name: ansible + port: 1234 network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" @@ -132,14 +132,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancegroup project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml index be3c227..a60441e 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance group manager +- name: Create a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -76,27 +76,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group_manager was created +- name: Verify that instance_group_manager was created google.cloud.gcp_compute_instance_group_manager_info: - filters: - - name = {{ resource_name }} - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance group manager that already exists +- name: Create a instance group manager that already exists google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -108,12 +108,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance group manager +- name: Delete a instance group manager google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -125,27 +125,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_group_manager was deleted +- name: Verify that instance_group_manager was deleted google.cloud.gcp_compute_instance_group_manager_info: - filters: - - name = {{ resource_name }} - zone: us-west1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-west1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance group manager that does not exist +- name: Delete a instance group manager that does not exist google.cloud.gcp_compute_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -157,36 +157,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_group_manager/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml index 6cb8d64..72fb809 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -31,162 +31,162 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_template was created +- name: Verify that instance_template was created google.cloud.gcp_compute_instance_template_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance template that already exists +- name: Create a instance template that already exists google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance_template was deleted +- name: Verify that instance_template was deleted google.cloud.gcp_compute_instance_template_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance template that does not exist +- name: Delete a instance template that does not exist google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-west1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml b/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_instance_template/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml b/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml index aa87a2a..aa65c31 100644 --- a/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml +++ b/tests/integration/targets/gcp_compute_interconnect_attachment/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml b/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml index aa87a2a..aa65c31 100644 --- a/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml +++ b/tests/integration/targets/gcp_compute_managed_ssl_certificate/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml index 9219386..b887e2b 100644 --- a/tests/integration/targets/gcp_compute_network/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network/tasks/autogen.yml @@ -13,95 +13,95 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network was created +- name: Verify that network was created google.cloud.gcp_compute_network_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a network that already exists +- name: Create a network that already exists google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network was deleted +- name: Verify that network was deleted google.cloud.gcp_compute_network_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a network that does not exist +- name: Delete a network that does not exist google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_network/tasks/main.yml b/tests/integration/targets/gcp_compute_network/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_network/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_network/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml index a613f09..81f46d2 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/autogen.yml @@ -13,16 +13,16 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'false' + auto_create_subnetworks: "false" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network -- name: create a subnetwork +- name: Create a subnetwork google.cloud.gcp_compute_subnetwork: name: "{{ resource_name }}" ip_cidr_range: 10.0.0.0/16 @@ -33,7 +33,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: subnetwork -- name: delete a network endpoint group +- name: Delete a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -45,7 +45,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a network endpoint group +- name: Create a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -57,27 +57,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network_endpoint_group was created +- name: Verify that network_endpoint_group was created google.cloud.gcp_compute_network_endpoint_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a network endpoint group that already exists +- name: Create a network endpoint group that already exists google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -89,12 +89,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a network endpoint group +- name: Delete a network endpoint group google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that network_endpoint_group was deleted +- name: Verify that network_endpoint_group was deleted google.cloud.gcp_compute_network_endpoint_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a network endpoint group that does not exist +- name: Delete a network endpoint group that does not exist google.cloud.gcp_compute_network_endpoint_group: name: "{{ resource_name }}" network: "{{ network }}" @@ -138,14 +138,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: "{{ resource_name }}" ip_cidr_range: 10.0.0.0/16 @@ -157,10 +157,10 @@ state: absent register: subnetwork ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: "{{ resource_name }}" - auto_create_subnetworks: 'false' + auto_create_subnetworks: "false" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_network_endpoint_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml index 4b55d97..25d46af 100644 --- a/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_group/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a node template +- name: Create a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: node_template -- name: delete a node group +- name: Delete a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node group +- name: Create a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -47,27 +47,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_group was created +- name: Verify that node_group was created google.cloud.gcp_compute_node_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a node group that already exists +- name: Create a node group that already exists google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -79,12 +79,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node group +- name: Delete a node group google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -96,27 +96,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_group was deleted +- name: Verify that node_group was deleted google.cloud.gcp_compute_node_group_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node group that does not exist +- name: Delete a node group that does not exist google.cloud.gcp_compute_node_group: name: "{{ resource_name }}" zone: us-central1-a @@ -128,14 +128,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 diff --git a/tests/integration/targets/gcp_compute_node_group/tasks/main.yml b/tests/integration/targets/gcp_compute_node_group/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_node_group/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_node_group/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml index 8297027..f21ce63 100644 --- a/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_node_template/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node template +- name: Create a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -33,27 +33,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_template was created +- name: Verify that node_template was created google.cloud.gcp_compute_node_template_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a node template that already exists +- name: Create a node template that already exists google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -63,12 +63,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node template +- name: Delete a node template google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -78,27 +78,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_template was deleted +- name: Verify that node_template was deleted google.cloud.gcp_compute_node_template_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node template that does not exist +- name: Delete a node template that does not exist google.cloud.gcp_compute_node_template: name: "{{ resource_name }}" region: us-central1 @@ -108,7 +108,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_node_template/tasks/main.yml b/tests/integration/targets/gcp_compute_node_template/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_node_template/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_node_template/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml index 933c110..5a986a9 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: create a region instance group manager +- name: Create a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: igrm -- name: delete a region autoscaler +- name: Delete a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -73,14 +73,14 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region autoscaler +- name: Create a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -89,34 +89,34 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_autoscaler was created +- name: Verify that region_autoscaler was created google.cloud.gcp_compute_region_autoscaler_info: - filters: - - name = my-region-autoscaler - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = my-region-autoscaler + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region autoscaler that already exists +- name: Create a region autoscaler that already exists google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -125,19 +125,19 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region autoscaler +- name: Delete a region autoscaler google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -146,34 +146,34 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_autoscaler was deleted +- name: Verify that region_autoscaler was deleted google.cloud.gcp_compute_region_autoscaler_info: - filters: - - name = my-region-autoscaler - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = my-region-autoscaler + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region autoscaler that does not exist +- name: Delete a region autoscaler that does not exist google.cloud.gcp_compute_region_autoscaler: name: my-region-autoscaler region: us-central1 @@ -182,21 +182,21 @@ max_num_replicas: 5 cool_down_period_sec: 60 cpu_utilization: - utilization_target: 0.5 - target: "{{igrm.selfLink}}" + utilization_target: !!float "0.5" + target: "{{ igrm.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -209,29 +209,29 @@ state: absent register: igrm ignore_errors: true -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -241,7 +241,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_autoscaler/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml index cd3e21e..beb644a 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_backend_service/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP @@ -26,12 +26,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -40,12 +40,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -54,32 +54,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_backend_service was created +- name: Verify that region_backend_service was created google.cloud.gcp_compute_region_backend_service_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region backend service that already exists +- name: Create a region backend service that already exists google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -88,17 +88,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -107,32 +107,32 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_backend_service was deleted +- name: Verify that region_backend_service was deleted google.cloud.gcp_compute_region_backend_service_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region backend service that does not exist +- name: Delete a region backend service that does not exist google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" connection_draining: draining_timeout_sec: 10 session_affinity: CLIENT_IP @@ -141,14 +141,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: "{{ resource_name }}" type: TCP diff --git a/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml b/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_backend_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml index 8e30419..1b04a50 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a region disk +- name: Delete a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -21,14 +21,14 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region disk +- name: Create a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -36,34 +36,34 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_disk was created +- name: Verify that region_disk was created google.cloud.gcp_compute_region_disk_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region disk that already exists +- name: Create a region disk that already exists google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -71,19 +71,19 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region disk +- name: Delete a region disk google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -91,34 +91,34 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_disk was deleted +- name: Verify that region_disk was deleted google.cloud.gcp_compute_region_disk_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region disk that does not exist +- name: Delete a region disk that does not exist google.cloud.gcp_compute_region_disk: name: "{{ resource_name }}" size_gb: 500 @@ -126,14 +126,14 @@ raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= region: us-central1 replica_zones: - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a - - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-a + - https://www.googleapis.com/compute/v1/projects/{{ gcp_project }}/zones/us-central1-b project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml b/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_disk/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml index 268eda1..badcfb8 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_health_check/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -30,7 +30,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region health check +- name: Create a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -47,27 +47,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_health_check was created +- name: Verify that region_health_check was created google.cloud.gcp_compute_region_health_check_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region health check that already exists +- name: Create a region health check that already exists google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -84,12 +84,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_health_check was deleted +- name: Verify that region_health_check was deleted google.cloud.gcp_compute_region_health_check_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region health check that does not exist +- name: Delete a region health check that does not exist google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: TCP @@ -143,7 +143,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml b/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_health_check/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml index 1a8b07a..e606464 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -31,28 +31,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a instance template +- name: Create a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancetemplate -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -64,7 +64,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region instance group manager +- name: Create a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -76,27 +76,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_instance_group_manager was created +- name: Verify that region_instance_group_manager was created google.cloud.gcp_compute_region_instance_group_manager_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region instance group manager that already exists +- name: Create a region instance group manager that already exists google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -108,12 +108,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region instance group manager +- name: Delete a region instance group manager google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -125,27 +125,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_instance_group_manager was deleted +- name: Verify that region_instance_group_manager was deleted google.cloud.gcp_compute_region_instance_group_manager_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region instance group manager that does not exist +- name: Delete a region instance group manager that does not exist google.cloud.gcp_compute_region_instance_group_manager: name: "{{ resource_name }}" base_instance_name: test1-child @@ -157,36 +157,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance template +- name: Delete a instance template google.cloud.gcp_compute_instance_template: name: "{{ resource_name }}" properties: disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts machine_type: n1-standard-1 network_interfaces: - - network: "{{ network }}" - access_configs: - - name: test-config - type: ONE_TO_ONE_NAT - nat_ip: "{{ address }}" + - network: "{{ network }}" + access_configs: + - name: test-config + type: ONE_TO_ONE_NAT + nat_ip: "{{ address }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instancetemplate ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-instancetemplate region: us-central1 @@ -196,7 +196,7 @@ state: absent register: address ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instancetemplate project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_instance_group_manager/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml index 88ff1e4..9c1da53 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml @@ -13,19 +13,19 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy region: us-central1 - enable_cdn: 'true' + enable_cdn: "true" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy region: us-central1 @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: delete a region target HTTP proxy +- name: Delete a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -45,7 +45,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region target HTTP proxy +- name: Create a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -55,27 +55,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_http_proxy was created +- name: Verify that region_target_http_proxy was created google.cloud.gcp_compute_region_target_http_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region target HTTP proxy that already exists +- name: Create a region target HTTP proxy that already exists google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -85,12 +85,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region target HTTP proxy +- name: Delete a region target HTTP proxy google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -100,27 +100,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_http_proxy was deleted +- name: Verify that region_target_http_proxy was deleted google.cloud.gcp_compute_region_target_http_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region target HTTP proxy that does not exist +- name: Delete a region target HTTP proxy that does not exist google.cloud.gcp_compute_region_target_http_proxy: name: "{{ resource_name }}" region: us-central1 @@ -130,14 +130,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy region: us-central1 @@ -146,16 +146,16 @@ auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent - ignore_errors: true -- name: delete a backend service + ignore_errors: true # noqa: ignore-errors +- name: Delete a backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy region: us-central1 - enable_cdn: 'true' + enable_cdn: "true" protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present - ignore_errors: true \ No newline at end of file + ignore_errors: true # noqa: ignore-errors diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml index 89e91e4..ac02c56 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a region health check +- name: Create a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: HTTPS @@ -35,20 +35,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpsproxy region: us-central1 backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" healthchecks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a region URL map +- name: Create a region URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpsproxy region: us-central1 @@ -58,7 +58,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -91,119 +91,119 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a region target HTTPS proxy +- name: Delete a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region target HTTPS proxy +- name: Create a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_https_proxy was created +- name: Verify that region_target_https_proxy was created google.cloud.gcp_compute_region_target_https_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region target HTTPS proxy that already exists +- name: Create a region target HTTPS proxy that already exists google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region target HTTPS proxy +- name: Delete a region target HTTPS proxy google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_target_https_proxy was deleted +- name: Verify that region_target_https_proxy was deleted google.cloud.gcp_compute_region_target_https_proxy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region target HTTPS proxy that does not exist +- name: Delete a region target HTTPS proxy that does not exist google.cloud.gcp_compute_region_target_https_proxy: name: "{{ resource_name }}" region: us-central1 ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -237,7 +237,7 @@ state: absent register: sslcert ignore_errors: true -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpsproxy region: us-central1 @@ -248,21 +248,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpsproxy region: us-central1 backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" healthchecks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a region health check +- name: Delete a region health check google.cloud.gcp_compute_region_health_check: name: "{{ resource_name }}" type: HTTPS @@ -276,7 +276,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_target_https_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml index 06ccec0..1cbfae9 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a region backend service +- name: Create a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 @@ -21,10 +21,10 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: present register: backendservice -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a region URL map +- name: Create a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -44,27 +44,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_url_map was created +- name: Verify that region_url_map was created google.cloud.gcp_compute_region_url_map_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a region URL map that already exists +- name: Create a region URL map that already exists google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -74,12 +74,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a region URL map +- name: Delete a region URL map google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -89,27 +89,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that region_url_map was deleted +- name: Verify that region_url_map was deleted google.cloud.gcp_compute_region_url_map_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a region URL map that does not exist +- name: Delete a region URL map that does not exist google.cloud.gcp_compute_region_url_map: name: "{{ resource_name }}" region: us-central1 @@ -119,14 +119,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a region backend service +- name: Delete a region backend service google.cloud.gcp_compute_region_backend_service: name: "{{ resource_name }}" region: us-central1 @@ -134,7 +134,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - load_balancing_scheme: "EXTERNAL" + load_balancing_scheme: EXTERNAL state: absent register: backendservice - ignore_errors: true \ No newline at end of file + ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml b/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_region_url_map/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml index 145f378..7663bf5 100644 --- a/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_reservation/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a reservation +- name: Delete a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -27,7 +27,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a reservation +- name: Create a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -41,27 +41,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that reservation was created +- name: Verify that reservation was created google.cloud.gcp_compute_reservation_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a reservation that already exists +- name: Create a reservation that already exists google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a reservation +- name: Delete a reservation google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -94,27 +94,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that reservation was deleted +- name: Verify that reservation was deleted google.cloud.gcp_compute_reservation_info: - filters: - - name = {{ resource_name }} - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a reservation that does not exist +- name: Delete a reservation that does not exist google.cloud.gcp_compute_reservation: name: "{{ resource_name }}" zone: us-central1-a @@ -128,7 +128,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_reservation/tasks/main.yml b/tests/integration/targets/gcp_compute_reservation/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_reservation/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_reservation/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml index 161e7a8..86647db 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_resource_policy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a resource policy +- name: Delete a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -21,13 +21,13 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a resource policy +- name: Create a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -35,33 +35,33 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_policy was created +- name: Verify that resource_policy was created google.cloud.gcp_compute_resource_policy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a resource policy that already exists +- name: Create a resource policy that already exists google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -69,18 +69,18 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a resource policy +- name: Delete a resource policy google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -88,33 +88,33 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_policy was deleted +- name: Verify that resource_policy was deleted google.cloud.gcp_compute_resource_policy_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a resource policy that does not exist +- name: Delete a resource policy that does not exist google.cloud.gcp_compute_resource_policy: name: "{{ resource_name }}" region: us-central1 @@ -122,13 +122,13 @@ schedule: daily_schedule: days_in_cycle: 1 - start_time: '04:00' + start_time: "04:00" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml b/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_resource_policy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml index aab6cd9..347c503 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-route project: "{{ gcp_project }}" @@ -22,146 +22,146 @@ auto_create_subnetworks: true state: present register: network -- name: delete a route +- name: Delete a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a route +- name: Create a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that route was created +- name: Verify that route was created google.cloud.gcp_compute_route_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a route that already exists +- name: Create a route that already exists google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false # --- -- name: update a route +- name: Update a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/28 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - foobar + - backends + - foobar project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true #---------------------------------------------------------- -- name: delete a route +- name: Delete a route google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that route was deleted +- name: Verify that route was deleted google.cloud.gcp_compute_route_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a route that does not exist +- name: Delete a route that does not exist google.cloud.gcp_compute_route: name: "{{ resource_name }}" dest_range: 192.168.6.0/24 next_hop_gateway: global/gateways/default-internet-gateway network: "{{ network }}" tags: - - backends - - databases + - backends + - databases project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-route project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_route/tasks/main.yml b/tests/integration/targets/gcp_compute_route/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_route/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_route/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml index 6003e78..07acc69 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-router project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -30,17 +30,17 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a router +- name: Create a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -48,37 +48,37 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that router was created +- name: Verify that router was created google.cloud.gcp_compute_router_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a router that already exists +- name: Create a router that already exists google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -86,22 +86,22 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -109,37 +109,37 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that router was deleted +- name: Verify that router was deleted google.cloud.gcp_compute_router_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a router that does not exist +- name: Delete a router that does not exist google.cloud.gcp_compute_router: name: "{{ resource_name }}" network: "{{ network }}" @@ -147,24 +147,24 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-router project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_router/tasks/main.yml b/tests/integration/targets/gcp_compute_router/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_router/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_router/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml index ffbdb24..435284e 100644 --- a/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: disk-snapshot zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: delete a snapshot +- name: Delete a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a snapshot +- name: Create a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -46,26 +46,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that snapshot was created +- name: Verify that snapshot was created google.cloud.gcp_compute_snapshot_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a snapshot that already exists +- name: Create a snapshot that already exists google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -77,12 +77,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a snapshot +- name: Delete a snapshot google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -94,26 +94,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that snapshot was deleted +- name: Verify that snapshot was deleted google.cloud.gcp_compute_snapshot_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a snapshot that does not exist +- name: Delete a snapshot that does not exist google.cloud.gcp_compute_snapshot: name: "{{ resource_name }}" source_disk: "{{ disk }}" @@ -125,14 +125,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: disk-snapshot zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml b/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_snapshot/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml index 871715c..9d36683 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -46,7 +46,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -79,26 +79,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_certificate was created +- name: Verify that ssl_certificate was created google.cloud.gcp_compute_ssl_certificate_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a SSL certificate that already exists +- name: Create a SSL certificate that already exists google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -131,12 +131,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -169,26 +169,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_certificate was deleted +- name: Verify that ssl_certificate was deleted google.cloud.gcp_compute_ssl_certificate_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a SSL certificate that does not exist +- name: Delete a SSL certificate that does not exist google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" description: A certificate for testing. Do not use this certificate in production @@ -221,7 +221,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml index 551af9a..adbba9f 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_policy/tasks/autogen.yml @@ -13,115 +13,115 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a SSL policy +- name: Delete a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL policy +- name: Create a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_policy was created +- name: Verify that ssl_policy was created google.cloud.gcp_compute_ssl_policy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a SSL policy that already exists +- name: Create a SSL policy that already exists google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a SSL policy +- name: Delete a SSL policy google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that ssl_policy was deleted +- name: Verify that ssl_policy was deleted google.cloud.gcp_compute_ssl_policy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a SSL policy that does not exist +- name: Delete a SSL policy that does not exist google.cloud.gcp_compute_ssl_policy: name: "{{ resource_name }}" profile: CUSTOM min_tls_version: TLS_1_2 custom_features: - - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml b/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_ssl_policy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml index 74917a3..6849cca 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_subnetwork/tasks/autogen.yml @@ -13,16 +13,16 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-subnetwork - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: network -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -33,7 +33,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a subnetwork +- name: Create a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -44,27 +44,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subnetwork was created +- name: Verify that subnetwork was created google.cloud.gcp_compute_subnetwork_info: - filters: - - name = ansiblenet - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a subnetwork that already exists +- name: Create a subnetwork that already exists google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a subnetwork +- name: Delete a subnetwork google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -91,27 +91,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subnetwork was deleted +- name: Verify that subnetwork was deleted google.cloud.gcp_compute_subnetwork_info: - filters: - - name = ansiblenet - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = ansiblenet + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a subnetwork that does not exist +- name: Delete a subnetwork that does not exist google.cloud.gcp_compute_subnetwork: name: ansiblenet region: us-west1 @@ -122,17 +122,17 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-subnetwork - auto_create_subnetworks: 'true' + auto_create_subnetworks: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml b/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_subnetwork/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml index a64c03a..1c48c9d 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpproxy healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpproxy default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -65,7 +65,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target HTTP proxy +- name: Create a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -74,26 +74,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_http_proxy was created +- name: Verify that target_http_proxy was created google.cloud.gcp_compute_target_http_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target HTTP proxy that already exists +- name: Create a target HTTP proxy that already exists google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -102,12 +102,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target HTTP proxy +- name: Delete a target HTTP proxy google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -116,26 +116,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_http_proxy was deleted +- name: Verify that target_http_proxy was deleted google.cloud.gcp_compute_target_http_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target HTTP proxy that does not exist +- name: Delete a target HTTP proxy that does not exist google.cloud.gcp_compute_target_http_proxy: name: "{{ resource_name }}" url_map: "{{ urlmap }}" @@ -144,14 +144,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpproxy default_service: "{{ backendservice }}" @@ -161,21 +161,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpproxy healthy_threshold: 10 @@ -188,7 +188,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_http_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml index 62500b4..5731d08 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpsproxy healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpsproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpsproxy default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: urlmap -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -89,112 +89,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a target HTTPS proxy +- name: Delete a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target HTTPS proxy +- name: Create a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_https_proxy was created +- name: Verify that target_https_proxy was created google.cloud.gcp_compute_target_https_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target HTTPS proxy that already exists +- name: Create a target HTTPS proxy that already exists google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target HTTPS proxy +- name: Delete a target HTTPS proxy google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_https_proxy was deleted +- name: Verify that target_https_proxy was deleted google.cloud.gcp_compute_target_https_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target HTTPS proxy that does not exist +- name: Delete a target HTTPS proxy that does not exist google.cloud.gcp_compute_target_https_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" # noqa: args[module] url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targethttpsproxy description: A certificate for testing. Do not use this certificate in production @@ -228,7 +228,7 @@ state: absent register: sslcert ignore_errors: true -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: urlmap-targethttpsproxy default_service: "{{ backendservice }}" @@ -238,21 +238,21 @@ state: absent register: urlmap ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targethttpsproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-targethttpsproxy healthy_threshold: 10 @@ -265,7 +265,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targethttpsproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_https_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml index 6f55e0d..74a01f6 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" @@ -22,26 +22,26 @@ auto_create_subnetworks: true state: present register: network -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: - - network: "{{ network }}" + - network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a target instance +- name: Delete a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -51,7 +51,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target instance +- name: Create a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -61,27 +61,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_instance was created +- name: Verify that target_instance was created google.cloud.gcp_compute_target_instance_info: - filters: - - name = target - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = target + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target instance that already exists +- name: Create a target instance that already exists google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -91,12 +91,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target instance +- name: Delete a target instance google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -106,27 +106,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_instance was deleted +- name: Verify that target_instance was deleted google.cloud.gcp_compute_target_instance_info: - filters: - - name = target - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = target + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target instance that does not exist +- name: Delete a target instance that does not exist google.cloud.gcp_compute_target_instance: name: target instance: "{{ instance }}" @@ -136,26 +136,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - initialize_params: - source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts + - auto_delete: "true" + boot: "true" + initialize_params: + source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2204-lts labels: environment: production network_interfaces: - - network: "{{ network }}" + - network: "{{ network }}" zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -163,7 +163,7 @@ state: absent register: instance ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml b/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml index 712ea70..59a46d2 100644 --- a/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_pool/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target pool +- name: Create a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -31,27 +31,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_pool was created +- name: Verify that target_pool was created google.cloud.gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target pool that already exists +- name: Create a target pool that already exists google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -60,12 +60,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target pool +- name: Delete a target pool google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -74,27 +74,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_pool was deleted +- name: Verify that target_pool was deleted google.cloud.gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target pool that does not exist +- name: Delete a target pool that does not exist google.cloud.gcp_compute_target_pool: name: "{{ resource_name }}" region: us-west1 @@ -103,7 +103,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml b/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_pool/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml index fad23db..6142ec9 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targetsslproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: healthcheck-targetsslproxy type: TCP @@ -38,20 +38,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targetsslproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: create a SSL certificate +- name: Create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targetsslproxy description: A certificate for testing. Do not use this certificate in production @@ -84,112 +84,112 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: sslcert -- name: delete a target SSL proxy +- name: Delete a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target SSL proxy +- name: Create a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_ssl_proxy was created +- name: Verify that target_ssl_proxy was created google.cloud.gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target SSL proxy that already exists +- name: Create a target SSL proxy that already exists google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target SSL proxy +- name: Delete a target SSL proxy google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_ssl_proxy was deleted +- name: Verify that target_ssl_proxy was deleted google.cloud.gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target SSL proxy that does not exist +- name: Delete a target SSL proxy that does not exist google.cloud.gcp_compute_target_ssl_proxy: name: "{{ resource_name }}" ssl_certificates: - - "{{ sslcert }}" + - "{{ sslcert }}" service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a SSL certificate +- name: Delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: sslcert-targetsslproxy description: A certificate for testing. Do not use this certificate in production @@ -223,13 +223,13 @@ state: absent register: sslcert ignore_errors: true -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targetsslproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: SSL project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -237,7 +237,7 @@ state: absent register: backendservice ignore_errors: true -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: healthcheck-targetsslproxy type: TCP @@ -254,7 +254,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targetsslproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml index 47844d0..82e3e55 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targettcpproxy zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a health check +- name: Create a health check google.cloud.gcp_compute_health_check: name: healthcheck-targettcpproxy type: TCP @@ -38,20 +38,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targettcpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: delete a target TCP proxy +- name: Delete a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -61,7 +61,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target TCP proxy +- name: Create a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -71,26 +71,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_tcp_proxy was created +- name: Verify that target_tcp_proxy was created google.cloud.gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target TCP proxy that already exists +- name: Create a target TCP proxy that already exists google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -100,12 +100,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target TCP proxy +- name: Delete a target TCP proxy google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -115,26 +115,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_tcp_proxy was deleted +- name: Verify that target_tcp_proxy was deleted google.cloud.gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target TCP proxy that does not exist +- name: Delete a target TCP proxy that does not exist google.cloud.gcp_compute_target_tcp_proxy: name: "{{ resource_name }}" proxy_header: PROXY_V1 @@ -144,20 +144,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-targettcpproxy backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" + - "{{ healthcheck.selfLink }}" protocol: TCP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -165,7 +165,7 @@ state: absent register: backendservice ignore_errors: true -- name: delete a health check +- name: Delete a health check google.cloud.gcp_compute_health_check: name: healthcheck-targettcpproxy type: TCP @@ -182,7 +182,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-targettcpproxy zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml index a23158d..a14a149 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address-vpngateway region: us-west1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-vpngateway project: "{{ gcp_project }}" @@ -31,7 +31,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -41,7 +41,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a target vpn gateway +- name: Create a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -51,27 +51,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_vpn_gateway was created +- name: Verify that target_vpn_gateway was created google.cloud.gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a target vpn gateway that already exists +- name: Create a target vpn gateway that already exists google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -81,12 +81,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -96,27 +96,27 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that target_vpn_gateway was deleted +- name: Verify that target_vpn_gateway was deleted google.cloud.gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a target vpn gateway that does not exist +- name: Delete a target vpn gateway that does not exist google.cloud.gcp_compute_target_vpn_gateway: name: "{{ resource_name }}" region: us-west1 @@ -126,14 +126,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-vpngateway project: "{{ gcp_project }}" @@ -143,7 +143,7 @@ state: absent register: network ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address-vpngateway region: us-west1 diff --git a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml index 68b8fe4..ead14fe 100644 --- a/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group +- name: Create a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-urlmap zone: us-central1-a @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instancegroup -- name: create a HTTP health check +- name: Create a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-urlmap healthy_threshold: 10 @@ -34,20 +34,20 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: healthcheck -- name: create a backend service +- name: Create a backend service google.cloud.gcp_compute_backend_service: name: backendservice-urlmap backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: backendservice -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -56,7 +56,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a URL map +- name: Create a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -65,26 +65,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that url_map was created +- name: Verify that url_map was created google.cloud.gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a URL map that already exists +- name: Create a URL map that already exists google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -93,12 +93,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a URL map +- name: Delete a URL map google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -107,26 +107,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that url_map was deleted +- name: Verify that url_map was deleted google.cloud.gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a URL map that does not exist +- name: Delete a URL map that does not exist google.cloud.gcp_compute_url_map: name: "{{ resource_name }}" default_service: "{{ backendservice }}" @@ -135,28 +135,28 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a backend service +- name: Delete a backend service google.cloud.gcp_compute_backend_service: name: backendservice-urlmap backends: - - group: "{{ instancegroup.selfLink }}" + - group: "{{ instancegroup.selfLink }}" health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' + - "{{ healthcheck.selfLink }}" + enable_cdn: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: backendservice ignore_errors: true -- name: delete a HTTP health check +- name: Delete a HTTP health check google.cloud.gcp_compute_http_health_check: name: httphealthcheck-urlmap healthy_threshold: 10 @@ -169,7 +169,7 @@ state: absent register: healthcheck ignore_errors: true -- name: delete a instance group +- name: Delete a instance group google.cloud.gcp_compute_instance_group: name: instancegroup-urlmap zone: us-central1-a diff --git a/tests/integration/targets/gcp_compute_url_map/tasks/main.yml b/tests/integration/targets/gcp_compute_url_map/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml index 7f86903..79d4e05 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a address +- name: Create a address google.cloud.gcp_compute_address: name: address region: us-central1 @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address -- name: create a forward address +- name: Create a forward address google.cloud.gcp_compute_address: name: address-forwardingrule region: us-central1 @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: address_forwardingrule -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" @@ -40,7 +40,7 @@ auto_create_subnetworks: true state: present register: network -- name: create a disk +- name: Create a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -51,36 +51,36 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: disk -- name: create a instance +- name: Create a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a router +- name: Create a router google.cloud.gcp_compute_router: name: router-vpn-tunnel network: "{{ network }}" @@ -88,17 +88,17 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: router -- name: create a target vpn gateway +- name: Create a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel region: us-central1 @@ -108,7 +108,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: gateway -- name: create a forwarding rule +- name: Create a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-central1 @@ -120,7 +120,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a UDP-500 forwarding rule +- name: Create a UDP-500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp" region: us-central1 @@ -133,7 +133,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: create a UDP-4500 forwarding rule +- name: Create a UDP-4500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp-4500" region: us-central1 @@ -146,7 +146,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: delete a vpn tunnel +- name: Delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 @@ -156,10 +156,10 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" state: absent #---------------------------------------------------------- -- name: create a vpn tunnel +- name: Create a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 @@ -169,100 +169,100 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that vpn_tunnel was created +- name: Verify that vpn_tunnel was created google.cloud.gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a vpn tunnel that already exists +- name: Create a vpn tunnel that already exists google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a vpn tunnel +- name: Delete a vpn tunnel google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that vpn_tunnel was deleted +- name: Verify that vpn_tunnel was deleted google.cloud.gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/compute + filters: + - name = {{ resource_name }} + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/compute register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a vpn tunnel that does not exist +- name: Delete a vpn tunnel that does not exist google.cloud.gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-central1 target_vpn_gateway: "{{ gateway }}" router: "{{ router }}" - peer_ip: "{{address.address}}" + peer_ip: "{{ address.address }}" shared_secret: super secret project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown -- name: delete a UDP-4500 forwarding rule +- name: Delete a UDP-4500 forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp-4500" region: us-central1 @@ -276,7 +276,7 @@ state: absent ignore_errors: true register: result -- name: delete a UDP forwarding rule +- name: Delete a UDP forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}-udp" region: us-central1 @@ -290,13 +290,13 @@ state: absent ignore_errors: true register: result -- name: delete a forwarding rule +- name: Delete a forwarding rule google.cloud.gcp_compute_forwarding_rule: name: "{{ resource_name }}" region: us-central1 target: "{{ gateway.selfLink }}" ip_protocol: ESP - ip_address: "104.197.5.203" + ip_address: 104.197.5.203 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" @@ -304,7 +304,7 @@ ignore_errors: true register: result # If errors happen, don't crash the playbook! -- name: delete a target vpn gateway +- name: Delete a target vpn gateway google.cloud.gcp_compute_target_vpn_gateway: name: gateway-vpn-tunnel region: us-central1 @@ -315,7 +315,7 @@ state: absent register: gateway ignore_errors: true -- name: delete a router +- name: Delete a router google.cloud.gcp_compute_router: name: router-vpn-tunnel network: "{{ network }}" @@ -323,10 +323,10 @@ asn: 64514 advertise_mode: CUSTOM advertised_groups: - - ALL_SUBNETS + - ALL_SUBNETS advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 + - range: 1.2.3.4 + - range: 6.7.0.0/16 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -334,35 +334,35 @@ state: absent register: router ignore_errors: true -- name: delete a instance +- name: Delete a instance google.cloud.gcp_compute_instance: name: "{{ resource_name }}" machine_type: n1-standard-1 disks: - - auto_delete: 'true' - boot: 'true' - source: "{{ disk }}" - - auto_delete: 'true' - interface: NVME - type: SCRATCH - initialize_params: - disk_type: local-ssd + - auto_delete: "true" + boot: "true" + source: "{{ disk }}" + - auto_delete: "true" + interface: NVME + type: SCRATCH + initialize_params: + disk_type: local-ssd metadata: - cost-center: '12345' + cost-center: "12345" labels: environment: production network_interfaces: - - network: "{{ network }}" - access_configs: - - name: External NAT - nat_ip: "{{ address }}" - type: ONE_TO_ONE_NAT + - network: "{{ network }}" + access_configs: + - name: External NAT + nat_ip: "{{ address }}" + type: ONE_TO_ONE_NAT zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent -- name: delete a disk +- name: Delete a disk google.cloud.gcp_compute_disk: name: "{{ resource_prefix }}" size_gb: 50 @@ -374,7 +374,7 @@ state: absent register: disk ignore_errors: true -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-vpn-tunnel project: "{{ gcp_project }}" @@ -384,7 +384,7 @@ state: absent register: network ignore_errors: true -- name: delete a address +- name: Delete a address google.cloud.gcp_compute_address: name: address region: us-central1 @@ -393,4 +393,4 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: address - ignore_errors: true \ No newline at end of file + ignore_errors: true diff --git a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/tests/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml index 2443696..4a845ea 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -22,11 +22,11 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a cluster +- name: Create a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -35,29 +35,29 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cluster was created +- name: Verify that cluster was created google.cloud.gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "serviceaccount" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: serviceaccount + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a cluster that already exists +- name: Create a cluster that already exists google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -66,16 +66,16 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -84,29 +84,29 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that cluster was deleted +- name: Verify that cluster was deleted google.cloud.gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a cluster that does not exist +- name: Delete a cluster that does not exist google.cloud.gcp_container_cluster: name: my-cluster initial_node_count: 2 @@ -115,11 +115,11 @@ disk_size_gb: 500 location: us-central1-a project: "{{ gcp_project }}" - auth_kind: "serviceaccount" + auth_kind: serviceaccount service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_container_cluster/tasks/main.yml b/tests/integration/targets/gcp_container_cluster/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml index f3f5849..ae04f30 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a cluster +- name: Create a cluster google.cloud.gcp_container_cluster: name: cluster-nodepool initial_node_count: 4 @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: cluster -- name: delete a node pool +- name: Delete a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -34,7 +34,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node pool +- name: Create a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -45,26 +45,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_pool was created +- name: Verify that node_pool was created google.cloud.gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a node pool that already exists +- name: Create a node pool that already exists google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -75,12 +75,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node pool +- name: Delete a node pool google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -91,26 +91,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node_pool was deleted +- name: Verify that node_pool was deleted google.cloud.gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a node pool that does not exist +- name: Delete a node pool that does not exist google.cloud.gcp_container_node_pool: name: my-pool initial_node_count: 4 @@ -121,14 +121,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a cluster +- name: Delete a cluster google.cloud.gcp_container_cluster: name: cluster-nodepool initial_node_count: 4 diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/main.yml b/tests/integration/targets/gcp_container_node_pool/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml index 70d72cc..2e7b2bf 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -23,7 +23,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a managed zone +- name: Create a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -33,25 +33,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that managed_zone was created +- name: Verify that managed_zone was created google.cloud.gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a managed zone that already exists +- name: Create a managed zone that already exists google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -61,12 +61,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -76,25 +76,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that managed_zone was deleted +- name: Verify that managed_zone was deleted google.cloud.gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a managed zone that does not exist +- name: Delete a managed zone that does not exist google.cloud.gcp_dns_managed_zone: name: "{{ resource_name }}" dns_name: test.somewild2.example.com. @@ -104,7 +104,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/tests/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml index b446727..67fe3e3 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a managed zone +- name: Create a managed zone google.cloud.gcp_dns_managed_zone: name: managedzone-rrs dns_name: testzone-4.com. @@ -23,125 +23,125 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: managed_zone -- name: delete a resource record set +- name: Delete a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a resource record set +- name: Create a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_record_set was created +- name: Verify that resource_record_set was created google.cloud.gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a resource record set that already exists +- name: Create a resource record set that already exists google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a resource record set +- name: Delete a resource record set google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that resource_record_set was deleted +- name: Verify that resource_record_set was deleted google.cloud.gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a resource record set that does not exist +- name: Delete a resource record set that does not exist google.cloud.gcp_dns_resource_record_set: name: www.testzone-4.com. managed_zone: "{{ managed_zone }}" type: A ttl: 600 target: - - 10.1.2.3 - - 40.5.6.7 + - 10.1.2.3 + - 40.5.6.7 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a managed zone +- name: Delete a managed zone google.cloud.gcp_dns_managed_zone: name: managedzone-rrs dns_name: testzone-4.com. diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml index 4a4769d..20a7bde 100644 --- a/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_filestore_instance/tasks/autogen.yml @@ -13,133 +13,133 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_filestore_instance: name: "{{ resource_name }}" zone: us-central1-b tier: PREMIUM file_shares: - - capacity_gb: 2660 - name: share1 + - capacity_gb: 2660 + name: share1 networks: - - network: default - modes: - - MODE_IPV4 + - network: default + modes: + - MODE_IPV4 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_filestore_instance/tasks/main.yml b/tests/integration/targets/gcp_filestore_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_filestore_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_filestore_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml index d754203..d4afe35 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/autogen.yml @@ -13,136 +13,136 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a role +- name: Delete a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a role +- name: Create a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that role was created +- name: Verify that role was created google.cloud.gcp_iam_role_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a role that already exists +- name: Create a role that already exists google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false # ---------------------------------------------------------------------------- -- name: modify an IAM role that already exists +- name: Modify an IAM role that already exists google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - storage.buckets.get - - storage.buckets.list - - storage.objects.get - - storage.objects.list + - storage.buckets.get + - storage.buckets.list + - storage.objects.get + - storage.objects.list project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true #---------------------------------------------------------- -- name: delete a role +- name: Delete a role google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that role was deleted +- name: Verify that role was deleted google.cloud.gcp_iam_role_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30].replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a role that does not exist +- name: Delete a role that does not exist google.cloud.gcp_iam_role: name: "{{ resource_prefix[0:30].replace('-', '_') }}" title: My Custom Role description: My custom role description included_permissions: - - iam.roles.list - - iam.roles.create - - iam.roles.delete + - iam.roles.list + - iam.roles.create + - iam.roles.delete project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_iam_role/tasks/main.yml b/tests/integration/targets/gcp_iam_role/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_iam_role/tasks/main.yml +++ b/tests/integration/targets/gcp_iam_role/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index ec14f78..9a4106d 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a service account +- name: Delete a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a service account +- name: Create a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -31,24 +31,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service_account was created +- name: Verify that service_account was created google.cloud.gcp_iam_service_account_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") + | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a service account that already exists +- name: Create a service account that already exists google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -57,12 +58,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a service account +- name: Delete a service account google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -71,24 +72,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service_account was deleted +- name: Verify that service_account was deleted google.cloud.gcp_iam_service_account_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/iam + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/iam register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") + | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a service account that does not exist +- name: Delete a service account that does not exist google.cloud.gcp_iam_service_account: name: service-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key @@ -97,7 +99,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/main.yml b/tests/integration/targets/gcp_iam_service_account/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml b/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml index aa87a2a..aa65c31 100644 --- a/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml +++ b/tests/integration/targets/gcp_iam_service_account_key/defaults/main.yml @@ -1,3 +1,3 @@ --- # defaults file -resource_name: '{{resource_prefix}}' +resource_name: "{{ resource_prefix }}" diff --git a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml index dd7ed17..0e27077 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_crypto_key/tasks/autogen.yml @@ -13,8 +13,8 @@ --- # Pre-test setup -- name: create a key ring - gcp_kms_key_ring: +- name: Create a key ring + google.cloud.gcp_kms_key_ring: name: key-key-ring location: us-central1 project: "{{ gcp_project }}" @@ -22,8 +22,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: keyring -- name: delete a crypto key - gcp_kms_crypto_key: +- name: Delete a crypto key + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -31,8 +31,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a crypto key - gcp_kms_crypto_key: +- name: Create a crypto key + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -40,26 +40,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that crypto_key was created - gcp_kms_crypto_key_info: - key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudkms +- name: Verify that crypto_key was created + google.cloud.gcp_kms_crypto_key_info: + key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudkms register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a crypto key that already exists - gcp_kms_crypto_key: +- name: Create a crypto key that already exists + google.cloud.gcp_kms_crypto_key: name: "{{ resource_name }}" key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring project: "{{ gcp_project }}" @@ -67,7 +67,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml b/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml +++ b/tests/integration/targets/gcp_kms_crypto_key/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml index 0c52609..b0af43c 100644 --- a/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml +++ b/tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml @@ -1,3 +1,4 @@ +--- # Copyright 2019 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +13,8 @@ # limitations under the License. # Pre-test setup -- name: delete a key ring - gcp_kms_key_ring: +- name: Delete a key ring + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -21,8 +22,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a key ring - gcp_kms_key_ring: +- name: Create a key ring + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -30,26 +31,26 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that key_ring was created - gcp_kms_key_ring_info: - location: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudkms +- name: Verify that key_ring was created + google.cloud.gcp_kms_key_ring_info: + location: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudkms register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a key ring that already exists - gcp_kms_key_ring: +- name: Create a key ring that already exists + google.cloud.gcp_kms_key_ring: name: "{{ resource_name }}" location: us-central1 project: "{{ gcp_project }}" @@ -57,7 +58,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml b/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml +++ b/tests/integration/targets/gcp_kms_key_ring/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml index 8d0f6c0..90a77b0 100644 --- a/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml +++ b/tests/integration/targets/gcp_logging_metric/tasks/autogen.yml @@ -13,18 +13,18 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a metric +- name: Delete a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -38,18 +38,18 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a metric +- name: Create a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -63,35 +63,35 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that metric was created +- name: Verify that metric was created google.cloud.gcp_logging_metric_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a metric that already exists +- name: Create a metric that already exists google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -105,23 +105,23 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a metric +- name: Delete a metric google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -135,35 +135,35 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that metric was deleted +- name: Verify that metric was deleted google.cloud.gcp_logging_metric_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a metric that does not exist +- name: Delete a metric that does not exist google.cloud.gcp_logging_metric: name: "{{ resource_name }}" filter: resource.type=gae_app AND severity>=ERROR metric_descriptor: metric_kind: DELTA value_type: DISTRIBUTION - unit: '1' + unit: "1" labels: - - key: mass - value_type: STRING - description: amount of matter + - key: mass + value_type: STRING + description: amount of matter value_extractor: EXTRACT(jsonPayload.request) label_extractors: mass: EXTRACT(jsonPayload.request) @@ -177,7 +177,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_logging_metric/tasks/main.yml b/tests/integration/targets/gcp_logging_metric/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_logging_metric/tasks/main.yml +++ b/tests/integration/targets/gcp_logging_metric/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml index 1f115aa..619a49c 100644 --- a/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml @@ -13,101 +13,101 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a model +- name: Create a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that model was created +- name: Verify that model was created google.cloud.gcp_mlengine_model_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a model that already exists +- name: Create a model that already exists google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that model was deleted +- name: Verify that model was deleted google.cloud.gcp_mlengine_model_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a model that does not exist +- name: Delete a model that does not exist google.cloud.gcp_mlengine_model: name: "{{ resource_name | replace('-', '_') }}" description: My model regions: - - us-central1 + - us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_mlengine_model/tasks/main.yml b/tests/integration/targets/gcp_mlengine_model/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_mlengine_model/tasks/main.yml +++ b/tests/integration/targets/gcp_mlengine_model/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml index fc0bff2..d68bad0 100644 --- a/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml +++ b/tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml @@ -13,140 +13,140 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a model +- name: Create a model google.cloud.gcp_mlengine_model: name: model_version description: My model regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' + - us-central1 + online_prediction_logging: "true" + online_prediction_console_logging: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: model -- name: delete a version +- name: Delete a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a version +- name: Create a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that version was created +- name: Verify that version was created google.cloud.gcp_mlengine_version_info: - model: "{{ model }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + model: "{{ model }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a version that already exists +- name: Create a version that already exists google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a version +- name: Delete a version google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that version was deleted +- name: Verify that version was deleted google.cloud.gcp_mlengine_version_info: - model: "{{ model }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + model: "{{ model }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a version that does not exist +- name: Delete a version that does not exist google.cloud.gcp_mlengine_version: name: "{{ resource_name | replace('-', '_') }}" model: "{{ model }}" runtime_version: 1.13 python_version: 3.5 - is_default: 'true' + is_default: "true" deployment_uri: gs://ansible-cloudml-bucket/ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a model +- name: Delete a model google.cloud.gcp_mlengine_model: name: model_version description: My model regions: - - us-central1 - online_prediction_logging: 'true' - online_prediction_console_logging: 'true' + - us-central1 + online_prediction_logging: "true" + online_prediction_console_logging: "true" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" diff --git a/tests/integration/targets/gcp_mlengine_version/tasks/main.yml b/tests/integration/targets/gcp_mlengine_version/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_mlengine_version/tasks/main.yml +++ b/tests/integration/targets/gcp_mlengine_version/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml index 5aa60ee..ca78eb4 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a topic +- name: Create a topic google.cloud.gcp_pubsub_topic: name: topic-subscription project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: topic -- name: delete a subscription +- name: Delete a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a subscription +- name: Create a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -41,24 +41,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subscription was created +- name: Verify that subscription was created google.cloud.gcp_pubsub_subscription_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a subscription that already exists +- name: Create a subscription that already exists google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -68,12 +68,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a subscription +- name: Delete a subscription google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -83,24 +83,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that subscription was deleted +- name: Verify that subscription was deleted google.cloud.gcp_pubsub_subscription_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a subscription that does not exist +- name: Delete a subscription that does not exist google.cloud.gcp_pubsub_subscription: name: "{{ resource_name }}" topic: "{{ topic }}" @@ -110,14 +110,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: topic-subscription project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml index 4e5d438..0c0dbdc 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a topic +- name: Create a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -29,24 +29,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that topic was created +- name: Verify that topic was created google.cloud.gcp_pubsub_topic_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-topic1' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a topic that already exists +- name: Create a topic that already exists google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -54,12 +54,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a topic +- name: Delete a topic google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -67,24 +67,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that topic was deleted +- name: Verify that topic was deleted google.cloud.gcp_pubsub_topic_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/pubsub + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/pubsub register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-topic1' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a topic that does not exist +- name: Delete a topic that does not exist google.cloud.gcp_pubsub_topic: name: test-topic1 project: "{{ gcp_project }}" @@ -92,7 +92,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml index 1155fbd..cea48d6 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a network +- name: Create a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" @@ -22,7 +22,7 @@ auto_create_subnetworks: true state: present register: network -- name: delete a instance +- name: Delete a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -40,7 +40,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -58,25 +58,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_redis_instance_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -94,12 +94,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -117,25 +117,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_redis_instance_info: - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*instance37.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_redis_instance: name: instance37 tier: STANDARD_HA @@ -153,14 +153,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a network +- name: Delete a network google.cloud.gcp_compute_network: name: network-instance project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_redis_instance/tasks/main.yml b/tests/integration/targets/gcp_redis_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 0c92900..5545d0e 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a project +- name: Delete a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -24,7 +24,7 @@ id: "{{ gcp_folder_id }}" state: absent #---------------------------------------------------------- -- name: create a project +- name: Create a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -35,29 +35,30 @@ id: "{{ gcp_folder_id }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true - name: Pause for 2 minutes for project to appear ansible.builtin.pause: minutes: 2 -- name: verify that project was created +- name: Verify that project was created google.cloud.gcp_resourcemanager_project_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - # choose 1000 projects so iterate past the deleted ones. - page_size: 1000 - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 + - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list + | length == 1 # ---------------------------------------------------------------------------- -- name: create a project that already exists +- name: Create a project that already exists google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -68,12 +69,12 @@ id: "{{ gcp_folder_id }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a project +- name: Delete a project google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -84,29 +85,30 @@ id: "{{ gcp_folder_id }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true - name: Pause for 2 minutes for project to appear ansible.builtin.pause: minutes: 2 -- name: verify that project was deleted +- name: Verify that project was deleted google.cloud.gcp_resourcemanager_project_info: - project: "{{ resource_prefix[0:30] }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - # choose 1000 projects so iterate past the deleted ones. - page_size: 1000 - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ resource_prefix[0:30] }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + # choose 1000 projects so iterate past the deleted ones. + page_size: 1000 + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list | length == 1 + - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") + | list | length == 1 # ---------------------------------------------------------------------------- -- name: delete a project that does not exist +- name: Delete a project that does not exist google.cloud.gcp_resourcemanager_project: name: "{{ resource_prefix[0:30] }}" id: "{{ resource_prefix[0:30] }}" @@ -117,7 +119,7 @@ id: "{{ gcp_folder_id }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml index 08bba39..3eebf1b 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_config/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a config +- name: Create a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -31,24 +31,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that config was created +- name: Verify that config was created google.cloud.gcp_runtimeconfig_config_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a config that already exists +- name: Create a config that already exists google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -57,12 +57,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -71,24 +71,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that config was deleted +- name: Verify that config was deleted google.cloud.gcp_runtimeconfig_config_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a config that does not exist +- name: Delete a config that does not exist google.cloud.gcp_runtimeconfig_config: name: "{{ resource_name }}" description: My config @@ -97,7 +97,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml b/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml +++ b/tests/integration/targets/gcp_runtimeconfig_config/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml index 5ea7d80..4a790dc 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml +++ b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a config +- name: Create a config google.cloud.gcp_runtimeconfig_config: name: my-config description: My config @@ -22,7 +22,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: config -- name: delete a variable +- name: Delete a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -32,7 +32,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a variable +- name: Create a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -42,25 +42,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that variable was created +- name: Verify that variable was created google.cloud.gcp_runtimeconfig_variable_info: - config: my-config - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + config: my-config + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a variable that already exists +- name: Create a variable that already exists google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -70,12 +70,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a variable +- name: Delete a variable google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -85,25 +85,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that variable was deleted +- name: Verify that variable was deleted google.cloud.gcp_runtimeconfig_variable_info: - config: my-config - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloudruntimeconfig + config: my-config + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloudruntimeconfig register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*prod-variables/hostname.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a variable that does not exist +- name: Delete a variable that does not exist google.cloud.gcp_runtimeconfig_variable: name: prod-variables/hostname config: my-config @@ -113,14 +113,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a config +- name: Delete a config google.cloud.gcp_runtimeconfig_config: name: my-config description: My config diff --git a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml +++ b/tests/integration/targets/gcp_runtimeconfig_variable/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_serviceusage_service/aliases b/tests/integration/targets/gcp_serviceusage_service/aliases index 9812f01..26507c2 100644 --- a/tests/integration/targets/gcp_serviceusage_service/aliases +++ b/tests/integration/targets/gcp_serviceusage_service/aliases @@ -1,2 +1 @@ cloud/gcp -unsupported diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml index c5f7f1e..666da8f 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml @@ -13,62 +13,62 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a service +- name: Delete a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a service +- name: Create a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that service was created +- name: Verify that service was created google.cloud.gcp_serviceusage_service_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "'{{ (results['resources'] | selectattr('name', 'search', 'spanner.googleapis.com') | list | first).state }}' == 'ENABLED'" + - "'{{ (results['resources'] | selectattr('name', 'search', 'alloydb.googleapis.com') | list | first).state }}' == 'ENABLED'" # ---------------------------------------------------------------------------- -- name: create a service that already exists +- name: Create a service that already exists google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a service +- name: Delete a service google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # TODO(@toumorokoshi): investigate if the pause helps @@ -76,28 +76,28 @@ # - name: Pause for 1 minute to keep from hitting quota limit # ansible.builtin.pause: # minutes: 1 -- name: verify that service was deleted +- name: Verify that service was deleted google.cloud.gcp_serviceusage_service_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "'{{ (results['resources'] | selectattr('name', 'search', 'spanner.googleapis.com') | list | first).state }}' == 'DISABLED'" + - "'{{ (results['resources'] | selectattr('name', 'search', 'alloydb.googleapis.com') | list | first).state }}' == 'DISABLED'" # ---------------------------------------------------------------------------- -- name: delete a service that does not exist +- name: Delete a service that does not exist google.cloud.gcp_serviceusage_service: - name: spanner.googleapis.com + name: alloydb.googleapis.com project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml index da4942a..0bc8058 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sourcerepo_repository/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a repository +- name: Delete a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a repository +- name: Create a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,24 +29,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that repository was created +- name: Verify that repository was created google.cloud.gcp_sourcerepo_repository_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a repository that already exists +- name: Create a repository that already exists google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -54,12 +54,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a repository +- name: Delete a repository google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -67,24 +67,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that repository was deleted +- name: Verify that repository was deleted google.cloud.gcp_sourcerepo_repository_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a repository that does not exist +- name: Delete a repository that does not exist google.cloud.gcp_sourcerepo_repository: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -92,7 +92,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml b/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml +++ b/tests/integration/targets/gcp_sourcerepo_repository/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml index a3d8678..a3aa4cc 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_spanner_instance: name: instance-database display_name: My Spanner Instance @@ -26,7 +26,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a database +- name: Delete a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -35,7 +35,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a database +- name: Create a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -44,8 +44,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # - name: verify that database was created @@ -62,7 +62,7 @@ # that: # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a database that already exists +- name: Create a database that already exists google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -71,12 +71,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a database +- name: Delete a database google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -85,8 +85,8 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # commented out due to a flakey List endpoint @@ -107,7 +107,7 @@ # that: # - results['resources'] | map(attribute='name') | select("match", ".*webstore.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a database that does not exist +- name: Delete a database that does not exist google.cloud.gcp_spanner_database: name: webstore instance: "{{ instance }}" @@ -116,14 +116,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: instance-database display_name: My Spanner Instance diff --git a/tests/integration/targets/gcp_spanner_database/tasks/main.yml b/tests/integration/targets/gcp_spanner_database/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_spanner_database/tasks/main.yml +++ b/tests/integration/targets/gcp_spanner_database/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml index 8993c72..daae5c8 100644 --- a/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_spanner_instance/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -26,7 +26,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -39,24 +39,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_spanner_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -69,12 +69,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -87,24 +87,24 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_spanner_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/spanner.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/spanner.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*testinstance.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_spanner_instance: name: testinstance display_name: My Spanner Instance @@ -117,7 +117,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_spanner_instance/tasks/main.yml b/tests/integration/targets/gcp_spanner_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_spanner_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_spanner_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index 5171771..dd87faa 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-3" + name: "{{ resource_name }}-3" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,7 +28,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a database +- name: Delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -38,7 +38,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a database +- name: Create a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -48,25 +48,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that database was created +- name: Verify that database was created google.cloud.gcp_sql_database_info: - instance: "{{ instance.name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance.name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a database that already exists +- name: Create a database that already exists google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -76,12 +76,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a database +- name: Delete a database google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -91,25 +91,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that database was deleted +- name: Verify that database was deleted google.cloud.gcp_sql_database_info: - instance: "{{ instance.name }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance.name }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - "\"{{resource_name}}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a database that does not exist +- name: Delete a database that does not exist google.cloud.gcp_sql_database: name: "{{ resource_name }}" charset: utf8mb4 @@ -119,21 +119,21 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-3" + name: "{{ resource_name }}-3" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_database/tasks/main.yml b/tests/integration/targets/gcp_sql_database/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml index 7e49adb..c57de05 100644 --- a/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_instance/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,14 +28,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -43,31 +43,31 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was created +- name: Verify that instance was created google.cloud.gcp_sql_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a instance that already exists +- name: Create a instance that already exists google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -75,19 +75,19 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -95,31 +95,31 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that instance was deleted +- name: Verify that instance was deleted google.cloud.gcp_sql_instance_info: - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{resource_name}}-2.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a instance that does not exist +- name: Delete a instance that does not exist google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -127,7 +127,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_sql_instance/tasks/main.yml b/tests/integration/targets/gcp_sql_instance/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_instance/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_ssl_cert/aliases b/tests/integration/targets/gcp_sql_ssl_cert/aliases index 8189da3..0e4419e 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/aliases +++ b/tests/integration/targets/gcp_sql_ssl_cert/aliases @@ -1,4 +1 @@ -cloud/gcp -# unsupported as gcp_sql_ssl_cert_info resource -# does not exist. -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml index 78528c8..c24746d 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_ssl_cert/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,55 +28,72 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a SSL cert +- name: Delete a non-existent SSL cert google.cloud.gcp_sql_ssl_cert: - common_name: "{{resource_name}}" - instance: "{{instance['name'}}" + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "f572d396fae9206628714fb2ce00f72e94f2258f" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a SSL cert +- name: Create an SSL cert google.cloud.gcp_sql_ssl_cert: - common_name: "{{resource_name}}" - instance: "{{instance['name'}}" + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - # SslCert is not altered, just verified. - - result.changed == false -- name: verify that ssl_cert was created - google.cloud.gcp_sql_ssl_cert_info: - filters: - - name = - instance: "{{instance['name'}}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin - register: results -- name: verify that command succeeded - assert: + - result.changed == true +- name: Peform a no-op update to verify the cert was created + google.cloud.gcp_sql_ssl_cert: + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "{{ result['sha1Fingerprint'] }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + state: present + register: updates +- name: Verify that command succeeded + ansible.builtin.assert: that: - - results['resources'] | length == 1 + - updates.changed == false +#---------------------------------------------------------- +- name: Delete an SSL cert + google.cloud.gcp_sql_ssl_cert: + common_name: "{{ resource_name }}" + instance: + name: "{{ instance['name'] }}" + sha1_fingerprint: "{{ result['sha1Fingerprint'] }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + state: absent + register: result +- name: Assert changed is true + ansible.builtin.assert: + that: + - result.changed == true #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-2" + name: "{{ resource_name }}-2" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml b/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_ssl_cert/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml index c655c5e..20ddbea 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml @@ -13,14 +13,14 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance +- name: Create a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-1" + name: "{{ resource_name }}-1" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" @@ -28,7 +28,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance -- name: delete a user +- name: Delete a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -39,7 +39,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a user +- name: Create a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -50,25 +50,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that user was created +- name: Verify that user was created google.cloud.gcp_sql_user_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: create a user that already exists +- name: Create a user that already exists google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -79,12 +79,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a user +- name: Delete a user google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -95,25 +95,25 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that user was deleted +- name: Verify that user was deleted google.cloud.gcp_sql_user_info: - instance: "{{ instance }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/sqlservice.admin + instance: "{{ instance }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/sqlservice.admin register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" # ---------------------------------------------------------------------------- -- name: delete a user that does not exist +- name: Delete a user that does not exist google.cloud.gcp_sql_user: name: test-user host: 10.1.2.3 @@ -124,21 +124,21 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a instance +- name: Delete a instance google.cloud.gcp_sql_instance: - name: "{{resource_name}}-1" + name: "{{ resource_name }}-1" settings: ip_configuration: authorized_networks: - - name: google dns server - value: 8.8.8.8/32 + - name: google dns server + value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_sql_user/tasks/main.yml b/tests/integration/targets/gcp_sql_user/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/main.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml index d2f58c9..f5ccaca 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -29,12 +29,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a bucket that already exists +- name: Create a bucket that already exists google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -42,12 +42,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -55,12 +55,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a bucket that does not exist +- name: Delete a bucket that does not exist google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -68,7 +68,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/main.yml b/tests/integration/targets/gcp_storage_bucket/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml index a037a46..762e0f6 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,7 +21,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a bucket access control +- name: Delete a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -31,7 +31,7 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a bucket access control +- name: Create a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -41,12 +41,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a bucket access control that already exists +- name: Create a bucket access control that already exists google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -56,12 +56,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a bucket access control +- name: Delete a bucket access control google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -71,12 +71,12 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a bucket access control that does not exist +- name: Delete a bucket access control that does not exist google.cloud.gcp_storage_bucket_access_control: bucket: "{{ bucket }}" entity: user-alexstephen@google.com @@ -86,14 +86,14 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_default_object_acl/aliases b/tests/integration/targets/gcp_storage_default_object_acl/aliases index ff7eb2d..0e4419e 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/aliases +++ b/tests/integration/targets/gcp_storage_default_object_acl/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported \ No newline at end of file +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml index 77197a0..6f43684 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_default_object_acl/tasks/autogen.yml @@ -13,7 +13,7 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a bucket +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,74 +21,79 @@ service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: bucket -- name: delete a default object acl +- name: Delete a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a default object acl +- name: Create a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: create a default object acl that already exists +- name: Create a default object acl that already exists google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a default object acl +- name: Delete a default object acl google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete a default object acl that does not exist +- name: Delete a default object acl that does not exist google.cloud.gcp_storage_default_object_acl: bucket: "{{ bucket }}" - entity: OWNER:user-alexstephen@google.com + entity: user-alexstephen@google.com + role: READER project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! -- name: delete a bucket +- name: Delete a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml b/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_default_object_acl/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml diff --git a/tests/integration/targets/gcp_storage_object/tasks/main.yml b/tests/integration/targets/gcp_storage_object/tasks/main.yml index e96adcd..4d6d31f 100644 --- a/tests/integration/targets/gcp_storage_object/tasks/main.yml +++ b/tests/integration/targets/gcp_storage_object/tasks/main.yml @@ -1,18 +1,19 @@ --- # Pre-test setup -- name: create a temp file for uploading - tempfile: +- name: Create a temp file for uploading + ansible.builtin.tempfile: state: file register: upload_temp -- name: create a temp file for downloading - tempfile: +- name: Create a temp file for downloading + ansible.builtin.tempfile: state: file register: download_temp -- name: put content in the tempfile - copy: - content: "Ansible GCS test file" +- name: Put content in the tempfile + ansible.builtin.copy: + content: Ansible GCS test file dest: "{{ upload_temp.path }}" -- name: create a bucket + mode: 0644 +- name: Create a bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" @@ -21,51 +22,51 @@ state: present register: bucket #---------------------------------------------------------- -- name: upload the object to gcs +- name: Upload the object to gcs google.cloud.gcp_storage_object: - action: 'upload' + action: upload bucket: "{{ bucket.name }}" src: "{{ upload_temp.path }}" - dest: "ansible/{{ resource_name }}" + dest: ansible/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: download the object to disk +- name: Download the object to disk google.cloud.gcp_storage_object: - action: 'download' + action: download bucket: "{{ bucket.name }}" - src: "ansible/{{ resource_name }}" + src: ansible/{{ resource_name }} dest: "{{ download_temp.path }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete the object +- name: Delete the object google.cloud.gcp_storage_object: - action: 'delete' + action: delete bucket: "{{ bucket.name }}" - src: "ansible/{{ resource_name }}" + src: ansible/{{ resource_name }} project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true # ---------------------------------------------------------------------------- -- name: delete the bucket +- name: Delete the bucket google.cloud.gcp_storage_bucket: name: "{{ resource_name }}" project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index 140d1f2..196aa6a 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -13,108 +13,108 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: delete a node +- name: Delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- -- name: create a node +- name: Create a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node was created +- name: Verify that node was created google.cloud.gcp_tpu_node_info: - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- -- name: create a node that already exists +- name: Create a node that already exists google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false #---------------------------------------------------------- -- name: delete a node +- name: Delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is true - assert: +- name: Assert changed is true + ansible.builtin.assert: that: - result.changed == true -- name: verify that node was deleted +- name: Verify that node was deleted google.cloud.gcp_tpu_node_info: - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file | default(omit) }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file | default(omit) }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform register: results -- name: verify that command succeeded - assert: +- name: Verify that command succeeded + ansible.builtin.assert: that: - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- -- name: delete a node that does not exist +- name: Delete a node that does not exist google.cloud.gcp_tpu_node: name: "{{ resource_name }}" zone: us-central1-a - accelerator_type: "v2-32" - tensorflow_version: '2.10.0' + accelerator_type: v2-32 + tensorflow_version: 2.10.0 cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: result -- name: assert changed is false - assert: +- name: Assert changed is false + ansible.builtin.assert: that: - result.changed == false diff --git a/tests/integration/targets/gcp_tpu_node/tasks/main.yml b/tests/integration/targets/gcp_tpu_node/tasks/main.yml index 45d6e49..fe47378 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/main.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/main.yml @@ -1,2 +1,3 @@ --- -- include_tasks: autogen.yml +- name: Generated tests + ansible.builtin.include_tasks: autogen.yml From 661f114037d3b8719dfeba86ac18a57dee322a37 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 17 Nov 2023 16:47:05 -0800 Subject: [PATCH 106/138] chore: fix a line length lint error --- plugins/modules/gcp_sql_ssl_cert.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/gcp_sql_ssl_cert.py b/plugins/modules/gcp_sql_ssl_cert.py index ff4022b..02519b3 100644 --- a/plugins/modules/gcp_sql_ssl_cert.py +++ b/plugins/modules/gcp_sql_ssl_cert.py @@ -306,7 +306,8 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'sha1_fingerprint': module.params['sha1_fingerprint']} + res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), + 'sha1_fingerprint': module.params['sha1_fingerprint']} return "https://sqladmin.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}".format(**res) From 50ed9f42b5292db01f217cb98d47ffa82fffd6c2 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 20 Nov 2023 10:44:17 -0800 Subject: [PATCH 107/138] chore: rebase to master --- .../workflows/ansible-integration-tests.yml | 6 ++-- .github/workflows/ansible-test.yml | 10 +++---- .github/workflows/automationhub.yml | 30 +++++++++---------- .github/workflows/gcloud.yml | 4 +-- .github/workflows/gcsfuse.yml | 4 +-- .github/workflows/pythonpublish.yml | 30 +++++++++---------- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index e71730a..c7c63c8 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -26,13 +26,13 @@ jobs: - stable-2.15 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: - python-version: "3.9" # this is the minimum version required for Ansible 2.13 + python-version: '3.9' # this is the minimum version required for Ansible 2.15 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index eb6ee9c..26078e8 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -2,7 +2,7 @@ name: Run tests for the cloud.google collection on: [pull_request] env: - PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 + PYTHON_VERSION: "3.9" # minimum version for Ansible 2.15 jobs: sanity-and-lint: runs-on: ubuntu-latest @@ -16,11 +16,11 @@ jobs: - stable-2.15 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} # Automation-hub requires python2.7 sanity tests @@ -53,11 +53,11 @@ jobs: - stable-2.15 steps: - name: check out code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies diff --git a/.github/workflows/automationhub.yml b/.github/workflows/automationhub.yml index d309614..6adb138 100644 --- a/.github/workflows/automationhub.yml +++ b/.github/workflows/automationhub.yml @@ -8,18 +8,18 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: 3.x - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index f4fc7d3..c9b449c 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -27,12 +27,12 @@ jobs: - gcloud steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.9 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 0109925..4237699 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -22,12 +22,12 @@ jobs: - gcsfuse steps: - name: Check out code - uses: actions/checkout@v1 + uses: actions/checkout@v4 with: path: ansible_collections/google/cloud - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: 3.9 diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 42d663f..dd460e6 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -8,18 +8,18 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: 3.x - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ansible - - name: Build and publish - env: - ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} - run: | - ansible-galaxy collection build . - ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY From 7bf4129fb37bedc47ac5ba580bd3e76b15fddc56 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 13:50:56 -0800 Subject: [PATCH 108/138] chore: update ubuntu to latest; 18.04 is no more --- .github/workflows/gcloud.yml | 2 +- .github/workflows/gcsfuse.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index c9b449c..5b41103 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -13,7 +13,7 @@ on: - molecule/gcloud/** jobs: molecule: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 4237699..af6c089 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -11,7 +11,7 @@ on: - .github/workflows/gcsfuse.yml jobs: gcsfuse: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest env: PY_COLORS: 1 ANSIBLE_FORCE_COLOR: 1 From 009a6e7d31577769d61870818bb377a9b11f3709 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 14:23:27 -0800 Subject: [PATCH 109/138] chore: use the correct molecule driver package --- .github/workflows/gcloud.yml | 2 +- .github/workflows/gcsfuse.yml | 2 +- CONTRIBUTING.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 5b41103..8385fe9 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -48,7 +48,7 @@ jobs: sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule[docker] yamllint ansible ansible-lint docker + pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index af6c089..e91566a 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -43,7 +43,7 @@ jobs: sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io python -m pip install --upgrade pip - pip install molecule[docker] yamllint ansible ansible-lint docker + pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test run: >- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a71671..74c753d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,10 +124,10 @@ Run `ansible-test integration`. Currently some tests are disabled as [test are b ### Prequisites for role tests If you would like to use podman, you must -install the `molecule[podman]` package in PyPI: +install the `molecule-plugins[podman]` package in PyPI: ``` -pip install --upgrade molecule[podman] +pip install --upgrade molecule-plugins[podman] ``` ### Running role tests From 0b9a1f2e49dee6452f1c96c8d50b3c4e20da82cf Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 14:40:44 -0800 Subject: [PATCH 110/138] chore: cd to the repo root when running role tests --- .github/workflows/gcloud.yml | 1 + .github/workflows/gcsfuse.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 8385fe9..0fac681 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -51,6 +51,7 @@ jobs: pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test + working-directory: ansible_collections/google/cloud run: >- molecule --version && ansible --version && diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index e91566a..2d0dbc1 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -46,6 +46,7 @@ jobs: pip install molecule-plugins[docker] yamllint ansible ansible-lint docker - name: Run role test + working-directory: ansible_collections/google/cloud run: >- molecule --version && ansible --version && From 4115b7deb34c36b14ec37be89da3c159971263b6 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 15:44:49 -0800 Subject: [PATCH 111/138] chore: update container versions for molecule tests --- molecule/gcloud/molecule.yml | 4 ++-- molecule/gcsfuse/molecule.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/molecule/gcloud/molecule.yml b/molecule/gcloud/molecule.yml index 0bb3e5d..707639a 100644 --- a/molecule/gcloud/molecule.yml +++ b/molecule/gcloud/molecule.yml @@ -9,13 +9,13 @@ lint: | ansible-lint platforms: - name: instance - image: ubuntu:18.04 + image: ubuntu:20.04 privileged: true ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance - image: debian:9 + image: debian:10 privileged: true ansible.builtin.command: /lib/systemd/systemd volumes: diff --git a/molecule/gcsfuse/molecule.yml b/molecule/gcsfuse/molecule.yml index 0bb3e5d..707639a 100644 --- a/molecule/gcsfuse/molecule.yml +++ b/molecule/gcsfuse/molecule.yml @@ -9,13 +9,13 @@ lint: | ansible-lint platforms: - name: instance - image: ubuntu:18.04 + image: ubuntu:20.04 privileged: true ansible.builtin.command: /lib/systemd/systemd volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro - name: instance - image: debian:9 + image: debian:10 privileged: true ansible.builtin.command: /lib/systemd/systemd volumes: From 9efbead2531781359862816afbe70e6d5eb13e34 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 10 Nov 2023 16:45:40 -0800 Subject: [PATCH 112/138] chore: use https when adding the gcsfuse apt repo --- roles/gcsfuse/tasks/debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/gcsfuse/tasks/debian.yml b/roles/gcsfuse/tasks/debian.yml index ecd698f..be0847f 100644 --- a/roles/gcsfuse/tasks/debian.yml +++ b/roles/gcsfuse/tasks/debian.yml @@ -14,7 +14,7 @@ - name: Gcsfuse | Add the apt repository ansible.builtin.apt_repository: - repo: deb http://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main + repo: deb https://packages.cloud.google.com/apt gcsfuse-{{ ansible_distribution_release }} main state: present filename: gcsfuse From 811327bc096291eefc918cf801a3158bca3d92da Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 20 Nov 2023 11:17:25 -0800 Subject: [PATCH 113/138] chore: removed unused imports --- plugins/module_utils/gcp_utils.py | 4 +--- plugins/modules/gcp_appengine_firewall_rule.py | 2 +- plugins/modules/gcp_appengine_firewall_rule_info.py | 2 +- plugins/modules/gcp_bigquery_dataset.py | 1 - plugins/modules/gcp_bigquery_dataset_info.py | 2 +- plugins/modules/gcp_bigquery_table.py | 1 - plugins/modules/gcp_bigquery_table_info.py | 2 +- plugins/modules/gcp_bigtable_instance.py | 1 - plugins/modules/gcp_bigtable_instance_info.py | 2 +- plugins/modules/gcp_cloudbuild_trigger.py | 1 - plugins/modules/gcp_cloudbuild_trigger_info.py | 2 +- plugins/modules/gcp_cloudfunctions_cloud_function.py | 1 - plugins/modules/gcp_cloudfunctions_cloud_function_info.py | 2 +- plugins/modules/gcp_cloudscheduler_job.py | 1 - plugins/modules/gcp_cloudscheduler_job_info.py | 2 +- plugins/modules/gcp_cloudtasks_queue.py | 1 - plugins/modules/gcp_cloudtasks_queue_info.py | 2 +- plugins/modules/gcp_compute_address_info.py | 2 +- plugins/modules/gcp_compute_autoscaler_info.py | 2 +- plugins/modules/gcp_compute_backend_bucket.py | 1 - plugins/modules/gcp_compute_backend_bucket_info.py | 2 +- plugins/modules/gcp_compute_backend_service.py | 1 - plugins/modules/gcp_compute_backend_service_info.py | 2 +- plugins/modules/gcp_compute_disk_info.py | 2 +- plugins/modules/gcp_compute_external_vpn_gateway.py | 1 - plugins/modules/gcp_compute_external_vpn_gateway_info.py | 2 +- plugins/modules/gcp_compute_firewall_info.py | 2 +- plugins/modules/gcp_compute_forwarding_rule_info.py | 2 +- plugins/modules/gcp_compute_global_address_info.py | 2 +- plugins/modules/gcp_compute_global_forwarding_rule_info.py | 2 +- plugins/modules/gcp_compute_health_check.py | 1 - plugins/modules/gcp_compute_health_check_info.py | 2 +- plugins/modules/gcp_compute_http_health_check.py | 2 +- plugins/modules/gcp_compute_http_health_check_info.py | 2 +- plugins/modules/gcp_compute_https_health_check.py | 2 +- plugins/modules/gcp_compute_https_health_check_info.py | 2 +- plugins/modules/gcp_compute_image_info.py | 2 +- plugins/modules/gcp_compute_instance_group_info.py | 2 +- plugins/modules/gcp_compute_instance_group_manager_info.py | 2 +- plugins/modules/gcp_compute_instance_info.py | 1 - plugins/modules/gcp_compute_instance_template_info.py | 2 +- .../modules/gcp_compute_interconnect_attachment_info.py | 2 +- plugins/modules/gcp_compute_network.py | 1 - plugins/modules/gcp_compute_network_endpoint_group_info.py | 2 +- plugins/modules/gcp_compute_network_info.py | 2 +- plugins/modules/gcp_compute_node_group_info.py | 2 +- plugins/modules/gcp_compute_node_template.py | 1 - plugins/modules/gcp_compute_node_template_info.py | 2 +- plugins/modules/gcp_compute_region_autoscaler.py | 1 - plugins/modules/gcp_compute_region_autoscaler_info.py | 2 +- plugins/modules/gcp_compute_region_backend_service_info.py | 2 +- plugins/modules/gcp_compute_region_disk.py | 1 - plugins/modules/gcp_compute_region_disk_info.py | 2 +- plugins/modules/gcp_compute_region_health_check.py | 1 - plugins/modules/gcp_compute_region_health_check_info.py | 2 +- .../gcp_compute_region_instance_group_manager_info.py | 2 +- .../modules/gcp_compute_region_target_http_proxy_info.py | 2 +- .../modules/gcp_compute_region_target_https_proxy_info.py | 2 +- plugins/modules/gcp_compute_region_url_map_info.py | 2 +- plugins/modules/gcp_compute_reservation.py | 1 - plugins/modules/gcp_compute_reservation_info.py | 2 +- plugins/modules/gcp_compute_resource_policy.py | 1 - plugins/modules/gcp_compute_resource_policy_info.py | 2 +- plugins/modules/gcp_compute_route_info.py | 2 +- plugins/modules/gcp_compute_router_info.py | 2 +- plugins/modules/gcp_compute_snapshot_info.py | 2 +- plugins/modules/gcp_compute_ssl_certificate.py | 2 +- plugins/modules/gcp_compute_ssl_certificate_info.py | 2 +- plugins/modules/gcp_compute_ssl_policy.py | 1 - plugins/modules/gcp_compute_ssl_policy_info.py | 2 +- plugins/modules/gcp_compute_subnetwork_info.py | 2 +- plugins/modules/gcp_compute_target_http_proxy_info.py | 2 +- plugins/modules/gcp_compute_target_https_proxy_info.py | 2 +- plugins/modules/gcp_compute_target_instance_info.py | 2 +- plugins/modules/gcp_compute_target_pool_info.py | 2 +- plugins/modules/gcp_compute_target_ssl_proxy_info.py | 2 +- plugins/modules/gcp_compute_target_tcp_proxy_info.py | 2 +- plugins/modules/gcp_compute_target_vpn_gateway_info.py | 2 +- plugins/modules/gcp_compute_url_map_info.py | 2 +- plugins/modules/gcp_compute_vpn_tunnel_info.py | 2 +- plugins/modules/gcp_container_cluster.py | 1 - plugins/modules/gcp_container_cluster_info.py | 2 +- plugins/modules/gcp_container_node_pool_info.py | 2 +- plugins/modules/gcp_dns_managed_zone.py | 1 - plugins/modules/gcp_dns_managed_zone_info.py | 2 +- plugins/modules/gcp_dns_resource_record_set_info.py | 2 +- plugins/modules/gcp_filestore_instance.py | 1 - plugins/modules/gcp_filestore_instance_info.py | 2 +- plugins/modules/gcp_iam_role.py | 1 - plugins/modules/gcp_iam_role_info.py | 2 +- plugins/modules/gcp_iam_service_account.py | 2 +- plugins/modules/gcp_iam_service_account_info.py | 2 +- plugins/modules/gcp_iam_service_account_key.py | 4 +--- plugins/modules/gcp_kms_crypto_key.py | 1 - plugins/modules/gcp_kms_crypto_key_info.py | 2 +- plugins/modules/gcp_kms_key_ring.py | 2 +- plugins/modules/gcp_kms_key_ring_info.py | 2 +- plugins/modules/gcp_logging_metric.py | 1 - plugins/modules/gcp_logging_metric_info.py | 2 +- plugins/modules/gcp_mlengine_model.py | 1 - plugins/modules/gcp_mlengine_model_info.py | 2 +- plugins/modules/gcp_mlengine_version_info.py | 2 +- plugins/modules/gcp_pubsub_subscription_info.py | 2 +- plugins/modules/gcp_pubsub_topic.py | 1 - plugins/modules/gcp_pubsub_topic_info.py | 2 +- plugins/modules/gcp_redis_instance.py | 1 - plugins/modules/gcp_redis_instance_info.py | 2 +- plugins/modules/gcp_resourcemanager_project.py | 1 - plugins/modules/gcp_resourcemanager_project_info.py | 2 +- plugins/modules/gcp_runtimeconfig_config.py | 2 +- plugins/modules/gcp_runtimeconfig_config_info.py | 2 +- plugins/modules/gcp_runtimeconfig_variable.py | 2 +- plugins/modules/gcp_runtimeconfig_variable_info.py | 2 +- plugins/modules/gcp_serviceusage_service.py | 1 - plugins/modules/gcp_serviceusage_service_info.py | 2 +- plugins/modules/gcp_sourcerepo_repository.py | 2 +- plugins/modules/gcp_sourcerepo_repository_info.py | 2 +- plugins/modules/gcp_spanner_database_info.py | 2 +- plugins/modules/gcp_spanner_instance.py | 2 +- plugins/modules/gcp_spanner_instance_info.py | 2 +- plugins/modules/gcp_sql_database.py | 2 +- plugins/modules/gcp_sql_database_info.py | 2 +- plugins/modules/gcp_sql_instance.py | 1 - plugins/modules/gcp_sql_instance_info.py | 2 +- plugins/modules/gcp_sql_user_info.py | 2 +- plugins/modules/gcp_storage_object.py | 7 ------- plugins/modules/gcp_tpu_node.py | 1 - plugins/modules/gcp_tpu_node_info.py | 2 +- 128 files changed, 94 insertions(+), 138 deletions(-) diff --git a/plugins/module_utils/gcp_utils.py b/plugins/module_utils/gcp_utils.py index bff15f8..baf9a6c 100644 --- a/plugins/module_utils/gcp_utils.py +++ b/plugins/module_utils/gcp_utils.py @@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import ast import os import json @@ -25,8 +24,7 @@ except ImportError: HAS_GOOGLE_LIBRARIES = False from ansible.module_utils.basic import AnsibleModule, env_fallback -from ansible.module_utils.six import string_types -from ansible.module_utils._text import to_text, to_native +from ansible.module_utils._text import to_text def navigate_hash(source, path, default=None): diff --git a/plugins/modules/gcp_appengine_firewall_rule.py b/plugins/modules/gcp_appengine_firewall_rule.py index fbd8af2..f0dbd61 100644 --- a/plugins/modules/gcp_appengine_firewall_rule.py +++ b/plugins/modules/gcp_appengine_firewall_rule.py @@ -178,7 +178,7 @@ priority: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_appengine_firewall_rule_info.py b/plugins/modules/gcp_appengine_firewall_rule_info.py index adfeaf0..7206b15 100644 --- a/plugins/modules/gcp_appengine_firewall_rule_info.py +++ b/plugins/modules/gcp_appengine_firewall_rule_info.py @@ -141,7 +141,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_bigquery_dataset.py b/plugins/modules/gcp_bigquery_dataset.py index 99bdb9d..efc365a 100644 --- a/plugins/modules/gcp_bigquery_dataset.py +++ b/plugins/modules/gcp_bigquery_dataset.py @@ -479,7 +479,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_bigquery_dataset_info.py b/plugins/modules/gcp_bigquery_dataset_info.py index c4f6a65..ca689a6 100644 --- a/plugins/modules/gcp_bigquery_dataset_info.py +++ b/plugins/modules/gcp_bigquery_dataset_info.py @@ -302,7 +302,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_bigquery_table.py b/plugins/modules/gcp_bigquery_table.py index 8d7c1e2..b0021e2 100644 --- a/plugins/modules/gcp_bigquery_table.py +++ b/plugins/modules/gcp_bigquery_table.py @@ -999,7 +999,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_bigquery_table_info.py b/plugins/modules/gcp_bigquery_table_info.py index 45669a6..a67af95 100644 --- a/plugins/modules/gcp_bigquery_table_info.py +++ b/plugins/modules/gcp_bigquery_table_info.py @@ -581,7 +581,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_bigtable_instance.py b/plugins/modules/gcp_bigtable_instance.py index d314e67..e219cb2 100644 --- a/plugins/modules/gcp_bigtable_instance.py +++ b/plugins/modules/gcp_bigtable_instance.py @@ -240,7 +240,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_bigtable_instance_info.py b/plugins/modules/gcp_bigtable_instance_info.py index a8a2938..6c8f416 100644 --- a/plugins/modules/gcp_bigtable_instance_info.py +++ b/plugins/modules/gcp_bigtable_instance_info.py @@ -179,7 +179,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_cloudbuild_trigger.py b/plugins/modules/gcp_cloudbuild_trigger.py index a266d95..b252f86 100644 --- a/plugins/modules/gcp_cloudbuild_trigger.py +++ b/plugins/modules/gcp_cloudbuild_trigger.py @@ -1489,7 +1489,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_cloudbuild_trigger_info.py b/plugins/modules/gcp_cloudbuild_trigger_info.py index ebbf557..c8a9202 100644 --- a/plugins/modules/gcp_cloudbuild_trigger_info.py +++ b/plugins/modules/gcp_cloudbuild_trigger_info.py @@ -805,7 +805,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function.py b/plugins/modules/gcp_cloudfunctions_cloud_function.py index 3a33f2d..e09ed7b 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function.py @@ -374,7 +374,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py index 2c4df68..075fd86 100644 --- a/plugins/modules/gcp_cloudfunctions_cloud_function_info.py +++ b/plugins/modules/gcp_cloudfunctions_cloud_function_info.py @@ -264,7 +264,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_cloudscheduler_job.py b/plugins/modules/gcp_cloudscheduler_job.py index c103741..8a93053 100644 --- a/plugins/modules/gcp_cloudscheduler_job.py +++ b/plugins/modules/gcp_cloudscheduler_job.py @@ -634,7 +634,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_cloudscheduler_job_info.py b/plugins/modules/gcp_cloudscheduler_job_info.py index fda52e2..29ba123 100644 --- a/plugins/modules/gcp_cloudscheduler_job_info.py +++ b/plugins/modules/gcp_cloudscheduler_job_info.py @@ -370,7 +370,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_cloudtasks_queue.py b/plugins/modules/gcp_cloudtasks_queue.py index 90dbd65..f8b98f4 100644 --- a/plugins/modules/gcp_cloudtasks_queue.py +++ b/plugins/modules/gcp_cloudtasks_queue.py @@ -389,7 +389,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_cloudtasks_queue_info.py b/plugins/modules/gcp_cloudtasks_queue_info.py index 59a742b..631b10d 100644 --- a/plugins/modules/gcp_cloudtasks_queue_info.py +++ b/plugins/modules/gcp_cloudtasks_queue_info.py @@ -270,7 +270,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_address_info.py b/plugins/modules/gcp_compute_address_info.py index 6e47a99..247d892 100644 --- a/plugins/modules/gcp_compute_address_info.py +++ b/plugins/modules/gcp_compute_address_info.py @@ -226,7 +226,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_autoscaler_info.py b/plugins/modules/gcp_compute_autoscaler_info.py index 2ec9264..110c10d 100644 --- a/plugins/modules/gcp_compute_autoscaler_info.py +++ b/plugins/modules/gcp_compute_autoscaler_info.py @@ -311,7 +311,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_backend_bucket.py b/plugins/modules/gcp_compute_backend_bucket.py index d996e7d..420b593 100644 --- a/plugins/modules/gcp_compute_backend_bucket.py +++ b/plugins/modules/gcp_compute_backend_bucket.py @@ -373,7 +373,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_backend_bucket_info.py b/plugins/modules/gcp_compute_backend_bucket_info.py index e05c011..aaf40e3 100644 --- a/plugins/modules/gcp_compute_backend_bucket_info.py +++ b/plugins/modules/gcp_compute_backend_bucket_info.py @@ -243,7 +243,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_backend_service.py b/plugins/modules/gcp_compute_backend_service.py index 3a096ac..b259848 100644 --- a/plugins/modules/gcp_compute_backend_service.py +++ b/plugins/modules/gcp_compute_backend_service.py @@ -1417,7 +1417,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_backend_service_info.py b/plugins/modules/gcp_compute_backend_service_info.py index 52079d5..5e71577 100644 --- a/plugins/modules/gcp_compute_backend_service_info.py +++ b/plugins/modules/gcp_compute_backend_service_info.py @@ -753,7 +753,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_disk_info.py b/plugins/modules/gcp_compute_disk_info.py index 4d2ff40..8e36468 100644 --- a/plugins/modules/gcp_compute_disk_info.py +++ b/plugins/modules/gcp_compute_disk_info.py @@ -366,7 +366,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_external_vpn_gateway.py b/plugins/modules/gcp_compute_external_vpn_gateway.py index 46051fb..e2d96b1 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway.py @@ -219,7 +219,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_external_vpn_gateway_info.py b/plugins/modules/gcp_compute_external_vpn_gateway_info.py index 69453c2..6e2e0d0 100644 --- a/plugins/modules/gcp_compute_external_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_external_vpn_gateway_info.py @@ -166,7 +166,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_firewall_info.py b/plugins/modules/gcp_compute_firewall_info.py index b0336b1..dfc105e 100644 --- a/plugins/modules/gcp_compute_firewall_info.py +++ b/plugins/modules/gcp_compute_firewall_info.py @@ -313,7 +313,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_forwarding_rule_info.py b/plugins/modules/gcp_compute_forwarding_rule_info.py index de175c6..87dcb89 100644 --- a/plugins/modules/gcp_compute_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_forwarding_rule_info.py @@ -305,7 +305,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_global_address_info.py b/plugins/modules/gcp_compute_global_address_info.py index bd61fdd..34aa175 100644 --- a/plugins/modules/gcp_compute_global_address_info.py +++ b/plugins/modules/gcp_compute_global_address_info.py @@ -196,7 +196,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_global_forwarding_rule_info.py b/plugins/modules/gcp_compute_global_forwarding_rule_info.py index 57ba3b0..735d622 100644 --- a/plugins/modules/gcp_compute_global_forwarding_rule_info.py +++ b/plugins/modules/gcp_compute_global_forwarding_rule_info.py @@ -280,7 +280,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_health_check.py b/plugins/modules/gcp_compute_health_check.py index 0b70c6e..ca4c642 100644 --- a/plugins/modules/gcp_compute_health_check.py +++ b/plugins/modules/gcp_compute_health_check.py @@ -923,7 +923,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_health_check_info.py b/plugins/modules/gcp_compute_health_check_info.py index e7c3941..b6876f2 100644 --- a/plugins/modules/gcp_compute_health_check_info.py +++ b/plugins/modules/gcp_compute_health_check_info.py @@ -518,7 +518,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_http_health_check.py b/plugins/modules/gcp_compute_http_health_check.py index cee7e5d..ee1bae3 100644 --- a/plugins/modules/gcp_compute_http_health_check.py +++ b/plugins/modules/gcp_compute_http_health_check.py @@ -262,7 +262,7 @@ unhealthyThreshold: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import time diff --git a/plugins/modules/gcp_compute_http_health_check_info.py b/plugins/modules/gcp_compute_http_health_check_info.py index 8c3fe24..547fdc9 100644 --- a/plugins/modules/gcp_compute_http_health_check_info.py +++ b/plugins/modules/gcp_compute_http_health_check_info.py @@ -195,7 +195,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_https_health_check.py b/plugins/modules/gcp_compute_https_health_check.py index d714835..cd38bb1 100644 --- a/plugins/modules/gcp_compute_https_health_check.py +++ b/plugins/modules/gcp_compute_https_health_check.py @@ -259,7 +259,7 @@ unhealthyThreshold: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import time diff --git a/plugins/modules/gcp_compute_https_health_check_info.py b/plugins/modules/gcp_compute_https_health_check_info.py index 42162bb..58af6d4 100644 --- a/plugins/modules/gcp_compute_https_health_check_info.py +++ b/plugins/modules/gcp_compute_https_health_check_info.py @@ -195,7 +195,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_image_info.py b/plugins/modules/gcp_compute_image_info.py index ff16be2..2f1acd1 100644 --- a/plugins/modules/gcp_compute_image_info.py +++ b/plugins/modules/gcp_compute_image_info.py @@ -342,7 +342,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_instance_group_info.py b/plugins/modules/gcp_compute_instance_group_info.py index c290c87..a8d3045 100644 --- a/plugins/modules/gcp_compute_instance_group_info.py +++ b/plugins/modules/gcp_compute_instance_group_info.py @@ -204,7 +204,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_instance_group_manager_info.py b/plugins/modules/gcp_compute_instance_group_manager_info.py index 0936888..16a6e57 100644 --- a/plugins/modules/gcp_compute_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_instance_group_manager_info.py @@ -279,7 +279,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_instance_info.py b/plugins/modules/gcp_compute_instance_info.py index 254d414..e12b957 100644 --- a/plugins/modules/gcp_compute_instance_info.py +++ b/plugins/modules/gcp_compute_instance_info.py @@ -608,7 +608,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( navigate_hash, GcpSession, GcpModule, - GcpRequest, ) import json diff --git a/plugins/modules/gcp_compute_instance_template_info.py b/plugins/modules/gcp_compute_instance_template_info.py index 0c57eef..2d337cf 100644 --- a/plugins/modules/gcp_compute_instance_template_info.py +++ b/plugins/modules/gcp_compute_instance_template_info.py @@ -551,7 +551,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_interconnect_attachment_info.py b/plugins/modules/gcp_compute_interconnect_attachment_info.py index 5b4b05d..20b90be 100644 --- a/plugins/modules/gcp_compute_interconnect_attachment_info.py +++ b/plugins/modules/gcp_compute_interconnect_attachment_info.py @@ -311,7 +311,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_network.py b/plugins/modules/gcp_compute_network.py index 843cb36..e093195 100644 --- a/plugins/modules/gcp_compute_network.py +++ b/plugins/modules/gcp_compute_network.py @@ -246,7 +246,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_network_endpoint_group_info.py b/plugins/modules/gcp_compute_network_endpoint_group_info.py index 4968ad8..b36afb0 100644 --- a/plugins/modules/gcp_compute_network_endpoint_group_info.py +++ b/plugins/modules/gcp_compute_network_endpoint_group_info.py @@ -183,7 +183,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_network_info.py b/plugins/modules/gcp_compute_network_info.py index accf074..7896fac 100644 --- a/plugins/modules/gcp_compute_network_info.py +++ b/plugins/modules/gcp_compute_network_info.py @@ -193,7 +193,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_node_group_info.py b/plugins/modules/gcp_compute_node_group_info.py index 1a883cf..6864c28 100644 --- a/plugins/modules/gcp_compute_node_group_info.py +++ b/plugins/modules/gcp_compute_node_group_info.py @@ -210,7 +210,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_node_template.py b/plugins/modules/gcp_compute_node_template.py index 013cab9..5de307c 100644 --- a/plugins/modules/gcp_compute_node_template.py +++ b/plugins/modules/gcp_compute_node_template.py @@ -287,7 +287,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_compute_node_template_info.py b/plugins/modules/gcp_compute_node_template_info.py index fd343c2..5219bc6 100644 --- a/plugins/modules/gcp_compute_node_template_info.py +++ b/plugins/modules/gcp_compute_node_template_info.py @@ -211,7 +211,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_autoscaler.py b/plugins/modules/gcp_compute_region_autoscaler.py index d7eae16..6d4cca9 100644 --- a/plugins/modules/gcp_compute_region_autoscaler.py +++ b/plugins/modules/gcp_compute_region_autoscaler.py @@ -546,7 +546,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_region_autoscaler_info.py b/plugins/modules/gcp_compute_region_autoscaler_info.py index 0acd6a1..64114af 100644 --- a/plugins/modules/gcp_compute_region_autoscaler_info.py +++ b/plugins/modules/gcp_compute_region_autoscaler_info.py @@ -311,7 +311,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_backend_service_info.py b/plugins/modules/gcp_compute_region_backend_service_info.py index 7c1a2e6..685f48f 100644 --- a/plugins/modules/gcp_compute_region_backend_service_info.py +++ b/plugins/modules/gcp_compute_region_backend_service_info.py @@ -778,7 +778,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_disk.py b/plugins/modules/gcp_compute_region_disk.py index ae04b62..673d925 100644 --- a/plugins/modules/gcp_compute_region_disk.py +++ b/plugins/modules/gcp_compute_region_disk.py @@ -405,7 +405,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_compute_region_disk_info.py b/plugins/modules/gcp_compute_region_disk_info.py index 820ef29..6e70b4d 100644 --- a/plugins/modules/gcp_compute_region_disk_info.py +++ b/plugins/modules/gcp_compute_region_disk_info.py @@ -284,7 +284,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_health_check.py b/plugins/modules/gcp_compute_region_health_check.py index c67bf6f..fcbad21 100644 --- a/plugins/modules/gcp_compute_region_health_check.py +++ b/plugins/modules/gcp_compute_region_health_check.py @@ -929,7 +929,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_compute_region_health_check_info.py b/plugins/modules/gcp_compute_region_health_check_info.py index 24cd440..38b4a7c 100644 --- a/plugins/modules/gcp_compute_region_health_check_info.py +++ b/plugins/modules/gcp_compute_region_health_check_info.py @@ -529,7 +529,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_instance_group_manager_info.py b/plugins/modules/gcp_compute_region_instance_group_manager_info.py index a99e3ff..43816fd 100644 --- a/plugins/modules/gcp_compute_region_instance_group_manager_info.py +++ b/plugins/modules/gcp_compute_region_instance_group_manager_info.py @@ -292,7 +292,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_target_http_proxy_info.py b/plugins/modules/gcp_compute_region_target_http_proxy_info.py index 77852f6..f53beca 100644 --- a/plugins/modules/gcp_compute_region_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_http_proxy_info.py @@ -167,7 +167,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_target_https_proxy_info.py b/plugins/modules/gcp_compute_region_target_https_proxy_info.py index 29fed35..fdb9f99 100644 --- a/plugins/modules/gcp_compute_region_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_region_target_https_proxy_info.py @@ -174,7 +174,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_region_url_map_info.py b/plugins/modules/gcp_compute_region_url_map_info.py index 4fdcfba..3b5cdb7 100644 --- a/plugins/modules/gcp_compute_region_url_map_info.py +++ b/plugins/modules/gcp_compute_region_url_map_info.py @@ -1595,7 +1595,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_reservation.py b/plugins/modules/gcp_compute_reservation.py index 93a5f6a..c0a9dd0 100644 --- a/plugins/modules/gcp_compute_reservation.py +++ b/plugins/modules/gcp_compute_reservation.py @@ -356,7 +356,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_reservation_info.py b/plugins/modules/gcp_compute_reservation_info.py index aa9acf2..ba42f85 100644 --- a/plugins/modules/gcp_compute_reservation_info.py +++ b/plugins/modules/gcp_compute_reservation_info.py @@ -249,7 +249,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_resource_policy.py b/plugins/modules/gcp_compute_resource_policy.py index cfb0043..756685f 100644 --- a/plugins/modules/gcp_compute_resource_policy.py +++ b/plugins/modules/gcp_compute_resource_policy.py @@ -538,7 +538,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_resource_policy_info.py b/plugins/modules/gcp_compute_resource_policy_info.py index 5e6dfd2..545a3bf 100644 --- a/plugins/modules/gcp_compute_resource_policy_info.py +++ b/plugins/modules/gcp_compute_resource_policy_info.py @@ -337,7 +337,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_route_info.py b/plugins/modules/gcp_compute_route_info.py index 4dc7ced..86e9ab4 100644 --- a/plugins/modules/gcp_compute_route_info.py +++ b/plugins/modules/gcp_compute_route_info.py @@ -208,7 +208,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_router_info.py b/plugins/modules/gcp_compute_router_info.py index d847e05..d595d19 100644 --- a/plugins/modules/gcp_compute_router_info.py +++ b/plugins/modules/gcp_compute_router_info.py @@ -213,7 +213,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_snapshot_info.py b/plugins/modules/gcp_compute_snapshot_info.py index cfa1694..26963f3 100644 --- a/plugins/modules/gcp_compute_snapshot_info.py +++ b/plugins/modules/gcp_compute_snapshot_info.py @@ -251,7 +251,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_ssl_certificate.py b/plugins/modules/gcp_compute_ssl_certificate.py index d51055f..d2f4680 100644 --- a/plugins/modules/gcp_compute_ssl_certificate.py +++ b/plugins/modules/gcp_compute_ssl_certificate.py @@ -215,7 +215,7 @@ privateKey: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import time diff --git a/plugins/modules/gcp_compute_ssl_certificate_info.py b/plugins/modules/gcp_compute_ssl_certificate_info.py index 658d532..27b4ce2 100644 --- a/plugins/modules/gcp_compute_ssl_certificate_info.py +++ b/plugins/modules/gcp_compute_ssl_certificate_info.py @@ -162,7 +162,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_ssl_policy.py b/plugins/modules/gcp_compute_ssl_policy.py index d9f0e6d..64a62fd 100644 --- a/plugins/modules/gcp_compute_ssl_policy.py +++ b/plugins/modules/gcp_compute_ssl_policy.py @@ -247,7 +247,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_compute_ssl_policy_info.py b/plugins/modules/gcp_compute_ssl_policy_info.py index a2de79f..04219c8 100644 --- a/plugins/modules/gcp_compute_ssl_policy_info.py +++ b/plugins/modules/gcp_compute_ssl_policy_info.py @@ -198,7 +198,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_subnetwork_info.py b/plugins/modules/gcp_compute_subnetwork_info.py index 0d1870d..5b126f2 100644 --- a/plugins/modules/gcp_compute_subnetwork_info.py +++ b/plugins/modules/gcp_compute_subnetwork_info.py @@ -217,7 +217,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_http_proxy_info.py b/plugins/modules/gcp_compute_target_http_proxy_info.py index cf1228e..6a78af4 100644 --- a/plugins/modules/gcp_compute_target_http_proxy_info.py +++ b/plugins/modules/gcp_compute_target_http_proxy_info.py @@ -162,7 +162,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_https_proxy_info.py b/plugins/modules/gcp_compute_target_https_proxy_info.py index dda7693..b4186a9 100644 --- a/plugins/modules/gcp_compute_target_https_proxy_info.py +++ b/plugins/modules/gcp_compute_target_https_proxy_info.py @@ -184,7 +184,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_instance_info.py b/plugins/modules/gcp_compute_target_instance_info.py index 5bd62e8..791fb0a 100644 --- a/plugins/modules/gcp_compute_target_instance_info.py +++ b/plugins/modules/gcp_compute_target_instance_info.py @@ -169,7 +169,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_pool_info.py b/plugins/modules/gcp_compute_target_pool_info.py index 928de1b..54345a1 100644 --- a/plugins/modules/gcp_compute_target_pool_info.py +++ b/plugins/modules/gcp_compute_target_pool_info.py @@ -215,7 +215,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_ssl_proxy_info.py b/plugins/modules/gcp_compute_target_ssl_proxy_info.py index 6f2158d..e23e841 100644 --- a/plugins/modules/gcp_compute_target_ssl_proxy_info.py +++ b/plugins/modules/gcp_compute_target_ssl_proxy_info.py @@ -174,7 +174,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_tcp_proxy_info.py b/plugins/modules/gcp_compute_target_tcp_proxy_info.py index 58c2717..65cc775 100644 --- a/plugins/modules/gcp_compute_target_tcp_proxy_info.py +++ b/plugins/modules/gcp_compute_target_tcp_proxy_info.py @@ -166,7 +166,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_target_vpn_gateway_info.py b/plugins/modules/gcp_compute_target_vpn_gateway_info.py index f0f7ab6..8d9763b 100644 --- a/plugins/modules/gcp_compute_target_vpn_gateway_info.py +++ b/plugins/modules/gcp_compute_target_vpn_gateway_info.py @@ -177,7 +177,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_url_map_info.py b/plugins/modules/gcp_compute_url_map_info.py index e8e8837..fa5431a 100644 --- a/plugins/modules/gcp_compute_url_map_info.py +++ b/plugins/modules/gcp_compute_url_map_info.py @@ -2478,7 +2478,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_compute_vpn_tunnel_info.py b/plugins/modules/gcp_compute_vpn_tunnel_info.py index ac4f6cc..7b3430a 100644 --- a/plugins/modules/gcp_compute_vpn_tunnel_info.py +++ b/plugins/modules/gcp_compute_vpn_tunnel_info.py @@ -238,7 +238,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_container_cluster.py b/plugins/modules/gcp_container_cluster.py index 0a03999..0a5d949 100644 --- a/plugins/modules/gcp_container_cluster.py +++ b/plugins/modules/gcp_container_cluster.py @@ -1494,7 +1494,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_container_cluster_info.py b/plugins/modules/gcp_container_cluster_info.py index bb9d8f7..0b90433 100644 --- a/plugins/modules/gcp_container_cluster_info.py +++ b/plugins/modules/gcp_container_cluster_info.py @@ -850,7 +850,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_container_node_pool_info.py b/plugins/modules/gcp_container_node_pool_info.py index d990e5b..e27412a 100644 --- a/plugins/modules/gcp_container_node_pool_info.py +++ b/plugins/modules/gcp_container_node_pool_info.py @@ -441,7 +441,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_dns_managed_zone.py b/plugins/modules/gcp_dns_managed_zone.py index 91824e7..83c327a 100644 --- a/plugins/modules/gcp_dns_managed_zone.py +++ b/plugins/modules/gcp_dns_managed_zone.py @@ -483,7 +483,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_dns_managed_zone_info.py b/plugins/modules/gcp_dns_managed_zone_info.py index f23c2f1..333bfce 100644 --- a/plugins/modules/gcp_dns_managed_zone_info.py +++ b/plugins/modules/gcp_dns_managed_zone_info.py @@ -299,7 +299,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_dns_resource_record_set_info.py b/plugins/modules/gcp_dns_resource_record_set_info.py index 48b2bc9..622c310 100644 --- a/plugins/modules/gcp_dns_resource_record_set_info.py +++ b/plugins/modules/gcp_dns_resource_record_set_info.py @@ -151,7 +151,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_filestore_instance.py b/plugins/modules/gcp_filestore_instance.py index 4cd602b..7895f9c 100644 --- a/plugins/modules/gcp_filestore_instance.py +++ b/plugins/modules/gcp_filestore_instance.py @@ -294,7 +294,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_filestore_instance_info.py b/plugins/modules/gcp_filestore_instance_info.py index fa7d118..55ab27c 100644 --- a/plugins/modules/gcp_filestore_instance_info.py +++ b/plugins/modules/gcp_filestore_instance_info.py @@ -204,7 +204,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_iam_role.py b/plugins/modules/gcp_iam_role.py index 04248ba..8af62c8 100644 --- a/plugins/modules/gcp_iam_role.py +++ b/plugins/modules/gcp_iam_role.py @@ -183,7 +183,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpSession, GcpModule, GcpRequest, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_iam_role_info.py b/plugins/modules/gcp_iam_role_info.py index c88bdf9..35874cc 100644 --- a/plugins/modules/gcp_iam_role_info.py +++ b/plugins/modules/gcp_iam_role_info.py @@ -147,7 +147,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_iam_service_account.py b/plugins/modules/gcp_iam_service_account.py index dc27174..d93db04 100644 --- a/plugins/modules/gcp_iam_service_account.py +++ b/plugins/modules/gcp_iam_service_account.py @@ -150,7 +150,7 @@ oauth2ClientId: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_iam_service_account_info.py b/plugins/modules/gcp_iam_service_account_info.py index 9b045f2..b201718 100644 --- a/plugins/modules/gcp_iam_service_account_info.py +++ b/plugins/modules/gcp_iam_service_account_info.py @@ -146,7 +146,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_iam_service_account_key.py b/plugins/modules/gcp_iam_service_account_key.py index 7ada408..a34718d 100644 --- a/plugins/modules/gcp_iam_service_account_key.py +++ b/plugins/modules/gcp_iam_service_account_key.py @@ -205,12 +205,10 @@ path: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict from ansible.module_utils._text import to_native import json import os -import mimetypes -import hashlib import base64 ################################################################################ diff --git a/plugins/modules/gcp_kms_crypto_key.py b/plugins/modules/gcp_kms_crypto_key.py index 1d69966..40bfae9 100644 --- a/plugins/modules/gcp_kms_crypto_key.py +++ b/plugins/modules/gcp_kms_crypto_key.py @@ -265,7 +265,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_kms_crypto_key_info.py b/plugins/modules/gcp_kms_crypto_key_info.py index 9337f5e..bc40b48 100644 --- a/plugins/modules/gcp_kms_crypto_key_info.py +++ b/plugins/modules/gcp_kms_crypto_key_info.py @@ -189,7 +189,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_kms_key_ring.py b/plugins/modules/gcp_kms_key_ring.py index 4c2b0bf..7f70faa 100644 --- a/plugins/modules/gcp_kms_key_ring.py +++ b/plugins/modules/gcp_kms_key_ring.py @@ -154,7 +154,7 @@ location: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json ################################################################################ diff --git a/plugins/modules/gcp_kms_key_ring_info.py b/plugins/modules/gcp_kms_key_ring_info.py index 5b7ba43..39d3de9 100644 --- a/plugins/modules/gcp_kms_key_ring_info.py +++ b/plugins/modules/gcp_kms_key_ring_info.py @@ -142,7 +142,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_logging_metric.py b/plugins/modules/gcp_logging_metric.py index 88d3dc2..f897324 100644 --- a/plugins/modules/gcp_logging_metric.py +++ b/plugins/modules/gcp_logging_metric.py @@ -501,7 +501,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json diff --git a/plugins/modules/gcp_logging_metric_info.py b/plugins/modules/gcp_logging_metric_info.py index 244784b..76c323c 100644 --- a/plugins/modules/gcp_logging_metric_info.py +++ b/plugins/modules/gcp_logging_metric_info.py @@ -293,7 +293,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_mlengine_model.py b/plugins/modules/gcp_mlengine_model.py index f807037..e3edaac 100644 --- a/plugins/modules/gcp_mlengine_model.py +++ b/plugins/modules/gcp_mlengine_model.py @@ -224,7 +224,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_mlengine_model_info.py b/plugins/modules/gcp_mlengine_model_info.py index e82c175..11f28ae 100644 --- a/plugins/modules/gcp_mlengine_model_info.py +++ b/plugins/modules/gcp_mlengine_model_info.py @@ -160,7 +160,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_mlengine_version_info.py b/plugins/modules/gcp_mlengine_version_info.py index 9f8e945..ecf9281 100644 --- a/plugins/modules/gcp_mlengine_version_info.py +++ b/plugins/modules/gcp_mlengine_version_info.py @@ -251,7 +251,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_pubsub_subscription_info.py b/plugins/modules/gcp_pubsub_subscription_info.py index e9541ed..b911131 100644 --- a/plugins/modules/gcp_pubsub_subscription_info.py +++ b/plugins/modules/gcp_pubsub_subscription_info.py @@ -324,7 +324,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_pubsub_topic.py b/plugins/modules/gcp_pubsub_topic.py index 47968e4..28fdb08 100644 --- a/plugins/modules/gcp_pubsub_topic.py +++ b/plugins/modules/gcp_pubsub_topic.py @@ -239,7 +239,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_pubsub_topic_info.py b/plugins/modules/gcp_pubsub_topic_info.py index c4cccf7..0dc6f4e 100644 --- a/plugins/modules/gcp_pubsub_topic_info.py +++ b/plugins/modules/gcp_pubsub_topic_info.py @@ -171,7 +171,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_redis_instance.py b/plugins/modules/gcp_redis_instance.py index 285a663..ac8724a 100644 --- a/plugins/modules/gcp_redis_instance.py +++ b/plugins/modules/gcp_redis_instance.py @@ -408,7 +408,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_redis_instance_info.py b/plugins/modules/gcp_redis_instance_info.py index 349778f..33a9241 100644 --- a/plugins/modules/gcp_redis_instance_info.py +++ b/plugins/modules/gcp_redis_instance_info.py @@ -282,7 +282,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index 51f1a37..cd2d099 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -220,7 +220,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_resourcemanager_project_info.py b/plugins/modules/gcp_resourcemanager_project_info.py index bd06067..7d97829 100644 --- a/plugins/modules/gcp_resourcemanager_project_info.py +++ b/plugins/modules/gcp_resourcemanager_project_info.py @@ -179,7 +179,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_runtimeconfig_config.py b/plugins/modules/gcp_runtimeconfig_config.py index 6f386f9..6fe439e 100644 --- a/plugins/modules/gcp_runtimeconfig_config.py +++ b/plugins/modules/gcp_runtimeconfig_config.py @@ -131,7 +131,7 @@ name: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import re diff --git a/plugins/modules/gcp_runtimeconfig_config_info.py b/plugins/modules/gcp_runtimeconfig_config_info.py index 154896a..063c1ce 100644 --- a/plugins/modules/gcp_runtimeconfig_config_info.py +++ b/plugins/modules/gcp_runtimeconfig_config_info.py @@ -126,7 +126,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_runtimeconfig_variable.py b/plugins/modules/gcp_runtimeconfig_variable.py index 9e922c1..8da8732 100644 --- a/plugins/modules/gcp_runtimeconfig_variable.py +++ b/plugins/modules/gcp_runtimeconfig_variable.py @@ -161,7 +161,7 @@ config: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import re diff --git a/plugins/modules/gcp_runtimeconfig_variable_info.py b/plugins/modules/gcp_runtimeconfig_variable_info.py index c786cb1..ec1adb9 100644 --- a/plugins/modules/gcp_runtimeconfig_variable_info.py +++ b/plugins/modules/gcp_runtimeconfig_variable_info.py @@ -142,7 +142,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_serviceusage_service.py b/plugins/modules/gcp_serviceusage_service.py index 58e26c6..221f7b6 100644 --- a/plugins/modules/gcp_serviceusage_service.py +++ b/plugins/modules/gcp_serviceusage_service.py @@ -193,7 +193,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import re diff --git a/plugins/modules/gcp_serviceusage_service_info.py b/plugins/modules/gcp_serviceusage_service_info.py index e18a7ac..1c49512 100644 --- a/plugins/modules/gcp_serviceusage_service_info.py +++ b/plugins/modules/gcp_serviceusage_service_info.py @@ -169,7 +169,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_sourcerepo_repository.py b/plugins/modules/gcp_sourcerepo_repository.py index c1f8486..178cee8 100644 --- a/plugins/modules/gcp_sourcerepo_repository.py +++ b/plugins/modules/gcp_sourcerepo_repository.py @@ -148,7 +148,7 @@ size: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import re diff --git a/plugins/modules/gcp_sourcerepo_repository_info.py b/plugins/modules/gcp_sourcerepo_repository_info.py index 5c8387f..4a0d809 100644 --- a/plugins/modules/gcp_sourcerepo_repository_info.py +++ b/plugins/modules/gcp_sourcerepo_repository_info.py @@ -133,7 +133,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_spanner_database_info.py b/plugins/modules/gcp_spanner_database_info.py index 589198d..2f45553 100644 --- a/plugins/modules/gcp_spanner_database_info.py +++ b/plugins/modules/gcp_spanner_database_info.py @@ -158,7 +158,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_spanner_instance.py b/plugins/modules/gcp_spanner_instance.py index fce17d8..deb212f 100644 --- a/plugins/modules/gcp_spanner_instance.py +++ b/plugins/modules/gcp_spanner_instance.py @@ -209,7 +209,7 @@ labels: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import time diff --git a/plugins/modules/gcp_spanner_instance_info.py b/plugins/modules/gcp_spanner_instance_info.py index 5488691..90e25dd 100644 --- a/plugins/modules/gcp_spanner_instance_info.py +++ b/plugins/modules/gcp_spanner_instance_info.py @@ -156,7 +156,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_sql_database.py b/plugins/modules/gcp_sql_database.py index 99fc423..685ffee 100644 --- a/plugins/modules/gcp_sql_database.py +++ b/plugins/modules/gcp_sql_database.py @@ -181,7 +181,7 @@ instance: # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest import json import time diff --git a/plugins/modules/gcp_sql_database_info.py b/plugins/modules/gcp_sql_database_info.py index f2267b1..dfc9bc9 100644 --- a/plugins/modules/gcp_sql_database_info.py +++ b/plugins/modules/gcp_sql_database_info.py @@ -149,7 +149,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_sql_instance.py b/plugins/modules/gcp_sql_instance.py index b43ad29..9f18a2f 100644 --- a/plugins/modules/gcp_sql_instance.py +++ b/plugins/modules/gcp_sql_instance.py @@ -814,7 +814,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_sql_instance_info.py b/plugins/modules/gcp_sql_instance_info.py index 3e14f27..afbc7c3 100644 --- a/plugins/modules/gcp_sql_instance_info.py +++ b/plugins/modules/gcp_sql_instance_info.py @@ -510,7 +510,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ diff --git a/plugins/modules/gcp_sql_user_info.py b/plugins/modules/gcp_sql_user_info.py index 948808d..762a735 100644 --- a/plugins/modules/gcp_sql_user_info.py +++ b/plugins/modules/gcp_sql_user_info.py @@ -149,7 +149,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, replace_resource_dict import json ################################################################################ diff --git a/plugins/modules/gcp_storage_object.py b/plugins/modules/gcp_storage_object.py index f6fcb01..1411d0f 100644 --- a/plugins/modules/gcp_storage_object.py +++ b/plugins/modules/gcp_storage_object.py @@ -151,17 +151,10 @@ storage_class: ################################################################################ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( - navigate_hash, GcpSession, GcpModule, - GcpRequest, - replace_resource_dict, ) -import json import os -import mimetypes -import hashlib -import base64 try: import google.cloud diff --git a/plugins/modules/gcp_tpu_node.py b/plugins/modules/gcp_tpu_node.py index d5c6289..32d599e 100644 --- a/plugins/modules/gcp_tpu_node.py +++ b/plugins/modules/gcp_tpu_node.py @@ -297,7 +297,6 @@ from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import ( GcpModule, GcpRequest, remove_nones_from_dict, - replace_resource_dict, ) import json import time diff --git a/plugins/modules/gcp_tpu_node_info.py b/plugins/modules/gcp_tpu_node_info.py index 60c81b7..a01d08a 100644 --- a/plugins/modules/gcp_tpu_node_info.py +++ b/plugins/modules/gcp_tpu_node_info.py @@ -218,7 +218,7 @@ resources: ################################################################################ # Imports ################################################################################ -from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest +from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule import json ################################################################################ From 2ca4eccc78a82d3abe17acf99439729509c19991 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Tue, 21 Nov 2023 09:39:11 -0800 Subject: [PATCH 114/138] chore: return service_usage test to unsupported due to quota enforcement --- tests/integration/targets/gcp_serviceusage_service/aliases | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/targets/gcp_serviceusage_service/aliases b/tests/integration/targets/gcp_serviceusage_service/aliases index 26507c2..9812f01 100644 --- a/tests/integration/targets/gcp_serviceusage_service/aliases +++ b/tests/integration/targets/gcp_serviceusage_service/aliases @@ -1 +1,2 @@ cloud/gcp +unsupported From 913cafddde513e8e4ebdf83f174a3e3db31d46bf Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Wed, 22 Nov 2023 13:25:01 -0800 Subject: [PATCH 115/138] Upgrade galaxy version to 1.3; update changelog --- .gitignore | 1 + CHANGELOG.rst | 16 + changelogs/.plugin-cache.yaml | 874 ------------------ changelogs/changelog.yaml | 87 +- changelogs/fragments/app-default-creds.yml | 3 - .../fragments/gcp_serviceusage_service.yml | 4 - changelogs/fragments/gcp_sql_ssl_cert.yml | 3 - .../gcp_storage_default_object_acl.yml | 3 - changelogs/fragments/upgrade-versions.yml | 6 - galaxy.yml | 4 +- 10 files changed, 76 insertions(+), 925 deletions(-) delete mode 100644 changelogs/.plugin-cache.yaml delete mode 100644 changelogs/fragments/app-default-creds.yml delete mode 100644 changelogs/fragments/gcp_serviceusage_service.yml delete mode 100644 changelogs/fragments/gcp_sql_ssl_cert.yml delete mode 100644 changelogs/fragments/gcp_storage_default_object_acl.yml delete mode 100644 changelogs/fragments/upgrade-versions.yml diff --git a/.gitignore b/.gitignore index d1aae87..e7a7d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ tests/output/ __pycache__ *.tar.gz venv/ +changelogs/.plugin-cache.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9bc9c27..663a9ab 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,22 @@ Google.Cloud Release Notes .. contents:: Topics +v1.3.0 +====== + +Minor Changes +------------- + +- anisble-test - integration tests are now run against 2.14.0 and 2.15.0 +- ansible - 2.14.0 is now the minimum version supported +- ansible-lint - fixed over a thousand reported errors +- ansible-lint - upgraded to 6.22 +- ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). +- gcp_serviceusage_service - added backoff when checking for operation completion. +- gcp_serviceusage_service - use alloyb API for the integration test as spanner conflicts with other tests +- gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource creation +- gcp_storage_default_object_acl - removed non-existent fields; the resource is not usable. + v1.2.0 ====== diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml deleted file mode 100644 index d7f9cec..0000000 --- a/changelogs/.plugin-cache.yaml +++ /dev/null @@ -1,874 +0,0 @@ ---- -objects: - role: {} -plugins: - become: {} - cache: {} - callback: {} - cliconf: {} - connection: {} - filter: {} - httpapi: {} - inventory: - gcp_compute: - description: Google Cloud Compute Engine inventory source - name: gcp_compute - version_added: - lookup: {} - module: - gcp_appengine_firewall_rule: - description: Creates a GCP FirewallRule - name: gcp_appengine_firewall_rule - namespace: "" - version_added: - gcp_appengine_firewall_rule_info: - description: Gather info for GCP FirewallRule - name: gcp_appengine_firewall_rule_info - namespace: "" - version_added: - gcp_bigquery_dataset: - description: Creates a GCP Dataset - name: gcp_bigquery_dataset - namespace: "" - version_added: - gcp_bigquery_dataset_info: - description: Gather info for GCP Dataset - name: gcp_bigquery_dataset_info - namespace: "" - version_added: - gcp_bigquery_table: - description: Creates a GCP Table - name: gcp_bigquery_table - namespace: "" - version_added: - gcp_bigquery_table_info: - description: Gather info for GCP Table - name: gcp_bigquery_table_info - namespace: "" - version_added: - gcp_bigtable_instance: - description: Creates a GCP Instance - name: gcp_bigtable_instance - namespace: "" - version_added: - gcp_bigtable_instance_info: - description: Gather info for GCP Instance - name: gcp_bigtable_instance_info - namespace: "" - version_added: - gcp_cloudbuild_trigger: - description: Creates a GCP Trigger - name: gcp_cloudbuild_trigger - namespace: "" - version_added: - gcp_cloudbuild_trigger_info: - description: Gather info for GCP Trigger - name: gcp_cloudbuild_trigger_info - namespace: "" - version_added: - gcp_cloudfunctions_cloud_function: - description: Creates a GCP CloudFunction - name: gcp_cloudfunctions_cloud_function - namespace: "" - version_added: - gcp_cloudfunctions_cloud_function_info: - description: Gather info for GCP CloudFunction - name: gcp_cloudfunctions_cloud_function_info - namespace: "" - version_added: - gcp_cloudscheduler_job: - description: Creates a GCP Job - name: gcp_cloudscheduler_job - namespace: "" - version_added: - gcp_cloudscheduler_job_info: - description: Gather info for GCP Job - name: gcp_cloudscheduler_job_info - namespace: "" - version_added: - gcp_cloudtasks_queue: - description: Creates a GCP Queue - name: gcp_cloudtasks_queue - namespace: "" - version_added: - gcp_cloudtasks_queue_info: - description: Gather info for GCP Queue - name: gcp_cloudtasks_queue_info - namespace: "" - version_added: - gcp_compute_address: - description: Creates a GCP Address - name: gcp_compute_address - namespace: "" - version_added: - gcp_compute_address_info: - description: Gather info for GCP Address - name: gcp_compute_address_info - namespace: "" - version_added: - gcp_compute_autoscaler: - description: Creates a GCP Autoscaler - name: gcp_compute_autoscaler - namespace: "" - version_added: - gcp_compute_autoscaler_info: - description: Gather info for GCP Autoscaler - name: gcp_compute_autoscaler_info - namespace: "" - version_added: - gcp_compute_backend_bucket: - description: Creates a GCP BackendBucket - name: gcp_compute_backend_bucket - namespace: "" - version_added: - gcp_compute_backend_bucket_info: - description: Gather info for GCP BackendBucket - name: gcp_compute_backend_bucket_info - namespace: "" - version_added: - gcp_compute_backend_service: - description: Creates a GCP BackendService - name: gcp_compute_backend_service - namespace: "" - version_added: - gcp_compute_backend_service_info: - description: Gather info for GCP BackendService - name: gcp_compute_backend_service_info - namespace: "" - version_added: - gcp_compute_disk: - description: Creates a GCP Disk - name: gcp_compute_disk - namespace: "" - version_added: - gcp_compute_disk_info: - description: Gather info for GCP Disk - name: gcp_compute_disk_info - namespace: "" - version_added: - gcp_compute_external_vpn_gateway: - description: Creates a GCP ExternalVpnGateway - name: gcp_compute_external_vpn_gateway - namespace: "" - version_added: - gcp_compute_external_vpn_gateway_info: - description: Gather info for GCP ExternalVpnGateway - name: gcp_compute_external_vpn_gateway_info - namespace: "" - version_added: - gcp_compute_firewall: - description: Creates a GCP Firewall - name: gcp_compute_firewall - namespace: "" - version_added: - gcp_compute_firewall_info: - description: Gather info for GCP Firewall - name: gcp_compute_firewall_info - namespace: "" - version_added: - gcp_compute_forwarding_rule: - description: Creates a GCP ForwardingRule - name: gcp_compute_forwarding_rule - namespace: "" - version_added: - gcp_compute_forwarding_rule_info: - description: Gather info for GCP ForwardingRule - name: gcp_compute_forwarding_rule_info - namespace: "" - version_added: - gcp_compute_global_address: - description: Creates a GCP GlobalAddress - name: gcp_compute_global_address - namespace: "" - version_added: - gcp_compute_global_address_info: - description: Gather info for GCP GlobalAddress - name: gcp_compute_global_address_info - namespace: "" - version_added: - gcp_compute_global_forwarding_rule: - description: Creates a GCP GlobalForwardingRule - name: gcp_compute_global_forwarding_rule - namespace: "" - version_added: - gcp_compute_global_forwarding_rule_info: - description: Gather info for GCP GlobalForwardingRule - name: gcp_compute_global_forwarding_rule_info - namespace: "" - version_added: - gcp_compute_health_check: - description: Creates a GCP HealthCheck - name: gcp_compute_health_check - namespace: "" - version_added: - gcp_compute_health_check_info: - description: Gather info for GCP HealthCheck - name: gcp_compute_health_check_info - namespace: "" - version_added: - gcp_compute_http_health_check: - description: Creates a GCP HttpHealthCheck - name: gcp_compute_http_health_check - namespace: "" - version_added: - gcp_compute_http_health_check_info: - description: Gather info for GCP HttpHealthCheck - name: gcp_compute_http_health_check_info - namespace: "" - version_added: - gcp_compute_https_health_check: - description: Creates a GCP HttpsHealthCheck - name: gcp_compute_https_health_check - namespace: "" - version_added: - gcp_compute_https_health_check_info: - description: Gather info for GCP HttpsHealthCheck - name: gcp_compute_https_health_check_info - namespace: "" - version_added: - gcp_compute_image: - description: Creates a GCP Image - name: gcp_compute_image - namespace: "" - version_added: - gcp_compute_image_info: - description: Gather info for GCP Image - name: gcp_compute_image_info - namespace: "" - version_added: - gcp_compute_instance: - description: Creates a GCP Instance - name: gcp_compute_instance - namespace: "" - version_added: - gcp_compute_instance_group: - description: Creates a GCP InstanceGroup - name: gcp_compute_instance_group - namespace: "" - version_added: - gcp_compute_instance_group_info: - description: Gather info for GCP InstanceGroup - name: gcp_compute_instance_group_info - namespace: "" - version_added: - gcp_compute_instance_group_manager: - description: Creates a GCP InstanceGroupManager - name: gcp_compute_instance_group_manager - namespace: "" - version_added: - gcp_compute_instance_group_manager_info: - description: Gather info for GCP InstanceGroupManager - name: gcp_compute_instance_group_manager_info - namespace: "" - version_added: - gcp_compute_instance_info: - description: Gather info for GCP Instance - name: gcp_compute_instance_info - namespace: "" - version_added: - gcp_compute_instance_template: - description: Creates a GCP InstanceTemplate - name: gcp_compute_instance_template - namespace: "" - version_added: - gcp_compute_instance_template_info: - description: Gather info for GCP InstanceTemplate - name: gcp_compute_instance_template_info - namespace: "" - version_added: - gcp_compute_interconnect_attachment: - description: Creates a GCP InterconnectAttachment - name: gcp_compute_interconnect_attachment - namespace: "" - version_added: - gcp_compute_interconnect_attachment_info: - description: Gather info for GCP InterconnectAttachment - name: gcp_compute_interconnect_attachment_info - namespace: "" - version_added: - gcp_compute_network: - description: Creates a GCP Network - name: gcp_compute_network - namespace: "" - version_added: - gcp_compute_network_endpoint_group: - description: Creates a GCP NetworkEndpointGroup - name: gcp_compute_network_endpoint_group - namespace: "" - version_added: - gcp_compute_network_endpoint_group_info: - description: Gather info for GCP NetworkEndpointGroup - name: gcp_compute_network_endpoint_group_info - namespace: "" - version_added: - gcp_compute_network_info: - description: Gather info for GCP Network - name: gcp_compute_network_info - namespace: "" - version_added: - gcp_compute_node_group: - description: Creates a GCP NodeGroup - name: gcp_compute_node_group - namespace: "" - version_added: - gcp_compute_node_group_info: - description: Gather info for GCP NodeGroup - name: gcp_compute_node_group_info - namespace: "" - version_added: - gcp_compute_node_template: - description: Creates a GCP NodeTemplate - name: gcp_compute_node_template - namespace: "" - version_added: - gcp_compute_node_template_info: - description: Gather info for GCP NodeTemplate - name: gcp_compute_node_template_info - namespace: "" - version_added: - gcp_compute_region_autoscaler: - description: Creates a GCP RegionAutoscaler - name: gcp_compute_region_autoscaler - namespace: "" - version_added: - gcp_compute_region_autoscaler_info: - description: Gather info for GCP RegionAutoscaler - name: gcp_compute_region_autoscaler_info - namespace: "" - version_added: - gcp_compute_region_backend_service: - description: Creates a GCP RegionBackendService - name: gcp_compute_region_backend_service - namespace: "" - version_added: - gcp_compute_region_backend_service_info: - description: Gather info for GCP RegionBackendService - name: gcp_compute_region_backend_service_info - namespace: "" - version_added: - gcp_compute_region_disk: - description: Creates a GCP RegionDisk - name: gcp_compute_region_disk - namespace: "" - version_added: - gcp_compute_region_disk_info: - description: Gather info for GCP RegionDisk - name: gcp_compute_region_disk_info - namespace: "" - version_added: - gcp_compute_region_health_check: - description: Creates a GCP RegionHealthCheck - name: gcp_compute_region_health_check - namespace: "" - version_added: - gcp_compute_region_health_check_info: - description: Gather info for GCP RegionHealthCheck - name: gcp_compute_region_health_check_info - namespace: "" - version_added: - gcp_compute_region_instance_group_manager: - description: Creates a GCP RegionInstanceGroupManager - name: gcp_compute_region_instance_group_manager - namespace: "" - version_added: - gcp_compute_region_instance_group_manager_info: - description: Gather info for GCP RegionInstanceGroupManager - name: gcp_compute_region_instance_group_manager_info - namespace: "" - version_added: - gcp_compute_region_target_http_proxy: - description: Creates a GCP RegionTargetHttpProxy - name: gcp_compute_region_target_http_proxy - namespace: "" - version_added: - gcp_compute_region_target_http_proxy_info: - description: Gather info for GCP RegionTargetHttpProxy - name: gcp_compute_region_target_http_proxy_info - namespace: "" - version_added: - gcp_compute_region_target_https_proxy: - description: Creates a GCP RegionTargetHttpsProxy - name: gcp_compute_region_target_https_proxy - namespace: "" - version_added: - gcp_compute_region_target_https_proxy_info: - description: Gather info for GCP RegionTargetHttpsProxy - name: gcp_compute_region_target_https_proxy_info - namespace: "" - version_added: - gcp_compute_region_url_map: - description: Creates a GCP RegionUrlMap - name: gcp_compute_region_url_map - namespace: "" - version_added: - gcp_compute_region_url_map_info: - description: Gather info for GCP RegionUrlMap - name: gcp_compute_region_url_map_info - namespace: "" - version_added: - gcp_compute_reservation: - description: Creates a GCP Reservation - name: gcp_compute_reservation - namespace: "" - version_added: - gcp_compute_reservation_info: - description: Gather info for GCP Reservation - name: gcp_compute_reservation_info - namespace: "" - version_added: - gcp_compute_resource_policy: - description: Creates a GCP ResourcePolicy - name: gcp_compute_resource_policy - namespace: "" - version_added: - gcp_compute_resource_policy_info: - description: Gather info for GCP ResourcePolicy - name: gcp_compute_resource_policy_info - namespace: "" - version_added: - gcp_compute_route: - description: Creates a GCP Route - name: gcp_compute_route - namespace: "" - version_added: - gcp_compute_route_info: - description: Gather info for GCP Route - name: gcp_compute_route_info - namespace: "" - version_added: - gcp_compute_router: - description: Creates a GCP Router - name: gcp_compute_router - namespace: "" - version_added: - gcp_compute_router_info: - description: Gather info for GCP Router - name: gcp_compute_router_info - namespace: "" - version_added: - gcp_compute_snapshot: - description: Creates a GCP Snapshot - name: gcp_compute_snapshot - namespace: "" - version_added: - gcp_compute_snapshot_info: - description: Gather info for GCP Snapshot - name: gcp_compute_snapshot_info - namespace: "" - version_added: - gcp_compute_ssl_certificate: - description: Creates a GCP SslCertificate - name: gcp_compute_ssl_certificate - namespace: "" - version_added: - gcp_compute_ssl_certificate_info: - description: Gather info for GCP SslCertificate - name: gcp_compute_ssl_certificate_info - namespace: "" - version_added: - gcp_compute_ssl_policy: - description: Creates a GCP SslPolicy - name: gcp_compute_ssl_policy - namespace: "" - version_added: - gcp_compute_ssl_policy_info: - description: Gather info for GCP SslPolicy - name: gcp_compute_ssl_policy_info - namespace: "" - version_added: - gcp_compute_subnetwork: - description: Creates a GCP Subnetwork - name: gcp_compute_subnetwork - namespace: "" - version_added: - gcp_compute_subnetwork_info: - description: Gather info for GCP Subnetwork - name: gcp_compute_subnetwork_info - namespace: "" - version_added: - gcp_compute_target_http_proxy: - description: Creates a GCP TargetHttpProxy - name: gcp_compute_target_http_proxy - namespace: "" - version_added: - gcp_compute_target_http_proxy_info: - description: Gather info for GCP TargetHttpProxy - name: gcp_compute_target_http_proxy_info - namespace: "" - version_added: - gcp_compute_target_https_proxy: - description: Creates a GCP TargetHttpsProxy - name: gcp_compute_target_https_proxy - namespace: "" - version_added: - gcp_compute_target_https_proxy_info: - description: Gather info for GCP TargetHttpsProxy - name: gcp_compute_target_https_proxy_info - namespace: "" - version_added: - gcp_compute_target_instance: - description: Creates a GCP TargetInstance - name: gcp_compute_target_instance - namespace: "" - version_added: - gcp_compute_target_instance_info: - description: Gather info for GCP TargetInstance - name: gcp_compute_target_instance_info - namespace: "" - version_added: - gcp_compute_target_pool: - description: Creates a GCP TargetPool - name: gcp_compute_target_pool - namespace: "" - version_added: - gcp_compute_target_pool_info: - description: Gather info for GCP TargetPool - name: gcp_compute_target_pool_info - namespace: "" - version_added: - gcp_compute_target_ssl_proxy: - description: Creates a GCP TargetSslProxy - name: gcp_compute_target_ssl_proxy - namespace: "" - version_added: - gcp_compute_target_ssl_proxy_info: - description: Gather info for GCP TargetSslProxy - name: gcp_compute_target_ssl_proxy_info - namespace: "" - version_added: - gcp_compute_target_tcp_proxy: - description: Creates a GCP TargetTcpProxy - name: gcp_compute_target_tcp_proxy - namespace: "" - version_added: - gcp_compute_target_tcp_proxy_info: - description: Gather info for GCP TargetTcpProxy - name: gcp_compute_target_tcp_proxy_info - namespace: "" - version_added: - gcp_compute_target_vpn_gateway: - description: Creates a GCP TargetVpnGateway - name: gcp_compute_target_vpn_gateway - namespace: "" - version_added: - gcp_compute_target_vpn_gateway_info: - description: Gather info for GCP TargetVpnGateway - name: gcp_compute_target_vpn_gateway_info - namespace: "" - version_added: - gcp_compute_url_map: - description: Creates a GCP UrlMap - name: gcp_compute_url_map - namespace: "" - version_added: - gcp_compute_url_map_info: - description: Gather info for GCP UrlMap - name: gcp_compute_url_map_info - namespace: "" - version_added: - gcp_compute_vpn_tunnel: - description: Creates a GCP VpnTunnel - name: gcp_compute_vpn_tunnel - namespace: "" - version_added: - gcp_compute_vpn_tunnel_info: - description: Gather info for GCP VpnTunnel - name: gcp_compute_vpn_tunnel_info - namespace: "" - version_added: - gcp_container_cluster: - description: Creates a GCP Cluster - name: gcp_container_cluster - namespace: "" - version_added: - gcp_container_cluster_info: - description: Gather info for GCP Cluster - name: gcp_container_cluster_info - namespace: "" - version_added: - gcp_container_node_pool: - description: Creates a GCP NodePool - name: gcp_container_node_pool - namespace: "" - version_added: - gcp_container_node_pool_info: - description: Gather info for GCP NodePool - name: gcp_container_node_pool_info - namespace: "" - version_added: - gcp_dns_managed_zone: - description: Creates a GCP ManagedZone - name: gcp_dns_managed_zone - namespace: "" - version_added: - gcp_dns_managed_zone_info: - description: Gather info for GCP ManagedZone - name: gcp_dns_managed_zone_info - namespace: "" - version_added: - gcp_dns_resource_record_set: - description: Creates a GCP ResourceRecordSet - name: gcp_dns_resource_record_set - namespace: "" - version_added: - gcp_dns_resource_record_set_info: - description: Gather info for GCP ResourceRecordSet - name: gcp_dns_resource_record_set_info - namespace: "" - version_added: - gcp_filestore_instance: - description: Creates a GCP Instance - name: gcp_filestore_instance - namespace: "" - version_added: - gcp_filestore_instance_info: - description: Gather info for GCP Instance - name: gcp_filestore_instance_info - namespace: "" - version_added: - gcp_iam_role: - description: Creates a GCP Role - name: gcp_iam_role - namespace: "" - version_added: - gcp_iam_role_info: - description: Gather info for GCP Role - name: gcp_iam_role_info - namespace: "" - version_added: - gcp_iam_service_account: - description: Creates a GCP ServiceAccount - name: gcp_iam_service_account - namespace: "" - version_added: - gcp_iam_service_account_info: - description: Gather info for GCP ServiceAccount - name: gcp_iam_service_account_info - namespace: "" - version_added: - gcp_iam_service_account_key: - description: Creates a GCP ServiceAccountKey - name: gcp_iam_service_account_key - namespace: "" - version_added: - gcp_kms_crypto_key: - description: Creates a GCP CryptoKey - name: gcp_kms_crypto_key - namespace: "" - version_added: - gcp_kms_crypto_key_info: - description: Gather info for GCP CryptoKey - name: gcp_kms_crypto_key_info - namespace: "" - version_added: - gcp_kms_key_ring: - description: Creates a GCP KeyRing - name: gcp_kms_key_ring - namespace: "" - version_added: - gcp_kms_key_ring_info: - description: Gather info for GCP KeyRing - name: gcp_kms_key_ring_info - namespace: "" - version_added: - gcp_logging_metric: - description: Creates a GCP Metric - name: gcp_logging_metric - namespace: "" - version_added: - gcp_logging_metric_info: - description: Gather info for GCP Metric - name: gcp_logging_metric_info - namespace: "" - version_added: - gcp_mlengine_model: - description: Creates a GCP Model - name: gcp_mlengine_model - namespace: "" - version_added: - gcp_mlengine_model_info: - description: Gather info for GCP Model - name: gcp_mlengine_model_info - namespace: "" - version_added: - gcp_mlengine_version: - description: Creates a GCP Version - name: gcp_mlengine_version - namespace: "" - version_added: - gcp_mlengine_version_info: - description: Gather info for GCP Version - name: gcp_mlengine_version_info - namespace: "" - version_added: - gcp_pubsub_subscription: - description: Creates a GCP Subscription - name: gcp_pubsub_subscription - namespace: "" - version_added: - gcp_pubsub_subscription_info: - description: Gather info for GCP Subscription - name: gcp_pubsub_subscription_info - namespace: "" - version_added: - gcp_pubsub_topic: - description: Creates a GCP Topic - name: gcp_pubsub_topic - namespace: "" - version_added: - gcp_pubsub_topic_info: - description: Gather info for GCP Topic - name: gcp_pubsub_topic_info - namespace: "" - version_added: - gcp_redis_instance: - description: Creates a GCP Instance - name: gcp_redis_instance - namespace: "" - version_added: - gcp_redis_instance_info: - description: Gather info for GCP Instance - name: gcp_redis_instance_info - namespace: "" - version_added: - gcp_resourcemanager_project: - description: Creates a GCP Project - name: gcp_resourcemanager_project - namespace: "" - version_added: - gcp_resourcemanager_project_info: - description: Gather info for GCP Project - name: gcp_resourcemanager_project_info - namespace: "" - version_added: - gcp_runtimeconfig_config: - description: Creates a GCP Config - name: gcp_runtimeconfig_config - namespace: "" - version_added: - gcp_runtimeconfig_config_info: - description: Gather info for GCP Config - name: gcp_runtimeconfig_config_info - namespace: "" - version_added: - gcp_runtimeconfig_variable: - description: Creates a GCP Variable - name: gcp_runtimeconfig_variable - namespace: "" - version_added: - gcp_runtimeconfig_variable_info: - description: Gather info for GCP Variable - name: gcp_runtimeconfig_variable_info - namespace: "" - version_added: - gcp_serviceusage_service: - description: Creates a GCP Service - name: gcp_serviceusage_service - namespace: "" - version_added: - gcp_serviceusage_service_info: - description: Gather info for GCP Service - name: gcp_serviceusage_service_info - namespace: "" - version_added: - gcp_sourcerepo_repository: - description: Creates a GCP Repository - name: gcp_sourcerepo_repository - namespace: "" - version_added: - gcp_sourcerepo_repository_info: - description: Gather info for GCP Repository - name: gcp_sourcerepo_repository_info - namespace: "" - version_added: - gcp_spanner_database: - description: Creates a GCP Database - name: gcp_spanner_database - namespace: "" - version_added: - gcp_spanner_database_info: - description: Gather info for GCP Database - name: gcp_spanner_database_info - namespace: "" - version_added: - gcp_spanner_instance: - description: Creates a GCP Instance - name: gcp_spanner_instance - namespace: "" - version_added: - gcp_spanner_instance_info: - description: Gather info for GCP Instance - name: gcp_spanner_instance_info - namespace: "" - version_added: - gcp_sql_database: - description: Creates a GCP Database - name: gcp_sql_database - namespace: "" - version_added: - gcp_sql_database_info: - description: Gather info for GCP Database - name: gcp_sql_database_info - namespace: "" - version_added: - gcp_sql_instance: - description: Creates a GCP Instance - name: gcp_sql_instance - namespace: "" - version_added: - gcp_sql_instance_info: - description: Gather info for GCP Instance - name: gcp_sql_instance_info - namespace: "" - version_added: - gcp_sql_ssl_cert: - description: Creates a GCP SslCert - name: gcp_sql_ssl_cert - namespace: "" - version_added: - gcp_sql_user: - description: Creates a GCP User - name: gcp_sql_user - namespace: "" - version_added: - gcp_sql_user_info: - description: Gather info for GCP User - name: gcp_sql_user_info - namespace: "" - version_added: - gcp_storage_bucket: - description: Creates a GCP Bucket - name: gcp_storage_bucket - namespace: "" - version_added: - gcp_storage_bucket_access_control: - description: Creates a GCP BucketAccessControl - name: gcp_storage_bucket_access_control - namespace: "" - version_added: - gcp_storage_default_object_acl: - description: Creates a GCP DefaultObjectACL - name: gcp_storage_default_object_acl - namespace: "" - version_added: - gcp_storage_object: - description: Creates a GCP Object - name: gcp_storage_object - namespace: "" - version_added: - gcp_tpu_node: - description: Creates a GCP Node - name: gcp_tpu_node - namespace: "" - version_added: - gcp_tpu_node_info: - description: Gather info for GCP Node - name: gcp_tpu_node_info - namespace: "" - version_added: - netconf: {} - shell: {} - strategy: {} - test: {} - vars: {} -version: 1.2.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 29c7c50..4d47e48 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -1,52 +1,79 @@ ---- -ancestor: +ancestor: null releases: 1.1.0: changes: bugfixes: - - Disk has been fixed to send the sourceSnapshot parameter. - - gcp_cloudtasks_queue - was not functional before, and is now functional. - - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) as the domain, no longer erroneously reporting changes after an execution. - - gcp_compute_backend_service - no longer erroneously reports changes after an execution for ``capacity_scaler``. - - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot use basic-auth. - - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. - - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as absent. - - gcp_iam_role - update of a role is functional (GitHub - - gcp_spanner_database - recognize a non-existent resource as absent. - - gcp_storage_object - fix for correct version of dependency requirement. + - Disk has been fixed to send the sourceSnapshot parameter. + - gcp_cloudtasks_queue - was not functional before, and is now functional. + - gcp_compute_* - these resources use the correct selflink (www.googleapis.com) + as the domain, no longer erroneously reporting changes after an execution. + - gcp_compute_backend_service - no longer erroneously reports changes after + an execution for ``capacity_scaler``. + - gcp_container_cluster - support GKE clusters greater than 1.19+, which cannot + use basic-auth. + - gcp_crypto_key - skip_initial_version_creation defaults to the correct value. + - gcp_iam_role - now properly undeletes and recognizes soft deleted roles as + absent. + - gcp_iam_role - update of a role is functional (GitHub + - gcp_spanner_database - recognize a non-existent resource as absent. + - gcp_storage_object - fix for correct version of dependency requirement. minor_changes: - - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the name parameter. + - GCE inventory plugin - a new option ``name_suffix``, to add a suffix to the + name parameter. fragments: - - "0001_disk.yml" - - bugfixes.yaml - release_date: "2022-12-16" + - 0001_disk.yml + - bugfixes.yaml + release_date: '2022-12-16' 1.1.1: changes: bugfixes: - - fix collection to work with Python 2.7 + - fix collection to work with Python 2.7 fragments: - - fix-2.7.yml - release_date: "2022-12-16" + - fix-2.7.yml + release_date: '2022-12-16' 1.1.2: changes: bugfixes: - - fix `gcp_compute` no longer being a valid name of the inventory plugin + - fix `gcp_compute` no longer being a valid name of the inventory plugin fragments: - - fix-inventory-plugin.yml - release_date: "2022-12-21" + - fix-inventory-plugin.yml + release_date: '2022-12-21' 1.1.3: changes: bugfixes: - - "gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly pointed to the gcloud filter logic rather than the API (fixes #549)" + - 'gcp_compute_instance_info: fix incorrect documentation for filter which incorrectly + pointed to the gcloud filter logic rather than the API (fixes #549)' fragments: - - gce-changelog.yaml - release_date: "2023-03-04" + - gce-changelog.yaml + release_date: '2023-03-04' 1.2.0: changes: bugfixes: - - Use default service account if `service_account_email` is unset. + - Use default service account if `service_account_email` is unset. minor_changes: - - Add DataPlane V2 Support. - - Add auth support for GCP access tokens (#574). - - Add support for ip_allocation_policy->stack_type. - release_date: "2023-07-07" + - Add DataPlane V2 Support. + - Add auth support for GCP access tokens (#574). + - Add support for ip_allocation_policy->stack_type. + release_date: '2023-07-07' + 1.3.0: + changes: + minor_changes: + - anisble-test - integration tests are now run against 2.14.0 and 2.15.0 + - ansible - 2.14.0 is now the minimum version supported + - ansible-lint - fixed over a thousand reported errors + - ansible-lint - upgraded to 6.22 + - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). + - gcp_serviceusage_service - added backoff when checking for operation completion. + - gcp_serviceusage_service - use alloyb API for the integration test as spanner + conflicts with other tests + - gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource + creation + - gcp_storage_default_object_acl - removed non-existent fields; the resource + is not usable. + fragments: + - app-default-creds.yml + - gcp_serviceusage_service.yml + - gcp_sql_ssl_cert.yml + - gcp_storage_default_object_acl.yml + - upgrade-versions.yml + release_date: '2023-11-22' diff --git a/changelogs/fragments/app-default-creds.yml b/changelogs/fragments/app-default-creds.yml deleted file mode 100644 index cacdcc4..0000000 --- a/changelogs/fragments/app-default-creds.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - ansible-test - add support for GCP application default credentials (https://github.com/ansible-collections/google.cloud/issues/359). diff --git a/changelogs/fragments/gcp_serviceusage_service.yml b/changelogs/fragments/gcp_serviceusage_service.yml deleted file mode 100644 index e373ec7..0000000 --- a/changelogs/fragments/gcp_serviceusage_service.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - gcp_serviceusage_service - added backoff when checking for operation completion. - - gcp_serviceusage_service - use alloyb API for the integration test as spanner conflicts with other tests diff --git a/changelogs/fragments/gcp_sql_ssl_cert.yml b/changelogs/fragments/gcp_sql_ssl_cert.yml deleted file mode 100644 index 7e5b0ed..0000000 --- a/changelogs/fragments/gcp_sql_ssl_cert.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - gcp_sql_ssl_cert - made sha1_fingerprint optional, which enables resource creation diff --git a/changelogs/fragments/gcp_storage_default_object_acl.yml b/changelogs/fragments/gcp_storage_default_object_acl.yml deleted file mode 100644 index 6642204..0000000 --- a/changelogs/fragments/gcp_storage_default_object_acl.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - gcp_storage_default_object_acl - removed non-existent fields; the resource is not usable. diff --git a/changelogs/fragments/upgrade-versions.yml b/changelogs/fragments/upgrade-versions.yml deleted file mode 100644 index 1c850cf..0000000 --- a/changelogs/fragments/upgrade-versions.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -minor_changes: - - ansible - 2.14.0 is now the minimum version supported - - anisble-test - integration tests are now run against 2.14.0 and 2.15.0 - - ansible-lint - upgraded to 6.22 - - ansible-lint - fixed over a thousand reported errors diff --git a/galaxy.yml b/galaxy.yml index e6e50a4..78b2578 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: 1.2.0 +version: 1.3.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -19,7 +19,7 @@ readme: README.md # @nicks:irc/im.site#channel' authors: - Google - - Google + - Google ### OPTIONAL but strongly recommended From 2a322dd9cd2a5acdc7e46a7eed7853e6c10c846c Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Tue, 28 Nov 2023 14:46:37 -0800 Subject: [PATCH 116/138] chore: update README version --- .gitignore | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e7a7d8f..6e7ddb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # personal credentials are added here: do not check in. tests/integration/cloud-config-gcp.ini +ansible.cfg # running ansible integration tests adds files here. tests/integration/inventory tests/output/ diff --git a/README.md b/README.md index 24dec78..ccf8fb4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Google Cloud Platform Ansible Collection This collection provides a series of Ansible modules and plugins for interacting with the [Google Cloud Platform](https://cloud.google.com) -This collection works with Ansible 2.9+ +This collection works with Ansible 2.14+ # Installation ```bash From f7140225a87526cdb518d01daef209886706d312 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 23 May 2024 12:31:26 +0200 Subject: [PATCH 117/138] fix: support more than 10 secrets versions on gcp_secret_manager --- plugins/lookup/gcp_secret_manager.py | 5 ++++- plugins/modules/gcp_secret_manager.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/lookup/gcp_secret_manager.py b/plugins/lookup/gcp_secret_manager.py index bd9ca55..b3eeaf9 100644 --- a/plugins/lookup/gcp_secret_manager.py +++ b/plugins/lookup/gcp_secret_manager.py @@ -208,7 +208,10 @@ class LookupModule(LookupBase): self.raise_error(module, f"unable to list versions of secret {response.status_code}") version_list = response.json() if "versions" in version_list: - return sorted(version_list['versions'], key=lambda d: d['name'])[-1]['name'].split('/')[-1] + versions_numbers = [] + for version in version_list['versions']: + versions_numbers.append(version['name'].split('/')[-1]) + return sorted(versions_numbers, key=int)[-1] else: self.raise_error(module, f"Unable to list secret versions via {response.request.url}: {response.json()}") diff --git a/plugins/modules/gcp_secret_manager.py b/plugins/modules/gcp_secret_manager.py index f8d5623..91b186d 100644 --- a/plugins/modules/gcp_secret_manager.py +++ b/plugins/modules/gcp_secret_manager.py @@ -261,7 +261,10 @@ def fetch_resource(module, allow_not_found=True): return None if "versions" in version_list: - latest_version = sorted(version_list['versions'], key=lambda d: d['name'])[-1]['name'].split('/')[-1] + versions_numbers = [] + for version in version_list['versions']: + versions_numbers.append(version['name'].split('/')[-1]) + latest_version = sorted(versions_numbers, key=int)[-1] module.params['calc_version'] = latest_version else: # if this occurs, there are no available secret versions From d9d57cbeeb94b4e71ea2259a506c6877491e215f Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Wed, 24 Jul 2024 16:15:24 -0700 Subject: [PATCH 118/138] Remove jinja vars from conditional statements in integration test asserts --- .../targets/gcp_container_cluster/tasks/autogen.yml | 4 ++-- .../targets/gcp_container_node_pool/tasks/autogen.yml | 4 ++-- .../targets/gcp_dns_resource_record_set/tasks/autogen.yml | 4 ++-- .../targets/gcp_pubsub_subscription/tasks/autogen.yml | 4 ++-- tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml | 4 ++-- tests/integration/targets/gcp_sql_database/tasks/autogen.yml | 4 ++-- tests/integration/targets/gcp_sql_user/tasks/autogen.yml | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml index 4a845ea..f3c1d12 100644 --- a/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -55,7 +55,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*my-cluster.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a cluster that already exists google.cloud.gcp_container_cluster: @@ -104,7 +104,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*my-cluster.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a cluster that does not exist google.cloud.gcp_container_cluster: diff --git a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml index ae04f30..84fe978 100644 --- a/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml +++ b/tests/integration/targets/gcp_container_node_pool/tasks/autogen.yml @@ -62,7 +62,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*my-pool.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a node pool that already exists google.cloud.gcp_container_node_pool: @@ -108,7 +108,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*my-pool.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a node pool that does not exist google.cloud.gcp_container_node_pool: diff --git a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml index 67fe3e3..c8ca535 100644 --- a/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml +++ b/tests/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml @@ -67,7 +67,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*www\\.testzone-4\\.com.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a resource record set that already exists google.cloud.gcp_dns_resource_record_set: @@ -118,7 +118,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*www\\.testzone-4\\.com.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a resource record set that does not exist google.cloud.gcp_dns_resource_record_set: diff --git a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml index ca78eb4..6aeaa58 100644 --- a/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_subscription/tasks/autogen.yml @@ -56,7 +56,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a subscription that already exists google.cloud.gcp_pubsub_subscription: @@ -98,7 +98,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a subscription that does not exist google.cloud.gcp_pubsub_subscription: diff --git a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml index 0c0dbdc..d9f3cd3 100644 --- a/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml +++ b/tests/integration/targets/gcp_pubsub_topic/tasks/autogen.yml @@ -44,7 +44,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'test-topic1' in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*test-topic1.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a topic that already exists google.cloud.gcp_pubsub_topic: @@ -82,7 +82,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'test-topic1' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*test-topic1.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a topic that does not exist google.cloud.gcp_pubsub_topic: diff --git a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml index dd87faa..a84096f 100644 --- a/tests/integration/targets/gcp_sql_database/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_database/tasks/autogen.yml @@ -64,7 +64,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "\"{{ resource_name }}\" in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a database that already exists google.cloud.gcp_sql_database: @@ -107,7 +107,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "\"{{ resource_name }}\" not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a database that does not exist google.cloud.gcp_sql_database: diff --git a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml index 20ddbea..0a820cf 100644 --- a/tests/integration/targets/gcp_sql_user/tasks/autogen.yml +++ b/tests/integration/targets/gcp_sql_user/tasks/autogen.yml @@ -66,7 +66,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'test-user' in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*test-user.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: Create a user that already exists google.cloud.gcp_sql_user: @@ -111,7 +111,7 @@ - name: Verify that command succeeded ansible.builtin.assert: that: - - "'test-user' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" + - results['resources'] | map(attribute='name') | select("match", ".*test-user.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: Delete a user that does not exist google.cloud.gcp_sql_user: From 2aebc4f1b3b48c74ebd7604d6f48d66125fd09a7 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 25 Jul 2024 10:47:31 -0700 Subject: [PATCH 119/138] Bump min Ansible version to 2.16 --- .../workflows/ansible-integration-tests.yml | 11 +++-- .github/workflows/ansible-test.yml | 40 +++++++++---------- .github/workflows/gcloud.yml | 4 +- .github/workflows/gcsfuse.yml | 4 +- README.md | 2 +- meta/runtime.yml | 2 +- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ansible-integration-tests.yml b/.github/workflows/ansible-integration-tests.yml index c7c63c8..ce18e0e 100644 --- a/.github/workflows/ansible-integration-tests.yml +++ b/.github/workflows/ansible-integration-tests.yml @@ -21,9 +21,12 @@ jobs: strategy: max-parallel: 1 matrix: + # Our current version strategy is to support both supported versions of ansible-core + # and test against the minimum version of Python supported by both. If/when we change + # the integration tests to support parallelism we can revisit. ansible_version: - - stable-2.14 - - stable-2.15 + - stable-2.16 + - stable-2.17 steps: - name: check out code uses: actions/checkout@v4 @@ -32,7 +35,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.9' # this is the minimum version required for Ansible 2.15 + python-version: '3.10' # this is the minimum version required for Ansible 2.16 - name: Install dependencies run: pip install -r requirements.txt - name: Install ansible-base (${{ matrix.ansible_version }}) @@ -67,4 +70,4 @@ jobs: # run tests - name: Run integration tests # Add the -vvv flag to print out more output - run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages + run: ansible-test integration -v --color --python 3.10 --venv-system-site-packages diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 9c36c12..978e22c 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -1,8 +1,6 @@ --- name: Run tests for the cloud.google collection on: [pull_request] -env: - PYTHON_VERSION: "3.9" # minimum version for Ansible 2.15 jobs: sanity-and-lint: runs-on: ubuntu-latest @@ -11,9 +9,16 @@ jobs: working-directory: ansible_collections/google/cloud strategy: matrix: + # Our version strategy is to test against the current and previous version + # of ansible-core and each major version of Python supported by both. + # https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix ansible_version: - - stable-2.14 - - stable-2.15 + - stable-2.16 + - stable-2.17 + python_version: + - '3.10' + - '3.11' + - '3.12' steps: - name: check out code uses: actions/checkout@v4 @@ -23,25 +28,14 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: ${{ env.PYTHON_VERSION }} - # Automation-hub requires python2.7 sanity tests - - name: setup python2.7 - run: | - sudo apt-add-repository universe - sudo apt update - sudo apt install python2.7 - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo /usr/bin/python2.7 get-pip.py - pip2 install virtualenv + python-version: ${{ matrix.python_version }} - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run ansible-test sanity # validate-modules cannot be turned on until #498 is resolved. run: ansible-test sanity -v --color --skip validate-modules - - name: Install ansible-lint - run: pip install ansible-lint==6.22.0 - name: Run ansible-lint - run: ansible-lint + uses: ansible/ansible-lint@v24.7.0 unit: runs-on: ubuntu-latest defaults: @@ -50,8 +44,12 @@ jobs: strategy: matrix: ansible_version: - - stable-2.14 - - stable-2.15 + - stable-2.16 + - stable-2.17 + python_version: + - '3.10' + - '3.11' + - '3.12' steps: - name: check out code uses: actions/checkout@v4 @@ -60,7 +58,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: ${{ matrix.python_version }} - name: Install dependencies run: pip install -r requirements.txt - name: Install test dependencies @@ -68,4 +66,4 @@ jobs: - name: Install ansible-base (${{ matrix.ansible_version }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check - name: Run unit tests - run: ansible-test units -v --color --python "$PYTHON_VERSION" + run: ansible-test units -v --color --python "${{ matrix.python_version }}" diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index 0fac681..b7b8406 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -31,10 +31,10 @@ jobs: with: path: ansible_collections/google/cloud - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.10 - name: Install dependencies run: | diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index 2d0dbc1..ce8f26d 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -26,10 +26,10 @@ jobs: with: path: ansible_collections/google/cloud - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.10 - name: Install dependencies run: | diff --git a/README.md b/README.md index ccf8fb4..1eae4ca 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Google Cloud Platform Ansible Collection This collection provides a series of Ansible modules and plugins for interacting with the [Google Cloud Platform](https://cloud.google.com) -This collection works with Ansible 2.14+ +This collection works with Ansible 2.16+ # Installation ```bash diff --git a/meta/runtime.yml b/meta/runtime.yml index ef34670..a336af3 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: ">=2.14.0" +requires_ansible: ">=2.16.0" action_groups: gcp: From 2e32ac3c4c9950864036255be82237a909db7553 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 25 Jul 2024 11:03:53 -0700 Subject: [PATCH 120/138] actions/setup-python appears to need a string when there are two digits to the right of the decimal --- .github/workflows/gcloud.yml | 2 +- .github/workflows/gcsfuse.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gcloud.yml b/.github/workflows/gcloud.yml index b7b8406..711ef94 100644 --- a/.github/workflows/gcloud.yml +++ b/.github/workflows/gcloud.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.10 + python-version: '3.10' - name: Install dependencies run: | diff --git a/.github/workflows/gcsfuse.yml b/.github/workflows/gcsfuse.yml index ce8f26d..8898703 100644 --- a/.github/workflows/gcsfuse.yml +++ b/.github/workflows/gcsfuse.yml @@ -29,7 +29,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.10 + python-version: '3.10' - name: Install dependencies run: | From fc42b8fbc22d8b1f95ba2a2808a38755a4808c19 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 25 Jul 2024 11:13:41 -0700 Subject: [PATCH 121/138] Revert ansible/ansible-lint GitHub action usage --- .github/workflows/ansible-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 978e22c..8d57604 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -34,8 +34,10 @@ jobs: - name: Run ansible-test sanity # validate-modules cannot be turned on until #498 is resolved. run: ansible-test sanity -v --color --skip validate-modules + - name: Install ansible-lint + run: pip install ansible-lint==24.7.0 - name: Run ansible-lint - uses: ansible/ansible-lint@v24.7.0 + run: ansible-lint unit: runs-on: ubuntu-latest defaults: From e79c751f3affb50e1b2443e29c3848c276f37bc5 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 13:21:00 -0700 Subject: [PATCH 122/138] Fix assertNotEquals: deprecated in 3.2, removed in 3.12 --- tests/unit/plugins/test_gcp_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/plugins/test_gcp_utils.py b/tests/unit/plugins/test_gcp_utils.py index 4956fe5..804bbbb 100644 --- a/tests/unit/plugins/test_gcp_utils.py +++ b/tests/unit/plugins/test_gcp_utils.py @@ -85,7 +85,7 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): difference = {"test": "original"} request1 = GcpRequest(value1) request2 = GcpRequest(value2) - self.assertNotEquals(request1, request2) + self.assertNotEqual(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_nested_dictionaries_no_difference(self): @@ -99,7 +99,7 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): difference = {"foo": {"quiet": {"tree": "test"}, "bar": "baz"}} request1 = GcpRequest(value1) request2 = GcpRequest(value2) - self.assertNotEquals(request1, request2) + self.assertNotEqual(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_arrays_strings_no_difference(self): @@ -123,7 +123,7 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): } request1 = GcpRequest(value1) request2 = GcpRequest(value2) - self.assertNotEquals(request1, request2) + self.assertNotEqual(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_arrays_dicts_with_no_difference(self): @@ -141,7 +141,7 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): difference = {"foo": [{"test": "value", "foo": "bar"}]} request1 = GcpRequest(value1) request2 = GcpRequest(value2) - self.assertNotEquals(request1, request2) + self.assertNotEqual(request1, request2) self.assertEqual(request1.difference(request2), difference) def test_dicts_boolean_with_difference(self): @@ -165,5 +165,5 @@ class GCPRequestDifferenceTestCase(unittest.TestCase): } request1 = GcpRequest(value1) request2 = GcpRequest(value2) - self.assertNotEquals(request1, request2) + self.assertNotEqual(request1, request2) self.assertEqual(request1.difference(request2), difference) From c76063342ebaf9833bd9b128ff2d322d164387c5 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 13:21:21 -0700 Subject: [PATCH 123/138] Include container cluster in the cleanup script --- scripts/cleanup-project.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index b05a2f1..76f9714 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -16,6 +16,7 @@ ZONE="us-central1-a" main() { # note: the ordering here is deliberate, to start with # leaf resources and work upwards to parent resources. + cleanup_resource "container" "clusters" "" "--zone=$ZONE" cleanup_resource_per_region "compute" "vpn-tunnels" cleanup_resource "compute" "instances" "" "--zone=$ZONE" cleanup_resource_per_region "compute" "addresses" From 5d28cf0bdeb7e6ddce64ca0fcad2edd6f480c135 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 15:12:45 -0700 Subject: [PATCH 124/138] Update ansible-lint; exclude the submodule and stop excluding others --- .ansible-lint | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index c77c6a8..00c8c96 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,10 +1,10 @@ --- +profile: production parseable: true skip_list: - ANSIBLE0010 use_default_rules: true verbosity: 1 exclude_paths: - - ./roles/gcp_http_lb/ - - ./tests/ - - ./plugins + # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible + - roles/google-cloud-ops-agents-ansible/ From 3010182ade956bf9ddfa248dd9dc355ca401c748 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 15:17:30 -0700 Subject: [PATCH 125/138] Change RHEL yum references to dnf --- roles/gcloud/tasks/archive/command_completion.yml | 2 +- roles/gcloud/tasks/package/redhat.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/gcloud/tasks/archive/command_completion.yml b/roles/gcloud/tasks/archive/command_completion.yml index 2772101..a130e33 100644 --- a/roles/gcloud/tasks/archive/command_completion.yml +++ b/roles/gcloud/tasks/archive/command_completion.yml @@ -10,7 +10,7 @@ when: ansible_os_family == "Debian" - name: Gcloud | Archive | RedHat | Ensure bash completion is installed - ansible.builtin.yum: + ansible.builtin.dnf: name: - bash-completion register: task_result diff --git a/roles/gcloud/tasks/package/redhat.yml b/roles/gcloud/tasks/package/redhat.yml index 8917561..156d545 100644 --- a/roles/gcloud/tasks/package/redhat.yml +++ b/roles/gcloud/tasks/package/redhat.yml @@ -1,18 +1,18 @@ --- -- name: Gcloud | RHEL | Add an Apt signing key, uses whichever key is at the URL +# https://cloud.google.com/sdk/docs/install#rpm +- name: Gcloud | RHEL | Add a dnf signing key, uses whichever key is at the URL ansible.builtin.yum_repository: name: google-cloud-sdk description: Google Cloud SDK - baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64 + baseurl: https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64 enabled: true gpgcheck: true - repo_gpgcheck: true + repo_gpgcheck: false gpgkey: - - https://packages.cloud.google.com/yum/doc/yum-key.gpg - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg - name: Gcloud | RHEL | Install the google-cloud-sdk package - ansible.builtin.yum: + ansible.builtin.dnf: name: google-cloud-sdk update_cache: "yes" register: task_result @@ -21,7 +21,7 @@ delay: 2 - name: Gcloud | Debian | Install the google-cloud-sdk additional components - ansible.builtin.yum: + ansible.builtin.dnf: name: google-cloud-sdk-{{ item }} update_cache: "yes" register: task_result From c630ef996a5949976792419e1534852d98f07021 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 15:24:26 -0700 Subject: [PATCH 126/138] Fix the path to google-cloud-ops-agents-ansible --- .ansible-lint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ansible-lint b/.ansible-lint index 00c8c96..1f5f25a 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,4 @@ use_default_rules: true verbosity: 1 exclude_paths: # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible - - roles/google-cloud-ops-agents-ansible/ + - ./roles/google-cloud-ops-agents-ansible/ From c9b7cf5a2157441dd73bd33ef083df40ba7a41b4 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 15:42:19 -0700 Subject: [PATCH 127/138] Try passing a full path to the ansible-lint config file --- .ansible-lint | 2 +- .github/workflows/ansible-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 1f5f25a..00c8c96 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,4 @@ use_default_rules: true verbosity: 1 exclude_paths: # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible - - ./roles/google-cloud-ops-agents-ansible/ + - roles/google-cloud-ops-agents-ansible/ diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 8d57604..cc2df80 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -37,7 +37,7 @@ jobs: - name: Install ansible-lint run: pip install ansible-lint==24.7.0 - name: Run ansible-lint - run: ansible-lint + run: ansible-lint -c ${GITHUB_WORKSPACE}/ansible_collections/google/cloud/.ansible-lint unit: runs-on: ubuntu-latest defaults: From 6a078d2ddbffcf54d8108d402d2cee21fc0797ac Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 15:49:09 -0700 Subject: [PATCH 128/138] Make the path to google-cloud-ops-agents-ansible prefixed with ./ --- .ansible-lint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ansible-lint b/.ansible-lint index 00c8c96..1f5f25a 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,4 @@ use_default_rules: true verbosity: 1 exclude_paths: # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible - - roles/google-cloud-ops-agents-ansible/ + - ./roles/google-cloud-ops-agents-ansible/ From 811901f82c1325118a952abfe112eac2c7538dd3 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 16:02:15 -0700 Subject: [PATCH 129/138] Add some debugging statements --- .github/workflows/ansible-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index cc2df80..7206aa2 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -36,8 +36,12 @@ jobs: run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint run: pip install ansible-lint==24.7.0 + - name: Debug the ansible-lint path + run: | + pwd + ls -al - name: Run ansible-lint - run: ansible-lint -c ${GITHUB_WORKSPACE}/ansible_collections/google/cloud/.ansible-lint + run: ansible-lint --show-relpath --exclude ./roles/google-cloud-ops-agents-ansible/ unit: runs-on: ubuntu-latest defaults: From 12d500f044f2f6717979c1f88357234910dda75b Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 16:08:18 -0700 Subject: [PATCH 130/138] Use the submodule path, not the name of the repo --- .ansible-lint | 2 +- .github/workflows/ansible-test.yml | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 1f5f25a..19247a5 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,4 @@ use_default_rules: true verbosity: 1 exclude_paths: # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible - - ./roles/google-cloud-ops-agents-ansible/ + - ./roles/google_cloud_ops_agents/ diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 7206aa2..8d57604 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -36,12 +36,8 @@ jobs: run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint run: pip install ansible-lint==24.7.0 - - name: Debug the ansible-lint path - run: | - pwd - ls -al - name: Run ansible-lint - run: ansible-lint --show-relpath --exclude ./roles/google-cloud-ops-agents-ansible/ + run: ansible-lint unit: runs-on: ubuntu-latest defaults: From dfe85d24a05f1022984a855828e66edb1ad785ce Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 16:18:55 -0700 Subject: [PATCH 131/138] ansible-lint truly hates not running in the workspace root directory --- .github/workflows/ansible-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 8d57604..2bef646 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -36,8 +36,12 @@ jobs: run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint run: pip install ansible-lint==24.7.0 + - name: Debug the ansible-lint path + run: | + pwd + ls -al - name: Run ansible-lint - run: ansible-lint + run: ansible-lint --exclude ./roles/google_cloud_ops_agents/ unit: runs-on: ubuntu-latest defaults: From 7ae46673ed6a7d283143355ef26a5259b949e698 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 16:33:09 -0700 Subject: [PATCH 132/138] Use the path that ansible-lint is reporting for exclusion --- .ansible-lint | 2 +- .github/workflows/ansible-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 19247a5..0c5e668 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,4 @@ use_default_rules: true verbosity: 1 exclude_paths: # Ignore submodule https://github.com/GoogleCloudPlatform/google-cloud-ops-agents-ansible - - ./roles/google_cloud_ops_agents/ + - roles/google_cloud_ops_agents/ diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 2bef646..6a2e1fc 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -41,7 +41,7 @@ jobs: pwd ls -al - name: Run ansible-lint - run: ansible-lint --exclude ./roles/google_cloud_ops_agents/ + run: ansible-lint --exclude roles/google_cloud_ops_agents/ unit: runs-on: ubuntu-latest defaults: From 7a95362e0305884545466bfd5d2501e5cd234bdf Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Fri, 26 Jul 2024 16:44:29 -0700 Subject: [PATCH 133/138] Remove debugging lines --- .github/workflows/ansible-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 6a2e1fc..e9fea6a 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -36,10 +36,6 @@ jobs: run: ansible-test sanity -v --color --skip validate-modules - name: Install ansible-lint run: pip install ansible-lint==24.7.0 - - name: Debug the ansible-lint path - run: | - pwd - ls -al - name: Run ansible-lint run: ansible-lint --exclude roles/google_cloud_ops_agents/ unit: From ac707b2508f10fb50b6720a23b8de4f392fd1487 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Mon, 19 Aug 2024 10:49:08 +0200 Subject: [PATCH 134/138] README: Add Communication section with Forum information (#644) * README: Add Communication section with Forum information * Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 1eae4ca..76c6faa 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,17 @@ This collection provides a series of Ansible modules and plugins for interacting This collection works with Ansible 2.16+ +# Communication + +* Join the Ansible forum: + * [Get Help](https://forum.ansible.com/c/help/6): get help or help others. Please use appropriate tags, for example `cloud`. + * [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). + # Installation ```bash ansible-galaxy collection install google.cloud From add323be7075f8932ee6a88aaff8f47f2bbe70a4 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Wed, 21 Aug 2024 12:38:39 -0700 Subject: [PATCH 135/138] Prepare v1.4.0 release --- CHANGELOG.rst | 18 ++++++++++++++++++ README.md | 1 + changelogs/changelog.yaml | 15 +++++++++++++++ galaxy.yml | 2 +- meta/runtime.yml | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 663a9ab..9a5c3ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,24 @@ Google.Cloud Release Notes .. contents:: Topics +v1.4.0 +====== + +Minor Changes +------------- + +- ansible - 2.16.0 is now the minimum version supported +- ansible - 3.10 is now the minimum Python version +- ansible-test - integration tests are now run against 2.16.0 and 2.17.0 +- gcloud role - use dnf instead of yum on RHEL +- gcp_secret_manager - add as a module and lookup plugin (https://github.com/ansible-collections/google.cloud/pull/578) +- gcp_secret_manager - support more than 10 versions (https://github.com/ansible-collections/google.cloud/pull/634) +- restore google_cloud_ops_agents submodule (https://github.com/ansible-collections/google.cloud/pull/594) + +Bugfixes +-------- + +- ansible-lint - remove jinja templates from test assertions v1.3.0 ====== diff --git a/README.md b/README.md index 76c6faa..5c3f7da 100644 --- a/README.md +++ b/README.md @@ -106,3 +106,4 @@ ansible-galaxy collection install google.cloud * Cloud Storage BucketAccessControl (gcp_storage_bucket_access_control, gcp_storage_bucket_access_control_info) * Cloud Storage DefaultObjectACL (gcp_storage_default_object_acl, gcp_storage_default_object_acl_info) * Cloud TPU Node (gcp_tpu_node, gcp_tpu_node_info) + * Secret Manager (gcp_secret_manager) diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 4d47e48..fbd9264 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -77,3 +77,18 @@ releases: - gcp_storage_default_object_acl.yml - upgrade-versions.yml release_date: '2023-11-22' + 1.4.0: + changes: + bugfixes: + - ansible-lint - remove jinja templates from test assertions + minor_changes: + - ansible - 2.16.0 is now the minimum version supported + - ansible - 3.10 is now the minimum Python version + - ansible-test - integration tests are now run against 2.16.0 and 2.17.0 + - gcloud role - use dnf instead of yum on RHEL + - gcp_secret_manager - add as a module and lookup plugin (https://github.com/ansible-collections/google.cloud/pull/578) + - gcp_secret_manager - support more than 10 versions (https://github.com/ansible-collections/google.cloud/pull/634) + - restore google_cloud_ops_agents submodule (https://github.com/ansible-collections/google.cloud/pull/594) + fragments: + - release-1-4-0.yml + release_date: '2024-08-21' diff --git a/galaxy.yml b/galaxy.yml index 78b2578..5c8bc17 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: 1.3.0 +version: 1.4.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/meta/runtime.yml b/meta/runtime.yml index a336af3..0f2f2a5 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -152,6 +152,7 @@ action_groups: - gcp_runtimeconfig_config_info - gcp_runtimeconfig_variable - gcp_runtimeconfig_variable_info + - gcp_secret_manager - gcp_serviceusage_service - gcp_serviceusage_service_info - gcp_sourcerepo_repository From bc7313854d8e3e32c73715804f9e0e4b7db2cdb3 Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 22 Aug 2024 15:40:29 -0700 Subject: [PATCH 136/138] Remove an f-string usage for backward compatibility --- plugins/modules/gcp_secret_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/gcp_secret_manager.py b/plugins/modules/gcp_secret_manager.py index 91b186d..a02a402 100644 --- a/plugins/modules/gcp_secret_manager.py +++ b/plugins/modules/gcp_secret_manager.py @@ -443,7 +443,7 @@ def main(): fetch.pop('value') fetch.pop('payload') if "msg" in fetch: - fetch['msg'] = f"{fetch['msg']} | not returning secret value since 'return_value is set to false" + fetch['msg'] = "{} | not returning secret value since 'return_value is set to false".format(fetch['msg']) else: fetch['msg'] = "not returning secret value since 'return_value is set to false" From 83e84e80d56312306a77c9f45c13dd23585a127b Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 22 Aug 2024 16:04:26 -0700 Subject: [PATCH 137/138] Add a basic DOCUMENTATION string for gcp_kms_filters.py --- plugins/filter/gcp_kms_filters.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/filter/gcp_kms_filters.py b/plugins/filter/gcp_kms_filters.py index 44ae8d0..4a08c1a 100644 --- a/plugins/filter/gcp_kms_filters.py +++ b/plugins/filter/gcp_kms_filters.py @@ -13,6 +13,15 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +DOCUMENTATION = ''' + author: + - Eric Anderson + name: gcp_kms_filters + short_description: Support auth tokens as a Filter plugin + description: + - Enables the 'accesstoken' authentication choice. +''' + from ansible.errors import AnsibleError from ansible_collections.google.cloud.plugins.module_utils.gcp_utils import GcpSession From ff3e2a2d430747cc47f32df62ced67c8eb68ca6c Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Thu, 22 Aug 2024 16:32:54 -0700 Subject: [PATCH 138/138] Prepare for 1.4.1 release --- CHANGELOG.rst | 9 +++++++++ changelogs/changelog.yaml | 8 ++++++++ galaxy.yml | 5 ++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9a5c3ce..7e76c68 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,15 @@ Google.Cloud Release Notes .. contents:: Topics +v1.4.1 +====== + +Bugfixes +-------- + +- gcp_kms_filters - add DOCUMENTATION string +- gcp_secret_manager - make an f-string usage backward compatible + v1.4.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index fbd9264..738da7b 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -92,3 +92,11 @@ releases: fragments: - release-1-4-0.yml release_date: '2024-08-21' + 1.4.1: + changes: + bugfixes: + - gcp_kms_filters - add DOCUMENTATION string + - gcp_secret_manager - make an f-string usage backward compatible + fragments: + - release-1-4-1.yml + release_date: '2024-08-22' diff --git a/galaxy.yml b/galaxy.yml index 5c8bc17..abd99cb 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: google name: cloud # The version of the collection. Must be compatible with semantic versioning -version: 1.4.0 +version: 1.4.1 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -61,3 +61,6 @@ homepage: http://cloud.google.com # The URL to the collection issue tracker issues: https://github.com/ansible-collections/google.cloud/issues + +build_ignore: + - venv