/ ディレクトリ / プレイグラウンド / terraform-skill
● コミュニティ antonbabenko ⚡ 即起動

terraform-skill

作者 antonbabenko · antonbabenko/terraform-skill

Maintained by Anton Babenko — Terraform and OpenTofu patterns from terraform-best-practices.com and terraform-aws-modules, with when-and-why decision frameworks.

A Claude agent skill for Terraform/OpenTofu work. Teaches Claude to choose between native Terraform tests (1.6+) and Terratest, structure modules like terraform-aws-modules, wire up GitHub Actions / GitLab CI with cost estimation and security scanning, and apply production patterns. Explains not just 'what' but 'when and why'.

なぜ使うのか

主な機能

ライブデモ

実際の動作

terraform-skill.replay ▶ 準備完了
0/0

インストール

クライアントを選択

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "terraform-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/antonbabenko/terraform-skill",
        "~/.claude/skills/terraform-skill"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop → Settings → Developer → Edit Config を開く。保存後、アプリを再起動。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "terraform-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/antonbabenko/terraform-skill",
        "~/.claude/skills/terraform-skill"
      ],
      "_inferred": true
    }
  }
}

Cursor は Claude Desktop と同じ mcpServers スキーマを使用。プロジェクト設定はグローバルより優先。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "terraform-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/antonbabenko/terraform-skill",
        "~/.claude/skills/terraform-skill"
      ],
      "_inferred": true
    }
  }
}

Cline サイドバーの MCP Servers アイコンをクリックし、"Edit Configuration" を選択。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "terraform-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/antonbabenko/terraform-skill",
        "~/.claude/skills/terraform-skill"
      ],
      "_inferred": true
    }
  }
}

Claude Desktop と同じ形式。Windsurf を再起動して反映。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "terraform-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/antonbabenko/terraform-skill",
        "~/.claude/skills/terraform-skill"
      ]
    }
  ]
}

Continue はマップではなくサーバーオブジェクトの配列を使用。

~/.config/zed/settings.json
{
  "context_servers": {
    "terraform-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/antonbabenko/terraform-skill",
          "~/.claude/skills/terraform-skill"
        ]
      }
    }
  }
}

context_servers に追加。保存時に Zed がホットリロード。

claude mcp add terraform-skill -- git clone https://github.com/antonbabenko/terraform-skill ~/.claude/skills/terraform-skill

ワンライナー。claude mcp list で確認、claude mcp remove で削除。

ユースケース

実用的な使い方: terraform-skill

Scaffold a new Terraform module the idiomatic way

👤 Platform engineers publishing a reusable module ⏱ ~45 min intermediate

使うタイミング: You're splitting out a module for internal or public reuse and want the structure right the first time.

フロー
  1. State the module's purpose
    Use the terraform-skill. Scaffold a module for an AWS ECS service with optional ALB and CloudWatch alarms.✓ コピーしました
    → Structure follows terraform-aws-modules conventions — main.tf, variables.tf, outputs.tf, versions.tf, README.md, examples/
  2. Add tests
    Recommend tests — native or Terratest? Apply the decision framework.✓ コピーしました
    → Reasoned choice and scaffolded test files

結果: A module that passes review on the first PR.

注意点
  • Versioning too loose (~> vs specific) — Skill defaults to pinned minors for required_providers
組み合わせ: github

Add a hardened CI pipeline to an existing Terraform repo

👤 DevOps / platform engineers ⏱ ~40 min advanced

使うタイミング: Your repo lacks plan-on-PR, cost checks, or security scans.

前提条件
  • GitHub or GitLab hosting — For the respective pipeline template
フロー
  1. Request the pipeline
    Use terraform-skill. Add GitHub Actions for plan-on-PR, Infracost, tfsec, and gated apply on main.✓ コピーしました
    → Workflow files with concurrency guards, OIDC auth, status checks
  2. Security tune
    Which Checkov / tfsec rules should we fail on vs warn?✓ コピーしました
    → Opinionated list with rationale

結果: A pipeline that blocks risky changes without slowing everyone down.

注意点
  • Pipeline uses long-lived AWS keys — Skill prefers OIDC/role assumption, not static keys
組み合わせ: github

Design a multi-environment layout without state explosions

👤 Teams scaling from dev/prod to dev/staging/prod/per-tenant ⏱ ~60 min advanced

使うタイミング: You feel the pain of copy-pasted env folders or a monolith state.

フロー
  1. Describe the envs
    Use terraform-skill. We need dev/staging/prod plus per-tenant envs. What layout scales?✓ コピーしました
    → Recommendation with tradeoffs (workspaces vs dirs vs Terragrunt)
  2. Plan the migration
    We're currently on a single state. Sketch the migration.✓ コピーしました
    → State-move plan with risk callouts

結果: A layout you can defend in an ADR.

注意点
  • Moving state without imports/breakdowns can destroy resources — The skill insists on terraform state mv / import steps, not delete-and-recreate

組み合わせ

他のMCPと組み合わせて10倍の力を

terraform-skill + github

Skill produces module + workflow; GitHub MCP opens the PR

Scaffold the module, add the workflow, open a PR into our platform repo.✓ コピーしました
terraform-skill + aws

Cross-check the Terraform plan against live AWS state

Show me the plan, then diff against actual resources via the AWS MCP.✓ コピーしました

ツール

このMCPが提供する機能

ツール入力呼び出すタイミングコスト
Module scaffolding module purpose + provider Starting a new module 0
Test strategy advisor module scope Adding test coverage 0
CI pipeline templates (GHA / GitLab) hosting choice Setting up CI for a repo 0
Pattern compare a snippet Reviewing existing code 0

コストと制限

運用コスト

APIクォータ
None
呼び出しあたりのトークン
2-6k per session — moderate
金額
Free — skill is local
ヒント
Ask one focused question (testing / CI / layout) at a time.

セキュリティ

権限、シークレット、影響範囲

認証情報の保管: No credentials in the skill. Any provider creds belong in your env, not the generated code.
データ送信先: None from the skill itself

トラブルシューティング

よくあるエラーと対処法

Skill's suggestion conflicts with your org's style

Provide your .terraform-docs config and existing module as style anchors.

Recommended OIDC setup fails on assume-role

Check the trust policy's sub condition matches your branch/env.

代替案

terraform-skill 他との比較

代替案代わりに使う場面トレードオフ
Terragrunt-first skillsYou're committed to TerragruntLess coverage here; Terragrunt workflows differ substantially
Cloud-provider-native IaC skills (aws-cdk, pulumi)You're not on Terraform/OpenTofuDifferent tool, different patterns

その他

リソース

📖 GitHub の公式 README を読む

🐙 オープンな issue を見る

🔍 400以上のMCPサーバーとSkillsを見る