Я пишу сценарий оболочки (для начинающих), который должен развертывать несколько стеков CF в определенном порядке (поскольку существуют экспорты, которые зависят от других, так же порядка) и должен параметризировать $ Stackname и $ stack-type (Create / обновить / удалить) вот то, что я мог бы понять, но не работает никакой помощи / модификации приветствуются. Должно работать следующим образом:
./script.sh -s3 -st update-stack -sn test
должно выполняться
aws cloudformation update-stack test us-west-2-id-ca-su-s3 --template-body file://path-to-cfmn.yaml
#!/bin/bash
set -e
set -u
set -o pipefail
s3=false
iam=false
redshift=false
glue=false
lambda=false
alert=false
elasti_cache=false
step_function=false
while getopts ":s3:im:rs:gl:lm:al:ea:sf:sn:st" opt; do
case ${opt} in
s3) s3=true
;;
im) iam=true
;;
rs) redshift=true
;;
gl) glue=true
;;
lm) lambda=true
;;
al) alert=true
;;
ea) elasti_cache=true
;;
sf) step_function=true
;;
sn) stack_name="$OPTARG"
echo "The value provided is $OPTARG"
;;
st) stack_type="$OPTARG"
echo "The value provided is $OPTARG"
?) usage
;;
esac
done
if [ $s3 == true ]; then
echo "Deploying s3 buckets"
aws cloudformation $stack_type $stack-name cf-as-us-west-2-id-ca-su-s3-RawRefinedBucket --template-body file://path-to-cfmn.yaml
fi
if [ $iam == true ]; then
echo "Deploying Policy and Role for Glue jobs"
aws cloudformation $stack_type $stack-name cf-as-us-west-2-id-ca-su-IAM --template-body file://path-to-cfmn.yaml
fi
if [ $redshift == true ]; then
echo "Deploying Redshift cluster"
aws cloudformation create-stack --stack-name cf-as-us-west-2-sg0304496-ca-su-Redshift --template-body file://path-to-cfmn.yaml
fi
if [ $glue == true ]; then
echo "Deploying Glue jobs"
aws cloudformation $stack_type $stack-name cf-as-us-west-2-id-ca-su-Glue --template-body file://path-to-cfmn.yaml
fi
if [ $lambda == true ]; then
echo "Deploying Lambda function"
aws cloudformation $stack_type $stack-name cf-as-us-west-2-id-ca-su-Lambda --template-body file://path-to-cfmn.yaml
Не удается продолжить развертывание.