Skip to content

Commit 4a4a0a0

Browse files
authored
Merge pull request #9 from egarbi/develop
Adds stickness feature
2 parents ff6d852 + 66fa6e4 commit 4a4a0a0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ variable "policy" {
7777
default = ""
7878
}
7979

80+
variable "cookie_duration" {
81+
description = "The time period, in seconds, during which requests from a client should be routed to the same target.The range is 1 second to 1 week (604800 seconds)"
82+
default = "86400"
83+
}
84+
85+
variable "stick_enabled" {
86+
description = "Boolen to enable / disable stickiness"
87+
default = "false"
88+
}
89+
8090
/* * Resources.
8191
*/
8292

@@ -116,6 +126,11 @@ resource "aws_alb_target_group" "main" {
116126
protocol = "HTTP"
117127
vpc_id = "${var.vpc_id}"
118128
health_check = ["${var.healthcheck}"]
129+
stickiness {
130+
type = "lb_cookie"
131+
cookie_duration = "${var.cookie_duration}"
132+
enabled = "${var.stick_enabled}"
133+
}
119134
}
120135

121136
resource "aws_alb_listener_rule" "main" {

0 commit comments

Comments
 (0)