-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
35 lines (30 loc) · 1020 Bytes
/
Makefile
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
STAGE = _YOUR_STAGE_
S3_BUCKET = _YOUR_S3_BUCKET_
REGION = _YOUR_AWS_REGION_
STACK_NAME = cfn-ci-cd-demo
package:
@[ -d .cfn ] || mkdir .cfn
@aws cloudformation package \
--template-file cfn.yml \
--s3-bucket $(S3_BUCKET) \
--output-template-file .cfn/packaged.yml \
--region $(REGION)
deploy:
@if [ -f params/param.$(STAGE).json ]; then \
aws cloudformation deploy \
--template-file .cfn/packaged.yml \
--stack-name $(STACK_NAME)-$(STAGE) \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
--parameter-overrides `cat params/param.$(STAGE).json | jq -r '.Parameters | to_entries | map("\(.key)=\(.value|tostring)") | .[]' | tr '\n' ' ' | awk '{print}'` \
--no-execute-changeset \
--region $(REGION); \
else \
aws cloudformation deploy \
--template-file .cfn/packaged.yml \
--stack-name $(STACK_NAME)-$(STAGE) \
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
--no-execute-changeset \
--region $(REGION); \
fi
all: package deploy
.PHONY: package deploy all