From ef91934370c562036d2e0a796d9da126904b8c54 Mon Sep 17 00:00:00 2001 From: Will Austin Date: Fri, 31 Oct 2025 14:57:36 -0600 Subject: [PATCH] feat: add support for deployment_circuit_breaker configuration This change adds support for the ECS deployment circuit breaker feature, which allows for automatic rollback of failed deployments. The deployment_circuit_breaker configuration is now passed through from the service variable to the underlying ECS service module, enabling users to configure automatic rollback behavior for their Atlantis deployments. Example usage: service = { deployment_circuit_breaker = { enable = true rollback = true } } Updated both example configurations (github-complete and github-separate) to demonstrate the circuit breaker feature. Tested locally by referencing the module and confirming the circuit breaker configuration is properly applied to the ECS service. --- README.md | 20 ++++++++++++++++++++ examples/github-complete/main.tf | 6 ++++++ main.tf | 1 + 3 files changed, 27 insertions(+) diff --git a/README.md b/README.md index ae785f82..779531fe 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,26 @@ module "atlantis" { } ``` +### Enable Deployment Circuit Breaker + +You can enable the ECS deployment circuit breaker to automatically roll back failed deployments: + +```hcl +module "atlantis" { + source = "terraform-aws-modules/atlantis/aws" + + # ... + + service = { + # Enable circuit breaker for automatic rollback on failed deployments + deployment_circuit_breaker = { + enable = true + rollback = true + } + } +} +``` + ## Examples - [Complete Atlantis with GitHub webhook](https://github.com/terraform-aws-modules/terraform-aws-atlantis/tree/master/examples/github-complete) diff --git a/examples/github-complete/main.tf b/examples/github-complete/main.tf index cb387c72..91f8f664 100644 --- a/examples/github-complete/main.tf +++ b/examples/github-complete/main.tf @@ -70,6 +70,12 @@ module "atlantis" { tasks_iam_role_policies = { AdministratorAccess = "arn:aws:iam::aws:policy/AdministratorAccess" } + + # Enable circuit breaker for automatic rollback on failed deployments + deployment_circuit_breaker = { + enable = true + rollback = true + } } # ALB diff --git a/main.tf b/main.tf index 84317650..93f9dcca 100644 --- a/main.tf +++ b/main.tf @@ -235,6 +235,7 @@ module "ecs_service" { alarms = try(var.service.alarms, {}) capacity_provider_strategy = try(var.service.capacity_provider_strategy, {}) cluster_arn = var.create_cluster && var.create ? module.ecs_cluster.arn : var.cluster_arn + deployment_circuit_breaker = try(var.service.deployment_circuit_breaker, {}) deployment_controller = try(var.service.deployment_controller, {}) deployment_maximum_percent = try(var.service.deployment_maximum_percent, local.deployment_maximum_percent) deployment_minimum_healthy_percent = try(var.service.deployment_minimum_healthy_percent, local.deployment_minimum_healthy_percent)