Skip to content

Commit d1c0eb5

Browse files
Merge pull request #4 from gaussb-labs/feature/add-deregistration-delay
feat: Set deregistration delay in target group of ALB
2 parents e3f7c34 + ed405bb commit d1c0eb5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ resource "aws_lb" "alb" {
2626
}
2727

2828
resource "aws_lb_target_group" "app" {
29-
name = "${var.environment}-${local.target_group_app_name}"
30-
port = var.app_port
31-
protocol = "HTTP"
32-
vpc_id = var.vpc_id
29+
name = "${var.environment}-${local.target_group_app_name}"
30+
port = var.app_port
31+
protocol = "HTTP"
32+
vpc_id = var.vpc_id
33+
deregistration_delay = var.target_group_deregistration_delay
3334
health_check {
3435
enabled = var.target_group_healthcheck_enabled
3536
healthy_threshold = var.target_group_healthcheck_healthy_threshold

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,9 @@ variable "target_group_healthcheck_timeout" {
107107
description = "Amount of time, in seconds, during which no response means a failed health check."
108108
default = 5
109109
}
110+
111+
variable "target_group_deregistration_delay" {
112+
type = number
113+
description = "Amount of time, in seconds, for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused"
114+
default = 300
115+
}

0 commit comments

Comments
 (0)