Skip to content

[FEAT]: migrate documentation to tfplugindocs auto-generation #3241

@mkushakov

Description

@mkushakov

Summary

Migrate 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 has several limitations:

  • Schema drift: Schema changes in Go code don't automatically reflect in docs, leading to outdated documentation
  • No validation: There's no way to validate that docs match the actual provider schema
  • Inconsistent formatting: Manual authoring leads to inconsistent formatting across resource docs
  • No example extraction: HCL examples are embedded in markdown rather than being testable .tf files
  • Not standard: Most Terraform providers use tfplugindocs — the upstream standard tooling

Proposed Changes

  • Add tools.go with terraform-plugin-docs dependency
  • Add docs-generate, docs-validate, docs-migrate Makefile targets
  • Migrate website/docs/ to templates/ + docs/ format using tfplugindocs migrate
  • Extract HCL examples into examples/resources/ and examples/data-sources/
  • Enable gradual adoption of {{ .SchemaMarkdown }} for auto-generated schema docs

Benefits

  • Standard tooling: Aligns with the Terraform provider ecosystem best practice
  • Validation: make docs-validate catches documentation issues early
  • Gradual migration: Templates can progressively use {{ .SchemaMarkdown }} as schema descriptions improve
  • Testable examples: Extracted .tf files can be validated independently
  • CI integration: Easy to add docs-validate as a CI check

Workflow After Migration

  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions