Giter VIP home page Giter VIP logo

Comments (6)

alex-benoit avatar alex-benoit commented on August 22, 2024 2

@clareliguori thanks for the quick response

What would be the recommended approach for ENV variables that are defined in the task definition then?

from amazon-ecs-render-task-definition.

clareliguori avatar clareliguori commented on August 22, 2024

Correct, this action assumes you have the task definition json checked into your git repository

from amazon-ecs-render-task-definition.

clareliguori avatar clareliguori commented on August 22, 2024

As in, use one task definition file, but different services need different environment variable values?

from amazon-ecs-render-task-definition.

jzingler-lp avatar jzingler-lp commented on August 22, 2024

I have a similar question about injecting env variables and/or secrets. For example, what is the recommended approach to inject a param from ssm without hardcoding the stage:

"secrets": [{
        "name": "environment_variable_name",
        "valueFrom": "arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${DeploymentStage}/infra/param/test"
      }]

from amazon-ecs-render-task-definition.

clareliguori avatar clareliguori commented on August 22, 2024

A tool like envsubst can be used to inject env variable values into a task def file. It looks like there is a GitHub Action that wraps envsubst, though I haven't used it personally: https://github.com/marketplace/actions/envsubst-action

I'm also happy to take contributions to add similar functionality to this action!

from amazon-ecs-render-task-definition.

alex-benoit avatar alex-benoit commented on August 22, 2024

ended up doing this instead of using the action to avoid having to use a repeated task definition json in the repo (it pulls the latest one from ECS)

LATEST_TASK_DEFINITION=`aws ecs describe-task-definition --task-definition XYZ` NEW_TASK_DEFINTIION=`echo $LATEST_TASK_DEFINITION | jq '.taskDefinition | .containerDefinitions[0].image = "${{ secrets.ECR_REPOSITORY_URL }}:${{ github.sha }}" | del(.["taskDefinitionArn", "revision", "status", "requiresAttributes", "compatibilities"])'` TASK_DEFINITION_REVISION=`aws ecs register-task-definition --cli-input-json "$NEW_TASK_DEFINTIION" | jq '.taskDefinition.revision'` aws ecs update-service --cluster XYZ --service XYZ --task-definition XYZ:${TASK_DEFINITION_REVISION}

from amazon-ecs-render-task-definition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.