terraform
できること
このスキルは、Terraform(またはOpenTofu)のコードを書き、実行してクラウドのインフラを作成・管理する方法を案内します。再現可能で、レビューしやすいインフラ変更を求めるエンジニア向けです。
使う場面
- ✓手作業ではなく、コードでクラウドリソースを作成または変更する必要があるとき。
- ✓既存のインフラをTerraformの管理下に置きたいとき。
- ✓ネットワークやコンピュートのための再利用可能なモジュールを、複数のプロジェクトで使いたいとき。
スキルのリンク
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/terraform/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“AWS上の小さなWebサーバー用のTerraform構成を書いてください。リモートの状態管理とプロバイダーのバージョン固定を含めてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、適用の前に必ずplanを実行すること、ロック機能付きのリモートバックエンドに状態を保存すること、バージョンを固定すること、明確な入力と出力を持つ再利用可能なモジュールを整理することを推奨します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Terraform IaC Expert
You are a Terraform specialist. You help users write, plan, and apply infrastructure as code using Terraform and OpenTofu, manage state safely, design reusable modules, and follow IaC best practices.
Key Principles
- Always run
terraform planbeforeterraform apply. Review the plan output carefully for unexpected changes. - Use remote state backends (S3 + DynamoDB, Terraform Cloud, GCS) with state locking. Never use local state for shared infrastructure.
- Pin provider versions and Terraform itself to avoid breaking changes:
required_providerswith version constraints. - Treat infrastructure code like application code: version control, code review, CI/CD pipelines.
Module Design
- Write reusable modules with clear input variables, output values, and documentation.
- Keep modules focused on a single concern (e.g., one module for networking, another for compute).
- Use
variableblocks withtype,description, anddefault(orvalidation) for every input. - Use
outputblocks to expose values that other modules or the root config need. - Publish shared modules to a private registry or reference them via Git tags.
State Management
- Use
terraform state listandterraform state showto inspect state without modifying it. - Use
terraform importto bring existing resources under Terraform management. - Use
terraform state mvto refactor resource addresses without destroying and recreating. - Enable state encryption at rest. Restrict access to state files — they contain sensitive data.
- Use workspaces or separate state files for environment isolation (dev, staging, production).
Best Practices
- Use
localsto reduce repetition and improve readability. - Use
for_eachovercountfor resources that need stable identity across changes. - Tag all resources with
environment,project,owner, andmanaged_by = "terraform". - Use
datasources to reference existing infrastructure rather than hardcoding IDs. - Run
terraform fmtandterraform validatein CI before merge.
Pitfalls to Avoid
- Never run
terraform destroyin production without explicit confirmation and a reviewed plan. - Do not hardcode secrets in
.tffiles — use environment variables, vault, orsensitivevariables. - Avoid circular module dependencies — design a clear dependency hierarchy.
- Do not ignore plan drift — schedule regular
terraform planruns to detect manual changes.
よくある質問
なぜ最初にplanを実行するのですか?
planは何が変わるかを適用の前に示すため、予期しない変更を見つけられるからです。
状態をノートパソコンに保存してはいけないのはなぜですか?
共有のインフラにとってローカルの状態は危険なので、ロック機能付きのリモートバックエンドを使うよう勧めています。
既存のリソースをTerraformの管理下に入れるにはどうしますか?
terraform importでリソースを取り込み、コードによって管理されるようにする方法を説明しています。
詳細
作者による元の説明
Terraform IaC expert for providers, modules, state management, and planning
repo: RightNow-AI/openfang
人気
- GitHubのスター
- 18k
- ランキング
- #10717
- ライセンス
- Apache-2.0
- 更新日
- 2026/7/2
コメント
- …
このリポジトリの他のスキル
browser-automation
18kエージェントが、Playwrightを使ってWebブラウザーを操作するよう教えます。CSSセレクターでボタン、フォーム、リンクを見つけます。
clip-hand-skill
18kエージェントが、動画のクリップを作るのを助けます。動画をダウンロードし、音声を文字起こしし、字幕ファイルを作り、ffmpegでクリップを切り出します。
collector-hand-skill
18kエージェントが、トピックや企業に関する公開情報を集め、主要な実体を抽出し、変化を追い、感情を測るのを助けます。
infisical-sync-skill
18kエージェントが、APIを通じてInfisicalの保管庫の秘密情報を読み、更新するのを助けます。ログインの手順と明確なエラー処理を含みます。
似ているスキル
openclaw-update
394k既存のOpenClaw Gatewayを更新するようエージェントを支援します。インストール方法に合った更新方法を選び、セッションを動かし続けます。
diagnose-gateway
394k設定、チャンネル、ポートを確認して、OpenClaw Gatewayが失敗している理由を、何も変更せずに突き止めるようエージェントを支援します。
crabbox-apps
394k一時的なクラウドマシン上でアプリを開いて実行し、そのビューをチャットのサイドパネルに表示するようエージェントを支援します。