From d2a87393343592acec08f61185efc5e5ea653475 Mon Sep 17 00:00:00 2001 From: Ivan Sukhomlyn Date: Fri, 26 Jan 2024 17:24:38 +0200 Subject: [PATCH 1/4] feat: Support manged_draining argument for aws_ecs_capacity_provider --- examples/ec2-autoscaling/main.tf | 2 ++ modules/cluster/README.md | 2 ++ modules/cluster/main.tf | 1 + 3 files changed, 5 insertions(+) diff --git a/examples/ec2-autoscaling/main.tf b/examples/ec2-autoscaling/main.tf index f808445..bfdd850 100644 --- a/examples/ec2-autoscaling/main.tf +++ b/examples/ec2-autoscaling/main.tf @@ -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 = { @@ -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 = { diff --git a/modules/cluster/README.md b/modules/cluster/README.md index 3d7abef..37a87c2 100644 --- a/modules/cluster/README.md +++ b/modules/cluster/README.md @@ -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 = { @@ -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 = { diff --git a/modules/cluster/main.tf b/modules/cluster/main.tf index c988f57..0f9ede5 100644 --- a/modules/cluster/main.tf +++ b/modules/cluster/main.tf @@ -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) From bccea0b62845674c723fc72fdf4dad21a09de25f Mon Sep 17 00:00:00 2001 From: Ivan Sukhomlyn Date: Fri, 26 Jan 2024 17:31:23 +0200 Subject: [PATCH 2/4] bump required AWS provider version to 5.34 --- modules/cluster/versions.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cluster/versions.tf b/modules/cluster/versions.tf index 682191e..e3f75a1 100644 --- a/modules/cluster/versions.tf +++ b/modules/cluster/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } From cd1fe4169c1a2001fc2a4d21668a85affdecde3b Mon Sep 17 00:00:00 2001 From: Ivan Sukhomlyn Date: Mon, 29 Jan 2024 20:06:37 +0200 Subject: [PATCH 3/4] align AWS provider version across the project --- README.md | 2 +- examples/complete/README.md | 4 ++-- examples/complete/versions.tf | 2 +- examples/ec2-autoscaling/README.md | 4 ++-- examples/ec2-autoscaling/versions.tf | 2 +- examples/fargate/README.md | 4 ++-- examples/fargate/versions.tf | 2 +- modules/cluster/README.md | 4 ++-- modules/container-definition/README.md | 4 ++-- modules/container-definition/versions.tf | 2 +- modules/service/README.md | 4 ++-- modules/service/versions.tf | 2 +- versions.tf | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 42fe72c..ea3a484 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ module "ecs" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers diff --git a/examples/complete/README.md b/examples/complete/README.md index 0cc2023..d5ba738 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 682191e..e3f75a1 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } diff --git a/examples/ec2-autoscaling/README.md b/examples/ec2-autoscaling/README.md index 0bca5f7..da7a567 100644 --- a/examples/ec2-autoscaling/README.md +++ b/examples/ec2-autoscaling/README.md @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/examples/ec2-autoscaling/versions.tf b/examples/ec2-autoscaling/versions.tf index 682191e..e3f75a1 100644 --- a/examples/ec2-autoscaling/versions.tf +++ b/examples/ec2-autoscaling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } diff --git a/examples/fargate/README.md b/examples/fargate/README.md index 90b40f4..ba6edaf 100644 --- a/examples/fargate/README.md +++ b/examples/fargate/README.md @@ -27,13 +27,13 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/examples/fargate/versions.tf b/examples/fargate/versions.tf index 682191e..e3f75a1 100644 --- a/examples/fargate/versions.tf +++ b/examples/fargate/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } diff --git a/modules/cluster/README.md b/modules/cluster/README.md index 37a87c2..10c18d2 100644 --- a/modules/cluster/README.md +++ b/modules/cluster/README.md @@ -137,13 +137,13 @@ module "ecs_cluster" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/modules/container-definition/README.md b/modules/container-definition/README.md index f8ce3cb..5bbb2da 100644 --- a/modules/container-definition/README.md +++ b/modules/container-definition/README.md @@ -116,13 +116,13 @@ module "example_ecs_container_definition" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/modules/container-definition/versions.tf b/modules/container-definition/versions.tf index 682191e..e3f75a1 100644 --- a/modules/container-definition/versions.tf +++ b/modules/container-definition/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } diff --git a/modules/service/README.md b/modules/service/README.md index f6bda11..fd16606 100644 --- a/modules/service/README.md +++ b/modules/service/README.md @@ -167,13 +167,13 @@ module "ecs_service" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | +| [aws](#requirement\_aws) | >= 5.34.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | +| [aws](#provider\_aws) | >= 5.34.0 | ## Modules diff --git a/modules/service/versions.tf b/modules/service/versions.tf index 682191e..e3f75a1 100644 --- a/modules/service/versions.tf +++ b/modules/service/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } diff --git a/versions.tf b/versions.tf index 682191e..e3f75a1 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.66.1" + version = ">= 5.34.0" } } } From a1de7971f8e2c5d1f6ca8db32c8e717f4553982f Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Mon, 12 Feb 2024 10:39:50 -0500 Subject: [PATCH 4/4] feat: Update MSTV to 1.3 to support state migrations, align provider version on minor version --- .pre-commit-config.yaml | 5 +++-- README.md | 4 ++-- examples/complete/README.md | 6 +++--- examples/complete/versions.tf | 4 ++-- examples/ec2-autoscaling/README.md | 6 +++--- examples/ec2-autoscaling/versions.tf | 4 ++-- examples/fargate/README.md | 6 +++--- examples/fargate/versions.tf | 4 ++-- modules/cluster/README.md | 6 +++--- modules/cluster/versions.tf | 4 ++-- modules/container-definition/README.md | 6 +++--- modules/container-definition/versions.tf | 4 ++-- modules/service/README.md | 6 +++--- modules/service/versions.tf | 4 ++-- versions.tf | 4 ++-- 15 files changed, 37 insertions(+), 36 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26acde2..89d40d7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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' @@ -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 diff --git a/README.md b/README.md index ea3a484..3a3d87e 100644 --- a/README.md +++ b/README.md @@ -159,8 +159,8 @@ module "ecs" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers diff --git a/examples/complete/README.md b/examples/complete/README.md index d5ba738..35429b4 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index e3f75a1..63e9319 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/examples/ec2-autoscaling/README.md b/examples/ec2-autoscaling/README.md index da7a567..d2206f8 100644 --- a/examples/ec2-autoscaling/README.md +++ b/examples/ec2-autoscaling/README.md @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/examples/ec2-autoscaling/versions.tf b/examples/ec2-autoscaling/versions.tf index e3f75a1..63e9319 100644 --- a/examples/ec2-autoscaling/versions.tf +++ b/examples/ec2-autoscaling/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/examples/fargate/README.md b/examples/fargate/README.md index ba6edaf..5cf6f30 100644 --- a/examples/fargate/README.md +++ b/examples/fargate/README.md @@ -26,14 +26,14 @@ Note that this example may create resources which will incur monetary charges on | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/examples/fargate/versions.tf b/examples/fargate/versions.tf index e3f75a1..63e9319 100644 --- a/examples/fargate/versions.tf +++ b/examples/fargate/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/modules/cluster/README.md b/modules/cluster/README.md index 10c18d2..f8c2cea 100644 --- a/modules/cluster/README.md +++ b/modules/cluster/README.md @@ -136,14 +136,14 @@ module "ecs_cluster" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/modules/cluster/versions.tf b/modules/cluster/versions.tf index e3f75a1..63e9319 100644 --- a/modules/cluster/versions.tf +++ b/modules/cluster/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/modules/container-definition/README.md b/modules/container-definition/README.md index 5bbb2da..5426afd 100644 --- a/modules/container-definition/README.md +++ b/modules/container-definition/README.md @@ -115,14 +115,14 @@ module "example_ecs_container_definition" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/modules/container-definition/versions.tf b/modules/container-definition/versions.tf index e3f75a1..63e9319 100644 --- a/modules/container-definition/versions.tf +++ b/modules/container-definition/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/modules/service/README.md b/modules/service/README.md index fd16606..1a93616 100644 --- a/modules/service/README.md +++ b/modules/service/README.md @@ -166,14 +166,14 @@ module "ecs_service" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 5.34.0 | +| [terraform](#requirement\_terraform) | >= 1.3 | +| [aws](#requirement\_aws) | >= 5.34 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 5.34.0 | +| [aws](#provider\_aws) | >= 5.34 | ## Modules diff --git a/modules/service/versions.tf b/modules/service/versions.tf index e3f75a1..63e9319 100644 --- a/modules/service/versions.tf +++ b/modules/service/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } } diff --git a/versions.tf b/versions.tf index e3f75a1..63e9319 100644 --- a/versions.tf +++ b/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3" required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.34.0" + version = ">= 5.34" } } }