-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
19 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,21 +1,18 @@ | ||
#!/bin/bash | ||
# Container runtime configuration script | ||
# Gets secrets config file from S3 and uses Deco to substitute parameter values | ||
# This script expects S3URL env variable with the full S3 path to the encrypted config file | ||
# Gets secrets config file from SSM parameter store and uses Deco to substitute parameter values | ||
# This script expects SSMPATH env variable with the full SSMPATH path to the encrypted config file | ||
|
||
if [ -n "$S3URL" ]; then | ||
echo "Getting config file from S3 (${S3URL}) ..." | ||
aws --version | ||
if [ -n "$SSMPATH" ]; then | ||
echo "Getting config file from SSM Parameter Store (${SSMPATH}) ..." | ||
deco version | ||
if [[ $? -ne 0 ]]; then | ||
echo "ERROR: aws-cli not found!" | ||
echo "ERROR: deco not found!" | ||
exit 1 | ||
fi | ||
aws --region us-east-1 s3 cp ${S3URL} ./config.encrypted | ||
aws --region us-east-1 kms decrypt --ciphertext-blob fileb://config.encrypted --output text --query Plaintext | base64 -d > deco-config.json | ||
deco validate deco-config.json || exit 1 | ||
deco run deco-config.json | ||
rm -f deco-config.json config.encrypted | ||
deco validate -e ssm://${SSMPATH} || exit 1 | ||
deco run -e ssm://${SSMPATH} | ||
else | ||
echo "ERROR: S3URL variable not set!" | ||
echo "ERROR: SSMPATH variable not set!" | ||
exit 1 | ||
fi | ||
fi |