Skip to content

Commit

Permalink
Merge pull request #1009 from lorengordon/feat/terraform-docs-config-…
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
lorengordon authored Jul 2, 2024
2 parents cba5253 + 66356cc commit 6a2ea50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
formatter: markdown table # required

sections:
hide:
- modules
- resources

sort:
by: required

output:
template: |-
<!-- BEGIN TFDOCS -->
{{ .Content }}
<!-- END TFDOCS -->
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,10 @@ TFDOCS_DIRS ?= $(filter $(TF_DIRS) $(HCL_DIRS),$(sort $(dir $(TFDOCS_FILES) $(HC
TFDOCS_TARGETS ?= $(addsuffix $(TFDOCS_FILE),$(TFDOCS_DIRS))

docs/%: export TFDOCS ?= terraform-docs
docs/%: export TFDOCS_MODULES_OPTIONS ?= --hide modules --hide resources --sort-by required
docs/%: export HCLDOCS_MODULES_OPTIONS ?= --hide modules --hide resources --sort-by required --hide outputs --hide requirements --hide providers --indent 3
docs/%: export TFDOCS_OPTIONS ?= --output-template '$(TFDOCS_TEMPLATE)' --output-file $(TFDOCS_FILE) markdown table
docs/%: export TFDOCS_TEMPLATE ?= <!-- BEGIN TFDOCS -->\n{{ .Content }}\n\n<!-- END TFDOCS -->
docs/%: export TFCMD_OPTS ?= $(if $(TF_FILES),$(TFDOCS_MODULES_OPTIONS),$(if $(HCL_FILES),$(HCLDOCS_MODULES_OPTIONS),))
docs/%: export TFDOCS_CMD ?= $(if $(TFCMD_OPTS),$(TFDOCS) $(TFCMD_OPTS) $(TFDOCS_OPTIONS),)
docs/%: export TFDOCS_LINT_CMD ?= $(if $(TFCMD_OPTS),$(TFDOCS) --output-check $(TFCMD_OPTS) $(TFDOCS_OPTIONS),)
docs/%: export TFDOCS_CONFIG ?= $(or $(wildcard .terraform-docs.yml),$(TARDIGRADE_CI_PATH)/.terraform-docs.yml)
docs/%: export TFDOCS_OPTIONS ?= --config $(TFDOCS_CONFIG) --output-file $(TFDOCS_FILE)
docs/%: export TFDOCS_CMD ?= $(TFDOCS) $(TFDOCS_OPTIONS)
docs/%: export TFDOCS_LINT_CMD ?= $(TFDOCS) --output-check $(TFDOCS_OPTIONS)

## Generates Terraform documentation
docs/generate: $(addprefix docs/generate/,$(TFDOCS_TARGETS))
Expand Down

0 comments on commit 6a2ea50

Please sign in to comment.