AgentSkillsCN

tfdc

使用 tfdc CLI 从公共注册表中获取 Terraform 文档。支持提供者文档的搜索/获取/导出、模块的搜索/获取、策略的搜索/获取,以及 Terraform 风格与模块开发指南的查阅。适用于需要查找、阅读或导出 Terraform 提供者文档、模块文档、策略文档,或开发指南时使用。

SKILL.md
--- frontmatter
name: tfdc
description: Retrieve Terraform documentation from the public registry using the tfdc CLI. Supports provider doc search/get/export, module search/get, policy search/get, and Terraform style/module-dev guides. Use when you need to find, read, or export Terraform provider docs, module docs, policy docs, or development guides.

tfdc

tfdc retrieves Terraform documentation from the public Terraform Registry and official HashiCorp docs.

Available commands

CommandDescription
provider searchSearch provider docs by service slug, returns provider_doc_id list
provider getFetch full provider doc content by provider_doc_id
provider exportBulk export all docs for a provider version to local files
module searchSearch the Terraform module registry
module getFetch module details by module ID
policy searchSearch Terraform policy sets
policy getFetch policy details by policy ID
guide styleFetch Terraform style guide
guide module-devFetch module development guide

Workflow

Provider, module, and policy docs use a two-step search-then-get flow:

bash
# Step 1: Find doc IDs
tfdc provider search -name aws -service ec2 -type resources -format json

# Step 2: Fetch full content by ID
tfdc provider get -doc-id 10595066

Output formats

All search/get/guide commands support -format text|json|markdown (default: text).

Search JSON: { "items": [...], "total": N } Detail JSON: { "id": "...", "content": "...", "content_type": "text/markdown" }

Global flags

FlagDefaultDescription
-chdirnoneSwitch working directory; auto-detects .terraform.lock.hcl
-timeout10sHTTP timeout
-retry3Retry count
-registry-urlhttps://registry.terraform.ioRegistry base URL
-insecureoffSkip TLS verification
-user-agenttfdc/devUser-Agent header
-debugoffDebug logs to stderr
-cache-dir~/.cache/tfdcCache directory
-cache-ttl24hCache TTL
-no-cacheoffDisable cache

Exit codes

CodeMeaning
0Success
1Invalid arguments or validation error
2Not found
3Remote API error
4File write or serialization error

Individual skill details

For detailed usage of each command, see the individual skills: tfdc-provider-search, tfdc-provider-get, tfdc-provider-export, tfdc-module-search, tfdc-module-get, tfdc-policy-search, tfdc-policy-get, tfdc-guide-style, tfdc-guide-module-dev.