[ECS] [request]: describe-task-definition needs to download an uploadable json including tags
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
What do you want us to build?
In the AWS console for the task definitions, when on the JSON tab, there is a button called "Download AWS CLI input". The downloaded json file looks different from when I run the corresponding AWS cli command to describe the task definition:
```
aws ecs describe-task-definition --region us-west-2 --profile MyProfile --task-definition my-application
```
To be able to deploy a task definition via Github actions, the task definition json needs to look like what is being produced by the UI Button.
Hence the `aws ecs describe-task-definition` should be able to download the exact same json file.
**Which service(s) is this request for?**
ECS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
Our task definition gets created via terraform including tags. The task definition then ultimately gets updated by a Github workflow when a new build of an image is available. We are following the workflow here: https://github.com/aws-actions/amazon-ecs-deploy-task-definition#task-definition-file (i.e. download the current task definition, render it with the newly built image tag, sanitize it, deploy it again).
However, after a deployment has happened, the task definition being deployed and the one being generated by terraform, differ and hence on the next terraform run, it wants to update the task definition again. This is because the task definition that is being downloaded by `aws ecs describe-task-definition` comes without tags. Even using the following the json looks different:
```
aws ecs describe-task-definition \
--task-definition ${{ inputs.task_definition }} \
--include TAGS \
--query taskDefinition > task-definition.json
```
**Are you currently working around this issue?**
Only partly, with a lot of steps in a custom github action to download and "sanitize" the downloaded task definition, but we're still not being able to upload the tags again.
```
aws ecs describe-task-definition \
--task-definition ${{ inputs.task_definition }} \
--query taskDefinition > task-definition.json
echo $(jq 'del(. |
.compatibilities,
.taskDefinitionArn,
.requiresAttributes,
.revision,
.status,
.registeredAt,
.registeredBy)'
${{ steps.task-def.outputs.task-definition }}) > clean-task-definition.json
```
This is still missing the tags though because they are on the same level as the taskDefinition dictionary in the json file.
Contributor guide
Research direction
Start by comparing the AWS CLI `ecs describe-task-definition` output, including `--include TAGS` and `--query taskDefinition`, with the AWS console's “Download AWS CLI input” JSON. Review the linked GitHub Actions task-definition workflow and its sanitization steps. Done means the described task definition can be reused for deployment while preserving tags and matching the console's uploadable format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, github-actions, shell
- Domain
- api, cloud, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100