import-infrastructure-as-code
できること
このツールは、既存のAzureインフラストラクチャをTerraformのコードに変換します。クラウドリソースを検出し、標準モジュール(AVM)を使って同じ構成を再現するため、管理や複製が簡単になります。
使う場面
- ✓既存のAzureインフラストラクチャを再現したいとき。
- ✓Azureのリソースをバージョン管理や再利用ができるコードにしたいとき。
- ✓インフラの構成を移行またはバックアップしたいとき。
スキルのリンク
https://github.com/github/awesome-copilot/blob/main/skills/import-infrastructure-as-code/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“サブスクリプション「12345678-abcd-1234-abcd-1234567890ab」のリソースグループ「my-app」を、AVMモジュールを使ってTerraformコードに変換してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このツールは、Azure CLI(コマンドラインインターフェース)を使って既存のリソースを読み取ります。次に、それらのリソースに対応する標準モジュール(Azure Verified Modules、AVM)を探し、Terraformのコードを生成します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Import Infrastructure as Code (Azure -> Terraform with AVM)
Convert existing Azure infrastructure into maintainable Terraform code using discovery data and Azure Verified Modules.
When to Use This Skill
Use this skill when the user asks to:
- Import existing Azure resources into Terraform
- Generate IaC from live Azure environments
- Handle any Azure resource type supported by AVM (and document justified non-AVM fallbacks)
- Recreate infrastructure from a subscription or resource group
- Map dependencies between discovered Azure resources
- Use AVM modules instead of handwritten
azurerm_*resources
Prerequisites
- Azure CLI installed and authenticated (
az login) - Access to the target subscription or resource group
- Terraform CLI installed
- Network access to Terraform Registry and AVM index sources
Inputs
| Parameter | Required | Default | Description |
|---|---|---|---|
subscription-id |
No | Active CLI context | Azure subscription used for subscription-scope discovery and context setting |
resource-group-name |
No | None | Azure resource group used for resource-group-scope discovery |
resource-id |
No | None | One or more Azure ARM resource IDs used for specific-resource-scope discovery |
At least one of subscription-id, resource-group-name, or resource-id is required.
Step-by-Step Workflows
1) Collect Required Scope (Mandatory)
Request one of these scopes before running discovery commands:
- Subscription scope:
<subscription-id> - Resource group scope:
<resource-group-name> - Specific resources scope: one or more
<resource-id>values
Scope handling rules:
- Treat Azure ARM resource IDs (for example
/subscriptions/.../providers/...) as cloud resource identifiers, not local file system paths. - Use resource IDs only with Azure CLI
--idsarguments (for exampleaz resource show --ids <resource-id>). - Never pass resource IDs to file-reading commands (
cat,ls,read_file, glob searches) unless the user explicitly says they are local file paths. - If the user already provided one valid scope, do not ask for additional scope inputs unless required by a failing command.
- Do not ask follow-up questions that can be answered from already-provided scope values.
If scope is missing, ask for it explicitly and stop.
2) Authenticate and Set Context
Run only the commands required for the selected scope.
For subscription scope:
az login
az account set --subscription <subscription-id>
az account show --query "{subscriptionId:id, name:name, tenantId:tenantId}" -o json
Expected output: JSON object with subscriptionId, name, and tenantId.
For resource group or specific resource scope, az login is still required but az account set is optional if the active context is already correct.
When using specific resource scope, prefer direct --ids-based commands first and avoid extra discovery prompts for subscription or resource group unless needed for a concrete command.
3) Run Discovery Commands
Discover resources using the selected scopes. Ensure to fetch all necessary information for accurate Terraform generation.
# Subscription scope
az resource list --subscription <subscription-id> -o json
# Resource group scope
az resource list --resource-group <resource-group-name> -o json
# Specific resource scope
az resource show --ids <resource-id-1> <resource-id-2> ... -o json
Expected output: JSON object or array containing Azure resource metadata (id, type, name, location, tags, properties).
4) Resolve Dependencies Before Code Generation
Parse exported JSON and map:
- Parent-child relationships (for example: NIC -> Subnet -> VNet)
- Cross-resource references in
properties - Ordering for Terraform creation
IMPORTANT: Generate the following documentation and save it to a docs folder in the root of the project.
exported-resources.jsonwith all discovered resources and their metadata, including dependencies and references.EXPORTED-ARCHITECTURE.MDfile with a human-readable architecture overview based on the discovered resources and their relationships.
5) Select Azure Verified Modules (Required)
Use the latest AVM version for each resource type.
Terraform Registry
- Search for "avm" + resource name
- Filter by "Partner" tag to find official AVM modules
- Example: Search "avm storage account" → filter by Partner
Official AVM Index
…
よくある質問
「AVMモジュール」とは何ですか?
Terraformを使ってAzureインフラを構築するための、標準化されたモジュールです。Microsoftがテストしており、一貫性とセキュリティが確保されています。
Terraformをインストールしておく必要がありますか?
はい。コードを生成して利用するために、パソコンにTerraform CLIがインストールされている必要があります。
対応するAVMモジュールがないAzureリソースはどうなりますか?
ツールは状況を記録するよう試みます。代替案を提案することもあれば、手動で設定する必要があると示すこともあります。
詳細
作者による元の説明
Import existing Azure resources into Terraform using Azure CLI discovery and Azure Verified Modules (AVM). Use when asked to reverse-engineer live Azure infrastructure, generate Infrastructure as Code from existing subscriptions/resource groups/resource IDs, map dependencies, derive exact import addresses from downloaded module source, prevent configuration drift, and produce AVM-based Terraform f
repo: github/awesome-copilot
人気
- GitHubのスター
- 40k
- ランキング
- #7249
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
acquire-codebase-knowledge
40kエージェントが、既存のコードプロジェクトを理解してドキュメント化できるよう支援します。新しく参加するメンバーのオンボーディングや、アーキテクチャの全体像の把握に役立ちます。
acreadiness-assess
40kエージェントが、プロジェクトのAI対応状況を評価してレポートを生成できるよう支援します。プロジェクトがAIツールをどの程度活用できる状態にあるかを把握するのに役立ちます。
acreadiness-generate-instructions
40kエージェントが、評価結果をもとにAIツール向けの指示文を作成できるよう支援します。AIがコードとどのようにやり取りするかを改善し、特定された不足点を解消するのに役立ちます。
acreadiness-policy
40kエージェントが、AIプロジェクトの評価ポリシーの策定や適用を支援できるようにします。プロジェクトの評価方法を標準化し、コンプライアンスを確保するのに役立ちます。
似ているスキル
openclaw-update
394k既存のOpenClaw Gatewayを更新するようエージェントを支援します。インストール方法に合った更新方法を選び、セッションを動かし続けます。
diagnose-gateway
394k設定、チャンネル、ポートを確認して、OpenClaw Gatewayが失敗している理由を、何も変更せずに突き止めるようエージェントを支援します。
crabbox-apps
394k一時的なクラウドマシン上でアプリを開いて実行し、そのビューをチャットのサイドパネルに表示するようエージェントを支援します。