diff --git a/README.md b/README.md index 7685222..99eddf9 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ module "iglu_lb" { | [name](#input\_name) | A name which will be pre-pended to the resources created | `string` | n/a | yes | | [network](#input\_network) | The name of the network to deploy within | `string` | n/a | yes | | [project\_id](#input\_project\_id) | The project ID in which the stack is being deployed | `string` | n/a | yes | +| [network\_project\_id](#input\_network\_project\_id) | The project ID of the shared VPC in which the stack is being deployed | `string` | `""` | no | | [region](#input\_region) | The name of the region to deploy within | `string` | n/a | yes | | [super\_api\_key](#input\_super\_api\_key) | A UUIDv4 string to use as the master API key for Iglu Server management | `string` | n/a | yes | | [accept\_limited\_use\_license](#input\_accept\_limited\_use\_license) | Acceptance of the SLULA terms (https://docs.snowplow.io/limited-use-license-1.0/) | `bool` | `false` | no | diff --git a/main.tf b/main.tf index e6f55a2..229245f 100644 --- a/main.tf +++ b/main.tf @@ -58,7 +58,8 @@ resource "google_project_iam_member" "sa_cloud_sql_client" { # --- CE: Firewall rules resource "google_compute_firewall" "ingress_ssh" { - name = "${var.name}-ssh-in" + project = (var.network_project_id != "") ? var.network_project_id : var.project_id + name = "${var.name}-ssh-in" network = var.network target_tags = [var.name] @@ -76,7 +77,8 @@ resource "google_compute_firewall" "ingress_ssh" { # # https://cloud.google.com/load-balancing/docs/health-check-concepts#ip-ranges resource "google_compute_firewall" "ingress" { - name = "${var.name}-traffic-in" + project = (var.network_project_id != "") ? var.network_project_id : var.project_id + name = "${var.name}-traffic-in" network = var.network target_tags = [var.name] @@ -90,7 +92,8 @@ resource "google_compute_firewall" "ingress" { } resource "google_compute_firewall" "egress" { - name = "${var.name}-traffic-out" + project = (var.network_project_id != "") ? var.network_project_id : var.project_id + name = "${var.name}-traffic-out" network = var.network target_tags = [var.name] diff --git a/variables.tf b/variables.tf index 80ed80e..8529080 100644 --- a/variables.tf +++ b/variables.tf @@ -25,6 +25,12 @@ variable "project_id" { type = string } +variable "network_project_id" { + description = "The project ID of the shared VPC in which the stack is being deployed" + type = string + default = "" +} + variable "region" { description = "The name of the region to deploy within" type = string