provider-docs

作者: hashicorp

使用 HashiCorp 推薦的模式、tfplugindocs 模板和 schema,為 Terraform Registry 建立、更新和審查 Terraform provider 文件。

npx skills add https://github.com/hashicorp/agent-skills --skill provider-docs

Terraform Provider Docs

Follow This Workflow

  1. Confirm scope and documentation targets.
  • Map code changes to the exact doc targets: provider index, resources, data sources, ephemeral resources, list resources, functions, actions, or guides.
  • Decide whether content should come from schema descriptions, templates, or both.
  1. Write schema descriptions first.
  • Add precise user-facing descriptions to schema fields so generated docs stay aligned with behavior.
  • Keep wording specific to argument purpose, constraints, defaults, and computed behavior.
  1. Add or update template files in docs/.
  • Create only files that map to implemented provider objects.
  • Use HashiCorp-recommended template paths:
    • docs/index.md.tmpl
    • docs/data-sources/<name>.md.tmpl
    • docs/resources/<name>.md.tmpl
    • docs/ephemeral-resources/<name>.md.tmpl
    • docs/list-resources/<name>.md.tmpl
    • docs/functions/<name>.md.tmpl
    • docs/actions/<name>.md.tmpl (tfplugindocs generates action docs with Terraform v1.14.0+)
    • docs/guides/<name>.md.tmpl
  • Keep templates focused on overview and examples; rely on generated sections for field-by-field details.
  • Keep HCL examples in the examples/ directory — one example per file, pulled into templates with tffile — rather than inlined in templates (see Example File Conventions in references/hashicorp-provider-docs.md). Examples must not contain terraform, provider, or output blocks.
  • For action pages, follow the structure in references/hashicorp-provider-docs.md (Action Pages section): examples must show both the action block and the action_trigger lifecycle wiring, and actions get no attribute/output section.
  1. Generate documentation with tfplugindocs.
  • Prefer repository defaults when configured:
go generate ./...
  • Otherwise run the generator directly:
go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name <provider_name>
  • Re-run generation after every schema or template edit.
  1. Validate the generated markdown.
  • Verify files in docs/ match the current provider implementation.
  • Verify examples are valid HCL and reflect current argument/attribute names.
  • Verify required/optional/computed semantics in docs match schema behavior.
  1. Apply Registry publication rules before release.
  • Use semantic version tags prefixed with v (for example v1.2.3).
  • Create release tags from the default branch.
  • Keep terraform-registry-manifest.json in the repository root.
  • Expect docs to be versioned in Registry and switchable with the version selector.
  1. Preview or troubleshoot publication when needed.
  • Use the HashiCorp preview process to inspect rendered docs before release when accuracy risk is high.
  • If docs are missing in Registry, check tag format, tag source branch, manifest file presence, and provider publication status.

Enforce Quality Bar

  • Keep documentation behaviorally accurate; never describe unsupported arguments or attributes.
  • Keep examples minimal, realistic, and runnable.
  • Keep terminology and naming consistent across provider, resources, and data sources.
  • Avoid duplicating generated argument/attribute blocks in manual templates.
  • Keep doc changes tied to the same PR as schema/API changes whenever possible.

Load References On Demand

  • Read references/hashicorp-provider-docs.md for source-backed rules and official links.
  • Load only the sections needed for the current change to keep context lean.

來自 hashicorp 的更多技能

provider-actions
hashicorp
使用 Plugin Framework 實作 Terraform Provider 動作。在開發於生命週期事件(之前/之後…)執行的命令式操作時使用。
official
new-terraform-provider
hashicorp
在新版Terraform Provider使用Plugin Framework建立框架時使用此功能:工作區佈局、Go模組設定、Provider伺服器main.go,以及provider.go…
official
terraform-test
hashicorp
編寫和執行 Terraform 測試的綜合指南。在建立測試檔案(.tftest.hcl)、使用 run 區塊編寫測試情境、驗證…時使用。
official
terraform-test
hashicorp
撰寫與執行 Terraform 測試的完整指南,涵蓋斷言、模擬及模組驗證。使用 .tftest.hcl 語法編寫測試檔案,透過 run 區塊在 plan 或 apply 模式下執行,支援順序與平行執行,並可選擇隔離狀態。對資源屬性、輸出及資料來源進行條件斷言;使用 expect_failures 驗證無效輸入是否被正確拒絕。模擬提供者(Terraform 1.7.0 以上版本)可模擬基礎設施行為,無需...
official
provider-actions
hashicorp
使用 Plugin Framework 在資源生命週期事件中執行命令式的 Terraform Provider 動作。支援建立前/後與更新前/後的觸發機制(Terraform 1.14.0 不支援銷毀事件)。需以正確的框架類型、集合的 ElementType 及輸入驗證器定義適當的綱要。包含進度回報、逾時管理及長時間操作的全面錯誤處理。實作輪詢與...
official
aws-ami-builder
hashicorp
使用Packer的amazon-ebs建置器建立自訂Amazon Machine Images。透過HCL範本自動化從來源AMI建立AMI,並搭配佈建工具(Shell腳本、檔案上傳、組態管理)進行自訂。支援透過ami_regions進行多區域AMI分發,以及依名稱、擁有者和虛擬化類型進行靈活的來源AMI篩選。可透過環境變數、AWS憑證檔案或IAM執行個體設定檔進行驗證;包含範本的驗證與建置命令...
official
new-terraform-provider
hashicorp
使用 Plugin Framework 建立新的 Terraform provider。生成新的 Go 模組工作區,採用標準的「terraform-provider-」命名慣例,並初始化所需的依賴項。提供遵循 HashiCorp Plugin Framework 模式的範本 main.go 檔案,並附有待辦事項標記供自訂使用。透過執行建置與測試指令來驗證設定,確保 provider 能成功編譯並通過初步檢查。在建立新的工作區前,會先確認意圖以管理工作區。
official
azure-verified-modules
hashicorp
認證要求與Azure Terraform模組尋求AVM合規性的最佳實踐。強制執行提供者版本限制(azurerm >= 4.0, < 5.0;azapi >= 2.0, < 3.0),並禁止基於git的模組引用,改為使用固定的Terraform註冊表來源。要求所有識別碼採用小寫蛇形命名法、精確的變數類型、透過防腐層模式實現離散的輸出屬性,以及按字母順序排列的locals。新增資源時需要功能切換變數...
official