-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_ecr_repository: add newest_image_tag
for improving experience with tag immutability
#26658
Comments
We are running into exactly this issue with a Fargate task definition. The definition is in terraform and originally creates the resource with the |
I have a similar issue. I use Terraform to provision the resources (ECS, EC2, etc). But deployments are managed by the GitLab pipeline: the script updates the task definition with a new tag. To prevent Terraform from reverting the tag, I ignore changes in the task definition: resource "aws_ecs_service" "service" {
...
lifecycle {
ignore_changes = [task_definition, desired_count]
}
} This approach works fine until something apart from the image tag needs to be changed in the task definition (e.g. add a new environment variable). |
This functionality has been released in v4.56.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Description
data.aws_ecr_repository.service
could have the tag of the newest pushed image as an attribute. That would grant a dynamic experience when working with immutable tags.See this example that works fine when dealing with mutable tags:
Now, if I can't set
image_version
tolatest
, how to make sureterraform apply
will keep up to date with newest image? To keep updating theimage_version
value manually seems like unnecessary work and poor experience.Tag immutability should be used in production for hardening security, a better experience in doing so could drive that change in many systems.
New or Affected Resource(s)
aws_ecr_repository
Potential Terraform Configuration
or even better:
References
https://sysdig.com/blog/toctou-tag-mutability/
https://aquasecurity.github.io/tfsec/v1.15.0/checks/aws/ecr/enforce-immutable-repository/
The text was updated successfully, but these errors were encountered: