Save your dockerfile in a folder called images, this terraform code will build and push a multi-archtecture image to ECR. Whenever you update the Dockerfile and associated image tag, the null resource will be triggered to "re-create" subsequently updating the image in ECR.
Then simply run terraform apply -replace=null_resource.build_and_push
,- don't forget to use the full resource address if this code is inside a module. E.g module.name.null_resource.build_and_push
.