Saltar al contenido
Skillpedia
Deploy y nube (DevOps)40 mil · #7249

import-infrastructure-as-code

Qué hace

Esta herramienta convierte tu infraestructura existente de Azure en código Terraform. Descubre tus recursos en la nube y los vuelve a crear usando módulos estándar (AVM), lo que facilita su gestión y replicación.

Cuándo usarla

  • ✓Cuando quieres recrear una infraestructura de Azure que ya existe.
  • ✓Para convertir recursos de Azure en código que puedas versionar y reutilizar.
  • ✓Cuando migras o guardas copias de seguridad de configuraciones de infraestructura.

Link de la skill

https://github.com/github/awesome-copilot/blob/main/skills/import-infrastructure-as-code/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/github/awesome-copilot/blob/main/skills/import-infrastructure-as-code/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Convierte mi grupo de recursos 'my-app' de la suscripción '12345678-abcd-1234-abcd-1234567890ab' en código Terraform usando módulos AVM.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La herramienta usa la interfaz de línea de comandos de Azure (Azure CLI) para revisar tus recursos existentes. Después busca módulos estándar (Azure Verified Modules, AVM) que coincidan con esos recursos y genera el código Terraform.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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

…

Preguntas frecuentes

¿Qué son los 'módulos AVM'?

Son bloques de construcción estandarizados y probados por Microsoft para crear infraestructura de Azure con Terraform, lo que garantiza coherencia y seguridad.

¿Necesito tener Terraform instalado?

Sí, necesitas tener instalada en tu ordenador la CLI de Terraform para que la herramienta pueda generar y usar el código.

¿Qué pasa si un recurso de Azure no tiene un módulo AVM equivalente?

La herramienta intentará documentar la situación y puede sugerir alternativas o indicar que ese recurso tendrá que configurarse a mano.

Detalles

Descripción original del autor

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

Popularidad

Estrellas en GitHub
40 mil
Posición en el ranking
#7249
Licencia
MIT
Actualizada
15/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas