diff --git a/.github/actions/tftest/Dockerfile b/.github/actions/tftest/Dockerfile index 3a54d78..e0b36a9 100644 --- a/.github/actions/tftest/Dockerfile +++ b/.github/actions/tftest/Dockerfile @@ -17,7 +17,7 @@ FROM python:3-alpine RUN apk add --no-cache \ git -ENV TERRAFORM_VERSION=1.3.4 +ENV TERRAFORM_VERSION=1.4.4 RUN wget -q "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \ unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && rm "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \ diff --git a/modules/apigee-x-core/main.tf b/modules/apigee-x-core/main.tf index f9c6e6e..c51b557 100644 --- a/modules/apigee-x-core/main.tf +++ b/modules/apigee-x-core/main.tf @@ -16,12 +16,11 @@ locals { envgroups = { for key, value in var.apigee_envgroups : key => value.hostnames } - instances = { for key, value in var.apigee_instances : key => { - region = value.region - environments = value.environments - psa_ip_cidr_range = value.ip_range - disk_encryption_key = module.kms-inst-disk[key].key_ids[value.key_name] - consumer_accept_list = value.consumer_accept_list + instances = { for key, value in var.apigee_instances : value.region => { + environments = value.environments + runtime_ip_cidr_range = value.ip_range + disk_encryption_key = module.kms-inst-disk[key].key_ids[value.key_name] + consumer_accept_list = value.consumer_accept_list } } } @@ -34,10 +33,8 @@ resource "google_project_service_identity" "apigee_sa" { module "kms-org-db" { source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms?ref=v26.0.0" project_id = var.project_id - key_iam = { - org-db = { - "roles/cloudkms.cryptoKeyEncrypterDecrypter" = ["serviceAccount:${google_project_service_identity.apigee_sa.email}"] - } + iam = { + "roles/cloudkms.cryptoKeyEncrypterDecrypter" = ["serviceAccount:${google_project_service_identity.apigee_sa.email}"] } keyring = { location = coalesce(var.org_kms_keyring_location, var.ax_region) @@ -53,10 +50,8 @@ module "kms-inst-disk" { for_each = var.apigee_instances source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms?ref=v26.0.0" project_id = var.project_id - key_iam = { - (each.value.key_name) = { - "roles/cloudkms.cryptoKeyEncrypterDecrypter" = ["serviceAccount:${google_project_service_identity.apigee_sa.email}"] - } + iam = { + "roles/cloudkms.cryptoKeyEncrypterDecrypter" = ["serviceAccount:${google_project_service_identity.apigee_sa.email}"] } keyring = { location = coalesce(each.value.keyring_location, each.value.region) diff --git a/modules/apigee-x-core/versions.tf b/modules/apigee-x-core/versions.tf index 1238916..c55065e 100644 --- a/modules/apigee-x-core/versions.tf +++ b/modules/apigee-x-core/versions.tf @@ -15,7 +15,7 @@ */ terraform { - required_version = ">= 1.1.0" + required_version = ">= 1.4.4" required_providers { google = { source = "hashicorp/google" diff --git a/tests/samples/test_controlled_internet_egress.py b/tests/samples/test_controlled_internet_egress.py index 314249c..5176591 100644 --- a/tests/samples/test_controlled_internet_egress.py +++ b/tests/samples/test_controlled_internet_egress.py @@ -44,7 +44,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1", "test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_dns_peering.py b/tests/samples/test_dns_peering.py index d9acc14..cc0c552 100644 --- a/tests/samples/test_dns_peering.py +++ b/tests/samples/test_dns_peering.py @@ -16,7 +16,7 @@ import os import pytest from .utils import * - +import json FIXTURES_DIR = os.path.join(os.path.dirname(__file__), "../../samples/x-dns-peering") @@ -28,6 +28,7 @@ def resources(recursive_plan_runner): project_id="testonly", project_create="true" ) + print(json.dumps(resources,indent=2)) return resources @@ -43,7 +44,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1", "test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_ilb_mtls.py b/tests/samples/test_ilb_mtls.py index 3807ad3..1b04e40 100644 --- a/tests/samples/test_ilb_mtls.py +++ b/tests/samples/test_ilb_mtls.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_l4xlb_mtls.py b/tests/samples/test_l4xlb_mtls.py index a903c00..7655891 100644 --- a/tests/samples/test_l4xlb_mtls.py +++ b/tests/samples/test_l4xlb_mtls.py @@ -43,8 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) - + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): "Test Apigee Envgroup Attachments." diff --git a/tests/samples/test_l7xlb.py b/tests/samples/test_l7xlb.py index 5c10265..b6984d7 100644 --- a/tests/samples/test_l7xlb.py +++ b/tests/samples/test_l7xlb.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_multi_region.py b/tests/samples/test_multi_region.py index 369b322..cae6caa 100644 --- a/tests/samples/test_multi_region.py +++ b/tests/samples/test_multi_region.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_nb_psc_xlb.py b/tests/samples/test_nb_psc_xlb.py index f13870b..f41ea19 100644 --- a/tests/samples/test_nb_psc_xlb.py +++ b/tests/samples/test_nb_psc_xlb.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_sb_psc.py b/tests/samples/test_sb_psc.py index a8d5b11..851ba14 100644 --- a/tests/samples/test_sb_psc.py +++ b/tests/samples/test_sb_psc.py @@ -44,7 +44,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_shared_vpc.py b/tests/samples/test_shared_vpc.py index e8a5b66..cd8212f 100644 --- a/tests/samples/test_shared_vpc.py +++ b/tests/samples/test_shared_vpc.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_transtive_peering.py b/tests/samples/test_transtive_peering.py index 5df43b8..a718f13 100644 --- a/tests/samples/test_transtive_peering.py +++ b/tests/samples/test_transtive_peering.py @@ -45,7 +45,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1","test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/test_x_basic.py b/tests/samples/test_x_basic.py index 07a4ebb..026268e 100644 --- a/tests/samples/test_x_basic.py +++ b/tests/samples/test_x_basic.py @@ -43,7 +43,7 @@ def test_apigee_instance(resources): def test_apigee_instance_attachment(resources): "Test Apigee Instance Attachments." - assert_instance_attachment(resources, ["euw1-instance-test1", "euw1-instance-test2"]) + assert_instance_attachment(resources, ["test1-europe-west1", "test2-europe-west1"]) def test_envgroup_attachment(resources): diff --git a/tests/samples/utils.py b/tests/samples/utils.py index 40c8950..92d3f97 100644 --- a/tests/samples/utils.py +++ b/tests/samples/utils.py @@ -13,6 +13,7 @@ # limitations under the License. import pprint +import json def assert_envgroup_attachment(resources, envs): "Test Apigee Envgroup Attachments." @@ -38,6 +39,7 @@ def assert_envgroup_hostnames(resources, hostnames, index=0): def assert_instance(resources, location, ip_range, index=0): "Test Apigee Instance Resource" instances = resources_by_type(resources, "google_apigee_instance") + print(json.dumps(instances,indent=2)) assert len(instances) >= index+1 assert instances[index]["values"]["location"] == location assert instances[index]["values"]["ip_range"] == ip_range @@ -46,6 +48,7 @@ def assert_instance(resources, location, ip_range, index=0): def assert_instance_attachment(resources, attachment_ids): "Test Apigee Instance Attachments." attachments = resources_by_type(resources, "google_apigee_instance_attachment") + print(attachments) assert len(attachments) == len(attachment_ids) attachment_ids_found = set(a["index"] for a in attachments) assert set(attachment_ids_found) == set(attachment_ids)