Skip to content

Commit

Permalink
adding additional ports parameter, optional (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpeder authored Jun 21, 2020
1 parent 5ae9a42 commit c8055a1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ provision a project with the necessary APIs enabled.

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| additional\_ports | A list of additional ports/ranges to open access to on the instances from IAP. | list(string) | `<list>` | no |
| create\_instance\_from\_template | Whether to create and instance from the template or not. If false, no instance is created, but the instance template is created and usable by a MIG | bool | `"true"` | no |
| disk\_size\_gb | Boot disk size in GB | string | `"100"` | no |
| disk\_type | Boot disk type, can be either pd-ssd, local-ssd, or pd-standard | string | `"pd-standard"` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ module "iap_tunneling" {

host_project = var.host_project
project = var.project
additional_ports = var.additional_ports
fw_name_allow_ssh_from_iap = var.fw_name_allow_ssh_from_iap
network = var.network
service_accounts = [local.service_account_email]
Expand Down
1 change: 1 addition & 0 deletions modules/iap-tunneling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ the necessary APIs enabled.

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| additional\_ports | A list of additional ports/ranges to open access to on the instances from IAP. | list(string) | `<list>` | no |
| fw\_name\_allow\_ssh\_from\_iap | Firewall rule name for allowing SSH from IAP. | string | `"allow-ssh-from-iap-to-tunnel"` | no |
| host\_project | The network host project ID. | string | `""` | no |
| instances | Names and zones of the instances to allow SSH from IAP. | object | n/a | yes |
Expand Down
2 changes: 1 addition & 1 deletion modules/iap-tunneling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "google_compute_firewall" "allow_from_iap_to_instances" {

allow {
protocol = "tcp"
ports = ["22"]
ports = toset(concat(["22"], var.additional_ports))
}

# https://cloud.google.com/iap/docs/using-tcp-forwarding#before_you_begin
Expand Down
6 changes: 6 additions & 0 deletions modules/iap-tunneling/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ variable "members" {
description = "List of IAM resources to allow using the IAP tunnel."
type = list(string)
}

variable "additional_ports" {
description = "A list of additional ports/ranges to open access to on the instances from IAP."
type = list(string)
default = []
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ variable "fw_name_allow_ssh_from_iap" {
default = "allow-ssh-from-iap-to-tunnel"
}

variable "additional_ports" {
description = "A list of additional ports/ranges to open access to on the instances from IAP."
type = list(string)
default = []
}

variable "disk_size_gb" {
description = "Boot disk size in GB"
default = 100
Expand Down

0 comments on commit c8055a1

Please sign in to comment.