Skip to content

feat: migrate to tfplugindocs auto-generated documentation#3239

Open
mkushakov wants to merge 1 commit intointegrations:mainfrom
mkushakov:feat/auto-docs-generation
Open

feat: migrate to tfplugindocs auto-generated documentation#3239
mkushakov wants to merge 1 commit intointegrations:mainfrom
mkushakov:feat/auto-docs-generation

Conversation

@mkushakov
Copy link

@mkushakov mkushakov commented Feb 27, 2026

Resolves #3241

Summary

Migrates documentation from the manually-maintained website/docs/ format to auto-generated documentation using terraform-plugin-docs (tfplugindocs).

Motivation

Currently, documentation is manually written in website/docs/ as .html.markdown files. This approach has several limitations:

  • Schema changes don't automatically reflect in docs
  • No validation that docs match the actual provider schema
  • Inconsistent formatting across resource docs
  • No extraction of example HCL code into testable files

The tfplugindocs tool is the standard approach used by most Terraform providers and provides:

  • Template-based docs in templates/ that can reference schema descriptions via {{ .SchemaMarkdown }}
  • Extracted HCL examples in examples/ that can be tested
  • Auto-generation of docs/ output via make docs-generate
  • Validation via make docs-validate

Changes

  • tools.go (new): Adds terraform-plugin-docs as a tool dependency alongside existing misspell and golangci-lint
  • GNUmakefile: Adds three new targets:
    • docs-generate — generates docs/ from templates/
    • docs-validate — validates generated docs
    • docs-migrate — one-time migration from website/docs/ to templates/ format
  • templates/ (new): Contains .md.tmpl template files migrated from website/docs/
  • examples/resources/, examples/data-sources/ (new): Extracted HCL code examples
  • docs/ (new): Auto-generated output — replaces website/docs/
  • website/docs/ (removed): Replaced by docs/
  • go.mod/go.sum: Added terraform-plugin-docs dependency

Pre-existing fixes

The migration also fixed two pre-existing YAML frontmatter indentation issues in the OIDC subject claim customization template docs that caused validation failures.

Workflow

After this change, the documentation workflow becomes:

  1. Edit templates in templates/ or update schema descriptions in Go source code
  2. Run make docs-generate to regenerate docs/
  3. Run make docs-validate to verify
  4. Commit both templates/ changes and docs/ output

Templates can gradually be enhanced to use {{ .SchemaMarkdown }} for auto-generated schema documentation as schema descriptions are improved in the provider source code.

- Add tools.go with terraform-plugin-docs dependency
- Add docs-generate, docs-validate, docs-migrate targets to GNUmakefile
- Migrate website/docs/ to templates/ + docs/ format using tfplugindocs migrate
- Extract HCL examples into examples/resources/ and examples/data-sources/
- Fix pre-existing YAML frontmatter indentation issues in OIDC template docs
- Generated docs/ output passes docs-validate

The docs/ directory is now auto-generated from templates/ and should be
regenerated by running 'make docs-generate' after schema or template changes.
@github-actions
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@github-actions github-actions bot added the Type: Feature New feature or request label Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: migrate documentation to tfplugindocs auto-generation

1 participant