From 0f502a8cfb3c3fd128f71e553aa32961b5ccae75 Mon Sep 17 00:00:00 2001 From: Teodelas Date: Mon, 6 Nov 2023 03:56:03 -0500 Subject: [PATCH] Fix modules to support new Apigee X environment types (#1841) * Update main.tf * Update variables.tf * Update main.tf Updated environment members to be alphabetical order * fixed linting and terraform fmt * removed venv * removed venv directory --------- Co-authored-by: Teo De Las Heras --- .gitignore | 2 ++ modules/apigee/README.md | 9 ++++----- modules/apigee/main.tf | 9 +++++---- modules/apigee/variables.tf | 1 + 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cbf110dd..a4e6b621 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +venv/* +*/venv/* **/.terraform **/terraform.tfstate* **/terraform.tfvars diff --git a/modules/apigee/README.md b/modules/apigee/README.md index 5a05ecb3..24c6f416 100644 --- a/modules/apigee/README.md +++ b/modules/apigee/README.md @@ -354,19 +354,18 @@ module "apigee" { } # tftest modules=1 resources=10 ``` - ## Variables | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [project_id](variables.tf#L125) | Project ID. | string | ✓ | | +| [project_id](variables.tf#L126) | 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#L72) | Instances ([REGION] => [INSTANCE]). | map(object({…})) | | {} | -| [organization](variables.tf#L97) | Apigee organization. If set to null the organization must already exist. | object({…}) | | null | +| [environments](variables.tf#L46) | Environments. | map(object({…})) | | {} | +| [instances](variables.tf#L73) | Instances ([REGION] => [INSTANCE]). | map(object({…})) | | {} | +| [organization](variables.tf#L98) | 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 be571a8a..4db47ee0 100644 --- a/modules/apigee/main.tf +++ b/modules/apigee/main.tf @@ -40,11 +40,11 @@ resource "google_apigee_envgroup" "envgroups" { resource "google_apigee_environment" "environments" { for_each = var.environments - name = each.key - display_name = each.value.display_name - description = each.value.description - deployment_type = each.value.deployment_type api_proxy_type = each.value.api_proxy_type + deployment_type = each.value.deployment_type + description = each.value.description + display_name = each.value.display_name + name = each.key dynamic "node_config" { for_each = try(each.value.node_config, null) != null ? [""] : [] content { @@ -53,6 +53,7 @@ resource "google_apigee_environment" "environments" { } } org_id = local.org_id + type = each.value.type lifecycle { ignore_changes = [ node_config["current_aggregate_node_count"] diff --git a/modules/apigee/variables.tf b/modules/apigee/variables.tf index 7ec2cc2d..027ad05e 100644 --- a/modules/apigee/variables.tf +++ b/modules/apigee/variables.tf @@ -50,6 +50,7 @@ variable "environments" { description = optional(string, "Terraform-managed") deployment_type = optional(string) api_proxy_type = optional(string) + type = optional(string) node_config = optional(object({ min_node_count = optional(number) max_node_count = optional(number)