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:
@@ -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({ advanced_api_ops = optional(bool, false) api_security = optional(bool, false) connectors_platform = optional(bool, false) integration = optional(bool, false) monetization = optional(bool, false) })">object({…})</code> | | <code>null</code> |
|
||||
| [endpoint_attachments](variables.tf#L29) | Endpoint attachments. | <code title="map(object({ region = string service_attachment = string }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [envgroups](variables.tf#L39) | Environment groups (NAME => [HOSTNAMES]). | <code>map(list(string))</code> | | <code>{}</code> |
|
||||
| [environments](variables.tf#L46) | Environments. | <code title="map(object({ api_proxy_type = optional(string) description = optional(string, "Terraform-managed") display_name = optional(string) deployment_type = optional(string) envgroups = optional(list(string), []) forward_proxy_uri = optional(string) iam = optional(map(list(string)), {}) iam_bindings = optional(map(object({ role = string members = list(string) })), {}) iam_bindings_additive = optional(map(object({ role = string member = string })), {}) node_config = optional(object({ min_node_count = optional(number) max_node_count = optional(number) })) type = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [instances](variables.tf#L74) | Instances ([REGION] => [INSTANCE]). | <code title="map(object({ consumer_accept_list = optional(list(string)) description = optional(string, "Terraform-managed") disk_encryption_key = optional(string) display_name = optional(string) enable_nat = optional(bool, false) environments = optional(list(string), []) name = optional(string) runtime_ip_cidr_range = optional(string) troubleshooting_ip_cidr_range = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [organization](variables.tf#L99) | Apigee organization. If set to null the organization must already exist. | <code title="object({ analytics_region = optional(string) api_consumer_data_encryption_key = optional(string) api_consumer_data_location = optional(string) authorized_network = optional(string) billing_type = optional(string) control_plane_encryption_key = optional(string) database_encryption_key = optional(string) description = optional(string, "Terraform-managed") disable_vpc_peering = optional(bool, false) display_name = optional(string) properties = optional(map(string), {}) runtime_type = optional(string, "CLOUD") retention = optional(string) })">object({…})</code> | | <code>null</code> |
|
||||
| [instances](variables.tf#L74) | Instances ([REGION] => [INSTANCE]). | <code title="map(object({ consumer_accept_list = optional(list(string)) description = optional(string, "Terraform-managed") 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) troubleshooting_ip_cidr_range = optional(string) }))">map(object({…}))</code> | | <code>{}</code> |
|
||||
| [organization](variables.tf#L100) | Apigee organization. If set to null the organization must already exist. | <code title="object({ analytics_region = optional(string) api_consumer_data_encryption_key = optional(string) api_consumer_data_location = optional(string) authorized_network = optional(string) billing_type = optional(string) control_plane_encryption_key = optional(string) database_encryption_key = optional(string) description = optional(string, "Terraform-managed") disable_vpc_peering = optional(bool, false) display_name = optional(string) properties = optional(map(string), {}) runtime_type = optional(string, "CLOUD") retention = optional(string) })">object({…})</code> | | <code>null</code> |
|
||||
|
||||
## Outputs
|
||||
|
||||
|
||||
@@ -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" {
|
||||
|
||||
@@ -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)
|
||||
|
||||
24
tests/modules/apigee/test_apigee_nat_activate.tfvars
Normal file
24
tests/modules/apigee/test_apigee_nat_activate.tfvars
Normal 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
|
||||
}
|
||||
}
|
||||
45
tests/modules/apigee/test_apigee_nat_activate.yaml
Normal file
45
tests/modules/apigee/test_apigee_nat_activate.yaml
Normal 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
|
||||
@@ -28,3 +28,4 @@ tests:
|
||||
organization_only_psc_mode:
|
||||
organization_only_vpc_mode:
|
||||
organization_retention:
|
||||
test_apigee_nat_activate:
|
||||
|
||||
Reference in New Issue
Block a user