juan-canham-resume/deploy/shared-functions

19 lines
667 B
Bash

#!/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
}