본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)40k · #7249

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/import-infrastructure-as-code/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“구독 '12345678-abcd-1234-abcd-1234567890ab'의 리소스 그룹 'my-app'을 AVM 모듈을 사용해 Terraform 코드로 바꿔 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 Azure CLI(Azure 명령줄 인터페이스)를 사용해 기존 리소스를 살펴봅니다. 그런 다음 이 리소스와 맞는 표준 모듈(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 --ids arguments (for example az 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.json with all discovered resources and their metadata, including dependencies and references.
  • EXPORTED-ARCHITECTURE.MD file 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가 설치되어 있어야 합니다.

Azure 리소스에 해당하는 AVM 모듈이 없으면 어떻게 되나요?

도구는 상황을 기록하려고 시도하며, 대안을 제안하거나 해당 리소스를 수동으로 설정해야 한다고 알릴 수 있습니다.

상세 정보

작성자의 원본 설명

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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬