From 36c707faf68040a02c3491f3d7df0dcf7927fda7 Mon Sep 17 00:00:00 2001 From: g-greatdevaks Date: Tue, 5 Sep 2023 21:16:24 +0530 Subject: [PATCH] add and fix tests for apigee module --- tests/modules/apigee/all.tfvars | 1 + tests/modules/apigee/all.yaml | 1 + tests/modules/apigee/instance_only.tfvars | 7 ---- .../apigee/instance_only_psc_mode.tfvars | 18 +++++++++ .../apigee/instance_only_psc_mode.yaml | 37 +++++++++++++++++++ .../apigee/instance_only_vpc_mode.tfvars | 18 +++++++++ .../apigee/instance_only_vpc_mode.yaml | 37 +++++++++++++++++++ tests/modules/apigee/no_instances.tfvars | 1 + tests/modules/apigee/no_instances.yaml | 1 + .../apigee/organization_only_psc_mode.tfvars | 11 ++++++ ...y.yaml => organization_only_psc_mode.yaml} | 18 ++++++--- ...vars => organization_only_vpc_mode.tfvars} | 3 +- ...y.yaml => organization_only_vpc_mode.yaml} | 1 + .../apigee/organization_retention.tfvars | 3 +- .../apigee/organization_retention.yaml | 1 + tests/modules/apigee/tftest.yaml | 6 ++- 16 files changed, 147 insertions(+), 17 deletions(-) delete mode 100644 tests/modules/apigee/instance_only.tfvars create mode 100644 tests/modules/apigee/instance_only_psc_mode.tfvars create mode 100644 tests/modules/apigee/instance_only_psc_mode.yaml create mode 100644 tests/modules/apigee/instance_only_vpc_mode.tfvars create mode 100644 tests/modules/apigee/instance_only_vpc_mode.yaml create mode 100644 tests/modules/apigee/organization_only_psc_mode.tfvars rename tests/modules/apigee/{instance_only.yaml => organization_only_psc_mode.yaml} (60%) rename tests/modules/apigee/{organization_only.tfvars => organization_only_vpc_mode.tfvars} (90%) rename tests/modules/apigee/{organization_only.yaml => organization_only_vpc_mode.yaml} (96%) diff --git a/tests/modules/apigee/all.tfvars b/tests/modules/apigee/all.tfvars index 69ffb0840f..e0e648bd58 100644 --- a/tests/modules/apigee/all.tfvars +++ b/tests/modules/apigee/all.tfvars @@ -7,6 +7,7 @@ organization = { billing_type = "Pay-as-you-go" database_encryption_key = "123456789" analytics_region = "europe-west1" + disable_vpc_peering = false } envgroups = { test = ["test.example.com"] diff --git a/tests/modules/apigee/all.yaml b/tests/modules/apigee/all.yaml index c23eab27ee..50cef735e1 100644 --- a/tests/modules/apigee/all.yaml +++ b/tests/modules/apigee/all.yaml @@ -71,6 +71,7 @@ values: retention: DELETION_RETENTION_UNSPECIFIED runtime_database_encryption_key_name: '123456789' runtime_type: CLOUD + disable_vpc_peering: false counts: google_apigee_endpoint_attachment: 2 diff --git a/tests/modules/apigee/instance_only.tfvars b/tests/modules/apigee/instance_only.tfvars deleted file mode 100644 index 5807494662..0000000000 --- a/tests/modules/apigee/instance_only.tfvars +++ /dev/null @@ -1,7 +0,0 @@ -project_id = "my-project" -instances = { - europe-west1 = { - runtime_ip_cidr_range = "10.0.4.0/22" - troubleshooting_ip_cidr_range = "10.1.1.0.0/28" - } -} diff --git a/tests/modules/apigee/instance_only_psc_mode.tfvars b/tests/modules/apigee/instance_only_psc_mode.tfvars new file mode 100644 index 0000000000..275f3ddf55 --- /dev/null +++ b/tests/modules/apigee/instance_only_psc_mode.tfvars @@ -0,0 +1,18 @@ +project_id = "my-project" +organization = { + display_name = "My Organization" + description = "My Organization" + # authorized_network = "my-vpc" + runtime_type = "CLOUD" + billing_type = "Pay-as-you-go" + database_encryption_key = "123456789" + analytics_region = "europe-west1" + disable_vpc_peering = true +} +instances = { + europe-west1 = { + # runtime_ip_cidr_range = "10.0.4.0/22" + # troubleshooting_ip_cidr_range = "10.1.1.0/28" + } +} + diff --git a/tests/modules/apigee/instance_only_psc_mode.yaml b/tests/modules/apigee/instance_only_psc_mode.yaml new file mode 100644 index 0000000000..8f05d18198 --- /dev/null +++ b/tests/modules/apigee/instance_only_psc_mode.yaml @@ -0,0 +1,37 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +values: + google_apigee_instance.instances["europe-west1"]: + description: Terraform-managed + disk_encryption_key_name: null + display_name: null + # ip_range: 10.0.4.0/22,10.1.1.0/28 + location: europe-west1 + name: instance-europe-west1 + google_apigee_organization.organization[0]: + analytics_region: europe-west1 + # authorized_network: my-vpc + billing_type: Pay-as-you-go + description: null + display_name: null + project_id: my-project + retention: DELETION_RETENTION_UNSPECIFIED + runtime_database_encryption_key_name: '123456789' + runtime_type: CLOUD + disable_vpc_peering: true + +counts: + google_apigee_instance: 1 + google_apigee_organization: 1 diff --git a/tests/modules/apigee/instance_only_vpc_mode.tfvars b/tests/modules/apigee/instance_only_vpc_mode.tfvars new file mode 100644 index 0000000000..2af9e45d8b --- /dev/null +++ b/tests/modules/apigee/instance_only_vpc_mode.tfvars @@ -0,0 +1,18 @@ +project_id = "my-project" +organization = { + display_name = "My Organization" + description = "My Organization" + authorized_network = "my-vpc" + runtime_type = "CLOUD" + billing_type = "Pay-as-you-go" + database_encryption_key = "123456789" + analytics_region = "europe-west1" + disable_vpc_peering = false +} +instances = { + europe-west1 = { + runtime_ip_cidr_range = "10.0.4.0/22" + troubleshooting_ip_cidr_range = "10.1.1.0/28" + } +} + diff --git a/tests/modules/apigee/instance_only_vpc_mode.yaml b/tests/modules/apigee/instance_only_vpc_mode.yaml new file mode 100644 index 0000000000..bb8585b158 --- /dev/null +++ b/tests/modules/apigee/instance_only_vpc_mode.yaml @@ -0,0 +1,37 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +values: + google_apigee_instance.instances["europe-west1"]: + description: Terraform-managed + disk_encryption_key_name: null + display_name: null + ip_range: 10.0.4.0/22,10.1.1.0/28 + location: europe-west1 + name: instance-europe-west1 + google_apigee_organization.organization[0]: + analytics_region: europe-west1 + authorized_network: my-vpc + billing_type: Pay-as-you-go + description: null + display_name: null + project_id: my-project + retention: DELETION_RETENTION_UNSPECIFIED + runtime_database_encryption_key_name: '123456789' + runtime_type: CLOUD + disable_vpc_peering: false + +counts: + google_apigee_instance: 1 + google_apigee_organization: 1 diff --git a/tests/modules/apigee/no_instances.tfvars b/tests/modules/apigee/no_instances.tfvars index f88722ceed..1e95cfb184 100644 --- a/tests/modules/apigee/no_instances.tfvars +++ b/tests/modules/apigee/no_instances.tfvars @@ -7,6 +7,7 @@ organization = { billing_type = "PAYG" database_encryption_key = "123456789" analytics_region = "europe-west1" + disable_vpc_peering = false } envgroups = { test = ["test.example.com"] diff --git a/tests/modules/apigee/no_instances.yaml b/tests/modules/apigee/no_instances.yaml index ce509047b4..912baf33a7 100644 --- a/tests/modules/apigee/no_instances.yaml +++ b/tests/modules/apigee/no_instances.yaml @@ -43,6 +43,7 @@ values: retention: DELETION_RETENTION_UNSPECIFIED runtime_database_encryption_key_name: '123456789' runtime_type: CLOUD + disable_vpc_peering: false counts: google_apigee_envgroup: 2 diff --git a/tests/modules/apigee/organization_only_psc_mode.tfvars b/tests/modules/apigee/organization_only_psc_mode.tfvars new file mode 100644 index 0000000000..dc2fa43827 --- /dev/null +++ b/tests/modules/apigee/organization_only_psc_mode.tfvars @@ -0,0 +1,11 @@ +project_id = "my-project" +organization = { + display_name = "My Organization" + description = "My Organization" + authorized_network = null + runtime_type = "CLOUD" + billing_type = "PAYG" + database_encryption_key = "123456789" + analytics_region = "europe-west1" + disable_vpc_peering = true +} diff --git a/tests/modules/apigee/instance_only.yaml b/tests/modules/apigee/organization_only_psc_mode.yaml similarity index 60% rename from tests/modules/apigee/instance_only.yaml rename to tests/modules/apigee/organization_only_psc_mode.yaml index bc42a37039..2bc93b4f59 100644 --- a/tests/modules/apigee/instance_only.yaml +++ b/tests/modules/apigee/organization_only_psc_mode.yaml @@ -13,11 +13,17 @@ # limitations under the License. values: - google_apigee_instance.instances["europe-west1"]: - ip_range: 10.0.4.0/22,10.1.1.0.0/28 - location: europe-west1 - name: "instance-europe-west1" - org_id: organizations/my-project + google_apigee_organization.organization[0]: + analytics_region: europe-west1 + authorized_network: null + billing_type: PAYG + description: null + display_name: null + project_id: my-project + retention: DELETION_RETENTION_UNSPECIFIED + runtime_database_encryption_key_name: '123456789' + runtime_type: CLOUD + disable_vpc_peering: true counts: - google_apigee_instance: 1 \ No newline at end of file + google_apigee_organization: 1 diff --git a/tests/modules/apigee/organization_only.tfvars b/tests/modules/apigee/organization_only_vpc_mode.tfvars similarity index 90% rename from tests/modules/apigee/organization_only.tfvars rename to tests/modules/apigee/organization_only_vpc_mode.tfvars index db2b709790..f1d2be6153 100644 --- a/tests/modules/apigee/organization_only.tfvars +++ b/tests/modules/apigee/organization_only_vpc_mode.tfvars @@ -7,4 +7,5 @@ organization = { billing_type = "PAYG" database_encryption_key = "123456789" analytics_region = "europe-west1" -} \ No newline at end of file + disable_vpc_peering = false +} diff --git a/tests/modules/apigee/organization_only.yaml b/tests/modules/apigee/organization_only_vpc_mode.yaml similarity index 96% rename from tests/modules/apigee/organization_only.yaml rename to tests/modules/apigee/organization_only_vpc_mode.yaml index 8eee04fcc0..90978d2f90 100644 --- a/tests/modules/apigee/organization_only.yaml +++ b/tests/modules/apigee/organization_only_vpc_mode.yaml @@ -23,6 +23,7 @@ values: retention: DELETION_RETENTION_UNSPECIFIED runtime_database_encryption_key_name: '123456789' runtime_type: CLOUD + disable_vpc_peering: false counts: google_apigee_organization: 1 diff --git a/tests/modules/apigee/organization_retention.tfvars b/tests/modules/apigee/organization_retention.tfvars index d28af03a95..0fbb109124 100644 --- a/tests/modules/apigee/organization_retention.tfvars +++ b/tests/modules/apigee/organization_retention.tfvars @@ -8,4 +8,5 @@ organization = { database_encryption_key = "123456789" analytics_region = "europe-west1" retention = "MINIMUM" -} \ No newline at end of file + disable_vpc_peering = false +} diff --git a/tests/modules/apigee/organization_retention.yaml b/tests/modules/apigee/organization_retention.yaml index 4af350b863..d501ce50fb 100644 --- a/tests/modules/apigee/organization_retention.yaml +++ b/tests/modules/apigee/organization_retention.yaml @@ -23,6 +23,7 @@ values: retention: MINIMUM runtime_database_encryption_key_name: '123456789' runtime_type: CLOUD + disable_vpc_peering: false counts: google_apigee_organization: 1 diff --git a/tests/modules/apigee/tftest.yaml b/tests/modules/apigee/tftest.yaml index f4a9944ea7..065432ff62 100644 --- a/tests/modules/apigee/tftest.yaml +++ b/tests/modules/apigee/tftest.yaml @@ -21,7 +21,9 @@ tests: env_only_with_api_proxy_type: env_only_with_deployment_type: envgroup_only: - instance_only: + instance_only_psc_mode: + instance_only_vpc_mode: no_instances: - organization_only: + organization_only_psc_mode: + organization_only_vpc_mode: organization_retention: