-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
78 lines (71 loc) · 2.51 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.PHONY: phony
phony:
build:
@cargo build
run:
@cargo run
release:
@cargo build --release
test: phony
@cargo check
@cargo test --all
@\
cd test/cdk && \
$(MAKE) install diff deploy
test-clean-all:
@\
set -x; \
aws resourcegroupstaggingapi get-resources \
--tag-filters Key=ApplicationName,Values=cfn-teleport-test \
--resource-type-filters s3:bucket \
--query 'ResourceTagMappingList[].[ResourceARN]' \
--output text | while read -r arn; do \
echo "Deleting bucket "$$arn"..."; \
aws s3api delete-bucket --bucket "$${arn##*:}"; \
done; \
aws resourcegroupstaggingapi get-resources \
--tag-filters Key=ApplicationName,Values=cfn-teleport-test \
--resource-type-filters dynamodb:table \
--query 'ResourceTagMappingList[].[ResourceARN]' \
--output text | while read -r arn; do \
echo "Deleting table "$$arn"..."; \
aws dynamodb delete-table --table-name "$${arn##*/}" --output text > /dev/null; \
done; \
aws ec2 describe-instances \
--filters "Name=tag:ApplicationName,Values=cfn-teleport-test" \
"Name=instance-state-code,Values=16" \
--query 'Reservations[].Instances[].[InstanceId]' \
--output text | while read -r arn; do \
echo "Deleting instance "$$arn"..."; \
aws ec2 terminate-instances --instance-ids "$${arn##*/}" --output text > /dev/null; \
done; \
aws resourcegroupstaggingapi get-resources \
--tag-filters Key=ApplicationName,Values=cfn-teleport-test \
--resource-type-filters ec2:security-group \
--query 'ResourceTagMappingList[].[ResourceARN]' \
--output text | while read -r arn; do \
echo "Deleting security-group "$$arn"..."; \
aws ec2 delete-security-group --group-id "$${arn##*/}" --output text > /dev/null; \
done; \
aws ec2 delete-key-pair --key-name "cfn-teleport-test" ; \
aws iam list-roles \
--query 'Roles[?RoleName==`cfn-teleport-test`].[RoleName]' \
--output text | while read -r role; do \
aws iam list-instance-profiles \
--query 'InstanceProfiles[?Roles[?RoleName==`cfn-teleport-test`]].[InstanceProfileName]' \
--output text | while read -r profile; do \
echo "Deleting instance-profile "$$profile"..."; \
aws iam remove-role-from-instance-profile --instance-profile-name "$$profile" --role-name "$$role"; \
aws iam delete-instance-profile --instance-profile-name "$$profile"; \
done; \
aws iam delete-role --role-name "$$role" ; \
echo "Deleting role "$$role"..."; \
done
test-reset:
@\
cd test/cdk && \
$(MAKE) DESTROY
@$(MAKE) test-clean-all
lint:
@cargo fmt -- --check
@cargo clippy -- -D warnings