Skip to content

Commit

Permalink
update compare script
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-87 committed Dec 26, 2024
1 parent d902040 commit 2d2b733
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ssm-compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function vault_get_keys() {
function ssm_get_path() {
AWS_REGION="ap-northeast-1" # Tokyo region
params=$(aws ssm get-parameters-by-path --path /$APP_NAME --region $AWS_REGION --with-decryption | jq -r ".Parameters[] | select(.Name | startswith(\"/$APP_NAME/${PREFIX}\")) | .Name")
echo "total:" $(wc -l <<< "$params")
echo "$params" | tr ' ' '\n' | cut -d '/' -f 3 | sed 's/^/"/;s/$/"/'
echo "total of variables in SSM:" $(wc -l <<< "$params")

SSM_VARS=($(echo $params | tr ' ' '\n' | cut -d '/' -f 3 | sed 's/^/"/;s/$/"/'))

Expand All @@ -45,9 +44,12 @@ function ssm_get_path() {
fi
done
if [[ "$found" == false ]]; then
echo "Missing: $expected_var"
echo "Missing variable in Vault: $expected_var"
fi
done
if [[ "$found" == true ]]; then
echo "The variables are the same"
fi
}

ssm_get_path

0 comments on commit 2d2b733

Please sign in to comment.