-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 1.39 KB
/
Copy pathMakefile
File metadata and controls
58 lines (46 loc) · 1.39 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
SHELL := /bin/bash
.PHONY: download
download:
./script/download.sh
.PHONY: build
build:
./script/build.sh
.PHONY: build-lambda
build-lambda:
./script/build.sh --zip-only
.PHONY: clean
clean:
@rm -rf ./bin
# TF_STATE_BUCKET must be set; the backend is a partial config so the bucket
# name stays out of this repo.
.PHONY: init
init:
@[ -n "$(TF_STATE_BUCKET)" ] || { echo "TF_STATE_BUCKET is not set"; exit 1; }
@terraform init -backend-config="bucket=$(TF_STATE_BUCKET)"
# An unset required variable makes terraform wait on stdin, stranding the state
# lock if the run is interrupted. -input=false errors instead of asking, and
# doesn't affect the apply approval prompt.
.PHONY: require-vars
require-vars:
@[ -n "$(TF_VAR_aws_s3_bucket_override)" ] || { echo "TF_VAR_aws_s3_bucket_override is not set"; exit 1; }
# Previews what deploy would do, so it uses the same released binaries.
.PHONY: plan
plan: require-vars download
@terraform plan -input=false
# Deploys the binaries built from the working tree rather than the latest release.
.PHONY: apply
apply: require-vars clean build-lambda
@terraform apply -input=false
.PHONY: deploy
deploy: require-vars download
@terraform apply -input=false
.PHONY: destroy
destroy:
@terraform destroy
.PHONY: fmt
fmt:
@terraform fmt
@go fmt ./...
.PHONY: test
test:
@CGO_ENABLED=1 go test -race -covermode=atomic $(shell go list ./... | grep -v /integration)