-
Notifications
You must be signed in to change notification settings - Fork 9
/
create-stack.sh
executable file
·27 lines (27 loc) · 1.09 KB
/
create-stack.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -eo pipefail
if [[ $# -gt 1 ]]; then
TEMPLATE_NAME=$1
shift
OVERRIDES="$@"
OVERRIDES_ARG="--parameter-overrides ${OVERRIDES}"
TEMPLATE=$(cat ${TEMPLATE_NAME}.yml)
elif [[ $# -eq 1 ]]; then
TEMPLATE_NAME=$1
TEMPLATE=$(cat ${TEMPLATE_NAME}.yml)
if [[ "$TEMPLATE" =~ PLACEHOLDER ]]; then
echo "Usage: ./create-stack.sh <template-name> <parameters>"
echo "e.g. ./create-stack.sh alarm-device [email protected] deviceName=my-appliance deviceId=device-6talxmpl5mmik6qh5moba6jium"
exit 0
fi
else
echo "Usage: ./create-stack.sh <template-name> <parameters>"
echo "e.g. ./create-stack.sh application-role"
echo "e.g. ./create-stack.sh alarm-device [email protected] deviceName=my-appliance deviceId=device-6talxmpl5mmik6qh5moba6jium"
exit 0
fi
STACK_NAME=panorama-${TEMPLATE_NAME}
if [[ "$TEMPLATE" =~ "AWS::IAM::Role" ]]; then
CAPA_ARG="--capabilities CAPABILITY_NAMED_IAM"
fi
aws cloudformation deploy --template-file ${TEMPLATE_NAME}.yml --stack-name ${STACK_NAME} ${CAPA_ARG} ${OVERRIDES_ARG}