Skip to content
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

[Enhancement]: ECS Task Definitions now supports deletion #29682

Open
andrewradamis-paay opened this issue Feb 27, 2023 · 4 comments
Open

[Enhancement]: ECS Task Definitions now supports deletion #29682

andrewradamis-paay opened this issue Feb 27, 2023 · 4 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.

Comments

@andrewradamis-paay
Copy link
Contributor

andrewradamis-paay commented Feb 27, 2023

Description

I haven't found the official AWS announcement yet, but it appears ECS rolled out a Delete Task Definitions API for ECS (finally). The AWS ECS Console has also been updated.

Per the documentation, deletion requires the task definition to be deregistered first.

I don't think this feature has hit the aws-go-sdk yet, but I believe it will require some discussion before implementing as it could introduce a breaking change. I've listed a few ways in the Potential Terraform Configuration section that would be both opt-in and useful to me.

Affected Resource(s) and/or Data Source(s)

aws_ecs_task_definition

Potential Terraform Configuration

// Deletes task definition after de-registering
resource "aws_ecs_task_definition" "service" {
  ...
  delete_on_deregister = true
}

// Delete all old task definition iterations except the last 3
resource "aws_ecs_task_definition" "service" {
  family = "service"
  ...
  delete_old_versions_except = 3
}

// Delete all iterations on delete
resource "aws_ecs_task_definition" "service" {
  family = "service"
  ...
  delete_all_iterations_on_dispose = true
}

References

https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DeleteTaskDefinitions.html
aws/containers-roadmap#685 (comment)

Would you like to implement a fix?

Yes

@andrewradamis-paay andrewradamis-paay added enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Feb 27, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/ecs Issues and PRs that pertain to the ecs service. label Feb 27, 2023
@ewbankkit
Copy link
Contributor

Announcement.
Blog post.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Feb 28, 2023
@wedge-jarrad
Copy link
Contributor

Here's my thoughts. I'm nobody, so take them for what they're worth :D

delete_on_deregister - probably the easiest to implement though I have a hard time imagining that I would use this. I currently use skip_destroy = true in order to keep the old versions active to facilitate rollbacks.

delete_all_iterations_on_dispose - Seems useful as a 1-time cleanup task if you've built up a large number of task definition versions over the years while waiting for the ability to delete them to be implemented. But, in the extreme case where you have thousands of versions, this may take a very long time. A user might be more wise to manage the 1-time cleanup outside of Terraform.

delete_old_versions_except - To me this would be the most useful option by far. The first time you add it on an existing task def with many old versions you'll have the same issue as I mentioned for delete_all_iterations_on_dispose so user beware, but it would be useful going forward. My only argument against it is that it will be obsoleted (hopefully soon but who knows) by official lifecycle management aws/containers-roadmap#1967. Would also need to figure out how this would interact with skip_destroy = true since I want to keep the old version active until I'm sure I won't want to roll back to it, at which point it can be both deregistered and deleted.

@david-hodgson-at-sky
Copy link

david-hodgson-at-sky commented Jan 18, 2024

This feature would be a partial mitigation to #11526 Terraform forcing replacement of ECS task definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

No branches or pull requests

4 participants