Skip to content

Commit b519e0e

Browse files
feat: Add in desync_mitigation and protocol version to module variables (trussworks#149)
* Add desync_mitigation and protocol version to the module's settings * Fix formatting * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 49853d1 commit b519e0e

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ No modules.
7676
| allow\_public\_https | Allow inbound access from the Internet to port 443 | `string` | `true` | no |
7777
| container\_port | The port on which the container will receive traffic. | `string` | `443` | no |
7878
| container\_protocol | The protocol to use to connect with the container. | `string` | `"HTTPS"` | no |
79+
| container\_protocol\_version | The protocol version to use with the container. | `string` | `"HTTP1"` | no |
7980
| deregistration\_delay | The amount time for the LB to wait before changing the state of a deregistering target from draining to unused. Default is 90s. | `string` | `90` | no |
81+
| desync\_mitigation\_mode | Specifies how the load balancer handles security issues related to HTTP desync | `string` | `"defensive"` | no |
8082
| enable\_deletion\_protection | If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer | `string` | `false` | no |
8183
| environment | Environment tag, e.g prod. | `string` | n/a | yes |
8284
| health\_check\_interval | The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. Default 30 seconds. | `string` | `30` | no |

main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ resource "aws_security_group_rule" "app_alb_allow_http_from_world" {
6262
#
6363

6464
resource "aws_lb" "main" {
65-
name = "${var.name}-${var.environment}"
66-
internal = var.alb_internal
67-
subnets = var.alb_subnet_ids
68-
security_groups = [local.security_group]
69-
idle_timeout = var.alb_idle_timeout
65+
name = "${var.name}-${var.environment}"
66+
internal = var.alb_internal
67+
subnets = var.alb_subnet_ids
68+
security_groups = [local.security_group]
69+
idle_timeout = var.alb_idle_timeout
70+
desync_mitigation_mode = var.desync_mitigation_mode
7071

7172
enable_deletion_protection = var.enable_deletion_protection
7273

@@ -85,11 +86,12 @@ resource "aws_lb" "main" {
8586
resource "aws_lb_target_group" "https" {
8687
# Name must be less than or equal to 32 characters, or AWS API returns error.
8788
# Error: "name" cannot be longer than 32 characters
88-
name = coalesce(var.target_group_name, format("ecs-%s-%s-https", var.name, var.environment))
89-
port = var.container_port
90-
protocol = var.container_protocol
91-
vpc_id = var.alb_vpc_id
92-
target_type = "ip"
89+
name = coalesce(var.target_group_name, format("ecs-%s-%s-https", var.name, var.environment))
90+
port = var.container_port
91+
protocol = var.container_protocol
92+
protocol_version = var.container_protocol_version
93+
vpc_id = var.alb_vpc_id
94+
target_type = "ip"
9395

9496
# The amount time for the LB to wait before changing the state of a
9597
# deregistering target from draining to unused. AWS default is 300 seconds.

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,24 @@ variable "container_protocol" {
6161
default = "HTTPS"
6262
}
6363

64+
variable "container_protocol_version" {
65+
description = "The protocol version to use with the container."
66+
type = string
67+
default = "HTTP1"
68+
}
69+
6470
variable "deregistration_delay" {
6571
description = "The amount time for the LB to wait before changing the state of a deregistering target from draining to unused. Default is 90s."
6672
type = string
6773
default = 90
6874
}
6975

76+
variable "desync_mitigation_mode" {
77+
description = "Specifies how the load balancer handles security issues related to HTTP desync"
78+
type = string
79+
default = "defensive"
80+
}
81+
7082
variable "enable_deletion_protection" {
7183
description = " If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer"
7284
type = string

0 commit comments

Comments
 (0)