Because of an upcoming .Net8 upgrade we're changing our container port to unprivileged 8080 for better security [1].
For this we've updated our task definitions but when recreating the service, the terraform-aws-ecs-service module for some reason for us always uses the first created task definition it finds and not the latest.
Some users may actually want the terraform-aws-ecs-service module to only use the task definition created by the module so we suggest to introduce a service_use_latest_task_definition bool parameter.
If use_latest_task_definition is provided use the latest revision of the task definition
If not provided or false (default), keep the current behaviour of using the task definition from task_definition.tf
Because of an upcoming .Net8 upgrade we're changing our container port to unprivileged 8080 for better security [1].
For this we've updated our task definitions but when recreating the service, the terraform-aws-ecs-service module for some reason for us always uses the first created task definition it finds and not the latest.
Some users may actually want the terraform-aws-ecs-service module to only use the task definition created by the module so we suggest to introduce a
service_use_latest_task_definition
bool parameter.If
use_latest_task_definition
is provided use the latest revision of the task definition If not provided or false (default), keep the current behaviour of using the task definition from task_definition.tfThanks to @tobyclemson's suggestion trivial to implement using ecs_task_definition.arn_without_revision by changing service.tf#L4 to
[1] https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/8.0/aspnet-port