-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
49 lines (41 loc) · 1.55 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# requires AWS_PROFILE
# bucket must exist, prefix will be created
S3_BUCKET ?= "s4c-cft-iru"
S3_PREFIX ?= "test"
# We need the REGION or the TemplateURLs might be created for a different region, resulting in a deployment error
S3_REGION ?= "eu-west-1" # ireland
SECURE_API_TOKEN ?= ""
STACK_NAME = "SecureForCloudECSTest"
.PHONY: packaged-template.yaml
validate:
aws cloudformation validate-template --template-body file://./CloudVision.yaml
lint:
cfn-lint *.yaml -i W3002
packaged-template.yaml:
aws s3 rm s3://$(S3_BUCKET)/ecs/$(S3_PREFIX) --recursive
aws cloudformation package \
--region $(S3_REGION) \
--template-file CloudVision.yaml \
--s3-bucket $(S3_BUCKET) \
--s3-prefix ecs/$(S3_PREFIX) \
--force-upload \
--output-template-file packaged-template.yaml
test: packaged-template.yaml
aws cloudformation deploy \
--stack-name $(STACK_NAME) \
--template-file packaged-template.yaml \
--capabilities "CAPABILITY_NAMED_IAM" "CAPABILITY_AUTO_EXPAND" \
--parameter-overrides \
"SysdigSecureAPIToken=$(SECURE_API_TOKEN)" \
"ECRImageScanningDeploy=Yes" \
"ECSImageScanningDeploy=Yes"
ci: packaged-template.yaml
aws s3 cp ./packaged-template.yaml s3://$(S3_BUCKET)/ecs/$(S3_PREFIX)/entry-point.yaml
clean:
aws cloudformation delete-stack --stack-name $(STACK_NAME)
#
# local-test-manual:
# (have not found a way to do it via cli)
# aws console > cloudformation > create new stack (template, upload template: select ./templates_ecs/Cloudvision.yaml)
# note: this will upload the template into an s3 bucket, remember to delete it afterwards
#