Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bumped cff module version for apigee & kms to v26.0.0 #131

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 4 additions & 6 deletions modules/apigee-x-core/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Apigee Core Setup

<!-- BEGIN_TF_DOCS -->
## Providers

| Name | Version |
Expand All @@ -11,9 +10,9 @@

| Name | Source | Version |
|------|--------|---------|
| <a name="module_apigee"></a> [apigee](#module\_apigee) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/apigee | v19.0.0 |
| <a name="module_kms-inst-disk"></a> [kms-inst-disk](#module\_kms-inst-disk) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms | v19.0.0 |
| <a name="module_kms-org-db"></a> [kms-org-db](#module\_kms-org-db) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms | v19.0.0 |
| <a name="module_apigee"></a> [apigee](#module\_apigee) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/apigee | v26.0.0 |
| <a name="module_kms-inst-disk"></a> [kms-inst-disk](#module\_kms-inst-disk) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms | v26.0.0 |
| <a name="module_kms-org-db"></a> [kms-org-db](#module\_kms-org-db) | github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms | v26.0.0 |

## Resources

Expand All @@ -27,7 +26,7 @@
|------|-------------|------|---------|:--------:|
| <a name="input_apigee_envgroups"></a> [apigee\_envgroups](#input\_apigee\_envgroups) | Apigee Environment Groups. | <pre>map(object({<br> hostnames = list(string)<br> }))</pre> | `{}` | no |
| <a name="input_apigee_environments"></a> [apigee\_environments](#input\_apigee\_environments) | Apigee Environments. | <pre>map(object({<br> display_name = optional(string)<br> description = optional(string, "Terraform-managed")<br> node_config = optional(object({<br> min_node_count = optional(number)<br> max_node_count = optional(number)<br> }))<br> iam = optional(map(list(string)))<br> envgroups = list(string)<br> }))</pre> | `null` | no |
| <a name="input_apigee_instances"></a> [apigee\_instances](#input\_apigee\_instances) | Apigee Instances (only one instance for EVAL). | <pre>map(object({<br> region = string<br> ip_range = string<br> environments = list(string)<br> keyring_create = optional(bool, true)<br> keyring_name = optional(string, null)<br> keyring_location = optional(string, null)<br> key_name = optional(string, "inst-disk")<br> key_rotation_period = optional(string, "2592000s")<br> key_labels = optional(map(string), null)<br> consumer_accept_list = optional(list(string), null)<br> }))</pre> | `{}` | no |
| <a name="input_apigee_instances"></a> [apigee\_instances](#input\_apigee\_instances) | Apigee Instances (only one instance for EVAL). | <pre>map(object({<br> region = string<br> ip_range = string<br> environments = list(string)<br> keyring_create = optional(bool, true)<br> keyring_name = optional(string, null)<br> keyring_location = optional(string, null)<br> key_name = optional(string, "inst-disk")<br> key_rotation_period = optional(string, "2592000s")<br> key_labels = optional(map(string), null)<br> consumer_accept_list = optional(list(string), null)<br> }))</pre> | `{}` | no |
| <a name="input_ax_region"></a> [ax\_region](#input\_ax\_region) | GCP region for storing Apigee analytics data (see https://cloud.google.com/apigee/docs/api-platform/get-started/install-cli). | `string` | n/a | yes |
| <a name="input_billing_type"></a> [billing\_type](#input\_billing\_type) | Billing type of the Apigee organization. | `string` | `null` | no |
| <a name="input_network"></a> [network](#input\_network) | Network (self-link) to peer with the Apigee tennant project. | `string` | n/a | yes |
Expand All @@ -50,4 +49,3 @@
| <a name="output_instance_service_attachments"></a> [instance\_service\_attachments](#output\_instance\_service\_attachments) | Map of instance region -> instance PSC service attachment |
| <a name="output_org_id"></a> [org\_id](#output\_org\_id) | Apigee Organization ID in the format of 'organizations/<org\_id>' |
| <a name="output_organization"></a> [organization](#output\_organization) | Apigee Organization. |
<!-- END_TF_DOCS -->
29 changes: 12 additions & 17 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 @@ -32,12 +31,10 @@ resource "google_project_service_identity" "apigee_sa" {
}

module "kms-org-db" {
source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms?ref=v19.0.0"
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 @@ -51,12 +48,10 @@ module "kms-org-db" {

module "kms-inst-disk" {
for_each = var.apigee_instances
source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/kms?ref=v19.0.0"
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 All @@ -72,7 +67,7 @@ module "kms-inst-disk" {
}

module "apigee" {
source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/apigee?ref=v19.0.0"
source = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/apigee?ref=v26.0.0"
project_id = var.project_id
organization = {
display_name = var.org_display_name
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