forked from govuk-one-login/ipv-cri-common-lambdas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·35 lines (30 loc) · 1.06 KB
/
deploy.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
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
set -eu
stack_name="${1:-}"
audit_event_name_prefix="${2:-}"
cri_identifier="${3:-}"
if ! [[ "$stack_name" ]]; then
[[ $(aws sts get-caller-identity --query Arn --output text) =~ \/([^\/\.]+)\. ]] && user="${BASH_REMATCH[1]}" || exit
stack_name="$user-common-lambdas"
echo "» Using stack name '$stack_name'"
fi
sam validate -t infrastructure/lambda/template.yaml
sam validate -t infrastructure/lambda/template.yaml --lint
sam build -t infrastructure/lambda/template.yaml --cached --parallel
sam deploy --stack-name "$stack_name" \
--no-fail-on-empty-changeset \
--no-confirm-changeset \
--resolve-s3 \
--s3-prefix "$stack_name" \
--region "${AWS_REGION:-eu-west-2}" \
--capabilities CAPABILITY_IAM \
--tags \
cri:component=ipv-cri-common-lambdas \
cri:stack-type=dev \
cri:application=Orange \
cri:deployment-source=manual \
--parameter-overrides \
Environment=dev \
${audit_event_name_prefix:+AuditEventNamePrefix=$audit_event_name_prefix} \
${cri_identifier:+CriIdentifier=$cri_identifier}