Skip to content

Commit

Permalink
fixed: aligned test cases to v26.0.0 cff changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anaik91 committed Sep 25, 2023
1 parent 5a0d4a3 commit c58a133
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/actions/tftest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" && \
Expand Down
23 changes: 9 additions & 14 deletions modules/apigee-x-core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
} }
}

Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion modules/apigee-x-core/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

terraform {
required_version = ">= 1.1.0"
required_version = ">= 1.4.4"
required_providers {
google = {
source = "hashicorp/google"
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_controlled_internet_egress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions tests/samples/test_dns_peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand All @@ -28,6 +28,7 @@ def resources(recursive_plan_runner):
project_id="testonly",
project_create="true"
)
print(json.dumps(resources,indent=2))
return resources


Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_ilb_mtls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions tests/samples/test_l4xlb_mtls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_l7xlb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_multi_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_nb_psc_xlb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_sb_psc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_shared_vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_transtive_peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_x_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c58a133

Please sign in to comment.