From b02f0be1a2666b614fe1eff78838dc0762f71ab0 Mon Sep 17 00:00:00 2001 From: Artsiom Ihnatovich <41552160+ignatovich-artem@users.noreply.github.com> Date: Mon, 6 Sep 2021 14:42:46 +0300 Subject: [PATCH] Add ECS deployment circuit breaker (#19) * add ECS deployment circuit breaker * add empty line --- README.md | 2 ++ ecs-cluster.tf | 7 ++++++- variables.tf | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 01f241b..2de8cba 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ EOF | availability\_zones | List of availability zones which will be provisined by autoscailing group | list | `[]` | yes | | vpc\_id | The ID of VPC | string | - | yes | | container\_insights\_monitoring | Defines enable/disable Cloudwatch Container Insights monitoring | string | `disabled` | no | +| enable\_circuit\_breaker | Enable deployment circuit breaker | bool | false | no | +| enable\_rollback | Enable deployment rollback with circuit breaker | bool | false | no | ### Container definitions default value diff --git a/ecs-cluster.tf b/ecs-cluster.tf index 03d7e4b..10b4b2f 100644 --- a/ecs-cluster.tf +++ b/ecs-cluster.tf @@ -6,7 +6,7 @@ resource "aws_ecs_cluster" "this" { name = "containerInsights" value = var.container_insights_monitoring } - tags = merge(local.default_tags, var.tags) + tags = merge(local.default_tags, var.tags) } data "aws_ecs_cluster" "this" { @@ -69,6 +69,11 @@ resource "aws_ecs_service" "this" { container_port = var.container_port } + deployment_circuit_breaker { + enable = var.enable_circuit_breaker + rollback = var.enable_rollback + } + lifecycle { ignore_changes = [desired_count] } diff --git a/variables.tf b/variables.tf index faf74c4..765d60c 100644 --- a/variables.tf +++ b/variables.tf @@ -163,3 +163,15 @@ variable "container_insights_monitoring" { description = "Defines enable/disable Cloudwatch Container Insights monitoring" default = "disabled" } + +variable "enable_circuit_breaker" { + type = bool + default = false + description = "Whether to enable deployment circuit breaker" +} + +variable "enable_rollback" { + type = bool + default = false + description = "Whether to enable deployment rollback with circuit breaker" +}