Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

huawei-cloud-iac-reverse

БесплатноЗапускает вложенные скриптыНе проверен

Reverse-engineer existing Huawei Cloud resources into deployable Terraform IaC code. Queries all resources via RMS (Config/配置审计) API, analyzes specs and…

huaweicloudskillот huaweicloudskill360 установок в других каталогах

Об этом скилле

Huawei Cloud IaC Reverse Engineering Skill

Overview

Given a Huawei Cloud account with existing resources, this skill:

  1. Discovers all resources via RMS (Resource Management Service / 配置审计) API
  2. Analyzes resources in batches by service layer (network → storage → compute → database → auxiliary)
  3. Synthesizes Terraform HCL configurations from the analyzed topology
  4. Validates with terraform fmt → validate → plan
  5. Compares the generated code against the original inventory to identify gaps

Prerequisites

  • hcloud CLI (KooCLI) installed and configured with AK/SK
  • Terraform >= 1.90.0 installed (see references/cli-installation-guide.md)
  • Huawei Cloud provider for Terraform (auto-downloaded via Huawei Cloud mirror)
  • Environment variables: HUAWEI_ACCESS_KEY, HUAWEI_SECRET_KEY (unset HUAWEI_SECURITY_TOKEN if switching accounts)

Workflow

Phase 0: Credential Setup

# Set credentials (never write AK/SK into .tf files)
export HUAWEI_ACCESS_KEY="your-ak"
export HUAWEI_SECRET_KEY="your-sk"
# CRITICAL: unset stale security token when switching accounts
unset HUAWEI_SECURITY_TOKEN

Phase 1: Resource Discovery (RMS)

Use RMS ListAllResources to get ALL resources across ALL services in one call:

# List all resources in a region
hcloud Config ListAllResources --cli-region={region} --limit=200

Known limitations:

  • Subnets are NOT returned by RMS — query VPC API separately
  • CCE Turbo cluster nodes may not be returned by CCE API — extract from RMS data
  • Some resource properties (e.g., EVS volume_type) may be missing — supplement with service-specific APIs

Phase 2: Batch Analysis (9 phases by dependency layer)

Analyze resources in dependency order:

Phase Layer Resources Key Data to Extract
1 Network VPC, subnets, SGs, EIPs CIDR, AZ, rules, bandwidth
2 Storage OBS, EVS, SFS Turbo bucket names, share_type, size
3 Compute ECS instances flavor, image_id, AZ, disk, EIP, SG
4 CCE Clusters, nodes cluster version, network type, node flavor
5 Database GaussDB engine, version, flavor, HA mode, volume
6-7 Cache/MQ DCS, DMS spec_code, broker_num, storage
8 Auxiliary KMS, keypairs, HSS, LTS key alias, topic names
9 Topology Cross-references VPC→subnet→ECS, SG→rules, CCE→nodes

Phase 3: Terraform Code Generation

Generate .tf files in dependency order:

project/
├── providers.tf      # provider config (version, region, no AK/SK)
├── variables.tf      # variables (image IDs, keypair name, passwords)
├── terraform.tfvars  # region assignment
├── .tfrc             # Huawei Cloud provider mirror
├── main.tf           # Layer 0-1: VPC, subnets, SG, EIP
├── storage.tf        # Layer 2: OBS, SFS Turbo
├── compute.tf        # Layer 3a: ECS
├── cce.tf            # Layer 3b-4: CCE cluster + node pool
├── database.tf       # Layer 3c: GaussDB, DCS, DMS
├── security.tf       # Layer 0 aux: KMS
├── lts.tf            # LTS log groups
└── README.md         # documentation

Key rules:

  • Never write AK/SK into .tf files — use env vars or provider profile
  • Reference existing resources (keypairs, KMS keys) via variables, don't recreate
  • Resources auto-created by parent services (CCE nodes, GaussDB nodes, DCS nodes) are NOT in Terraform
  • Use charging_mode = "prePaid" / "postPaid" (string, not numeric)
  • CCE node pool volumes use volumetype (not volume_type)
  • GaussDB datastore.version uses MySQL-compatible version (e.g., "8.0"), not internal version

Phase 4: Validation

terraform fmt -recursive
terraform validate
terraform plan

Fix provider schema mismatches iteratively. Common issues:

  • billing_mode (deprecated) → charging_mode
  • volume_type → volumetype (CCE node pool)
  • spec_code → flavor (DCS)
  • subnet_id → network_id (DMS)
  • available_zones (deprecated) → availability_zones
  • scale_enable → scall_enable (CCE node pool, provider typo)
  • eni_subnet_ids → eni_subnet_id (CCE cluster)

Phase 5: Gap Analysis

Compare generated resources against original inventory:

Category Check
Fully covered Each original resource has a TF equivalent
Correctly excluded Auto-created sub-resources (CCE nodes, DB nodes) not in TF
Gaps Missing resources, incomplete properties, provider limitations

Common gaps to check:

  • GaussDB: provider may not support security_group_id, port, dataVolumeSizeInGBs
  • SFS Turbo: share_type mapping (e.g., HPC_STANDARD_20M → HPC + hpc_bandwidth)
  • CCE: initial node count vs node pool count
  • OBS: custom ACLs / cross-account grants
  • LTS: log topics
  • KMS: encryption keys

Core Commands

Command Purpose
hcloud Config ListAllResources --cli-region={region} --limit=200 Discover all resources via RMS
`hcloud GaussDB ShowGaussMySqlEn
Полный SKILL.md на ClawHub

Установить huawei-cloud-iac-reverse в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл huawei-cloud-iac-reverse?

Reverse-engineer existing Huawei Cloud resources into deployable Terraform IaC code. Queries all resources via RMS (Config/配置审计) API, analyzes specs and topology service-by-service, then synthesizes Terraform HCL configurations with provider validation. Use when the user wants to generate IaC from existing cloud resources, migrate infrastructure to code, or reverse-engineer cloud topology. Triggers include: "逆向生成IaC", "反向生成Terraform", "从现有资源生成代码", "reverse engineer IaC", "generate Terraform from existing resources", "infrastructure to code", "cloud to IaC".

Как установить скилл huawei-cloud-iac-reverse?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл huawei-cloud-iac-reverse запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить huawei-cloud-iac-reverse с