diff --git a/google_psc_to_elastic/main.tf b/google_psc_to_elastic/main.tf index 07a23db4..1abd6e77 100644 --- a/google_psc_to_elastic/main.tf +++ b/google_psc_to_elastic/main.tf @@ -3,13 +3,16 @@ locals { name = "${var.name}-${var.gcp_region}-psc-elastic-endpoint" } +data "google_project" "project" { +} + data "ec_gcp_private_service_connect_endpoint" "default" { region = var.gcp_region } data "google_compute_network" "default" { name = var.network_name - project = try(var.project_id_for_network, null) + project = var.project_id_for_network != "" ? var.project_id_for_network : data.google_project.project.project_id } data "google_compute_subnetwork" "default" { diff --git a/google_psc_to_elastic/variables.tf b/google_psc_to_elastic/variables.tf index fb6b0de8..48355db4 100644 --- a/google_psc_to_elastic/variables.tf +++ b/google_psc_to_elastic/variables.tf @@ -15,7 +15,8 @@ variable "network_name" { variable "project_id_for_network" { description = "The project ID of the network" - type = optional(string) + type = string + default = "" } variable "subnetwork_name" {