diff --git a/README.md b/README.md index 7685222..7b9684c 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ module "iglu_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 | | [patches\_allowed](#input\_patches\_allowed) | Whether or not patches are allowed for published Iglu Schemas | `bool` | `true` | 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)` |
[| 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
"0.0.0.0/0"
]