Skip to content

Generated documentation fails validation #445

@jedesroches

Description

@jedesroches

Terraform CLI and terraform-plugin-docs Versions

$ terraform version
Terraform v1.9.8
on darwin_amd64

Your version of Terraform is out of date! The latest version
is 1.10.5. You can update by downloading from https://www.terraform.io/downloads.html


$ go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs --version
tfplugindocs Version dev

Provider Code

N/A

Expected Behavior

When generating documentation with go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir . --provider-name name --examples-dir examples, then the validate command using go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs validate --provider-dir . --provider-name name should not report an error.

Actual Behavior

The actual output of the validate command is:

exporting schema from Terraform
compiling provider "name"
using Terraform CLI binary from PATH if available, otherwise downloading latest Terraform CLI binary
running terraform init
getting provider schema
2025/02/06 14:56:14 [DEBUG] Found documentation files [docs/data-sources/xxx.md docs/data-sources/yyy.md docs/index.md docs/resources/xxx.md docs/resources/yyy.md docs/resources/zzz.md]
running mixed directories check
2025/02/06 14:56:14 [DEBUG] Found directory: docs/data-sources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/data-sources
2025/02/06 14:56:14 [DEBUG] Found directory: docs
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
2025/02/06 14:56:14 [DEBUG] Found directory: docs/resources
detected static docs directory, running checks
running invalid directories check on docs/data-sources
running file checks on docs/data-sources/xxx.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/data-sources/xxx.md
2025/02/06 14:56:14 [DEBUG] File docs/data-sources/xxx.md size: 516 (limit: 500000)
running file checks on docs/data-sources/yyy.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/data-sources/yyy.md
2025/02/06 14:56:14 [DEBUG] File docs/data-sources/yyy.md size: 489 (limit: 500000)
running file checks on docs/index.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/index.md
2025/02/06 14:56:14 [DEBUG] File docs/index.md size: 816 (limit: 500000)
running invalid directories check on docs/resources
running file checks on docs/resources/xxx.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/xxx.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/xxx.md size: 524 (limit: 500000)
running file checks on docs/resources/zzz.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/zzz.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/zzz.md size: 615 (limit: 500000)
running file checks on docs/resources/yyy.md
2025/02/06 14:56:14 [DEBUG] Checking file: /Users/jde/Documents/name-terraform-provider/docs/resources/yyy.md
2025/02/06 14:56:14 [DEBUG] File docs/resources/yyy.md size: 372 (limit: 500000)
running file mismatch check
2025/02/06 14:56:14 [DEBUG] Found file xxx.md
2025/02/06 14:56:14 [DEBUG] Found file yyy.md
2025/02/06 14:56:14 [DEBUG] Found file zzz.md
2025/02/06 14:56:14 [DEBUG] Found resource xxx
2025/02/06 14:56:14 [DEBUG] Found resource yyy
2025/02/06 14:56:14 [DEBUG] Found resource zzz
2025/02/06 14:56:14 [DEBUG] Found file xxx.md
2025/02/06 14:56:14 [DEBUG] Found file yyy.md
2025/02/06 14:56:14 [DEBUG] Found datasource xxx
2025/02/06 14:56:14 [DEBUG] Found datasource yyy
Error executing command: validation errors found:
docs/index.md: error checking file frontmatter: YAML frontmatter should not contain subcategory

exit status 1

Note that in docs/index.md, the subcategory field is set to "".

Steps to Reproduce

  1. tfplugindocs generate --provider-dir . --provider-name name --examples-dir examples
  2. tfplugindocs validate --provider-dir . --provider-name name

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Setting the category to something else than the empty string does not fix the issue 🤷

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions