From 67ca7ca0fc6adc41965ead179ccda7159400da9a Mon Sep 17 00:00:00 2001 From: sanadhis Date: Wed, 28 Feb 2024 21:18:50 +0100 Subject: [PATCH 1/3] feat: allow to specify project_region and namespace for private-service-connect --- modules/private-service-connect/README.md | 2 ++ modules/private-service-connect/main.tf | 9 +++++++++ modules/private-service-connect/variables.tf | 12 ++++++++++++ 3 files changed, 23 insertions(+) diff --git a/modules/private-service-connect/README.md b/modules/private-service-connect/README.md index b64f60d9..825065ef 100644 --- a/modules/private-service-connect/README.md +++ b/modules/private-service-connect/README.md @@ -57,6 +57,8 @@ If you have a firewall rule blocking egress traffic, you will need to configure | private\_service\_connect\_ip | The internal IP to be used for the private service connect. | `string` | n/a | yes | | private\_service\_connect\_name | Private Service Connect endpoint name. Defaults to `global-psconnect-ip` | `string` | `"global-psconnect-ip"` | no | | project\_id | Project ID for Private Service Connect. | `string` | n/a | yes | +| service\_directory\_namespace | Service Directory namespace to register the forwarding rule under. | `string` | `null` | no | +| service\_directory\_region | Service Directory region to register this global forwarding rule under. Defaults to `us-central1` if not defined. | `string` | `null` | no | ## Outputs diff --git a/modules/private-service-connect/main.tf b/modules/private-service-connect/main.tf index 53bd647e..14ede729 100644 --- a/modules/private-service-connect/main.tf +++ b/modules/private-service-connect/main.tf @@ -38,4 +38,13 @@ resource "google_compute_global_forwarding_rule" "forwarding_rule_private_servic network = var.network_self_link ip_address = google_compute_global_address.private_service_connect.id load_balancing_scheme = "" + + dynamic "service_directory_registrations" { + for_each = var.service_directory_namespace != null || var.service_directory_region != null ? [1] : [] + + content { + namespace = var.service_directory_namespace + service_directory_region = var.service_directory_region + } + } } diff --git a/modules/private-service-connect/variables.tf b/modules/private-service-connect/variables.tf index f0045575..78d1f94b 100644 --- a/modules/private-service-connect/variables.tf +++ b/modules/private-service-connect/variables.tf @@ -56,3 +56,15 @@ variable "forwarding_rule_target" { error_message = "For forwarding_rule_target only `all-apis` and `vpc-sc` are valid." } } + +variable "service_directory_namespace" { + description = "Service Directory namespace to register the forwarding rule under." + type = string + default = null +} + +variable "service_directory_region" { + description = "Service Directory region to register this global forwarding rule under. Defaults to `us-central1` if not defined." + type = string + default = null +} From 2a0deb70dcdb5a39e0f53174ad1c6895aad58495 Mon Sep 17 00:00:00 2001 From: sanadhis Date: Thu, 29 Feb 2024 21:57:54 +0100 Subject: [PATCH 2/3] feat: bump minimum required google providers --- modules/private-service-connect/versions.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/private-service-connect/versions.tf b/modules/private-service-connect/versions.tf index 21234b28..defe225d 100644 --- a/modules/private-service-connect/versions.tf +++ b/modules/private-service-connect/versions.tf @@ -19,11 +19,11 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 3.50, < 6" + version = ">= 5.8, < 6" } google-beta = { source = "hashicorp/google-beta" - version = ">= 3.50, < 6" + version = ">= 5.8, < 6" } } From 688f6784390aff3194a3af60a31c1a0d299f8826 Mon Sep 17 00:00:00 2001 From: sanadhis Date: Fri, 1 Mar 2024 07:55:28 +0100 Subject: [PATCH 3/3] docs: add v10.0.0 note --- docs/upgrading_to_v10.0.0.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/upgrading_to_v10.0.0.md diff --git a/docs/upgrading_to_v10.0.0.md b/docs/upgrading_to_v10.0.0.md new file mode 100644 index 00000000..28357282 --- /dev/null +++ b/docs/upgrading_to_v10.0.0.md @@ -0,0 +1,5 @@ +# Upgrading to v10.0.0 + +The v10.0 release contains backwards-incompatible changes. + +This update requires upgrading the minimum provider version of `hashicorp/google` from `3.50` to `5.8` and `hashicorp/google-beta` from `3.50` to `5.8`.