Skip to content

Commit 3af7032

Browse files
committed
Expose LB timeout as a variable
If the CiviForm server fails to respond to a request before the timeout, the user ends up getting a 504 Gateway error. This can happen currently when doing an export that takes more than 60 seconds to compile. This change lets you override the default, and changes the default to 2 minutes.
1 parent f029ea2 commit 3af7032

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

cloud/aws/modules/ecs_fargate_service/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ resource "aws_lb" "civiform_lb" {
5656
load_balancer_type = "application"
5757
drop_invalid_header_fields = false
5858
subnets = var.public_subnets
59-
idle_timeout = 60
59+
idle_timeout = var.lb_idle_timeout
6060
enable_deletion_protection = false
6161
enable_cross_zone_load_balancing = false
6262
enable_http2 = true

cloud/aws/modules/ecs_fargate_service/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ variable "enable_http_listener" {
155155
type = bool
156156
default = true
157157
}
158+
159+
variable "lb_idle_timeout" {
160+
description = "Time in seconds that the connection is allowed to be idle."
161+
type = number
162+
default = 120
163+
}

cloud/aws/templates/aws_oidc/app.tf

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ module "ecs_fargate_service" {
334334
scale_target_min_capacity = var.ecs_scale_target_min_capacity
335335
https_target_port = var.port
336336
lb_internal = local.enable_managed_vpc ? false : true
337+
lb_idle_timeout = var.lb_idle_timeout
337338
lb_logging_enabled = var.lb_logging_enabled
338339
extra_inbound_rule_cidr = var.extra_inbound_rule_cidr
339340
enable_http_listener = var.enable_http_listener

cloud/aws/templates/aws_oidc/variable_definitions.json

+6
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,12 @@
431431
"tfvar": true,
432432
"type": "bool"
433433
},
434+
"LB_IDLE_TIMEOUT": {
435+
"required": false,
436+
"secret": false,
437+
"tfvar": true,
438+
"type": "integer"
439+
},
434440
"LB_LOGGING_ENABLED": {
435441
"required": false,
436442
"secret": false,

cloud/aws/templates/aws_oidc/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,12 @@ variable "external_vpc_public_subnet_ids" {
544544
default = []
545545
}
546546

547+
variable "lb_idle_timeout" {
548+
description = "Time in seconds that the connection is allowed to be idle. If the CiviForm server takes longer than this to respond (e.g. when compiling an export), the request will return a 504 Gateway error."
549+
type = number
550+
default = 120
551+
}
552+
547553
variable "lb_logging_enabled" {
548554
type = bool
549555
description = "Whether to enable LB access logging."

0 commit comments

Comments
 (0)