Skip to content

Commit

Permalink
Bugfix: security-credentials profile not instance profile (#16)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Menges <@mengesb>
  • Loading branch information
mengesb authored Apr 22, 2021
1 parent 5f3ae44 commit 925c3e9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion aws/aws-credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ function aws_instance_profile_name() {
# "Expiration": "2020-04-02T00:49:51Z"
# }
function aws_credentials() {
curl -s "${METADATA}/iam/security-credentials/$(aws_instance_profile_name)"
local credentials profile

credentials=$(curl -s "${METADATA}/iam/security-credentials/$(aws_instance_profile_name)")

if [[ -n "${credentials}" ]]; then
profile=$(curl -s "${METADATA}/iam/security-credentials/")
credentials=$(curl -s "${METADATA}/iam/security-credentials/${profile}")
fi

echo "${credentials}"
}

# @description
Expand Down

0 comments on commit 925c3e9

Please sign in to comment.