Skip to content

Commit

Permalink
Tweaked user-mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusB-DevOps committed Dec 9, 2024
1 parent 0e0dd35 commit 29f079e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/terraform-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ jobs:
id: user-mapping
run: |
USER_MAPPING=$(cat .github/workflows/user-mapping.json)
echo "::set-output name=user-mapping::$(jq -r --arg USERNAME "$GITHUB_ACTOR" '.[$USERNAME]') <<< "$USER_MAPPING")"
USER_CREDENTIALS=$(jq -r --arg USERNAME "$GITHUB_ACTOR" '.[$USERNAME]' <<< "$USER_MAPPING")
echo "::set-output name=user-mapping::${USER_CREDENTIALS}"
- name: Print user mapping
run: echo "${{ steps.user-mapping.outputs.user-mapping }}"

# Step 0.1: Set AWS credentials
- name: Set AWS Credentials
run: |
USERNAME="${{ github.actor }}"
USER_MAPPING="${{ steps.user-mapping.outputs.user-mapping }}"
AWS_SECRET_ACCESS_KEY=$(echo $USER_MAPPING | jq -r --arg USERNAME "$USERNAME" '.[$USERNAME].AWS_SECRET_ACCESS_KEY')
AWS_SECRET_KEY_ID=$(echo $USER_MAPPING | jq -r --arg USERNAME "$USERNAME" '.[$USERNAME].AWS_SECRET_KEY_ID')
echo "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" >> $GITHUB_ENV
echo "AWS_SECRET_KEY_ID=${AWS_SECRET_KEY_ID}" >> $GITHUB_ENV
USER_MAPPING=$(cat .github/workflows/user-mapping.json)
USER_CREDENTIALS=$(jq -r --arg USERNAME "$GITHUB_ACTOR" '.[$USERNAME]' <<< "$USER_MAPPING")
echo "AWS_SECRET_ACCESS_KEY=$(echo "$USER_CREDENTIALS" | jq -r '.AWS_SECRET_ACCESS_KEY')" >> $GITHUB_ENV
echo "AWS_SECRET_KEY_ID=$(echo "$USER_CREDENTIALS" | jq -r '.AWS_SECRET_KEY_ID')" >> $GITHUB_ENV
# Step 1: Configure AWS credentials
- name: Configure AWS credentials
Expand Down

0 comments on commit 29f079e

Please sign in to comment.