From 196a57a86bba3c6a2c55e48bfe08d4b1e5303acc Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Mon, 1 May 2017 13:58:11 -0400 Subject: [PATCH] add placement strat. --- tf_ecs_default_service/main.tf | 8 +++++++- tf_ecs_service/main.tf | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tf_ecs_default_service/main.tf b/tf_ecs_default_service/main.tf index 4f10868..a374d52 100644 --- a/tf_ecs_default_service/main.tf +++ b/tf_ecs_default_service/main.tf @@ -17,7 +17,13 @@ resource "aws_ecs_service" "svc" { "aws_iam_role_policy.ecs_service", "aws_alb_listener.front_end", ] - + + # We should spread across instances since we scale up or down on resources + placement_strategy { + type = "spread" + field = "instanceId" + } + lifecycle { create_before_destroy = true } diff --git a/tf_ecs_service/main.tf b/tf_ecs_service/main.tf index da30b04..cb8a4cc 100644 --- a/tf_ecs_service/main.tf +++ b/tf_ecs_service/main.tf @@ -18,6 +18,12 @@ resource "aws_ecs_service" "svc" { "aws_alb_listener.front_end" ] + # We should spread across instances since we scale up or down on resources + placement_strategy { + type = "spread" + field = "instanceId" + } + lifecycle { create_before_destroy = true }