diff --git a/README.md b/README.md index 2ce6edd..4e17605 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ module "collector_lb" { | [java\_opts](#input\_java\_opts) | Custom JAVA Options | `string` | `"-XX:InitialRAMPercentage=75 -XX:MaxRAMPercentage=75"` | no | | [labels](#input\_labels) | The labels to append to this resource | `map(string)` | `{}` | no | | [machine\_type](#input\_machine\_type) | The machine type to use | `string` | `"e2-small"` | no | +| [network\_project\_id](#input\_network\_project\_id) | The project ID of the shared VPC in which the stack is being deployed | `string` | `""` | no | | [record\_limit](#input\_record\_limit) | The number of events to buffer before pushing them to PubSub | `number` | `500` | no | | [ssh\_block\_project\_keys](#input\_ssh\_block\_project\_keys) | Whether to block project wide SSH keys | `bool` | `true` | no | | [ssh\_ip\_allowlist](#input\_ssh\_ip\_allowlist) | The list of CIDR ranges to allow SSH traffic from | `list(any)` |
[
"0.0.0.0/0"
]
| no | diff --git a/main.tf b/main.tf index a1d67a4..67cf1cc 100644 --- a/main.tf +++ b/main.tf @@ -64,7 +64,8 @@ resource "google_project_iam_member" "sa_logging_log_writer" { # --- 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] @@ -82,7 +83,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] @@ -96,7 +98,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 1c69886..89b9154 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