From 3ba695b0edd64421436b4bf5dc3599f34b75be93 Mon Sep 17 00:00:00 2001 From: apichick Date: Wed, 18 Jun 2025 10:44:00 +0200 Subject: [PATCH] DNS zones added you Apigee module (#3149) --- modules/apigee/README.md | 32 ++++++++++++++++++++++++++------ modules/apigee/main.tf | 12 ++++++++++++ modules/apigee/variables.tf | 12 ++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/modules/apigee/README.md b/modules/apigee/README.md index 45229c5bc..d4a1d30fb 100644 --- a/modules/apigee/README.md +++ b/modules/apigee/README.md @@ -17,6 +17,7 @@ This module simplifies the creation of a Apigee resources (organization, environ - [New instance (Non VPC Peering Provisioning Mode)](#new-instance-non-vpc-peering-provisioning-mode) - [New endpoint attachment](#new-endpoint-attachment) - [Apigee add-ons](#apigee-add-ons) +- [New DNS ZONE](#new-dns-zone) - [IAM](#iam) - [Recipes](#recipes) - [Variables](#variables) @@ -306,6 +307,24 @@ module "apigee" { # tftest modules=1 resources=1 ``` +## New DNS ZONE + +``` +module "apigee" { + source = "./fabric/modules/apigee" + project_id = "my-project" + dns_zones = { + test = { + domain = "mydomain.com" + description = "Zone for mydomain.com" + target_project_id = "my-other-project" + target_network_id = "projects/my-other-projects/global/networks/vpc" + } + } +} +# tftest modules=1 resources=1 +``` + ### IAM ```hcl @@ -364,13 +383,14 @@ module "apigee" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [project_id](variables.tf#L132) | Project ID. | string | ✓ | | +| [project_id](variables.tf#L144) | Project ID. | string | ✓ | | | [addons_config](variables.tf#L17) | Addons configuration. | object({…}) | | null | -| [endpoint_attachments](variables.tf#L29) | Endpoint attachments. | map(object({…})) | | {} | -| [envgroups](variables.tf#L39) | Environment groups (NAME => [HOSTNAMES]). | map(list(string)) | | {} | -| [environments](variables.tf#L46) | Environments. | map(object({…})) | | {} | -| [instances](variables.tf#L74) | Instances ([REGION] => [INSTANCE]). | map(object({…})) | | {} | -| [organization](variables.tf#L100) | Apigee organization. If set to null the organization must already exist. | object({…}) | | null | +| [dns_zones](variables.tf#L29) | DNS zones. | map(object({…})) | | {} | +| [endpoint_attachments](variables.tf#L41) | Endpoint attachments. | map(object({…})) | | {} | +| [envgroups](variables.tf#L51) | Environment groups (NAME => [HOSTNAMES]). | map(list(string)) | | {} | +| [environments](variables.tf#L58) | Environments. | map(object({…})) | | {} | +| [instances](variables.tf#L86) | Instances ([REGION] => [INSTANCE]). | map(object({…})) | | {} | +| [organization](variables.tf#L112) | Apigee organization. If set to null the organization must already exist. | object({…}) | | null | ## Outputs diff --git a/modules/apigee/main.tf b/modules/apigee/main.tf index 0c8f6bcfa..130314797 100644 --- a/modules/apigee/main.tf +++ b/modules/apigee/main.tf @@ -173,3 +173,15 @@ resource "google_apigee_addons_config" "addons_config" { } } } + +resource "google_apigee_dns_zone" "dns_zones" { + for_each = var.dns_zones + org_id = google_apigee_organization.organization[0].id + dns_zone_id = each.key + domain = each.value.domain + description = each.value.description + peering_config { + target_project_id = each.value.target_project_id + target_network_id = each.value.target_network_id + } +} diff --git a/modules/apigee/variables.tf b/modules/apigee/variables.tf index b7f9aa6d8..b450b47f5 100644 --- a/modules/apigee/variables.tf +++ b/modules/apigee/variables.tf @@ -26,6 +26,18 @@ variable "addons_config" { default = null } +variable "dns_zones" { + description = "DNS zones." + type = map(object({ + domain = string + description = string + target_project_id = string + target_network_id = string + })) + default = {} + nullable = false +} + variable "endpoint_attachments" { description = "Endpoint attachments." type = map(object({