diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml index 50f384b..568afa7 100644 --- a/.github/workflows/terraform-apply.yml +++ b/.github/workflows/terraform-apply.yml @@ -16,28 +16,29 @@ jobs: - name: Read User Mapping id: user-mapping - run: | - user_mapping=$(cat user-mapping.json) - github_actor=${{ github.actor }} + run: | + user_mapping=$(cat user-mapping.json) + github_actor=${{ github.actor }} + + echo "User mapping: $user_mapping" + echo "GitHub actor: $github_actor" - echo "User mapping: $user_mapping" - echo "GitHub actor: $github_actor" + user_data=$(echo "$user_mapping" | jq -r ".$github_actor") - user_data=$(echo "$user_mapping" | jq -r ".$github_actor") + if [[ -z "$user_data" ]]; then + echo "No user mapping found for $github_actor" + exit 1 + fi - if [[ -z "$user_data" ]]; then - echo "No user mapping found for $github_actor" - exit 1 - fi + access_key_id=$(echo $user_data | jq -r '.AWS_SECRET_ACCESS_KEY_ID') + secret_access_key=$(echo $user_data | jq -r '.AWS_SECRET_ACCESS_KEY') - access_key_id=$(echo $user_data | jq -r '.AWS_SECRET_ACCESS_KEY_ID') - secret_access_key=$(echo $user_data | jq -r '.AWS_SECRET_ACCESS_KEY') + echo "Access key ID: $access_key_id" + echo "Secret access key: $secret_access_key" - echo "Access key ID: $access_key_id" - echo "Secret access key: $secret_access_key" + echo "::set-output name=access_key_id::${access_key_id}" + echo "::set-output name=secret_access_key::${secret_access_key}" - echo "::set-output name=access_key_id::${access_key_id}" - echo "::set-output name=secret_access_key::${secret_access_key}" - name: Print User Mapping run: echo "${{ steps.user-mapping.outputs.user-mapping }}"