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" +}