From 531c4166b704fc65119e92309004f4b3b4aa428a Mon Sep 17 00:00:00 2001 From: Vladislav Aleksandrov <39378932+Valekse@users.noreply.github.com> Date: Thu, 11 Apr 2019 15:16:59 +0300 Subject: [PATCH] Add health_check_grace_period_seconds var to aws_ecs_service (#6) --- README.md | 1 + ecs-cluster.tf | 2 +- variables.tf | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9c5053..861fdbf 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ EOF | ecs\_cluster\_id | ID of existing ECS cluster (if want to attach service and etc to existing cluster) | string | `none` | no | | environment | Environment name is used to identify resources | string | `env` | no | | minimum\_service\_capacity | The number of instances of the task definition to place and keep running | string | `1` | no | +| health\_check\_grace\_period\_seconds | Seconds to ignore failing load balancer health checks on newly instantiated tasks | string | `30` | no | | project | Project name is used to identify resources | string | `test` | no | | service | Service name (will be used as family name in task definition) | string | `SuperService` | no | | subnets | List of subnets where to run ECS Service | list | - | yes | diff --git a/ecs-cluster.tf b/ecs-cluster.tf index 36a5168..4210df8 100644 --- a/ecs-cluster.tf +++ b/ecs-cluster.tf @@ -42,7 +42,7 @@ resource "aws_ecs_service" "this" { deployment_minimum_healthy_percent = "100" desired_count = "${var.minimum_service_capacity}" - health_check_grace_period_seconds = "30" + health_check_grace_period_seconds = "${var.health_check_grace_period_seconds}" network_configuration { subnets = ["${var.subnets}"] diff --git a/variables.tf b/variables.tf index ea502f4..67d7de6 100644 --- a/variables.tf +++ b/variables.tf @@ -50,6 +50,11 @@ variable "minimum_service_capacity" { default = "1" } +variable "health_check_grace_period_seconds" { + description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown" + default = "30" +} + variable "container_definitions" { description = "Fargate container definition"