Last active
July 6, 2022 13:00
-
-
Save jcrqr/710d050f45a1d834addbd64aed52f1b6 to your computer and use it in GitHub Desktop.
Read parameters from AWS SSM specified in a properties file and replace the keys in a configuration file with the parameter values
This file contains hidden or 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
{ | |
"foo": BAR | |
} |
This file contains hidden or 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
#! /bin/bash | |
aws ssm get-parameters --names $(awk -F "=" '{ print $2 }' secret.properties | paste -s -d " " -) --with-decryption \ | |
| jq '.Parameters[] | "s~\(.Name)~\"\(.Value)\"~"' | jq -rs '. | join(";")' \ | |
| { read re; sed -e "$re" secret.properties; } \ | |
| awk -F "=" '{ print "s~" $1 "~" $2 "~g" }' | paste -s -d "; " - \ | |
| { read re; sed -e "$re" config.json; } |
This file contains hidden or 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
BAR=/my/secret/param |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment