Deploy multiple build projects to ECS with one or multiple task definitions


I have 4 build projects which will eventually be deployed to ECS, however I would like to know if there is a solution for doing so. The issue I have encountered with me current solution:

Create a task definition (JSON) within each of the 4 build projects which defines each project with the docker tag “latest”.

By tagging each docker image with latest the ECS host does not pull the docker image on each update. This is a docker issue in of itself.

Each docker image build should be tagged with the build number or Circle CI SHA, this way the task definition pull the docker image as it would be a new docker image and tag.

by having the docker images being build individually and the task definition reside within in project, one project will not know the build number or Circle CI SHA hash to populate the environment variable … or is there?

Essential I would like to have. single task definition that populates the environment variable for each of the respective builds, alternatively if I need to host the task definition within each of the projects I would like to have to same result where the build is successful and the deployment is done the environment variable for the other docker builds are populate so that on each deployment is using the last successful build.

I hop this makes sense.