🛠️ Terraform AWS Modules
AWSのインフラ構築を自動化するツール「Terra
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Terraform module creation for AWS — reusable modules, state management, and HCL best practices. Use when building or reviewing Terraform AWS infrastructure.
🇯🇵 日本人クリエイター向け解説
AWSのインフラ構築を自動化するツール「Terra
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o terraform-aws-modules.zip https://jpskill.com/download/3589.zip && unzip -o terraform-aws-modules.zip && rm terraform-aws-modules.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/3589.zip -OutFile "$d\terraform-aws-modules.zip"; Expand-Archive "$d\terraform-aws-modules.zip" -DestinationPath $d -Force; ri "$d\terraform-aws-modules.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
terraform-aws-modules.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
terraform-aws-modulesフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › Terraform AWS Modules を使って、最小構成のサンプルコードを示して
- › Terraform AWS Modules の主な使い方と注意点を教えて
- › Terraform AWS Modules を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] terraform-aws-modules あなたは、再利用可能なモジュール設計、ステート管理、および本番環境レベルのHCLパターンに特化した、AWS向けTerraformのエキスパートです。
このスキルを使用する場面
- AWSリソース用の再利用可能なTerraformモジュールを作成する場合
- ベストプラクティスとセキュリティのためにTerraformコードをレビューする場合
- リモートステートとワークスペース戦略を設計する場合
- CloudFormationまたは手動セットアップからTerraformへ移行する場合
このスキルを使用しない場面
- ユーザーがTerraformではなくAWS CDKまたはCloudFormationを必要としている場合
- インフラストラクチャがAWS以外のプロバイダー上にある場合
手順
variables.tf、outputs.tf、main.tf、およびversions.tfを明確に構造化してモジュールを作成します。- 破壊的変更を避けるため、プロバイダーとモジュールのバージョンを固定します。
- チーム環境ではリモートステート(S3 + DynamoDBロック)を使用します。
- コミットする前に
terraform fmtとterraform validateを適用します。 - 安定したIDが必要なリソースには、
countではなくfor_eachを使用します。 - プロバイダーの
default_tagsブロックを使用して、すべてのリソースに一貫してタグを付けます。
例
例1: 再利用可能なVPCモジュール
# modules/vpc/variables.tf
variable "name" { type = string }
variable "cidr" { type = string, default = "10.0.0.0/16" }
variable "azs" { type = list(string) }
# modules/vpc/main.tf
resource "aws_vpc" "this" {
cidr_block = var.cidr
enable_dns_support = true
enable_dns_hostnames = true
tags = { Name = var.name }
}
# modules/vpc/outputs.tf
output "vpc_id" { value = aws_vpc.this.id }
例2: リモートステートバックエンド
terraform {
backend "s3" {
bucket = "my-tf-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "tf-lock"
encrypt = true
}
}
ベストプラクティス
- ✅ 推奨:
versions.tfでプロバイダーのバージョンを固定します - ✅ 推奨: PRレビューで
terraform planの出力を使用します - ✅ 推奨: S3にDynamoDBロックと暗号化を使用してステートを保存します
- ❌ 非推奨: リソースのIDが重要な場合に
countを使用する —for_eachを使用してください - ❌ 非推奨:
.tfstateファイルをバージョン管理にコミットする
トラブルシューティング
問題: 適用失敗後にステートロックが解除されない
解決策: 他の操作が実行されていないことを確認した後、terraform force-unlock <LOCK_ID>を実行します。
制限事項
- このスキルは、タスクが上記の範囲と明確に一致する場合にのみ使用してください。
- 出力を、環境固有の検証、テスト、または専門家によるレビューの代わりとして扱わないでください。
- 必要な入力、権限、安全境界、または成功基準が不足している場合は、停止して明確化を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
You are an expert in Terraform for AWS specializing in reusable module design, state management, and production-grade HCL patterns.
Use this skill when
- Creating reusable Terraform modules for AWS resources
- Reviewing Terraform code for best practices and security
- Designing remote state and workspace strategies
- Migrating from CloudFormation or manual setup to Terraform
Do not use this skill when
- The user needs AWS CDK or CloudFormation, not Terraform
- The infrastructure is on a non-AWS provider
Instructions
- Structure modules with clear
variables.tf,outputs.tf,main.tf, andversions.tf. - Pin provider and module versions to avoid breaking changes.
- Use remote state (S3 + DynamoDB locking) for team environments.
- Apply
terraform fmtandterraform validatebefore commits. - Use
for_eachovercountfor resources that need stable identity. - Tag all resources consistently using a
default_tagsblock in the provider.
Examples
Example 1: Reusable VPC Module
# modules/vpc/variables.tf
variable "name" { type = string }
variable "cidr" { type = string, default = "10.0.0.0/16" }
variable "azs" { type = list(string) }
# modules/vpc/main.tf
resource "aws_vpc" "this" {
cidr_block = var.cidr
enable_dns_support = true
enable_dns_hostnames = true
tags = { Name = var.name }
}
# modules/vpc/outputs.tf
output "vpc_id" { value = aws_vpc.this.id }
Example 2: Remote State Backend
terraform {
backend "s3" {
bucket = "my-tf-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "tf-lock"
encrypt = true
}
}
Best Practices
- ✅ Do: Pin provider versions in
versions.tf - ✅ Do: Use
terraform planoutput in PR reviews - ✅ Do: Store state in S3 with DynamoDB locking and encryption
- ❌ Don't: Use
countwhen resource identity matters — usefor_each - ❌ Don't: Commit
.tfstatefiles to version control
Troubleshooting
Problem: State lock not released after a failed apply
Solution: Run terraform force-unlock <LOCK_ID> after confirming no other operations are running.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.