From bcf191ab5a3ed0bd20136f0645d579e2de1a1b50 Mon Sep 17 00:00:00 2001 From: Natalia Strelkova Date: Tue, 1 Aug 2023 13:04:47 +0200 Subject: [PATCH] description: only one main variable --- modules/net-vpc-swp/README.md | 23 +++++++++++------------ modules/net-vpc-swp/main.tf | 12 ++++++------ modules/net-vpc-swp/variables.tf | 16 +++++----------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/modules/net-vpc-swp/README.md b/modules/net-vpc-swp/README.md index 721bedc8f..1e5d999df 100644 --- a/modules/net-vpc-swp/README.md +++ b/modules/net-vpc-swp/README.md @@ -171,19 +171,18 @@ module "secure-web-proxy" { |---|---|:---:|:---:|:---:| | [addresses](variables.tf#L19) | One or more IP addresses to be used for Secure Web Proxy. | | ✓ | | | [certificates](variables.tf#L27) | List of certificates to be used for Secure Web Proxy. | list(string) | ✓ | | -| [name](variables.tf#L56) | Name of the Secure Web Proxy resource. | string | ✓ | | -| [network](variables.tf#L61) | Name of the network the Secure Web Proxy is deployed into. | string | ✓ | | -| [project_id](variables.tf#L125) | Project id of the project that holds the network. | string | ✓ | | -| [region](variables.tf#L130) | Region where resources will be created. | string | ✓ | | -| [subnetwork](variables.tf#L141) | Name of the subnetwork the Secure Web Proxy is deployed into. | string | ✓ | | +| [name](variables.tf#L50) | Name of the Secure Web Proxy resource. | string | ✓ | | +| [network](variables.tf#L55) | Name of the network the Secure Web Proxy is deployed into. | string | ✓ | | +| [project_id](variables.tf#L119) | Project id of the project that holds the network. | string | ✓ | | +| [region](variables.tf#L124) | Region where resources will be created. | string | ✓ | | +| [subnetwork](variables.tf#L135) | Name of the subnetwork the Secure Web Proxy is deployed into. | string | ✓ | | | [delete_swg_autogen_router_on_destroy](variables.tf#L32) | Delete automatically provisioned Cloud Router on destroy. | bool | | true | -| [description](variables.tf#L38) | Optional description for the SWG. | string | | "Managed by Terraform." | -| [gateway_security_policy_description](variables.tf#L44) | Optional description for the gateway security policy. | string | | "Managed by Terraform." | -| [labels](variables.tf#L50) | Resource labels. | map(string) | | {} | -| [policy_rules](variables.tf#L66) | List of policy rule definitions, default to allow action. Available keys: secure_tags, url_lists, custom. URL lists that only have values set will be created. | object({…}) | | {} | -| [ports](variables.tf#L119) | Ports to use for Secure Web Proxy. | list(number) | | [443] | -| [scope](variables.tf#L135) | Scope determines how configuration across multiple Gateway instances are merged. | string | | null | -| [tls_inspection_config](variables.tf#L146) | TLS inspection configuration. | object({…}) | | null | +| [description](variables.tf#L38) | Optional description for the created resources. | string | | "Managed by Terraform." | +| [labels](variables.tf#L44) | Resource labels. | map(string) | | {} | +| [policy_rules](variables.tf#L60) | List of policy rule definitions, default to allow action. Available keys: secure_tags, url_lists, custom. URL lists that only have values set will be created. | object({…}) | | {} | +| [ports](variables.tf#L113) | Ports to use for Secure Web Proxy. | list(number) | | [443] | +| [scope](variables.tf#L129) | Scope determines how configuration across multiple Gateway instances are merged. | string | | null | +| [tls_inspection_config](variables.tf#L140) | TLS inspection configuration. | object({…}) | | null | ## Outputs diff --git a/modules/net-vpc-swp/main.tf b/modules/net-vpc-swp/main.tf index aebe19dc0..3766b4224 100644 --- a/modules/net-vpc-swp/main.tf +++ b/modules/net-vpc-swp/main.tf @@ -23,7 +23,7 @@ resource "google_network_security_gateway_security_policy" "policy" { project = var.project_id name = var.name location = var.region - description = var.gateway_security_policy_description + description = var.description tls_inspection_policy = var.tls_inspection_config != null ? google_network_security_tls_inspection_policy.tls-policy.0.id : null } @@ -33,7 +33,7 @@ resource "google_network_security_tls_inspection_policy" "tls-policy" { project = var.project_id name = var.name location = var.region - description = var.tls_inspection_config.description + description = var.tls_inspection_config.description != null ? var.tls_inspection_config.description : var.description ca_pool = var.tls_inspection_config.ca_pool exclude_public_ca_set = var.tls_inspection_config.exclude_public_ca_set } @@ -44,7 +44,7 @@ resource "google_network_security_gateway_security_policy_rule" "secure_tag_rule project = var.project_id name = each.key location = var.region - description = each.value.description + description = each.value.description != null ? each.value.description : var.description gateway_security_policy = google_network_security_gateway_security_policy.policy.name enabled = each.value.enabled priority = each.value.priority @@ -63,7 +63,7 @@ resource "google_network_security_url_lists" "url_lists" { project = var.project_id name = each.key location = var.region - description = each.value.description + description = each.value.description != null ? each.value.description : var.description values = each.value.values } @@ -73,7 +73,7 @@ resource "google_network_security_gateway_security_policy_rule" "url_list_rules" project = var.project_id name = each.key location = var.region - description = each.value.description + description = each.value.description != null ? each.value.description : var.description gateway_security_policy = google_network_security_gateway_security_policy.policy.name enabled = each.value.enabled priority = each.value.priority @@ -96,7 +96,7 @@ resource "google_network_security_gateway_security_policy_rule" "custom_rules" { provider = google-beta name = each.key location = var.region - description = each.value.description + description = each.value.description != null ? each.value.description : var.description gateway_security_policy = google_network_security_gateway_security_policy.policy.name enabled = each.value.enabled priority = each.value.priority diff --git a/modules/net-vpc-swp/variables.tf b/modules/net-vpc-swp/variables.tf index cca864ce2..17d9061ff 100644 --- a/modules/net-vpc-swp/variables.tf +++ b/modules/net-vpc-swp/variables.tf @@ -36,13 +36,7 @@ variable "delete_swg_autogen_router_on_destroy" { } variable "description" { - description = "Optional description for the SWG." - type = string - default = "Managed by Terraform." -} - -variable "gateway_security_policy_description" { - description = "Optional description for the gateway security policy." + description = "Optional description for the created resources." type = string default = "Managed by Terraform." } @@ -74,7 +68,7 @@ variable "policy_rules" { action = optional(string, "ALLOW") enabled = optional(bool, true) tls_inspection_enabled = optional(bool, false) - description = optional(string, "Managed by Terraform.") + description = optional(string) })), {}) url_lists = optional(map(object({ @@ -86,7 +80,7 @@ variable "policy_rules" { action = optional(string, "ALLOW") enabled = optional(bool, true) tls_inspection_enabled = optional(bool, false) - description = optional(string, "Managed by Terraform.") + description = optional(string) })), {}) custom = optional(map(object({ @@ -96,7 +90,7 @@ variable "policy_rules" { action = optional(string, "ALLOW") enabled = optional(bool, true) tls_inspection_enabled = optional(bool, false) - description = optional(string, "Managed by Terraform.") + description = optional(string) })), {}) }) validation { @@ -148,7 +142,7 @@ variable "tls_inspection_config" { type = object({ ca_pool = optional(string, null) exclude_public_ca_set = optional(bool, false) - description = optional(string, "Managed by Terraform.") + description = optional(string) }) default = null }