configure-aws-credentials
configure-aws-credentials copied to clipboard
Override Exported Variable Names
During our run, we need to pull in multiple AWS accounts for different resources and products. By default, this only exports to the standard AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
env variables, but we would like the option to run the action multiple times and include either a prefix
/ suffix
value for those environment variables or provide explicit override values for all of them.
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::1234:role/my-example-role
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::123456:role/my-second-role
# The following would be the addition
env-prefix: `SECOND` # would result in `SECOND_AWS_ACCESS_KEY` and so on...
# OR explicit
access-key-env: SECOND_AWS_ACCESS_KEY
secret-key-env: SECOND_AWS_SECRET_ACCESS_KEY
Would you be able to accomplish this by chaining steps together and setting environment variables yourself? Something like:
steps:
- name: Get AWS credentials
uses: aws-actions/[email protected]
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::1234:role/my-example-role
- name: Rename env variables
run: |
echo "${{ env.AWS_ACCESS_KEY_ID }}=SECOND_AWS_ACCESS_KEY" >> $GITHUB_ENV
echo "${{ env.AWS_SECRET_ACCESS_KEY }}=SECOND_AWS_SECRET_ACCESS_KEY" >> $GITHUB_ENV
echo "${{ env.AWS_SESSION_TOKEN }}=SECOND_AWS_SESSION_TOKEN" >> $GITHUB_ENV
- name: Get AWS credentials
uses: aws-actions/[email protected]
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::123456:role/my-second-role
And so on
This could be a feature we implement, however since there's a workaround you can do as described in the above comment, I wouldn't want to implement this unless it's something enough people want. I'll leave the issue open to collect more feedback 🙂
Upvoting, this would be nice to be able to configure this thing :pray:
We've decided we won't be supporting this. However, we will look into other ways to better support multiple profiles in the future. Stay tuned for that 🙂
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.