From 39f66dccfabd8702187daf7fbc168dbcebd6df0b Mon Sep 17 00:00:00 2001 From: Jonathan Sheu Date: Mon, 28 Oct 2019 11:16:23 -0700 Subject: [PATCH] Add slow_start parameter to ecs-service-with-alb (#151) --- aws-ecs-service/README.md | 1 + aws-ecs-service/alb.tf | 1 + aws-ecs-service/variables.tf | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/aws-ecs-service/README.md b/aws-ecs-service/README.md index c363e7e7..32614f16 100644 --- a/aws-ecs-service/README.md +++ b/aws-ecs-service/README.md @@ -166,6 +166,7 @@ service = false` argument can be removed. | registry\_secretsmanager\_arn | ARN for AWS Secrets Manager secret for credentials to private registry | string | `null` | no | | route53\_zone\_id | Zone in which to create an alias record to the ALB. | string | n/a | yes | | service | Service for tagging and naming. See [doc](../README.md#consistent-tagging). | string | n/a | yes | +| slow_start | Seconds for targets to warm up before the load balancer sends them a full share of requests. | number | 60 | no | | ssl\_policy | ELB policy to determine which SSL/TLS encryption protocols are enabled. Probably don't touch this. | string | `null` | no | | subdomain | Subdomain in the zone. Final domain name will be subdomain.zone | string | n/a | yes | | tag\_service | Apply cost tags to the ECS service. Only specify false for backwards compatibility with old ECS services. | bool | `true` | no | diff --git a/aws-ecs-service/alb.tf b/aws-ecs-service/alb.tf index 06799b52..7f15ecb8 100644 --- a/aws-ecs-service/alb.tf +++ b/aws-ecs-service/alb.tf @@ -15,6 +15,7 @@ resource "aws_lb_target_group" "service" { target_type = var.awsvpc_network_mode ? "ip" : "instance" deregistration_delay = 60 + slow_start = var.slow_start health_check { path = var.health_check_path diff --git a/aws-ecs-service/variables.tf b/aws-ecs-service/variables.tf index 1090a2b8..ddfcb4ad 100755 --- a/aws-ecs-service/variables.tf +++ b/aws-ecs-service/variables.tf @@ -196,3 +196,9 @@ variable "ordered_placement_strategy" { default = [] description = "Placement strategy for the task instances." } + +variable "slow_start" { + description = "Seconds for targets to warm up before the load balancer sends them a full share of requests. 30-900 seconds or 0 to disable." + type = number + default = 60 +}