Install
openclaw skills install @huaweiclouddev/huawei-cloud-terraform-generatorGenerate Huawei Cloud Terraform configurations and execute deployment with user-guided approval. Use this skill when users want to create Huawei Cloud infrastructure as Terraform, whether they ask explicitly for Terraform or describe goals such as deploying a website, launching an application, or creating network, compute, database, load balancing, or storage resources. Trigger when users mention 创建/create、生成/generate、部署/deploy、配置/configure、使用/use、管理/manage、华为云/Huawei Cloud、Terraform、ECS、VPC、资源/resource、云服务器/ECS、虚拟机/VM、实例/instance、网络/network、负载均衡/ELB、数据库/database、RDS、存储/storage、OBS、桶/bucket、域名/domain、DNS、证书/certificate、SSL、监控/monitoring、日志/log、备份/backup、容器/container、CCE、函数工作流/FunctionGraph
openclaw skills install @huaweiclouddev/huawei-cloud-terraform-generatorThis skill turns user infrastructure goals into Terraform configurations for Huawei Cloud. The primary workflow is to:
terraform plan succeedsterraform apply if approvedThis skill provides an interactive workflow where the agent guides the user through credential configuration, validates the plan, and executes apply upon explicit user confirmation.
Before using this skill, ensure the following are available:
Before generating Terraform, propose a concrete resource plan for the user to confirm. The plan should include:
See reference/guardrails.md for rules about not fabricating specifications and prices.
Do not ask the user to provide every parameter manually. Instead:
Users should mainly confirm a proposed solution, not build the full parameter set themselves.
This skill works in nine phases:
AK/SK credentials are read from environment variables HW_ACCESS_KEY and HW_SECRET_KEY
Before any step that depends on credentials (resource queries, terraform plan, etc.), read the complete rules in reference/guardrails.md.
If an API or Terraform call fails with an authentication error: tell the user the specific error, ask them to confirm when the issue is resolved, then retry. Do not guide the user on how to configure credentials.
The user may describe a resource directly, such as creating an ECS instance, or describe a business goal, such as deploying a website or launching an application.
You must first infer the intended Huawei Cloud architecture from the user's objective, not just from explicit resource names.
Based on the user's goal, identify:
For example:
Before generating Terraform, propose a concrete resource plan for the user to confirm following the rules in the Parameter Confirmation section.
See reference/guardrails.md for rules about handling sensitive information.
Required workflow:
Terraform generation:
# User confirmed: 80, 443, 22
resource "huaweicloud_networking_secgroup_rule" "http" {
security_group_id = huaweicloud_networking_secgroup.main.id
direction = "ingress"
ethertype = "IPv4"
port_range_min = 80
port_range_max = 80
protocol = "tcp"
remote_ip_prefix = "0.0.0.0/0"
}
# ... similar for 443, 22 (always include ethertype = "IPv4")
# Always include egress
resource "huaweicloud_networking_secgroup_rule" "egress" {
security_group_id = huaweicloud_networking_secgroup.main.id
direction = "egress"
ethertype = "IPv4"
remote_ip_prefix = "0.0.0.0/0"
}
Forbidden:
This step is mandatory and must never be skipped. A failed query is not a license to proceed — it is a blocker that must be resolved.
Before writing a single line of Terraform, you MUST verify every resource specification in the confirmed plan against the target region. The target region is already known from the confirmed plan in step 4.3 — lacking the region means step 4.3 was incomplete and must be revisited. There is no excuse for not knowing which region you are deploying to.
../huawei-cloud-computing-query/SKILL.md before invoking the skill. This tells you the exact invocation format, required parameters, parameter format, and how to pass the target region. You cannot correctly invoke a skill you haven't read.huawei-cloud-computing-query skill with the exact parameters it requires, passing the target region from the confirmed plan in step 4.3. Confirm that each resource specification in the confirmed plan actually exists and is available in the target region. Any specification that cannot be confirmed MUST NOT appear in any .tf file.Forbidden:
huawei-cloud-computing-query skill without first reading its SKILL.mdIf the query fails (environment error, network issue, SDK crash):
huawei-cloud-computing-query skill's environment check, verify credentials, check network.Why this matters: Writing an unavailable flavor into main.tf produces a configuration that passes terraform validate but fails at terraform apply — the worst kind of error because it surfaces only after minutes of waiting.
When modifying existing Terraform (user asks to change a flavor, switch regions, use a different instance type, etc.): re-run the availability query for the new specification in the new region BEFORE editing any .tf file. Do not assume the previously-queried results still apply.
CRITICAL: Before generating, MUST read relevant reference documents from Section 8.1 mapping table.
Once the user confirms the resource plan, generate the Terraform files following the required structure and style rules.
See reference/terraform-generation-guide.md for detailed file structure and content rules.
Critical: Generate all required files (providers.tf, variables.tf, main.tf, terraform.tfvars, README.md) and verify they exist before proceeding.
Before proceeding to validation, verify that Huawei Cloud credentials are configured via environment variables.
See reference/guardrails.md for rules about AK/SK handling.
Before running terraform init, configure the Huawei Cloud mirror to avoid slow downloads from the official Terraform registry. Do NOT attempt to download from official registry first. Always use Huawei Cloud mirror.
Steps:
.tfrc file in the project directory:
provider_installation {
network_mirror {
url = "https://mirrors.huaweicloud.com/terraform/"
include = ["registry.terraform.io/huaweicloud/*"]
}
}
TF_CLI_CONFIG_FILE environment variable to the .tfrc file pathterraform init command MUST include TF_CLI_CONFIG_FILE in the same command line. Bare terraform init without the env var is FORBIDDEN. Example:
export TF_CLI_CONFIG_FILE="/path/to/project/.tfrc" && terraform init -upgrade
Run validation in order: terraform fmt -recursive → terraform init → terraform validate → terraform plan
If any step fails, inspect the error, fix the configuration, and retry until terraform plan succeeds.
See reference/validation-workflow.md for detailed validation steps.
This step is MANDATORY and MUST be executed immediately after terraform plan succeeds, BEFORE any confirmation dialog or terraform apply. Skipping this step is a CRITICAL violation.
Cost display format (fill with actual resources from the plan):
💰 费用预估
即将创建的资源:
- [资源类型] ([规格]): [预估费用]
- [资源类型] ([规格]): [预估费用]
- ...
预估合计: [总费用]
📌 华为云价格计算器: https://www.huaweicloud.com/pricing.html#/calculator
Required elements (ALL must be present):
If you cannot estimate a cost: still list the resource with "费用请参考价格计算器" — do NOT omit the resource from the list.
Verification: Before proceeding to step 4.9, confirm that you have output ALL required elements above. If any element is missing, stop and add it.
After cost estimation is displayed, popup a confirmation dialog for user confirmation before executing apply.
See reference/guardrails.md for rules about user confirmation workflow.
If terraform apply fails, inspect the error, fix the configuration, re-run terraform plan, and re-execute terraform apply. Repeat until successful.
After terraform apply succeeds, verify that deployed resources match the confirmed plan. If discrepancies found, report and fix them.
See reference/guardrails.md for detailed guardrail rules.
Key principles:
After the user confirms the resource plan, generate Terraform that is minimal, valid, and aligned with the confirmed solution.
See reference/terraform-generation-guide.md for detailed guidance on file structure, content rules, data source usage, and variable design.
Core principles:
See reference/validation-workflow.md for detailed guidance on ensuring Terraform availability, provider download (from Huawei Cloud mirror), validation order, authentication, and repair loop.
Use the reference materials, templates, examples, and helper utilities in the skill package when relevant.
MUST consult these references before generating:
| Resource | Reference Document | Key Pattern |
|---|---|---|
| 通用规则 | reference/guardrails.md + reference/terraform-generation-guide.md | 密码自动生成、不向用户要敏感信息 |
| Security Group | reference/VPC-best-practices/VPC-best-practices.md → "Deploy Security Group" | ethertype is required |
| ECS with EIP | reference/ECS-best-practices/Deploy-Instance-with-EIP-best-practices.md | Use huaweicloud_compute_eip_associate, public_ip = .address |
| VPC/Subnet | reference/VPC-best-practices/VPC-best-practices.md → "Deploy Basic Network" | VPC/subnet structure |
| RDS | reference/RDS-best-practices/RDS-best-practices.md | Database + network config |
If the package contains an example close to the target scenario, use it as a starting point. Preserve useful structure, adapt to the confirmed plan, and remove unneeded resources.
Map business goals to service references (e.g., "deploy a website" → VPC + ECS + EIP, "managed database" → RDS + network).
Keep the final Terraform aligned with the user-confirmed plan and follow Minimum Viable Configuration principle.
Always verify that the template matches the confirmed plan and validate through the normal validation workflow.
Before finalizing, ensure:
terraform plan, or the blocker was clearly explainedterraform apply was executed only after explicit user confirmation (or user declined)