-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
38 lines (30 loc) · 869 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
36
37
38
COMPOSE_RUN_TF = docker-compose run terraform
COMPOSE_TF_LINT = docker-compose run terraform-lint
COMPOSE_TF_DOCS = docker-compose run terraform-docs
.env: ## Create .env file
@echo "No .env file found. Create new .env using .env.template"
cp .env.template .env
.PHONY: init
init: .env
$(COMPOSE_RUN_TF) terraform init
.PHONY: #validate
validate: .env init
$(COMPOSE_RUN_TF) terraform validate
.PHONY: format
format: .env #init
$(COMPOSE_RUN_TF) terraform fmt
.PHONY: lint
lint: .env #init
$(COMPOSE_TF_LINT) --init
$(COMPOSE_TF_LINT) --version
$(COMPOSE_TF_LINT) --format compact
.PHONY: docs
docs: .env init
$(COMPOSE_TF_DOCS) markdown --output-file README.md --output-mode inject .
.PHONY: precommit
precommit: .env init validate format lint docs
echo "Done"
.PHONY: clean
clean:
docker-compose down -v
rm -rf .env .terraform *.tfstate .tflint.d