Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support managed_draining argument at aws_ecs_capacity_provider #158

Merged
merged 4 commits into from
Feb 12, 2024
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
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.6
rev: v1.86.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
- id: terraform_validate
- id: terraform_docs
args:
- '--args=--lockfile=false'
Expand All @@ -23,8 +22,10 @@ repos:
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- id: terraform_validate
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ module "ecs" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

Expand Down
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
6 changes: 3 additions & 3 deletions examples/ec2-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
2 changes: 2 additions & 0 deletions examples/ec2-autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module "ecs_cluster" {
# On-demand instances
ex_1 = {
auto_scaling_group_arn = module.autoscaling["ex_1"].autoscaling_group_arn
managed_draining = "ENABLED"
managed_termination_protection = "ENABLED"

managed_scaling = {
Expand All @@ -53,6 +54,7 @@ module "ecs_cluster" {
# Spot instances
ex_2 = {
auto_scaling_group_arn = module.autoscaling["ex_2"].autoscaling_group_arn
managed_draining = "ENABLED"
managed_termination_protection = "ENABLED"

managed_scaling = {
Expand Down
4 changes: 2 additions & 2 deletions examples/ec2-autoscaling/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
6 changes: 3 additions & 3 deletions examples/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/fargate/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
8 changes: 5 additions & 3 deletions modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module "ecs_cluster" {
autoscaling_capacity_providers = {
one = {
auto_scaling_group_arn = "arn:aws:autoscaling:eu-west-1:012345678901:autoScalingGroup:08419a61:autoScalingGroupName/ecs-ec2-one-20220603194933774300000011"
managed_draining = "DISABLED"
managed_termination_protection = "ENABLED"

managed_scaling = {
Expand All @@ -86,6 +87,7 @@ module "ecs_cluster" {
}
two = {
auto_scaling_group_arn = "arn:aws:autoscaling:eu-west-1:012345678901:autoScalingGroup:08419a61:autoScalingGroupName/ecs-ec2-two-20220603194933774300000022"
managed_draining = "ENABLED"
managed_termination_protection = "ENABLED"

managed_scaling = {
Expand Down Expand Up @@ -134,14 +136,14 @@ module "ecs_cluster" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
1 change: 1 addition & 0 deletions modules/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ resource "aws_ecs_capacity_provider" "this" {

auto_scaling_group_provider {
auto_scaling_group_arn = each.value.auto_scaling_group_arn
managed_draining = try(each.value.managed_draining, "ENABLED")
# When you use managed termination protection, you must also use managed scaling otherwise managed termination protection won't work
managed_termination_protection = length(try([each.value.managed_scaling], [])) == 0 ? "DISABLED" : try(each.value.managed_termination_protection, null)

Expand Down
4 changes: 2 additions & 2 deletions modules/cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
6 changes: 3 additions & 3 deletions modules/container-definition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ module "example_ecs_container_definition" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/container-definition/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
6 changes: 3 additions & 3 deletions modules/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ module "ecs_service" {

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.34 |

## Providers

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

## Modules

Expand Down
4 changes: 2 additions & 2 deletions modules/service/versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
terraform {
required_version = ">= 1.0"
required_version = ">= 1.3"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
version = ">= 5.34"
}
}
}
Loading