-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: auto generated docs and refine makefile (#62)
Co-authored-by: dkool <dkool@dkools-MacBook-Pro.local>
- Loading branch information
Showing
4 changed files
with
59 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,34 @@ | ||
.PHONY: test | ||
.PHONY: test docs fmt validate install-tools | ||
|
||
export EXAMPLE | ||
|
||
all: install-tools validate fmt docs | ||
|
||
install-tools: | ||
@go install github.com/terraform-docs/terraform-docs@latest | ||
|
||
test: | ||
cd tests && go test -v -timeout 60m -run TestApplyNoError/$(EXAMPLE) ./vwan_test.go | ||
cd tests && go test -v -timeout 60m -run TestApplyNoError/$(EXAMPLE) ./deploy_test.go | ||
|
||
docs: | ||
@echo "Generating documentation for root and modules..." | ||
@BASE_DIR=$$(pwd); \ | ||
terraform-docs markdown . --output-file $$BASE_DIR/README.md --output-mode inject --hide modules; \ | ||
for dir in $$BASE_DIR/modules/*; do \ | ||
if [ -d "$$dir" ]; then \ | ||
echo "Processing $$dir..."; \ | ||
terraform-docs markdown $$dir --output-file $$dir/README.md --output-mode inject --hide modules || echo "Skipped: $$dir"; \ | ||
fi \ | ||
done | ||
|
||
fmt: | ||
terraform fmt -recursive | ||
|
||
validate: | ||
terraform init -backend=false | ||
terraform validate | ||
@echo "Cleaning up initialization files..." | ||
@rm -rf .terraform | ||
@rm -f terraform.tfstate | ||
@rm -f terraform.tfstate.backup | ||
@rm -f .terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.