Skip to content

Commit

Permalink
Add support for shared VPC in central project (closes #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
micksatana authored and jbeemster committed Jun 3, 2024
1 parent f548de3 commit 66b52b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ module "bigquery_loader_pubsub" {
| <a name="input_machine_type_mutator"></a> [machine\_type\_mutator](#input\_machine\_type\_mutator) | The machine type to use | `string` | `"e2-small"` | no |
| <a name="input_machine_type_repeater"></a> [machine\_type\_repeater](#input\_machine\_type\_repeater) | The machine type to use | `string` | `"e2-small"` | no |
| <a name="input_machine_type_streamloader"></a> [machine\_type\_streamloader](#input\_machine\_type\_streamloader) | The machine type to use | `string` | `"e2-small"` | no |
| <a name="input_network_project_id"></a> [network\_project\_id](#input\_network\_project\_id) | The project ID of the shared VPC in which the stack is being deployed | `string` | `""` | no |
| <a name="input_ssh_block_project_keys"></a> [ssh\_block\_project\_keys](#input\_ssh\_block\_project\_keys) | Whether to block project wide SSH keys | `bool` | `true` | no |
| <a name="input_ssh_ip_allowlist"></a> [ssh\_ip\_allowlist](#input\_ssh\_ip\_allowlist) | The list of CIDR ranges to allow SSH traffic from | `list(any)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_ssh_key_pairs"></a> [ssh\_key\_pairs](#input\_ssh\_key\_pairs) | The list of SSH key-pairs to add to the servers | <pre>list(object({<br> user_name = string<br> public_key = string<br> }))</pre> | `[]` | no |
Expand Down
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ resource "google_bigquery_dataset_iam_member" "dataset_bigquery_data_editor_bind
# --- 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]
Expand All @@ -113,7 +114,8 @@ resource "google_compute_firewall" "ingress_ssh" {
}

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]
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66b52b8

Please sign in to comment.