From ddd413c0225e3b3ad3b2d111d63fe886145fa420 Mon Sep 17 00:00:00 2001 From: Veronika Gnilitska <30597968+gberenice@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:05:05 +0300 Subject: [PATCH] feat: adds support for track_latest (#246) * feat: adds support for track_latest * chore: revert TF constraint update --- README.md | 5 +++-- docs/terraform.md | 5 +++-- main.tf | 1 + variables.tf | 6 ++++++ versions.tf | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4566af08..d65adbcb 100644 --- a/README.md +++ b/README.md @@ -213,13 +213,13 @@ Available targets: | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.14.0 | -| [aws](#requirement\_aws) | >= 4.59 | +| [aws](#requirement\_aws) | >= 5.37 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.59 | +| [aws](#provider\_aws) | >= 5.37 | ## Modules @@ -345,6 +345,7 @@ Available targets: | [task\_policy\_arns\_map](#input\_task\_policy\_arns\_map) | A map of name to IAM Policy ARNs to attach to the generated task role.
The names are arbitrary, but must be known at plan time. The purpose of the name
is so that changes to one ARN do not cause a ripple effect on the other ARNs.
If you cannot provide unique names known at plan time, use `task_policy_arns` instead. | `map(string)` | `{}` | no | | [task\_role\_arn](#input\_task\_role\_arn) | A `list(string)` of zero or one ARNs of IAM roles that allows
your Amazon ECS container task to make calls to other AWS services.
If the list is empty, a role will be created for you.
DEPRECATED: you can also pass a `string` with the ARN, but that
string must be known a "plan" time. | `any` | `[]` | no | | [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | +| [track\_latest](#input\_track\_latest) | Whether should track latest task definition or the one created with the resource. | `bool` | `false` | no | | [use\_alb\_security\_group](#input\_use\_alb\_security\_group) | A flag to enable/disable allowing traffic from the ALB security group to the service security group | `bool` | `false` | no | | [use\_nlb\_cidr\_blocks](#input\_use\_nlb\_cidr\_blocks) | A flag to enable/disable adding the NLB ingress rule to the service security group | `bool` | `false` | no | | [use\_old\_arn](#input\_use\_old\_arn) | A flag to enable/disable tagging the ecs resources that require the new arn format | `bool` | `false` | no | diff --git a/docs/terraform.md b/docs/terraform.md index be2747b9..fedbfa94 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -4,13 +4,13 @@ | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.14.0 | -| [aws](#requirement\_aws) | >= 4.59 | +| [aws](#requirement\_aws) | >= 5.37 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.59 | +| [aws](#provider\_aws) | >= 5.37 | ## Modules @@ -136,6 +136,7 @@ | [task\_policy\_arns\_map](#input\_task\_policy\_arns\_map) | A map of name to IAM Policy ARNs to attach to the generated task role.
The names are arbitrary, but must be known at plan time. The purpose of the name
is so that changes to one ARN do not cause a ripple effect on the other ARNs.
If you cannot provide unique names known at plan time, use `task_policy_arns` instead. | `map(string)` | `{}` | no | | [task\_role\_arn](#input\_task\_role\_arn) | A `list(string)` of zero or one ARNs of IAM roles that allows
your Amazon ECS container task to make calls to other AWS services.
If the list is empty, a role will be created for you.
DEPRECATED: you can also pass a `string` with the ARN, but that
string must be known a "plan" time. | `any` | `[]` | no | | [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | +| [track\_latest](#input\_track\_latest) | Whether should track latest task definition or the one created with the resource. | `bool` | `false` | no | | [use\_alb\_security\_group](#input\_use\_alb\_security\_group) | A flag to enable/disable allowing traffic from the ALB security group to the service security group | `bool` | `false` | no | | [use\_nlb\_cidr\_blocks](#input\_use\_nlb\_cidr\_blocks) | A flag to enable/disable adding the NLB ingress rule to the service security group | `bool` | `false` | no | | [use\_old\_arn](#input\_use\_old\_arn) | A flag to enable/disable tagging the ecs resources that require the new arn format | `bool` | `false` | no | diff --git a/main.tf b/main.tf index 0cd1864b..1ef45857 100644 --- a/main.tf +++ b/main.tf @@ -68,6 +68,7 @@ resource "aws_ecs_task_definition" "default" { pid_mode = var.pid_mode execution_role_arn = length(local.task_exec_role_arn) > 0 ? local.task_exec_role_arn : one(aws_iam_role.ecs_exec[*]["arn"]) task_role_arn = length(local.task_role_arn) > 0 ? local.task_role_arn : one(aws_iam_role.ecs_task[*]["arn"]) + track_latest = var.track_latest dynamic "proxy_configuration" { for_each = var.proxy_configuration == null ? [] : [var.proxy_configuration] diff --git a/variables.tf b/variables.tf index 4d8f3abe..4541808b 100644 --- a/variables.tf +++ b/variables.tf @@ -582,3 +582,9 @@ variable "pid_mode" { error_message = "The pid_mode value must be one of host or task." } } + +variable "track_latest" { + type = bool + description = "Whether should track latest task definition or the one created with the resource." + default = false +} \ No newline at end of file diff --git a/versions.tf b/versions.tf index 45076487..f33805c9 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.59" + version = ">= 5.37" } } }