From 29f079eaaa0a9ec93148d40c57d6f5cb79a6a073 Mon Sep 17 00:00:00 2001 From: MariusB-DevOps Date: Mon, 9 Dec 2024 14:22:40 +0000 Subject: [PATCH] Tweaked user-mapping --- .github/workflows/terraform-apply.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml index 350dba2..209d78d 100644 --- a/.github/workflows/terraform-apply.yml +++ b/.github/workflows/terraform-apply.yml @@ -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