agentleFS
ai-workspace-labai-workspace-lab/xworkspace-core-skills/skills/development-standards/iac-hcl/SKILL.md

iac-hcl

Skill8 starsChanged 5 months agoMITView on GitHub

开发或评审 Terraform 或 OpenTofu HCL 模块、根模块组装、变量输出、资源引用与状态地址变更。

The file

Files
SKILL.md

IaC / HCL 开发规范

  • 先定位根模块、调用方、Provider、状态空间和当前资源地址。按工程 IaC 规范读取拓扑与渲染约定。GitOps 管拓扑声明,IaC 模块消费输入并输出资源事实。
  • 根模块负责目标绑定和组装。子模块封装有明确生命周期、可复用的资源组合,使用类型明确的输入和最少的必要输出。已有模块契约能表达需求时扩展已有模块。复用条件相同的资源关系,保留不同 Provider 和生命周期的明确边界。
  • 用资源引用表达依赖,确有隐式依赖时才用显式依赖。用稳定资源标识维护 state 地址。目标仓要求由 YAML 渲染为显式块时,遵循该约定并验证输出和地址稳定性。模块移动、键变更或资源改名先核对 state 地址及迁移路径,验证实际 plan 中的创建、替换与删除。
  • HCL 表达目标状态,环境选择由权威声明驱动。复杂输入校验和渲染按现有工具归属,宿主机操作交给 Playbooks。复用应减少环境配置副本,避免让根模块变成多 Provider、多生命周期的开关集合。
  • 使用仓库实际工具执行格式检查、validate 和代表性 plan,核对正确的环境和 state。记录仅静态验证或 plan 的范围。资源变更的授权和执行沿用工程与运维流程。

命名与可读性按清单执行:块名使用稳定、合法的 HCL 标识符。可批量编排的 env 保持扁平显式块,不在 .tf 中使用 for_each、count、dynamic 或模板控制结构;循环放在既有 Python + Jinja2 渲染器。优先复用现有模块,不另起渲染入口。

参考 Terraform 模块组合及范式与模式选择。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.