Skip to content

Commit

Permalink
feat: Add support for setting http_keep_alive_timeout_sec (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim D'Agostino authored May 18, 2024
1 parent 5f9f1a1 commit 804b7b9
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 25 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module "gce-lb-http" {
| firewall\_networks | Names of the networks to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
| http\_keep\_alive\_timeout\_sec | Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). | `number` | `null` | no |
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |
Expand Down
11 changes: 6 additions & 5 deletions autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ resource "google_compute_target_https_proxy" "default" {
name = "${var.name}-https-proxy"
url_map = local.url_map

ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
}

resource "google_compute_ssl_certificate" "default" {
Expand Down
6 changes: 6 additions & 0 deletions autogen/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,9 @@ variable "https_port" {
error_message = "You must specify exactly one port between 1 and 65535"
}
}

variable "http_keep_alive_timeout_sec" {
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
type = number
default = null
}
11 changes: 6 additions & 5 deletions examples/dynamic-backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ module "load_balancer" {
source = "terraform-google-modules/lb-http/google//modules/dynamic_backends"
version = "~> 10.0"

name = "dynamic-backend-lb"
project = var.project
enable_ipv6 = true
create_ipv6_address = true
http_forward = false
name = "dynamic-backend-lb"
project = var.project
enable_ipv6 = true
create_ipv6_address = true
http_forward = false
http_keep_alive_timeout_sec = 610

load_balancing_scheme = "EXTERNAL_MANAGED"

Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ resource "google_compute_target_https_proxy" "default" {
name = "${var.name}-https-proxy"
url_map = local.url_map

ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
}

resource "google_compute_ssl_certificate" "default" {
Expand Down
1 change: 1 addition & 0 deletions modules/dynamic_backends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module "gce-lb-http" {
| firewall\_networks | Names of the networks to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
| http\_keep\_alive\_timeout\_sec | Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). | `number` | `null` | no |
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |
Expand Down
11 changes: 6 additions & 5 deletions modules/dynamic_backends/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ resource "google_compute_target_https_proxy" "default" {
name = "${var.name}-https-proxy"
url_map = local.url_map

ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
}

resource "google_compute_ssl_certificate" "default" {
Expand Down
6 changes: 6 additions & 0 deletions modules/dynamic_backends/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,9 @@ variable "https_port" {
error_message = "You must specify exactly one port between 1 and 65535"
}
}

variable "http_keep_alive_timeout_sec" {
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
type = number
default = null
}
1 change: 1 addition & 0 deletions modules/serverless_negs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ module "lb-http" {
| edge\_security\_policy | The resource URL for the edge security policy to associate with the backend service | `string` | `null` | no |
| enable\_ipv6 | Enable IPv6 address on the CDN load-balancer | `bool` | `false` | no |
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
| http\_keep\_alive\_timeout\_sec | Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). | `number` | `null` | no |
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |
Expand Down
11 changes: 6 additions & 5 deletions modules/serverless_negs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ resource "google_compute_target_https_proxy" "default" {
name = "${var.name}-https-proxy"
url_map = local.url_map

ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
ssl_policy = var.ssl_policy
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
server_tls_policy = var.server_tls_policy
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
}

resource "google_compute_ssl_certificate" "default" {
Expand Down
6 changes: 6 additions & 0 deletions modules/serverless_negs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,9 @@ variable "https_port" {
error_message = "You must specify exactly one port between 1 and 65535"
}
}

variable "http_keep_alive_timeout_sec" {
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
type = number
default = null
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,9 @@ variable "https_port" {
error_message = "You must specify exactly one port between 1 and 65535"
}
}

variable "http_keep_alive_timeout_sec" {
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
type = number
default = null
}

0 comments on commit 804b7b9

Please sign in to comment.