Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ module "ecs_alb_service_task" {
deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent
deployment_maximum_percent = var.deployment_maximum_percent
deployment_controller_type = var.deployment_controller_type
circuit_breaker_deployment_enabled = var.circuit_breaker_deployment_enabled
circuit_breaker_rollback_enabled = var.circuit_breaker_rollback_enabled
desired_count = var.desired_count
task_memory = var.task_memory
task_cpu = var.task_cpu
Expand Down Expand Up @@ -333,6 +335,8 @@ Available targets:
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Assign a public IP address to the ENI (Fargate launch type only). Valid values are `true` or `false`. Default `false` | `bool` | `false` | no |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| <a name="input_capacity_provider_strategies"></a> [capacity\_provider\_strategies](#input\_capacity\_provider\_strategies) | The capacity provider strategies to use for the service. See `capacity_provider_strategy` configuration block: https://www.terraform.io/docs/providers/aws/r/ecs_service.html#capacity_provider_strategy | <pre>list(object({<br> capacity_provider = string<br> weight = number<br> base = number<br> }))</pre> | `[]` | no |
| <a name="input_circuit_breaker_deployment_enabled"></a> [circuit\_breaker\_deployment\_enabled](#input\_circuit\_breaker\_deployment\_enabled) | Whether to enable the deployment circuit breaker logic for the service | `bool` | `false` | no |
| <a name="input_circuit_breaker_rollback_enabled"></a> [circuit\_breaker\_rollback\_enabled](#input\_circuit\_breaker\_rollback\_enabled) | Whether to enable Amazon ECS to roll back the service if a service deployment fails | `bool` | `false` | no |
| <a name="input_container_definition_json"></a> [container\_definition\_json](#input\_container\_definition\_json) | A string containing a JSON-encoded array of container definitions<br>(`"[{ "name": "container1", ... }, { "name": "container2", ... }]"`).<br>See [API\_ContainerDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html),<br>[cloudposse/terraform-aws-ecs-container-definition](https://github.com/cloudposse/terraform-aws-ecs-container-definition), or<br>[ecs\_task\_definition#container\_definitions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#container_definitions) | `string` | n/a | yes |
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
Expand Down
4 changes: 3 additions & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ related:
url: https://github.com/cloudposse/terraform-aws-alb-ingress
- name: terraform-aws-codebuild
description: Terraform Module to easily leverage AWS CodeBuild for Continuous Integration
url: https://github.com/cloudposse/terraform-aws-codebuild
url: https://github.com/cloudposse/terraform-aws-codebuild
- name: terraform-aws-ecr
description: Terraform Module to manage Docker Container Registries on AWS ECR
url: https://github.com/cloudposse/terraform-aws-ecr
Expand Down Expand Up @@ -135,6 +135,8 @@ usage: |2-
deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent
deployment_maximum_percent = var.deployment_maximum_percent
deployment_controller_type = var.deployment_controller_type
circuit_breaker_deployment_enabled = var.circuit_breaker_deployment_enabled
circuit_breaker_rollback_enabled = var.circuit_breaker_rollback_enabled
desired_count = var.desired_count
task_memory = var.task_memory
task_cpu = var.task_cpu
Expand Down
2 changes: 2 additions & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Assign a public IP address to the ENI (Fargate launch type only). Valid values are `true` or `false`. Default `false` | `bool` | `false` | no |
| <a name="input_attributes"></a> [attributes](#input\_attributes) | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
| <a name="input_capacity_provider_strategies"></a> [capacity\_provider\_strategies](#input\_capacity\_provider\_strategies) | The capacity provider strategies to use for the service. See `capacity_provider_strategy` configuration block: https://www.terraform.io/docs/providers/aws/r/ecs_service.html#capacity_provider_strategy | <pre>list(object({<br> capacity_provider = string<br> weight = number<br> base = number<br> }))</pre> | `[]` | no |
| <a name="input_circuit_breaker_deployment_enabled"></a> [circuit\_breaker\_deployment\_enabled](#input\_circuit\_breaker\_deployment\_enabled) | Whether to enable the deployment circuit breaker logic for the service | `bool` | `false` | no |
| <a name="input_circuit_breaker_rollback_enabled"></a> [circuit\_breaker\_rollback\_enabled](#input\_circuit\_breaker\_rollback\_enabled) | Whether to enable Amazon ECS to roll back the service if a service deployment fails | `bool` | `false` | no |
| <a name="input_container_definition_json"></a> [container\_definition\_json](#input\_container\_definition\_json) | A string containing a JSON-encoded array of container definitions<br>(`"[{ "name": "container1", ... }, { "name": "container2", ... }]"`).<br>See [API\_ContainerDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html),<br>[cloudposse/terraform-aws-ecs-container-definition](https://github.com/cloudposse/terraform-aws-ecs-container-definition), or<br>[ecs\_task\_definition#container\_definitions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#container_definitions) | `string` | n/a | yes |
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
Expand Down
20 changes: 20 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ resource "aws_ecs_service" "ignore_changes_task_definition" {
}
}

deployment_circuit_breaker {
enable = var.circuit_breaker_deployment_enabled
rollback = var.circuit_breaker_rollback_enabled
}

lifecycle {
ignore_changes = [task_definition]
}
Expand Down Expand Up @@ -428,6 +433,11 @@ resource "aws_ecs_service" "ignore_changes_task_definition_and_desired_count" {
type = var.deployment_controller_type
}

deployment_circuit_breaker {
enable = var.circuit_breaker_deployment_enabled
rollback = var.circuit_breaker_rollback_enabled
}

# https://www.terraform.io/docs/providers/aws/r/ecs_service.html#network_configuration
dynamic "network_configuration" {
for_each = var.network_mode == "awsvpc" ? ["true"] : []
Expand Down Expand Up @@ -523,6 +533,11 @@ resource "aws_ecs_service" "ignore_changes_desired_count" {
}
}

deployment_circuit_breaker {
enable = var.circuit_breaker_deployment_enabled
rollback = var.circuit_breaker_rollback_enabled
}

lifecycle {
ignore_changes = [desired_count]
}
Expand Down Expand Up @@ -607,4 +622,9 @@ resource "aws_ecs_service" "default" {
assign_public_ip = var.assign_public_ip
}
}

deployment_circuit_breaker {
enable = var.circuit_breaker_deployment_enabled
rollback = var.circuit_breaker_rollback_enabled
}
}
1 change: 1 addition & 0 deletions terraform-aws-ecs-alb-service-task
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,15 @@ variable "exec_enabled" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service"
default = false
}

variable "circuit_breaker_deployment_enabled" {
type = bool
description = "Whether to enable the deployment circuit breaker logic for the service"
default = false
}

variable "circuit_breaker_rollback_enabled" {
type = bool
description = "Whether to enable Amazon ECS to roll back the service if a service deployment fails"
default = false
}