Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Replace ssm params with secrets-manager secrets
- Loading branch information
Showing
3 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
ssm_get() { | ||
aws ssm get-parameter \ | ||
--name "/${KAIZEN_SSM_PARAMETER_PATH}/$1" \ | ||
--with-decryption \ | ||
--query Parameter.Value \ | ||
--output text | ||
get_secret() { | ||
aws secretsmanager get-secret-value \ | ||
--secret-id "kaizen-design-system/$1" \ | ||
--query SecretString \ | ||
| tr -d '"' | ||
} | ||
|
||
main() { | ||
printf "Fetching ssm parameters... " | ||
github_deploy_key=$(ssm_get "github-deploy-key") || exit $? | ||
npm_token=$(ssm_get "npm-token") || exit $? | ||
printf "Fetching secrets... " | ||
GH_SSH_KEY=$(get_secret "github-ssh-key") || exit $? | ||
GH_TOKEN=$(get_secret "github-api-token") || exit $? | ||
NPM_TOKEN=$(get_secret "npm-token") || exit $? | ||
echo "(done)" | ||
|
||
unset github_deploy_key | ||
unset npm_token | ||
unset GH_SSH_KEY | ||
unset GH_TOKEN | ||
unset NPM_TOKEN | ||
} | ||
|
||
main | ||
|
||
unset -f main ssm_get | ||
unset -f main get_secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters