-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
80 lines (63 loc) · 2.28 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
PROVIDER_NAME := pf9
RENDERED_PROVIDER_NAME := "Platform9 PMK"
GOBIN := $(PWD)/bin
PATH := $(GOBIN):$(PATH)
.PHONY: generate generate-code scaffold-ds scaffold-rs scaffold-provider build install apply destroy clean uninstall test fmt lint check-versions docs
generate:
@go generate ./...
generate-code:
@echo "Generating provider, resources, data-sources schema files from provider_code_spec.json..."
tfplugingen-framework generate all --input ./provider_code_spec.json --output internal/provider
install:
@echo "Installing provider..."
go install .
apply:
@echo "Applying example terraform config..."
cd _examples/cluster && terraform apply -auto-approve && cd ../..
destroy:
@echo "Destroying example terraform config..."
cd _examples/cluster && terraform destroy -auto-approve && cd ../..
clean:
@echo "Cleaning up..."
rm -rf ~/go/bin/terraform-provider-$(PROVIDER_NAME)
uninstall:
@echo "Uninstalling provider..."
go clean -i .
rm -f ~/go/bin/terraform-provider-$(PROVIDER_NAME)
test:
@echo "Running tests..."
go test ./...
fmt:
@echo "Formatting code..."
go fmt ./...
docs:
@echo "Generating docs..."
tfplugindocs generate --rendered-provider-name $(RENDERED_PROVIDER_NAME)
lint:
@echo "Linting code..."
go vet ./...
scaffold-ds:
@if [ -z "$(NAME)" ]; then \
echo "Error: Data-source name not provided. Usage: NAME=<data-source-name> make scaffold-ds"; \
exit 1; \
fi
@echo "Scaffolding code for data-source $(NAME)..."
tfplugingen-framework scaffold data-source --name $(NAME) --output-dir ./internal/provider --force
scaffold-rs:
@if [ -z "$(NAME)" ]; then \
echo "Error: resource name not provided. Usage: NAME=<resource-name> make scaffold-rs"; \
exit 1; \
fi
@echo "Scaffolding code for resource $(NAME)..."
tfplugingen-framework scaffold resource --name $(NAME) --output-dir ./internal/provider --force
scaffold-provider:
@echo "Scaffolding provider code..."
tfplugingen-framework scaffold provider --name $(PROVIDER_NAME) --output-dir ./internal/provider --force
dependencies:
@echo "Installing dependencies..."
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
check-versions:
@echo "Checking Go version..."
@echo "Go version must be at least 1.21.4"
@echo "Checking Terraform version..."
@echo "Terraform version must be at least 1.6.6"