From 67d6fe4f7bb00e1c539862fbd8494b6d06000dbe Mon Sep 17 00:00:00 2001 From: Harish V Date: Wed, 20 Sep 2023 14:35:11 +0800 Subject: [PATCH] feat: skip failures when fetching from SSM --- .platform/hooks/predeploy/06_fetch_ssm_parameters.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.platform/hooks/predeploy/06_fetch_ssm_parameters.sh b/.platform/hooks/predeploy/06_fetch_ssm_parameters.sh index 9a6186501..64b2d9b56 100644 --- a/.platform/hooks/predeploy/06_fetch_ssm_parameters.sh +++ b/.platform/hooks/predeploy/06_fetch_ssm_parameters.sh @@ -86,7 +86,15 @@ aws configure set default.region ap-southeast-1 for ENV_VAR in "${ENV_VARS[@]}"; do echo "Fetching ${ENV_VAR} from SSM" + + # Attempt to fetch the parameter; if it fails, skip to the next iteration of the loop VALUE=$(aws ssm get-parameter --name "${ENV_TYPE}_${ENV_VAR}" --with-decryption --query "Parameter.Value" --output text) + + if [ $? -ne 0 ]; then + echo "Failed to fetch ${ENV_VAR}. Skipping." + continue + fi + echo "${ENV_VAR}=${VALUE}" >> /tmp/isomer/.isomer.env echo "Saved ${ENV_VAR}" done