Huawei Cloud Resource Management Service (RMS) provides a centralized view of all resources, but the
naming convention for resources in the ListAllResources API often differs from the
naming required by the HuaweiCloud Terraform Provider.
To see what's currently created in your cloud, you can use the ListAllResources API.
This tool helps map those findings to Terraform resources like compute_instance.
Step 1 — Extracting RMS resource types
We use the ListProviders endpoint to get the full catalog of what RMS knows about. This
provides a clean list of provider-type pairs.
GET /v1/resource-manager/domains/{domain_id}/providers
{
"provider": "ecs",
"resource_types": [{ "name": "cloudservers" }]
}
Step 2 — Scrape Terraform resource names
We correlate these with the source of truth on GitHub: terraform-provider-huaweicloud.
# Listing all resource documentation
curl https://api.github.com/repos/huaweicloud/terraform-provider-huaweicloud/contents/docs/resources \
| jq -r '.[].name' | sed 's/\.md$//' | sort > tf_resources.txt
Step 3 — Build the mapping (Heuristic + LLM)
The naming pattern is mostly consistent (e.g., ecs.cloudservers →
huaweicloud_compute_instance), but not perfectly mechanical. We apply heuristics and
LLM assistance to build the mapping used by this tool.
# Terraform Example Code
terraform {
required_version = ">= 1.5.0"
required_providers {
huaweicloud = {
source = "huaweicloud/huaweicloud"
version = "~> 1.77.3"
}
}
}
provider "huaweicloud" {
region = "me-east-1" # Specify the region for the Huawei Cloud provider
access_key = var.access_key
secret_key = var.secret_key
auth_url = "https://iam.me-east-1.myhuaweicloud.com/v3"
cloud = "myhuaweicloud.com"
# regional = "true" # Enable regional services
# charging_mode = "postPaid"
}
# Terraform Import block
import {
to = huaweicloud_vpc.vpc_default
id = "9118766a-9v85-49e5-b513-ab3c159836ec"
}
import {
# add more imports here like this
...
}