/
deploy
executable file
·25 lines (19 loc) · 1.2 KB
/
deploy
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
#!/usr/bin/env bash
PROG=$(basename $0)
USAGE="usage: $PROG prefix"
if [[ $# -lt 1 ]]; then
echo "$USAGE"; exit 1
fi
prefix=$1
PAYMENT_ROLE_OUTPUT_KEY='PaymentRoleExport'
REPORTING_ROLE_OUTPUT_KEY='ReportingRoleExport'
prerequisites_stack="$prefix-prereqs"
sam deploy --resolve-s3 --stack-name $prerequisites_stack --capabilities CAPABILITY_IAM --template 0-prereqs.yml
payment_role=$(aws cloudformation describe-stacks --stack-name $prerequisites_stack --output text --query "Stacks[].Outputs[?OutputKey==\`$PAYMENT_ROLE_OUTPUT_KEY\`].OutputValue")
reporting_role=$(aws cloudformation describe-stacks --stack-name $prerequisites_stack --output text --query "Stacks[].Outputs[?OutputKey==\`$REPORTING_ROLE_OUTPUT_KEY\`].OutputValue")
topic_stack="$prefix-topicowner"
sam deploy --resolve-s3 --stack-name $topic_stack --capabilities CAPABILITY_IAM --template 1-topicowner.yml
payment_stack="$prefix-payment"
sam deploy --resolve-s3 --stack-name $payment_stack --capabilities CAPABILITY_IAM --template 2.1-payment.yml --role-arn $payment_role
reporting_stack="$prefix-reporting"
sam deploy --resolve-s3 --stack-name $reporting_stack --capabilities CAPABILITY_IAM --template 2.2-reporting.yml --role-arn $reporting_role