generated from hashicorp/terraform-provider-scaffolding-framework
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
GNUmakefile
51 lines (41 loc) · 1.02 KB
/
GNUmakefile
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
default: testacc
define MAINTF
terraform {
required_providers {
supabase = {
source = "supabase/supabase"
version = "~> 1.0"
}
}
}
endef
define TERRAFORMRC
provider_installation {
dev_overrides {
"supabase/supabase" = "$$PWD"
}
}
endef
export MAINTF
export TERRAFORMRC
# Run acceptance tests
.PHONY: testacc
testacc:
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m
# Generate schema.json for documentation
.PHONY: generate-json
generate-json:
@echo "Generating docs/schema.json"
@mkdir temp
@echo " - Generating temporary build"
@go build -o ./temp
@echo " - Creating temporary terraform config and definition"
@echo "$$TERRAFORMRC" > ./temp/local.tfrc.tpl
@echo "$$MAINTF" > ./temp/main.tf
@cd temp; envsubst '$${PWD}' < local.tfrc.tpl > local.tfrc
@echo " - Writing terraform schema to JSON"
@cd temp; export TF_CLI_CONFIG_FILE="$$PWD/local.tfrc" && \
terraform providers schema -json > schema.json && \
jq . schema.json > ../docs/schema.json
@echo "Cleaning up"
@rm -r temp