forked from telia-oss/terraform-aws-lambda-slack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (34 loc) · 1.08 KB
/
Makefile
File metadata and controls
39 lines (34 loc) · 1.08 KB
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
OS=darwin
DIR=$(shell pwd)
default: test
test:
@echo "== Test =="
@if ! terraform fmt -write=false -check=true >> /dev/null; then \
echo "✗ terraform fmt (Some files need to be formatted, run 'terraform fmt' to fix.)"; \
exit 1; \
else \
echo "√ terraform fmt"; \
fi
@for d in $$(find . -type f -name '*.tf' -path "./modules/*" -not -path "**/.terraform/*" -exec dirname {} \; | sort -u); do \
cd $$d; \
terraform init -backend=false >> /dev/null; \
terraform validate -check-variables=false; \
if [ $$? -eq 1 ]; then \
echo "✗ terraform validate failed: $$d"; \
exit 1; \
fi; \
cd $(DIR); \
done
@echo "√ terraform validate modules (not including variables)"; \
@for d in $$(find . -type f -name '*.tf' -path "./examples/*" -not -path "**/.terraform/*" -exec dirname {} \; | sort -u); do \
cd $$d; \
terraform init -backend=false >> /dev/null; \
terraform validate; \
if [ $$? -eq 1 ]; then \
echo "✗ terraform validate failed: $$d"; \
exit 1; \
fi; \
cd $(DIR); \
done
@echo "√ terraform validate examples"; \
.PHONY: default test