From 0471c7293d44e0063377d308a388ba9c926a5e0b Mon Sep 17 00:00:00 2001 From: David Mattia <8922077+dmattia@users.noreply.github.com> Date: Sat, 8 Aug 2020 23:26:38 -0500 Subject: [PATCH] Allow customizing grace period time (#10) Co-authored-by: dmattia --- main.tf | 3 ++- variables.tf | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 562362e..ad0a2d8 100644 --- a/main.tf +++ b/main.tf @@ -16,7 +16,8 @@ resource "aws_ecs_service" "service" { type = "ECS" } - health_check_grace_period_seconds = length(var.load_balancers) > 0 ? 60 : 0 + health_check_grace_period_seconds = var.health_check_grace_period_seconds + dynamic "load_balancer" { for_each = var.load_balancers diff --git a/variables.tf b/variables.tf index 59a81a3..6c7a842 100644 --- a/variables.tf +++ b/variables.tf @@ -82,6 +82,12 @@ variable additional_task_policy_arns_count { default = 0 } +variable health_check_grace_period_seconds { + type = number + default = 60 + description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers." +} + variable alb_security_group_ids { type = list(string) description = "The ids of all security groups set on the ALB. We require that the tasks can only talk to the ALB"