Change ECS Task Definition but keep latest image

Hello,

I have a setup creating all the ECS infrastructure, but the issue is that, when I have to update the task definition through terraform, I’d like to keep the image pointing to the latest (docker tag, image tag) of tha active task definition for the service.

I’m not using “:latest” as the tag because I have a specific tag generated by my CI, but after each update on terraform, I lose this link.

Could not find any solutions with datasources to retrieve this information.

Can someone give me some insight on how to retrieve this info and pass to the ecs_task_definition, image field (AWS ECR)?

Thanks!