terraform-docs-readme

Regenerates Terraform module READMEs by injecting terraform-docs output between BEGIN_TF_DOCS markers.

2|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill terraform-docs-readme-mbadali25
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-docs-readme
Source: https://github.com/mbadali25/useful-claude-add-ons/tree/main/skills/terraform-docs-readme
Command: npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill terraform-docs-readme-mbadali25

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Terraform module READMEs drift out of sync with the actual .tf files as variables, outputs, and resources change, and hand-editing the generated section gets silently overwritten on the next run. This Skill runs terraform-docs correctly against a module so the README's generated block always matches the code. ## Core Features & Use Cases - Preflight validation: A stdlib-only Python script checks the terraform-docs binary, version pins in .tool-versions, config file requirements, referenced files, and README markers before anything runs. - Scaffolding for new modules: Copies a ready-made .terraform-docs.yml, footer.md, main.tf header template, and README skeleton into modules that have never used terraform-docs. - Gotcha-driven troubleshooting: Documents the real failure modes — empty headers from misplaced comment blocks, CRLF/LF mixed line endings, appended blocks when markers are missing, and version drift between pinned and installed binaries. - Use Case: A developer adds three new variables to a Terraform module and asks to update the docs; the Skill runs preflight, confirms the pinned terraform-docs version satisfies the config, regenerates the README, and reviews the diff before commit. ## Quick Start Regenerate the Terraform README for the module in this directory using terraform-docs and show me the diff.

Frequently Asked Questions about terraform-docs-readme

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I regenerate a Terraform module README with terraform-docs?

Run terraform-docs . from the module directory so it picks up .terraform-docs.yml, which supplies the formatter and output file. The generated block is injected between BEGIN_TF_DOCS and END_TF_DOCS markers in README.md, leaving hand-written content untouched.

How do I install terraform-docs on Windows or Linux?

Use asdf install when the repo has a .tool-versions pin, winget install --id Terraform-docs.Terraform-docs --exact or choco install terraform-docs on Windows, and Homebrew or a direct binary download on Linux. There is no pip package for terraform-docs.

Why is my terraform-docs header not showing up in the README?

The header comment must be the first thing in main.tf. terraform-docs stops looking once it hits a terraform, provider, resource, variable, or module declaration, so a /** */ block placed after any of those produces an empty header with a successful exit code.

What terraform-docs version is required for footer-from and .Module in content?

footer-from and .Module inside the content template require terraform-docs 0.16.0 or later. Against an older binary the config fails or silently drops sections, so the preflight script computes the minimum from the config and compares it.

Why does terraform-docs produce mixed line endings on Windows?

If README.md is CRLF, terraform-docs writes the injected block with LF, leaving one file with two line-ending styles. Fix it at the repo level with a .gitattributes file setting *.md text eol=lf, then run git add --renormalize.

Can I check if a Terraform README is out of date without rewriting it?

Yes, run terraform-docs --output-check . to compare the current README against what would be generated. It prints that the README is out of date and exits 1 if they differ, writing nothing, which makes it suitable for CI gates or pre-commit hooks.