Skip to content

Commit 3a22a6d

Browse files
issues #59 Add an option for enabling deployment_circuit_breaker (#61)
* add an option for enabling deployment_circuit_breaker * update readme * define a block of type deployment_circuit_breaker * Update main.tf Co-authored-by: Julian Nonino <jnonino@users.noreply.github.com>
1 parent d9cfafd commit 3a22a6d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ In order to run all checks at any point run the following command:
9191
| <a name="input_deployment_controller"></a> [deployment\_controller](#input\_deployment\_controller) | (Optional) Deployment controller | `list(string)` | `[]` | no |
9292
| <a name="input_deployment_maximum_percent"></a> [deployment\_maximum\_percent](#input\_deployment\_maximum\_percent) | (Optional) The upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. | `number` | `200` | no |
9393
| <a name="input_deployment_minimum_healthy_percent"></a> [deployment\_minimum\_healthy\_percent](#input\_deployment\_minimum\_healthy\_percent) | (Optional) The lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. | `number` | `100` | no |
94+
| <a name="input_deployment_circuit_breaker"></a> [deployment\_circuit\_breaker](#input\_deployment\_circuit\_breaker) | (Optional) You can enable the deployment circuit breaker to cause a service deployment to transition to a failed state if tasks are persistently failing to reach RUNNING state or are failing healthcheck. The optional rollback option causes Amazon ECS to roll back to the last completed deployment upon a deployment failure. | <pre>list(object({<br> enabled = bool<br> rollback = bool<br> }))</pre> | `[]` | no |
9495
| <a name="input_desired_count"></a> [desired\_count](#input\_desired\_count) | (Optional) The number of instances of the task definition to place and keep running. Defaults to 0. | `number` | `1` | no |
9596
| <a name="input_ecs_cluster_arn"></a> [ecs\_cluster\_arn](#input\_ecs\_cluster\_arn) | ARN of an ECS cluster | `any` | n/a | yes |
9697
| <a name="input_ecs_cluster_name"></a> [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | (Optional) Name of the ECS cluster. Required only if autoscaling is enabled | `string` | `null` | no |

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ resource "aws_ecs_service" "service" {
9797
subnets = var.assign_public_ip ? var.public_subnets : var.private_subnets
9898
assign_public_ip = var.assign_public_ip
9999
}
100+
deployment_circuit_breaker {
101+
enable = var.deployment_circuit_breaker_enabled
102+
rollback = var.deployment_circuit_breaker_rollback
103+
}
100104
dynamic "ordered_placement_strategy" {
101105
for_each = var.ordered_placement_strategy
102106
content {

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ variable "deployment_minimum_healthy_percent" {
3131
default = 100
3232
}
3333

34+
variable "deployment_circuit_breaker_enabled" {
35+
description = "(Optional) You can enable the deployment circuit breaker to cause a service deployment to transition to a failed state if tasks are persistently failing to reach RUNNING state or are failing healthcheck."
36+
type = bool
37+
default = false
38+
}
39+
40+
variable "deployment_circuit_breaker_rollback" {
41+
description = "(Optional) The optional rollback option causes Amazon ECS to roll back to the last completed deployment upon a deployment failure."
42+
type = bool
43+
default = false
44+
}
45+
3446
variable "desired_count" {
3547
description = "(Optional) The number of instances of the task definition to place and keep running. Defaults to 0."
3648
type = number

0 commit comments

Comments
 (0)