Skip to content

Commit

Permalink
Allow optional colon delimited list for AWS_PARAMSTORE_SECRETS_GLOBAL…
Browse files Browse the repository at this point in the history
…_SSH
  • Loading branch information
katesybernaut committed Jul 7, 2021
1 parent 7431bfa commit 349bc21
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hooks/environment
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ get-ssm () {

if [ -n "${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH}" ]
then
echo "Adding Global SSH deploy key to a default SSH agent"
# shellcheck disable=SC2046
# AWS_PARAMSTORE_SECRETS_GLOBAL_SSH can optionally be a list delimited by `:`
GLOBAL_SSH_KEYS=(${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH//:/ })
eval $(/usr/bin/ssh-agent | sed "/^echo/d")
get-ssm "${AWS_PARAMSTORE_SECRETS_GLOBAL_SSH}" | ssh-add - 2>/dev/null
for KEY in ${GLOBAL_SSH_KEYS[@]}
do
echo "Adding ${KEY} deploy key to a default SSH agent"
# shellcheck disable=SC2046
get-ssm "${KEY}" | ssh-add - 2>/dev/null
done
fi

exports=$(bk-ssm-secrets)
Expand Down

0 comments on commit 349bc21

Please sign in to comment.