Added variable for activating nat and implementation in google_apigee… (#2999)

* Added variable for activating nat and implementation in google_apigee_net_address resource

* Regenerated readme

* Added tests for nat & activation

* Removed unnecessary coalesce

* Fixed test params

* Added test to confirm activate is working
This commit is contained in:
jacklever-hub24
2025-04-08 22:31:33 +10:00
committed by GitHub
parent 6d2173aada
commit 2390124877
6 changed files with 75 additions and 3 deletions

View File

@@ -359,13 +359,13 @@ module "apigee" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [project_id](variables.tf#L131) | Project ID. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L132) | Project ID. | <code>string</code> | ✓ | |
| [addons_config](variables.tf#L17) | Addons configuration. | <code title="object&#40;&#123;&#10; advanced_api_ops &#61; optional&#40;bool, false&#41;&#10; api_security &#61; optional&#40;bool, false&#41;&#10; connectors_platform &#61; optional&#40;bool, false&#41;&#10; integration &#61; optional&#40;bool, false&#41;&#10; monetization &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [endpoint_attachments](variables.tf#L29) | Endpoint attachments. | <code title="map&#40;object&#40;&#123;&#10; region &#61; string&#10; service_attachment &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [envgroups](variables.tf#L39) | Environment groups (NAME => [HOSTNAMES]). | <code>map&#40;list&#40;string&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [environments](variables.tf#L46) | Environments. | <code title="map&#40;object&#40;&#123;&#10; api_proxy_type &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; display_name &#61; optional&#40;string&#41;&#10; deployment_type &#61; optional&#40;string&#41;&#10; envgroups &#61; optional&#40;list&#40;string&#41;, &#91;&#93;&#41;&#10; forward_proxy_uri &#61; optional&#40;string&#41;&#10; iam &#61; optional&#40;map&#40;list&#40;string&#41;&#41;, &#123;&#125;&#41;&#10; iam_bindings &#61; optional&#40;map&#40;object&#40;&#123;&#10; role &#61; string&#10; members &#61; list&#40;string&#41;&#10; &#125;&#41;&#41;, &#123;&#125;&#41;&#10; iam_bindings_additive &#61; optional&#40;map&#40;object&#40;&#123;&#10; role &#61; string&#10; member &#61; string&#10; &#125;&#41;&#41;, &#123;&#125;&#41;&#10; node_config &#61; optional&#40;object&#40;&#123;&#10; min_node_count &#61; optional&#40;number&#41;&#10; max_node_count &#61; optional&#40;number&#41;&#10; &#125;&#41;&#41;&#10; type &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [instances](variables.tf#L74) | Instances ([REGION] => [INSTANCE]). | <code title="map&#40;object&#40;&#123;&#10; consumer_accept_list &#61; optional&#40;list&#40;string&#41;&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; disk_encryption_key &#61; optional&#40;string&#41;&#10; display_name &#61; optional&#40;string&#41;&#10; enable_nat &#61; optional&#40;bool, false&#41;&#10; environments &#61; optional&#40;list&#40;string&#41;, &#91;&#93;&#41;&#10; name &#61; optional&#40;string&#41;&#10; runtime_ip_cidr_range &#61; optional&#40;string&#41;&#10; troubleshooting_ip_cidr_range &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [organization](variables.tf#L99) | Apigee organization. If set to null the organization must already exist. | <code title="object&#40;&#123;&#10; analytics_region &#61; optional&#40;string&#41;&#10; api_consumer_data_encryption_key &#61; optional&#40;string&#41;&#10; api_consumer_data_location &#61; optional&#40;string&#41;&#10; authorized_network &#61; optional&#40;string&#41;&#10; billing_type &#61; optional&#40;string&#41;&#10; control_plane_encryption_key &#61; optional&#40;string&#41;&#10; database_encryption_key &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; disable_vpc_peering &#61; optional&#40;bool, false&#41;&#10; display_name &#61; optional&#40;string&#41;&#10; properties &#61; optional&#40;map&#40;string&#41;, &#123;&#125;&#41;&#10; runtime_type &#61; optional&#40;string, &#34;CLOUD&#34;&#41;&#10; retention &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
| [instances](variables.tf#L74) | Instances ([REGION] => [INSTANCE]). | <code title="map&#40;object&#40;&#123;&#10; consumer_accept_list &#61; optional&#40;list&#40;string&#41;&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; disk_encryption_key &#61; optional&#40;string&#41;&#10; display_name &#61; optional&#40;string&#41;&#10; enable_nat &#61; optional&#40;bool, false&#41;&#10; activate_nat &#61; optional&#40;bool, false&#41;&#10; environments &#61; optional&#40;list&#40;string&#41;, &#91;&#93;&#41;&#10; name &#61; optional&#40;string&#41;&#10; runtime_ip_cidr_range &#61; optional&#40;string&#41;&#10; troubleshooting_ip_cidr_range &#61; optional&#40;string&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> |
| [organization](variables.tf#L100) | Apigee organization. If set to null the organization must already exist. | <code title="object&#40;&#123;&#10; analytics_region &#61; optional&#40;string&#41;&#10; api_consumer_data_encryption_key &#61; optional&#40;string&#41;&#10; api_consumer_data_location &#61; optional&#40;string&#41;&#10; authorized_network &#61; optional&#40;string&#41;&#10; billing_type &#61; optional&#40;string&#41;&#10; control_plane_encryption_key &#61; optional&#40;string&#41;&#10; database_encryption_key &#61; optional&#40;string&#41;&#10; description &#61; optional&#40;string, &#34;Terraform-managed&#34;&#41;&#10; disable_vpc_peering &#61; optional&#40;bool, false&#41;&#10; display_name &#61; optional&#40;string&#41;&#10; properties &#61; optional&#40;map&#40;string&#41;, &#123;&#125;&#41;&#10; runtime_type &#61; optional&#40;string, &#34;CLOUD&#34;&#41;&#10; retention &#61; optional&#40;string&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>null</code> |
## Outputs

View File

@@ -113,6 +113,7 @@ resource "google_apigee_nat_address" "apigee_nat" {
}
name = each.key
instance_id = each.value
activate = var.instances[each.key].activate_nat
}
resource "google_apigee_instance_attachment" "instance_attachments" {

View File

@@ -79,6 +79,7 @@ variable "instances" {
disk_encryption_key = optional(string)
display_name = optional(string)
enable_nat = optional(bool, false)
activate_nat = optional(bool, false)
environments = optional(list(string), [])
name = optional(string)
runtime_ip_cidr_range = optional(string)

View File

@@ -0,0 +1,24 @@
project_id = "my-project"
organization = {
display_name = "My Organization"
description = "My Organization"
runtime_type = "CLOUD"
billing_type = "Pay-as-you-go"
database_encryption_key = "123456789"
analytics_region = "europe-west1"
disable_vpc_peering = true
}
environments = {
apis-test = {
display_name = "APIs test"
description = "APIs Test"
envgroups = ["test"]
}
}
instances = {
europe-west1 = {
environments = ["europe-west1"]
enable_nat = true
activate_nat = true
}
}

View File

@@ -0,0 +1,45 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
google_apigee_environment.environments["apis-test"]:
description: APIs Test
display_name: APIs test
name: apis-test
google_apigee_instance.instances["europe-west1"]:
description: Terraform-managed
disk_encryption_key_name: null
display_name: null
location: europe-west1
name: instance-europe-west1
google_apigee_organization.organization[0]:
analytics_region: europe-west1
authorized_network: null
billing_type: Pay-as-you-go
description: null
display_name: null
project_id: my-project
retention: DELETION_RETENTION_UNSPECIFIED
runtime_database_encryption_key_name: '123456789'
runtime_type: CLOUD
disable_vpc_peering: true
google_apigee_nat_address.apigee_nat["europe-west1"]:
activate: true
counts:
google_apigee_environment: 1
google_apigee_instance: 1
google_apigee_instance_attachment: 1
google_apigee_organization: 1
google_apigee_nat_address: 1

View File

@@ -28,3 +28,4 @@ tests:
organization_only_psc_mode:
organization_only_vpc_mode:
organization_retention:
test_apigee_nat_activate: