
huawei-cloud-terraform-generator
Generate 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
- Installs
- 17.1K
- Last 24h
- +104
- Trending rank
- #1934
- Security
- Warn
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-terraform-generator- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads huawei-cloud-terraform-generator automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
Huawei Cloud Terraform Generator
1. Overview
This skill turns user infrastructure goals into Terraform configurations for Huawei Cloud. The primary workflow is to:
- understand the user's actual deployment intent
- determine which resources should be created
- determine whether existing resources should be reused
- confirm key specifications and dependencies
- verify every resource specification against the target region's available resources — query first, write later
- ensure Terraform is installed
- generate Terraform configuration files
- run validation steps and fix generation issues until
terraform plansucceeds - ask user for confirmation and execute
terraform applyif approved
This skill provides an interactive workflow where the agent guides the user through credential configuration, validates the plan, and executes apply upon explicit user confirmation.
2. Prerequisites
Before using this skill, ensure the following are available:
- Terraform — installed in PATH or auto-installable (see validation-workflow.md)
- Provider download source — the Huawei Cloud mirror should be reachable (see validation-workflow.md)
- Target region — the deployment region (e.g. cn-north-4, cn-south-1) must be identified
3. Parameter Confirmation
Before generating Terraform, propose a concrete resource plan for the user to confirm. The plan should include:
- recommended resource specifications
- available candidate options when applicable
- whether to create new resources or reuse existing ones
- pricing information only when obtained from a reliable source
See reference/guardrails.md for rules about not fabricating specifications and prices.
Do not ask the user to provide every parameter manually. Instead:
- infer the likely architecture from the user's goal
- propose a concrete plan with recommended defaults
- confirm only the small number of decisions that materially affect correctness, cost, or architecture
Users should mainly confirm a proposed solution, not build the full parameter set themselves.
4. Workflow
This skill works in nine phases:
4.0 Credential handling (MUST READ)
AK/SK credentials are read from environment variables HW_ACCESS_KEY and HW_SECRET_KEY. For temporary/STS credentials, the agent must read HW_SECURITY_TOKEN (or HUAWEICLOUD_SECURITY_TOKEN) from environment variables and write it to terraform.tfvars as security_token. The provider does not reliably resolve security_token from env vars. If the env var is not set, omit it (permanent AK/SK scenario).
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.
4.1 Understand the user's real goal
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.
4.2 Determine the resource set
Based on the user's goal, identify:
- which resources need to be created
- which existing resources may be reused
- what dependencies exist between the resources
For example:
- a simple public website may require VPC, subnet, security group, ECS, and EIP
- a managed database deployment may require VPC, subnet, security group, and RDS
- a scalable public service may require VPC, subnet, security group, ECS or AS, ELB, and public access
4.3 Propose a resource plan for confirmation
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.
4.3.1 Confirm security group rules with user (CRITICAL)
Required workflow:
- Infer likely ports from user's goal (Web server → 80, 443; SSH → 22; Database → 3306, 5432)
- Ask user to confirm ports: "需要开放哪些端口?推荐:80、443、22"
- Generate rules based on confirmed ports, NOT default rules
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:
- ❌ Using only egress rule without ingress rules
- ❌ Using hardcoded default ports without asking user
- ❌ Generating rules that don't match user confirmation
4.4 Verify resource availability BEFORE generating any code
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.
- Step 1 — Read the target skill's SKILL.md first (DO NOT skip): You MUST read the file
../huawei-cloud-computing-query/SKILL.mdbefore 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. - Step 2 — Invoke the skill with confirmed parameters: Only after reading the skill definition, invoke the
huawei-cloud-computing-queryskill 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. - Cross-region assumptions are forbidden — a resource available in region A does NOT imply availability in region B. Always re-query for the target region.
Forbidden:
- ❌ Invoking the
huawei-cloud-computing-queryskill without first reading its SKILL.md - ❌ Guessing or fabricating parameters for skill invocation
- ❌ Proceeding to generate Terraform when a resource specification cannot be confirmed available
- ❌ Assuming resource availability carries over across regions
If the query fails (environment error, network issue, SDK crash):
- You MUST NOT proceed to generate Terraform. Stop immediately.
- Diagnose and fix the issue: invoke the
huawei-cloud-computing-queryskill's environment check, verify credentials, check network. - Retry the query. If it fails again, fix and retry again.
- There is no "graceful degradation" — an unverified specification is a broken deployment waiting to happen.
- The only acceptable outcomes from this step are: (a) all specs confirmed available, or (b) a spec is confirmed unavailable and the user is asked to choose a different one.
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.
4.5 Generate Terraform after confirmation
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.
4.6 Verify credentials configuration
Before proceeding to validation, verify that Huawei Cloud credentials are configured via environment variables.
See reference/guardrails.md for rules about AK/SK handling.
4.6.1 Configure Huawei Cloud mirror for provider download
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:
- Check if local provider cache exists (see validation-workflow.md for locations)
- If cache exists and version >= 1.90.0, skip download
- If download needed, create
.tfrcfile in the project directory:provider_installation { network_mirror { url = "https://mirrors.huaweicloud.com/terraform/" include = ["registry.terraform.io/huaweicloud/*"] } } - Set
TF_CLI_CONFIG_FILEenvironment variable to the.tfrcfile path - Every
terraform initcommand MUST includeTF_CLI_CONFIG_FILEin the same command line. Bareterraform initwithout the env var is FORBIDDEN. Example:export TF_CLI_CONFIG_FILE="/path/to/project/.tfrc" && terraform init -upgrade
4.7 Validate and fix the generated configuration
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.
4.8 Display cost estimation (CRITICAL — MUST NOT SKIP)
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):
- Resource list with specifications (from confirmed plan)
- Estimated monthly cost per resource (range is acceptable)
- Total estimated cost
- Link to Huawei Cloud pricing calculator (fixed URL)
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.
4.9 Execute terraform apply with user confirmation
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.
4.10 Apply error repair loop
If terraform apply fails, inspect the error, fix the configuration, re-run terraform plan, and re-execute terraform apply. Repeat until successful.
4.11 Post-apply resource verification
After terraform apply succeeds, verify that deployed resources match the confirmed plan. If discrepancies found, report and fix them.
5. Guardrails
See reference/guardrails.md for detailed guardrail rules.
Key principles:
- Do not fabricate specifications, prices, or resource facts
- Execute terraform apply with explicit user confirmation
- Do not request sensitive information
- Do not invoke any referenced skill without first reading that skill's SKILL.md file
6. Terraform Generation Rules
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:
- Start from the confirmed resource plan
- Follow the Minimum Viable Configuration principle
- Prefer Terraform validity over unnecessary flexibility
- Use existing package references when relevant
7. Environment Preparation and Validation
See reference/validation-workflow.md for detailed guidance on ensuring Terraform availability, provider download (from Huawei Cloud mirror), validation order, authentication, and repair loop.
8. Reference Usage and Template Guidance
Use the reference materials, templates, examples, and helper utilities in the skill package when relevant.
8.1 Use existing references 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 |
8.2 Use existing examples and templates as a starting point
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.
8.3 Match user goals to relevant references
Map business goals to service references (e.g., "deploy a website" → VPC + ECS + EIP, "managed database" → RDS + network).
8.4 Use references to improve, not to overbuild
Keep the final Terraform aligned with the user-confirmed plan and follow Minimum Viable Configuration principle.
8.5 Do not rely on templates blindly
Always verify that the template matches the confirmed plan and validate through the normal validation workflow.
9. Quality Checklist
Before finalizing, ensure:
- The generated Terraform matches the confirmed resource plan
- All 5 required files were generated and verified (providers.tf, variables.tf, main.tf, terraform.tfvars, README.md)
- No sensitive information was requested from user
- Validation reached
terraform plan, or the blocker was clearly explained - Cost estimation was displayed BEFORE user confirmation (step 4.8 — MUST NOT skip)
- Cost estimation includes ALL required elements: resource list, specifications, estimated cost per resource, total cost, pricing calculator link
- User was asked for confirmation via confirmation dialog before terraform apply
-
terraform applywas executed only after explicit user confirmation (or user declined)
FAQ
What does the huawei-cloud-terraform-generator skill do?
Generate 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
How do I install huawei-cloud-terraform-generator?
Run npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-terraform-generator in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/huawei-cloud-terraform-generator/ (personal) or .claude/skills/huawei-cloud-terraform-generator/ (project).
Which AI agents can use huawei-cloud-terraform-generator?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is huawei-cloud-terraform-generator safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk flagged items to review. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains huawei-cloud-terraform-generator?
It is published by huaweicloud in huaweicloud/huaweicloud-skills. It has 17,053 recorded installs.
More from huaweicloud/huaweicloud-skills
huawei-cloud-terraform-installer
huaweicloud/huaweicloud-skills
Installs Terraform CLI cross-platform with Huawei Cloud mirror support. Use this skill whenever the user mentions installing Terraform, setting up Terraform environment, or when IaC tasks detect missing Terraform. Trigger: install terraform, setup terraform, terraform environment, huaweicloud provider.
huawei-cloud-find-skills
huaweicloud/huaweicloud-skills
Invoke this skill to search, list, query, discover, browse, find and install any Huawei Cloud (华为云) agent skill. Triggers include: "华为云", "华为云有什么skill", "华为云相关skill", "华为云agent skill 市场", "华为云skill类目", "explore Huawei Cloud skills", "show Huawei Cloud skill categories", "does a Huawei Cloud skill exist for...", "which Huawei Cloud skills exist", "搜索华为云技能", "查询华为云skill列表", "有没有管理ECS/OBS/RDS的skill", "帮我找 XX 华为云skill", "介绍 XX Skill 内容", "华为云 XX Skill 具体做什么", "安装华为云Skill".
huawei-cloud-billing-scout
huaweicloud/huaweicloud-skills
Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use only when the user explicitly mentions 华为云 / Huawei Cloud / BSS and 余额/账单/对账/资源包/代金券/储值卡/企业或伙伴账务; refuses pay, renew, refund, delete.
huawei-cloud-computing-query
huaweicloud/huaweicloud-skills
Queries Huawei Cloud computing resources (ECS/BMS/IMS/AS), Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, BMS bare metal servers/flavors/quotas, IMS images/OS versions/members/quotas, and AS scaling groups/configs/policies/activity logs/lifecycle hooks/warm pools/quotas. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check BMS availability, browse images, or view auto-scaling group/policy status. Triggers: 弹性云服务器, ECS, 裸金属, BMS, 镜像, IMS, 弹性伸缩, AS, 伸缩组, 伸缩策略, 规格查询, flavor, instance, image, scaling.
huawei-cloud-obs-upload
huaweicloud/huaweicloud-skills
Upload local files or directories to Huawei Cloud OBS (Object Storage Service) buckets, list OBS buckets with capacity and object count, and schedule periodic uploads via crontab. Use this skill when the user wants to: (1) upload a local file or directory to an OBS bucket, (2) list OBS buckets and check their storage capacity and object count, (3) set up a scheduled/periodic upload task to automatically sync a local directory to an OBS bucket. Triggers include: user mentions "OBS", "object storage", "bucket list", "bucket capacity", "upload to OBS", "upload file", "upload directory", "scheduled upload", "periodic upload", "sync to bucket", "对象存储", "桶列表", "桶容量", "上传文件", "上传目录", "定时上传", "OBS管理"
huawei-cloud-network-query
huaweicloud/huaweicloud-skills
Queries Huawei Cloud network resources (VPC/EIP/ELB/NAT/VPN/DNS). Covers VPCs, subnets, security groups, firewalls, route tables, flow logs, EIPs, bandwidths, load balancers, listeners, pools, health monitors, NAT gateways, SNAT/DNAT rules, VPN gateways, VPN connections, DNS zones, record sets, PTR records, and endpoints. No write operations. Use this skill when the user needs to query network topology, security group rules, load balancer config, NAT rules, VPN status, or DNS resolution info. Triggers: VPC, 子网, 安全组, EIP, 弹性公网IP, ELB, 负载均衡, NAT网关, VPN, DNS, 域名解析, 路由表, 防火墙, 带宽, network, subnet, security group.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.