Skip to content
Back to search

terraform-skill

Terraform & OpenTofu Skill for AI Agents - testing, modules, CI/CD, and production patterns

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/antonbabenko/terraform-skill with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/antonbabenko/terraform-skill'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/antonbabenko-terraform-skill/badge.svg)](/listings/antonbabenko-terraform-skill)

HTML

<a href="/listings/antonbabenko-terraform-skill"><img src="/api/listings/antonbabenko-terraform-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Installed through one Claude Code marketplace, `antonbabenko/agent-plugins` (terraform-skill is listed there as an external plugin). Do not also add `antonbabenko/terraform-skill` as a marketplace - both use the same marketplace name and will clash.

Quick install (any agent)

Works with any [Agent Skills](https://agentskills.io)-compatible tool:

npx skills add https://github.com/antonbabenko/terraform-skill

Per-host instructions

<details> <summary>Claude Code</summary>

/plugin marketplace add antonbabenko/agent-plugins
/plugin install terraform-skill@antonbabenko

</details>

<details> <summary>Gemini CLI</summary>

gemini extensions install https://github.com/antonbabenko/terraform-skill

Update with `gemini extensions update terraform-skill`.

</details>

<details> <summary>Cursor</summary>

git clone https://github.com/antonbabenko/terraform-skill.git ~/.cursor/skills/terraform-skill

Cursor auto-discovers skills from `.agents/skills/` and `.cursor/skills/`.

</details>

<details> <summary>Copilot</summary>

/plugin install https://github.com/antonbabenko/terraform-skill
# or
git clone https://github.com/antonbabenko/terraform-skill.git ~/.copilot/skills/terraform-skill

Copilot auto-discovers skills from `.copilot/skills/`.

</details>

<details> <summary>OpenCode</summary>

git clone https://github.com/antonbabenko/terraform-skill.git ~/.agents/skills/terraform-skill

OpenCode auto-discovers skills from `.agents/skills/`, `.opencode/skills/`, and `.claude/skills/`.

</details>

<details> <summary>Codex (OpenAI)</summary>

git clone https://github.com/antonbabenko/terraform-skill.git ~/.agents/skills/terraform-skill

Codex auto-discovers skills from `~/.agents/skills/` and `.agents/skills/`. Update with `cd ~/.agents/skills/terraform-skill && git pull`.

For a managed Codex plugin install, use the `antonbabenko/agent-plugins` marketplace (`codex plugin marketplace add antonbabenko/agent-plugins`, then install `terraform-skill`). Do not add `antonbabenko/terraform-skill` as a separate marketplace - it clashes by name with `agent-plugins`.

</details>

<details> <summary>Autohand Code</summary>

Install the skill globally:

git clone https://github.com/antonbabenko/terraform-skill.git
mkdir -p ~/.autohand/skills
cp -R terraform-skill/skills/terraform-skill ~/.autohand/skills/

Or install it only for the current project:

git clone https://github.com/antonbabenko/terraform-skill.git
mkdir -p .autohand/skills
cp -R terraform-skill/skills/terraform-skill .autohand/skills/

Autohand Code discovers skills from `~/.autohand/skills/` and `.autohand/skills/`.

</details>

<details> <summary>Kiro</summary>

git clone https://github.com/antonbabenko/terraform-skill.git ~/.kiro/skills/terraform-skill

Kiro auto-discovers skills from `.kiro/skills/` (workspace) and `~/.kiro/skills/` (global).

</details>

<details> <summary>Antigravity/Antigravity IDE/Antigravity CLI</summary>

git clone https://github.com/antonbabenko/terraform-skill.git
ln -s "$(pwd)/terraform-skill/skills/terraform-skill" ~/.gemini/config/skills/terraform-skill

Update with `git pull`.

</details>

<details> <summary>Kiro</summary>

This repo is also a [Kiro Power](https://kiro.dev/docs/powers/) (root `POWER.md` + optional `mcp.json`). In Kiro: **Powers panel → "Add power from GitHub"**, then paste:

https://github.com/antonbabenko/terraform-skill

Kiro activates the power on keyword match (e.g. "terraform", "opentofu", "state", "modules"). Installing it also registers the optional read-only HashiCorp `terraform-mcp-server` (from `mcp.json`) under the Powers section of `~/.kiro/settings/mcp.json` — the guidance works without it. `POWER.md` is generated from `skills/terraform-skill/SKILL.md`; the skill content is shared, not duplicated.

</details>

<details> <summary>Manual (symlink local clone)</summary>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/plugin.json · Manifest · 22 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "terraform-skill",
  3. "description": "Terraform and OpenTofu best-practices skill for writing, reviewing, debugging, testing, CI, scans, and state operations.",
  4. "author": {
  5. "name": "Anton Babenko",
  6. "url": "https://github.com/antonbabenko"
  7. },
  8. "homepage": "https://github.com/antonbabenko/terraform-skill",
  9. "repository": "https://github.com/antonbabenko/terraform-skill",
  10. "license": "Apache-2.0",
  11. "keywords": [
  12. "ci-cd",
  13. "iac",
  14. "infrastructure-as-code",
  15. "modules",
  16. "opentofu",
  17. "security-scanning",
  18. "state-management",
  19. "terraform",
  20. "testing"
  21. ]
  22. }
README.md · README · 408 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Terraform & OpenTofu Skill for AI Agents
  2. [![Agent Skill](https://img.shields.io/badge/Agent-Skill-5865F2)](https://agentskills.io)
  3. [![Terraform](https://img.shields.io/badge/Terraform-1.0+-623CE4)](https://www.terraform.io/)
  4. [![OpenTofu](https://img.shields.io/badge/OpenTofu-1.6+-FFD814)](https://opentofu.org/)
  5. [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
  6. A best-practices skill for Terraform and OpenTofu, for AI coding agents (Claude Code, Cursor, Copilot, Gemini CLI, OpenCode, Codex, Kiro, and more). It helps the agent test code, structure modules, set up CI/CD, and write production infrastructure code.
  7. AWS, Azure, and GCP are all first-class. AWS stays the default in examples, but the same backend, auth, security, and resource guidance applies to all three - ask for the Azure or GCP equivalent of any pattern and the skill maps it.
  8. ## What this skill provides
  9. **Testing frameworks**
  10. - Decision matrix for native tests vs Terratest
  11. - Testing workflows (static, integration, E2E)
  12. - Examples and patterns
  13. **Module development**
  14. - Structure and naming conventions
  15. - Versioning strategies
  16. - Public vs private module patterns
  17. **State management**
  18. - Remote backends (S3, Azure, GCS, Terraform Cloud)
  19. - Locking and security
  20. - Multi-team state isolation
  21. - Migration and recovery procedures
  22. **CI/CD integration**
  23. - GitHub Actions workflows
  24. - GitLab CI examples
  25. - Cost optimization
  26. - Compliance automation
  27. **Security and compliance**
  28. - Trivy and Checkov integration
  29. - Policy-as-code patterns
  30. - Compliance scanning workflows
  31. **Quick reference**
  32. - Decision flowcharts
  33. - Common patterns (DO vs DON'T)
  34. - Cheat sheets
  35. ## Installation
  36. Installed through one Claude Code marketplace, `antonbabenko/agent-plugins`
  37. (terraform-skill is listed there as an external plugin). Do not also add
  38. `antonbabenko/terraform-skill` as a marketplace - both use the same marketplace
  39. name and will clash.
  40. ### Quick install (any agent)
  41. Works with any [Agent Skills](https://agentskills.io)-compatible tool:
  42. ```bash
  43. npx skills add https://github.com/antonbabenko/terraform-skill
  44. ```
  45. ### Per-host instructions
  46. <!-- prettier-ignore-start -->
  47. <details>
  48. <summary>Claude Code</summary>
  49. ```bash
  50. /plugin marketplace add antonbabenko/agent-plugins
  51. /plugin install terraform-skill@antonbabenko
  52. ```
  53. </details>
  54. <details>
  55. <summary>Gemini CLI</summary>
  56. ```bash
  57. gemini extensions install https://github.com/antonbabenko/terraform-skill
  58. ```
  59. Update with `gemini extensions update terraform-skill`.
  60. </details>
  61. <details>
  62. <summary>Cursor</summary>
  63. ```bash
  64. git clone https://github.com/antonbabenko/terraform-skill.git ~/.cursor/skills/terraform-skill
  65. ```
  66. Cursor auto-discovers skills from `.agents/skills/` and `.cursor/skills/`.
  67. </details>
  68. <details>
  69. <summary>Copilot</summary>
  70. ```bash
  71. /plugin install https://github.com/antonbabenko/terraform-skill
  72. # or
  73. git clone https://github.com/antonbabenko/terraform-skill.git ~/.copilot/skills/terraform-skill
  74. ```
  75. Copilot auto-discovers skills from `.copilot/skills/`.
  76. </details>
  77. <details>
  78. <summary>OpenCode</summary>
  79. ```bash
  80. git clone https://github.com/antonbabenko/terraform-skill.git ~/.agents/skills/terraform-skill
  81. ```
  82. OpenCode auto-discovers skills from `.agents/skills/`, `.opencode/skills/`, and `.claude/skills/`.
  83. </details>
  84. <details>
  85. <summary>Codex (OpenAI)</summary>
  86. ```bash
  87. git clone https://github.com/antonbabenko/terraform-skill.git ~/.agents/skills/terraform-skill
  88. ```
  89. Codex auto-discovers skills from `~/.agents/skills/` and `.agents/skills/`. Update with `cd ~/.agents/skills/terraform-skill && git pull`.
  90. For a managed Codex plugin install, use the `antonbabenko/agent-plugins`
  91. marketplace (`codex plugin marketplace add antonbabenko/agent-plugins`, then
  92. install `terraform-skill`). Do not add `antonbabenko/terraform-skill` as a
  93. separate marketplace - it clashes by name with `agent-plugins`.
  94. </details>
  95. <details>
  96. <summary>Autohand Code</summary>
  97. Install the skill globally:
  98. ```bash
  99. git clone https://github.com/antonbabenko/terraform-skill.git
  100. mkdir -p ~/.autohand/skills
  101. cp -R terraform-skill/skills/terraform-skill ~/.autohand/skills/
  102. ```
  103. Or install it only for the current project:
  104. ```bash
  105. git clone https://github.com/antonbabenko/terraform-skill.git
  106. mkdir -p .autohand/skills
  107. cp -R terraform-skill/skills/terraform-skill .autohand/skills/
  108. ```
  109. Autohand Code discovers skills from `~/.autohand/skills/` and `.autohand/skills/`.
  110. </details>
  111. <details>
  112. <summary>Kiro</summary>
  113. ```bash
  114. git clone https://github.com/antonbabenko/terraform-skill.git ~/.kiro/skills/terraform-skill
  115. ```
  116. Kiro auto-discovers skills from `.kiro/skills/` (workspace) and `~/.kiro/skills/` (global).
  117. </details>
  118. <details>
  119. <summary>Antigravity/Antigravity IDE/Antigravity CLI</summary>
  120. ```bash
  121. git clone https://github.com/antonbabenko/terraform-skill.git
  122. ln -s "$(pwd)/terraform-skill/skills/terraform-skill" ~/.gemini/config/skills/terraform-skill
  123. ```
  124. Update with `git pull`.
  125. </details>
  126. <details>
  127. <summary>Kiro</summary>
  128. This repo is also a [Kiro Power](https://kiro.dev/docs/powers/) (root
  129. `POWER.md` + optional `mcp.json`). In Kiro: **Powers panel → "Add power from
  130. GitHub"**, then paste:
  131. ```text
  132. https://github.com/antonbabenko/terraform-skill
  133. ```
  134. Kiro activates the power on keyword match (e.g. "terraform", "opentofu",
  135. "state", "modules"). Installing it also registers the optional read-only
  136. HashiCorp `terraform-mcp-server` (from `mcp.json`) under the Powers section of
  137. `~/.kiro/settings/mcp.json` — the guidance works without it. `POWER.md` is
  138. generated from `skills/terraform-skill/SKILL.md`; the skill content is shared,
  139. not duplicated.
  140. </details>
  141. <details>
  142. <summary>Manual (symlink local clone)</summary>
  143. ```bash
  144. git clone https://github.com/antonbabenko/terraform-skill
  145. mkdir -p ~/.claude/plugins
  146. ln -s "$(pwd)/terraform-skill" ~/.claude/plugins/terraform-skill
  147. ```
  148. Claude Code autodiscovers the skill at `skills/terraform-skill/SKILL.md` on next launch. Edits to the clone are picked up live.
  149. </details>
  150. <!-- prettier-ignore-end -->
  151. ### Verify installation
  152. After installation, try:
  153. ```
  154. "Create a Terraform module with testing for an S3 bucket"
  155. ```
  156. Claude picks up the skill automatically when working with Terraform or OpenTofu code.
  157. ## Recommended companion: code-intelligence
  158. Install the `code-intelligence` plugin alongside this one:
  159. ```bash
  160. /plugin marketplace add antonbabenko/agent-plugins
  161. /plugin install code-intelligence@antonbabenko
  162. ```
  163. It holds the general, any-language rules for navigating code (when to use a
  164. language server, plain text search, or fuzzy search; how to anchor a lookup to
  165. a position; what to do when a tool fails; saying so when one tool is swapped
  166. for another). terraform-skill is the Terraform-specific version of those rules.
  167. Why install it:
  168. - **Fewer tokens** - the rules live in one place. The agent loads them when
  169. needed instead of repeating them in every language skill.
  170. - **More accurate** - it finds definitions and references by meaning, not by
  171. plain text matching, so renames and refactors do not miss spots or change
  172. the wrong ones.
  173. - **Faster** - it picks the right tool the first time instead of retrying,
  174. and says up front when it had to use a different one.
  175. terraform-skill works on its own without it. The name `code-intelligence` is
  176. not unique; if a `code-intelligence` skill is active, check it is the one from
  177. [antonbabenko/agent-plugins](https://github.com/antonbabenko/agent-plugins).
  178. ## Quick start examples
  179. **Create a module with tests (AWS / Azure / GCP):**
  180. > "Create a Terraform module for an AWS VPC with native tests"
  181. >
  182. > "Build an Azure module: VNet, subnets, and a PostgreSQL Flexible Server, with native tests"
  183. >
  184. > "Write a GCP module for a VPC network, subnetwork, and Cloud SQL Postgres, with native tests"
  185. **Set up remote state:**
  186. > "Configure an S3 backend with native `use_lockfile` locking and encryption for Terraform state"
  187. >
  188. > "Choose and configure a remote state backend for AWS, Azure, or GCP (locking, encryption, versioning)"
  189. **Review existing code:**
  190. > "Review this Terraform configuration following best practices"
  191. **Generate CI/CD workflow:**
  192. > "Create a GitHub Actions workflow for Terraform with cost estimation"
  193. **Testing strategy:**
  194. > "Help me choose between native tests and Terratest for my modules"
  195. **State management:**
  196. > "How should I organize state files for a multi-team environment?"
  197. ## Longer example prompts
  198. These assume a recent Terraform/OpenTofu - `use_lockfile` is 1.10+, `write_only` is 1.11+.
  199. <details>
  200. <summary>AWS: production service (modules + composition, OIDC, native locking)</summary>
  201. > "I'm building a new production service on AWS. Design reusable Terraform modules plus a prod/staging composition for a VPC with public/private subnets across 3 AZs, an ECS Fargate service behind an ALB, and an RDS Postgres instance. Include native `terraform test` coverage, variables with descriptions/types/validation, S3 remote state with encryption, bucket versioning, and native `use_lockfile` locking (Terraform 1.10+). Keep secret values out of plan/state - use `write_only` / `*_wo` arguments where the provider supports them (Terraform 1.11+) and Secrets Manager/SSM references for runtime secrets. Add a GitHub Actions workflow that runs fmt/validate/tflint/trivy on PRs, produces a reviewed plan artifact, and applies it via AWS OIDC (no static keys). Keep prod/staging state isolated and follow naming conventions."
  202. </details>
  203. <details>
  204. <summary>GCP: port the AWS pattern (cross-cloud mapping, WIF, gcs backend)</summary>
  205. > "We're standardizing IaC across clouds. Port our AWS module pattern to GCP: reusable modules plus an environment composition for a VPC network, a regional subnetwork, and a Cloud SQL Postgres instance (`google_sql_database_instance`). Use the `gcs` backend (`bucket` + `prefix`) for remote state, and show the state bootstrap bucket separately with object versioning, uniform bucket-level access, public access prevention, and IAM bindings. Use Workload Identity Federation for keyless GitHub Actions auth (no long-lived service-account keys) and native tests. Also show the cross-cloud equivalents (resources + backend) so the team sees the AWS-to-GCP mapping."
  206. </details>
  207. ## What it covers
  208. ### Testing strategy
  209. Decision matrices for native tests (Terraform 1.6+) vs Terratest (Go-based), plus multi-environment testing patterns.
  210. ### Module development
  211. Naming conventions (`terraform-<PROVIDER>-<NAME>`), directory structure, input/output design, version constraints, and documentation standards.
  212. ### CI/CD workflows
  213. GitHub Actions, GitLab CI, Atlantis, Infracost cost estimation, Trivy/Checkov scanning, and compliance checks.
  214. ### Security and compliance
  215. Static analysis, policy-as-code, secrets management, state file security, backend encryption, and compliance scanning workflows.
  216. ### Patterns and anti-patterns
  217. Side-by-side DO vs DON'T examples for variable naming, resource naming, module composition, state management, and provider configuration.
  218. ## Why this skill
  219. This skill started from field-tested Terraform and OpenTofu patterns, then grew through contributions from people who hit missing guidance and added it back.
  220. **Sources:**
  221. - Patterns from [terraform-best-practices.com](https://www.terraform-best-practices.com/)
  222. - Approaches used across the [terraform-aws-modules](https://github.com/terraform-aws-modules) collection
  223. - AWS Hero experience with enterprise IaC
  224. **Version-specific guidance:**
  225. - Terraform 1.0+ features
  226. - OpenTofu 1.6+ compatibility
  227. - Native test framework (1.6+)
  228. - Current tooling ecosystem (2024-2026)
  229. **Decision frameworks:** not just "what to do" but "when and why".
  230. ## Requirements
  231. - An AI agent with skill support: Claude Code, Cursor, Copilot, Gemini CLI, OpenCode, Codex, Kiro, or any [Agent Skills](https://agentskills.io)-compatible host
  232. - Terraform 1.0+ or OpenTofu 1.6+
  233. - Optional: [Terraform MCP server](https://github.com/hashicorp/terraform-mcp-server) for registry integration
  234. ## Code intelligence (optional)
  235. The skill works without a language server. To jump to a definition, find
  236. references, outline a file, or show hover docs, it can also use
  237. [terraform-ls](https://github.com/hashicorp/terraform-ls), HashiCorp's official
  238. Terraform language server.
  239. - **Optional.** Without terraform-ls the skill falls back to text search
  240. (`rg`) plus reading files. Nothing breaks; you get text matches instead of
  241. matches by meaning.
  242. - **Needs.** A local `terraform` (or `tofu`) binary on `PATH`, and
  243. `terraform init` run in the workspace, before it can resolve names across
  244. modules and providers.
  245. - **Install.** Get it from the
  246. [terraform-ls releases](https://github.com/hashicorp/terraform-ls/releases)
  247. page, or turn it on through your editor or agent host. Use whatever version
  248. your host supports.
  249. - Claude Code: install it as an LSP plugin -
  250. `/plugin marketplace add boostvolt/claude-code-lsps` then
  251. `/plugin install terraform-ls@claude-code-lsps`.
  252. How the skill uses it:
  253. - Use the language server to follow a name to where it is defined or used; use
  254. `rg` plus reading files for exact text, known names, `.tfvars`, comments, and
  255. non-HCL files.
  256. - Point the language server at a spot in the file first (find an occurrence,
  257. then ask about that position).
  258. - terraform-ls cannot rename for you. To rename a variable, local, or output:
  259. find every reference, then edit each by hand. To rename a resource or module
  260. address: use a `moved` block, not a text replace.
  261. ## Contributing
  262. See [CLAUDE.md](CLAUDE.md) for skill development guidelines, content structure, how to propose improvements, and the validation approach.
  263. Report bugs or request features via [GitHub Issues](https://github.com/antonbabenko/terraform-skill/issues).
  264. ## Related resources
  265. ### Official documentation
  266. - [Terraform Language](https://developer.hashicorp.com/terraform/docs)
  267. - [Terraform Testing](https://developer.hashicorp.com/terraform/language/tests) - native test framework
  268. - [OpenTofu Documentation](https://opentofu.org/docs/)
  269. - [HashiCorp Recommended Practices](https://developer.hashicorp.com/terraform/cloud-docs/recommended-practices)
  270. ### Community resources
  271. - [Terraform compliance-as-code docs](https://compliance.tf/docs/) - Compliance frameworks, controls, implementation guides, remediations, etc
  272. - [Awesome Terraform](https://github.com/shuaibiyy/awesome-tf)
  273. - [Awesome Terraform Compliance](https://github.com/antonbabenko/awesome-terraform-compliance)
  274. - [Terraform Best Practices](https://terraform-best-practices.com) - the guide this skill is based on
  275. - [terraform-aws-modules](https://github.com/terraform-aws-modules) - AWS modules collection
  276. - [Terratest](https://terratest.gruntwork.io/docs/) - Go testing framework for Terraform
  277. - [Google Cloud Best Practices](https://docs.cloud.google.com/docs/terraform/best-practices/general-style-structure)
  278. - [AWS Terraform Best Practices](https://docs.aws.amazon.com/prescriptive-guidance/latest/terraform-aws-provider-best-practices/introduction.html)
  279. ### Development tools
  280. - [pre-commit-terraform](https://github.com/antonbabenko/pre-commit-terraform) - pre-commit hooks for Terraform
  281. - [terraform-docs](https://terraform-docs.io/) - generate documentation from modules
  282. - [terraform-switcher](https://github.com/warrensbox/terraform-switcher) - Terraform version manager
  283. - [TFLint](https://github.com/terraform-linters/tflint) - Terraform linter
  284. - [Trivy](https://github.com/aquasecurity/trivy) - IaC security scanner
  285. ## License
  286. Apache 2.0

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.