-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
65 lines (48 loc) · 1.56 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
include Makefile.deps
VERSION := 0.0.1
INSTALL_DIR := ~/.terraform.d/plugins/github.com/form3tech-oss/grafanacloud/$(VERSION)/linux_amd64
BINARY := terraform-provider-grafanacloud_v$(VERSION)
SHELL := /bin/bash
PATH := $(PATH):$(PWD)/bin
# Default values used by tests
GRAFANA_CLOUD_MOCK ?= 1
GRAFANA_CLOUD_API_KEY ?= very-secret
GRAFANA_CLOUD_ORGANISATION ?= dummy-org
GRAFANA_CLOUD_STACK ?= dummy-stack
build: lint testacc
mkdir -p bin
go build -o bin/$(BINARY) main.go
test:
GRAFANA_CLOUD_MOCK=$(GRAFANA_CLOUD_MOCK) \
go test -count 1 -v ./...
testacc:
TF_ACC=1 \
GRAFANA_CLOUD_API_KEY=$(GRAFANA_CLOUD_API_KEY) \
GRAFANA_CLOUD_ORGANISATION=$(GRAFANA_CLOUD_ORGANISATION) \
GRAFANA_CLOUD_STACK=$(GRAFANA_CLOUD_STACK) \
GRAFANA_CLOUD_MOCK=$(GRAFANA_CLOUD_MOCK) \
go test -count=1 ./... -v $(TESTARGS) -timeout 120m
lint: vet tflint tffmtcheck
vet:
go vet ./...
tflint:
find ./examples/ -type d -exec tflint \{\} \;
tffmtcheck:
terraform fmt -check -recursive ./examples/
fmt:
go fmt ./...
terraform fmt -recursive ./examples/
install: test build
mkdir -p $(INSTALL_DIR)
cp bin/$(BINARY) $(INSTALL_DIR)/
release:
goreleaser
docs:
tfplugindocs generate
tf-plan: install
cd examples/full && rm -f .terraform.lock.hcl && terraform init && terraform plan
tf-apply: install
cd examples/full && rm -f .terraform.lock.hcl && terraform init && terraform apply
tf-destroy: install
cd examples/full && rm -f .terraform.lock.hcl && terraform init && terraform destroy
.PHONY: build test testacc lint vet tffmtcheck fmt install release docs tf-plan tf-apply tf-destroy