juan-canham-resume/deploy/shared-functions

19 lines
667 B
Plaintext
Raw Permalink Normal View History

2020-03-17 03:54:15 +00:00
#!/usr/bin/env bash
SITENAME=$1
PROJECT=${SITENAME//./}
CFN_DIR="$( dirname "${BASH_SOURCE[0]}" )/cloudformation"
DEPLOY_CMD="aws cloudformation deploy --no-fail-on-empty-changeset --tags Classification=Public Site=$SITENAME"
deploy() {
# shellcheck disable=SC2145
echo "deploying $1 [${@:2}]"
# shellcheck disable=SC2068
$DEPLOY_CMD --stack-name "${PROJECT}-$1" --template-file "${CFN_DIR}/$1.yaml" --parameter-overrides ${@:2}
aws cloudformation wait stack-exists --stack-name "${PROJECT}-$1"
}
get-output() {
aws cloudformation describe-stacks --stack-name "${PROJECT}-$1" --query "Stacks[0].Outputs[?OutputKey==\`$2\`].OutputValue" --output text
}