Skip to content

Commit 804b7b9

Browse files
author
Jim D'Agostino
authored
feat: Add support for setting http_keep_alive_timeout_sec (#425)
1 parent 5f9f1a1 commit 804b7b9

File tree

12 files changed

+57
-25
lines changed

12 files changed

+57
-25
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ module "gce-lb-http" {
106106
| firewall\_networks | Names of the networks to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
107107
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
108108
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
109+
| 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 |
109110
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
110111
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
111112
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |

autogen/main.tf.tmpl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ resource "google_compute_target_https_proxy" "default" {
119119
name = "${var.name}-https-proxy"
120120
url_map = local.url_map
121121

122-
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
123-
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
124-
ssl_policy = var.ssl_policy
125-
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
126-
server_tls_policy = var.server_tls_policy
122+
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
123+
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
124+
ssl_policy = var.ssl_policy
125+
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
126+
server_tls_policy = var.server_tls_policy
127+
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
127128
}
128129

129130
resource "google_compute_ssl_certificate" "default" {

autogen/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,9 @@ variable "https_port" {
337337
error_message = "You must specify exactly one port between 1 and 65535"
338338
}
339339
}
340+
341+
variable "http_keep_alive_timeout_sec" {
342+
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
343+
type = number
344+
default = null
345+
}

examples/dynamic-backend/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ module "load_balancer" {
3434
source = "terraform-google-modules/lb-http/google//modules/dynamic_backends"
3535
version = "~> 10.0"
3636

37-
name = "dynamic-backend-lb"
38-
project = var.project
39-
enable_ipv6 = true
40-
create_ipv6_address = true
41-
http_forward = false
37+
name = "dynamic-backend-lb"
38+
project = var.project
39+
enable_ipv6 = true
40+
create_ipv6_address = true
41+
http_forward = false
42+
http_keep_alive_timeout_sec = 610
4243

4344
load_balancing_scheme = "EXTERNAL_MANAGED"
4445

main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ resource "google_compute_target_https_proxy" "default" {
117117
name = "${var.name}-https-proxy"
118118
url_map = local.url_map
119119

120-
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
121-
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
122-
ssl_policy = var.ssl_policy
123-
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
124-
server_tls_policy = var.server_tls_policy
120+
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
121+
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
122+
ssl_policy = var.ssl_policy
123+
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
124+
server_tls_policy = var.server_tls_policy
125+
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
125126
}
126127

127128
resource "google_compute_ssl_certificate" "default" {

modules/dynamic_backends/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ module "gce-lb-http" {
9999
| firewall\_networks | Names of the networks to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
100100
| firewall\_projects | Names of the projects to create firewall rules in | `list(string)` | <pre>[<br> "default"<br>]</pre> | no |
101101
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
102+
| 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 |
102103
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
103104
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
104105
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |

modules/dynamic_backends/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ resource "google_compute_target_https_proxy" "default" {
117117
name = "${var.name}-https-proxy"
118118
url_map = local.url_map
119119

120-
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
121-
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
122-
ssl_policy = var.ssl_policy
123-
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
124-
server_tls_policy = var.server_tls_policy
120+
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
121+
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
122+
ssl_policy = var.ssl_policy
123+
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
124+
server_tls_policy = var.server_tls_policy
125+
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
125126
}
126127

127128
resource "google_compute_ssl_certificate" "default" {

modules/dynamic_backends/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,9 @@ variable "https_port" {
324324
error_message = "You must specify exactly one port between 1 and 65535"
325325
}
326326
}
327+
328+
variable "http_keep_alive_timeout_sec" {
329+
description = "Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds)."
330+
type = number
331+
default = null
332+
}

modules/serverless_negs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ module "lb-http" {
8282
| edge\_security\_policy | The resource URL for the edge security policy to associate with the backend service | `string` | `null` | no |
8383
| enable\_ipv6 | Enable IPv6 address on the CDN load-balancer | `bool` | `false` | no |
8484
| http\_forward | Set to `false` to disable HTTP port 80 forward | `bool` | `true` | no |
85+
| 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 |
8586
| http\_port | The port for the HTTP load balancer | `number` | `80` | no |
8687
| https\_port | The port for the HTTPS load balancer | `number` | `443` | no |
8788
| https\_redirect | Set to `true` to enable https redirect on the lb. | `bool` | `false` | no |

modules/serverless_negs/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ resource "google_compute_target_https_proxy" "default" {
116116
name = "${var.name}-https-proxy"
117117
url_map = local.url_map
118118

119-
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
120-
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
121-
ssl_policy = var.ssl_policy
122-
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
123-
server_tls_policy = var.server_tls_policy
119+
ssl_certificates = compact(concat(var.ssl_certificates, google_compute_ssl_certificate.default[*].self_link, google_compute_managed_ssl_certificate.default[*].self_link, ), )
120+
certificate_map = var.certificate_map != null ? "//certificatemanager.googleapis.com/${var.certificate_map}" : null
121+
ssl_policy = var.ssl_policy
122+
quic_override = var.quic == null ? "NONE" : var.quic ? "ENABLE" : "DISABLE"
123+
server_tls_policy = var.server_tls_policy
124+
http_keep_alive_timeout_sec = var.http_keep_alive_timeout_sec
124125
}
125126

126127
resource "google_compute_ssl_certificate" "default" {

0 commit comments

Comments
 (0)