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: 2 additions & 2 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down
10 changes: 10 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ module "ecs" {
}
}

# Linear deployment
deployment_configuration = {
strategy = "LINEAR"

linear_configuration = {
step_percent = 20
step_bake_time_in_minutes = 1
}
}

service_connect_configuration = {
namespace = aws_service_discovery_http_namespace.this.arn
service = [
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
2 changes: 1 addition & 1 deletion examples/container-definition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2 |

## Providers
Expand Down
2 changes: 1 addition & 1 deletion examples/container-definition/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
null = {
source = "hashicorp/null"
Expand Down
4 changes: 2 additions & 2 deletions examples/ec2-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down
25 changes: 25 additions & 0 deletions examples/ec2-autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,31 @@ module "ecs_service" {
name = local.name
cluster_arn = module.ecs_cluster.arn

# Canary deployment
deployment_configuration = {
strategy = "CANARY"

canary_configuration = {
canary_percent = 10.0
canary_bake_time_in_minutes = 5
}

# # Example config using lifecycle hooks
# lifecycle_hook = {
# success = {
# hook_target_arn = aws_lambda_function.hook_success.arn
# role_arn = aws_iam_role.global.arn
# lifecycle_stages = ["POST_SCALE_UP", "POST_TEST_TRAFFIC_SHIFT"]
# hook_details = jsonencode("test")
# }
# failure = {
# hook_target_arn = aws_lambda_function.hook_failure.arn
# role_arn = aws_iam_role.global.arn
# lifecycle_stages = ["TEST_TRAFFIC_SHIFT", "POST_PRODUCTION_TRAFFIC_SHIFT"]
# }
# }
}

# Task Definition
requires_compatibilities = ["EC2"]
capacity_provider_strategy = {
Expand Down
2 changes: 1 addition & 1 deletion examples/ec2-autoscaling/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
4 changes: 2 additions & 2 deletions examples/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/fargate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module "ecs_service" {
# Enables ECS Exec
enable_execute_command = true

# for blue/green deployments
# Blue/green deployment
deployment_configuration = {
strategy = "BLUE_GREEN"
bake_time_in_minutes = 2
Expand Down
2 changes: 1 addition & 1 deletion examples/fargate/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
4 changes: 2 additions & 2 deletions modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ module "ecs_cluster" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
4 changes: 2 additions & 2 deletions modules/container-definition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ module "example_ecs_container_definition" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/container-definition/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
6 changes: 3 additions & 3 deletions modules/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ module "ecs_service" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.21 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.14 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.21 |

## Modules

Expand Down Expand Up @@ -250,7 +250,7 @@ module "ecs_service" {
| <a name="input_create_task_exec_policy"></a> [create\_task\_exec\_policy](#input\_create\_task\_exec\_policy) | Determines whether the ECS task definition IAM policy should be created. This includes permissions included in AmazonECSTaskExecutionRolePolicy as well as access to secrets and SSM parameters | `bool` | `true` | no |
| <a name="input_create_tasks_iam_role"></a> [create\_tasks\_iam\_role](#input\_create\_tasks\_iam\_role) | Determines whether the ECS tasks IAM role should be created | `bool` | `true` | no |
| <a name="input_deployment_circuit_breaker"></a> [deployment\_circuit\_breaker](#input\_deployment\_circuit\_breaker) | Configuration block for deployment circuit breaker | <pre>object({<br/> enable = bool<br/> rollback = bool<br/> })</pre> | `null` | no |
| <a name="input_deployment_configuration"></a> [deployment\_configuration](#input\_deployment\_configuration) | Configuration block for deployment settings | <pre>object({<br/> strategy = optional(string)<br/> bake_time_in_minutes = optional(string)<br/> lifecycle_hook = optional(map(object({<br/> hook_target_arn = string<br/> role_arn = string<br/> lifecycle_stages = list(string)<br/> hook_details = optional(string)<br/> })))<br/> })</pre> | `null` | no |
| <a name="input_deployment_configuration"></a> [deployment\_configuration](#input\_deployment\_configuration) | Configuration block for deployment settings | <pre>object({<br/> strategy = optional(string)<br/> bake_time_in_minutes = optional(string)<br/> canary_configuration = optional(object({<br/> canary_bake_time_in_minutes = optional(string)<br/> canary_percent = optional(string)<br/> }))<br/> linear_configuration = optional(object({<br/> step_bake_time_in_minutes = optional(string)<br/> step_percent = optional(string)<br/> }))<br/> lifecycle_hook = optional(map(object({<br/> hook_target_arn = string<br/> role_arn = string<br/> lifecycle_stages = list(string)<br/> hook_details = optional(string)<br/> })))<br/> })</pre> | `null` | no |
| <a name="input_deployment_controller"></a> [deployment\_controller](#input\_deployment\_controller) | Configuration block for deployment controller configuration | <pre>object({<br/> type = optional(string)<br/> })</pre> | `null` | no |
| <a name="input_deployment_maximum_percent"></a> [deployment\_maximum\_percent](#input\_deployment\_maximum\_percent) | Upper limit (as a percentage of the service's `desired_count`) of the number of running tasks that can be running in a service during a deployment | `number` | `200` | no |
| <a name="input_deployment_minimum_healthy_percent"></a> [deployment\_minimum\_healthy\_percent](#input\_deployment\_minimum\_healthy\_percent) | Lower limit (as a percentage of the service's `desired_count`) of the number of running tasks that must remain running and healthy in a service during a deployment | `number` | `66` | no |
Expand Down
36 changes: 36 additions & 0 deletions modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ resource "aws_ecs_service" "this" {
strategy = deployment_configuration.value.strategy
bake_time_in_minutes = deployment_configuration.value.bake_time_in_minutes

dynamic "linear_configuration" {
for_each = deployment_configuration.value.linear_configuration != null ? [deployment_configuration.value.linear_configuration] : []

content {
step_bake_time_in_minutes = linear_configuration.value.step_bake_time_in_minutes
step_percent = linear_configuration.value.step_percent
}
}

dynamic "canary_configuration" {
for_each = deployment_configuration.value.canary_configuration != null ? [deployment_configuration.value.canary_configuration] : []

content {
canary_bake_time_in_minutes = canary_configuration.value.canary_bake_time_in_minutes
canary_percent = canary_configuration.value.canary_percent
}
}

dynamic "lifecycle_hook" {
for_each = deployment_configuration.value.lifecycle_hook != null ? deployment_configuration.value.lifecycle_hook : {}

Expand Down Expand Up @@ -405,6 +423,24 @@ resource "aws_ecs_service" "ignore_task_definition" {
strategy = deployment_configuration.value.strategy
bake_time_in_minutes = deployment_configuration.value.bake_time_in_minutes

dynamic "linear_configuration" {
for_each = deployment_configuration.value.linear_configuration != null ? [deployment_configuration.value.linear_configuration] : []

content {
step_percent = linear_configuration.value.step_percent
step_bake_time_in_minutes = linear_configuration.value.step_bake_time_in_minutes
}
}

dynamic "canary_configuration" {
for_each = deployment_configuration.value.canary_configuration != null ? [deployment_configuration.value.canary_configuration] : []

content {
canary_percent = canary_configuration.value.canary_percent
canary_bake_time_in_minutes = canary_configuration.value.canary_bake_time_in_minutes
}
}

dynamic "lifecycle_hook" {
for_each = deployment_configuration.value.lifecycle_hook != null ? deployment_configuration.value.lifecycle_hook : {}

Expand Down
8 changes: 8 additions & 0 deletions modules/service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ variable "deployment_configuration" {
type = object({
strategy = optional(string)
bake_time_in_minutes = optional(string)
canary_configuration = optional(object({
canary_bake_time_in_minutes = optional(string)
canary_percent = optional(string)
}))
linear_configuration = optional(object({
step_bake_time_in_minutes = optional(string)
step_percent = optional(string)
}))
lifecycle_hook = optional(map(object({
hook_target_arn = string
role_arn = string
Expand Down
2 changes: 1 addition & 1 deletion modules/service/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
8 changes: 8 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ variable "services" {
deployment_configuration = optional(object({
strategy = optional(string)
bake_time_in_minutes = optional(string)
canary_configuration = optional(object({
canary_bake_time_in_minutes = optional(string)
canary_percent = optional(string)
}))
linear_configuration = optional(object({
step_bake_time_in_minutes = optional(string)
step_percent = optional(string)
}))
lifecycle_hook = optional(map(object({
hook_target_arn = string
role_arn = string
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/container-definition/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/service/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}
2 changes: 1 addition & 1 deletion wrappers/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.14"
version = ">= 6.21"
}
}
}