Skip to content

[ECS] [request]: describe-task-definition needs to download an uploadable json including tags #2013

@anitakrueger

Description

@anitakrueger

Community Note

  • Please vote on this issue by adding a 👍 reaction 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ECSAmazon Elastic Container ServiceProposedCommunity submitted issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions