abhilash1in / aws-secrets-manager-action

Use secrets from AWS Secrets Manager as environment variables in your GitHub Actions workflow
MIT License
68 stars 43 forks source link

Use inside of env: #38

Closed kaykhan closed 2 years ago

kaykhan commented 2 years ago

Hi, i want to rename the env variables (select only a few) returned from aws secret manager but it looks like its not possible to use the values inside of env.

jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Configure AWS Credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-region: us-east-2
    - name: Read secrets from AWS Secrets Manager into environment variables
      uses: abhilash1in/aws-secrets-manager-action@v2.1.0
      with:
        secrets: |
          prod-rds
        parse-json: true
        disable-warnings: true
    - uses: actions/setup-node@v1
      with:
        node-version: '14.x'
    - name: deploy
      working-directory: example-lambda
      run: |    
        npm i -g serverless
        npm install 
        echo $DATABASE_NAME
        serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY
        sls deploy --stage production
      env:
        DATABASE_USERNAME: $PROD_RDS_MYSQL_USERNAME
        DATABASE_PASSWORD: $PROD_RDS_MYSQL_PASSWORD
        DATABASE_NAME: $PROD_RDS_DATABASE_NAME

The echo $DATABASE_NAME comes back as just "$PROD_RDS_MYSQL_USERNAME"

Any ideas how i might do this?

kaykhan commented 2 years ago

Should be like this instead

 DATABASE_NAME: ${{ env.PROD_RDS_DATABASE_NAME }}