Skip to content

GitHub Action that sets Heroku environment variables from AWS SSM Parameter Store. This Action was created to efficiently synchronize when using the same environment variables on AWS and Heroku.

License

Notifications You must be signed in to change notification settings

iisyos/ssm-to-heroku-env-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

ssm-to-heroku-env-action

GitHub Action that sets Heroku environment variables from AWS SSM Parameter Store. This Action was created to efficiently synchronize when using the same environment variables on AWS and Heroku.

Inputs

Input Required Default Info
path Yes N/A The path to the environment variable in the AWS SSM Parameter Store that you want to set in Heroku
email Yes N/A Heroku email
token Yes N/A Heroku token
app Yes N/A Heroku app name

And you need to set AWS credentials by using like AWS Credentials for GitHub Actions.

Description

First of all, this actions retrieve environment variables from AWS SSM Parameter Store specifying path input. This mean when you set like under CLI command, you can retrieve under '/test/' recursively if you specified path as '/test/'.

aws ssm put-parameter \
    --name "/test/VALUE1" \
    --value "test1" \
    --type String \
    --region "ap-northeast-3"

Authentication to heroku is done by writing email and token in the .netrc file as written in the Heroku CLI Authentication.You can get your token from here. And you need to set your app name to app input.

Usage

You can perform this action whenever you like. Push is fine, and PR comments are also fine.

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ap-northeast-3
      - name: Sets Heroku environment
        uses: iisyos/[email protected]
        with:
          path: ${{ secrets.PARAMETER_STORE_PATH }}
          email: ${{ secrets.HEROKU_EMAIL }}
          token: ${{ secrets.HEROKU_TOKEN }}
          app: ${{ secrets.HEROKU_APP_NAME }}

About

GitHub Action that sets Heroku environment variables from AWS SSM Parameter Store. This Action was created to efficiently synchronize when using the same environment variables on AWS and Heroku.

Resources

License

Stars

Watchers

Forks

Packages

No packages published