Huawei Cloud module
Creates or updates a certificate object in Huawei Cloud ELB (v3 API) or WAF (v1 API), or writes the certificate straight into a CDN (v2 API) domain's HTTPS configuration. For ELB and WAF the module manages the certificate object only and never calls the listener or protected-domain APIs — you bind the object once in the console and every renewal follows automatically. It never touches the SSL Certificate Manager (SCM) service. Uses AK/SK (access key + secret key) authentication.
Overview
- Transport: the Huawei Cloud Go SDK v3 (ELB v3, WAF v1, CDN v2 clients), AK/SK-signed. Each request has a 30 s timeout.
- Auth: Access Key + Secret Key pair (AK/SK). Generated in My Credentials. CDN additionally needs the account's
domain_idin the credential. - Scope: one sub-service and one object per target. ELB and WAF are regional (target
region+project_id); CDN is global — its calls always go tocdn.myhuaweicloud.comand ignore the target'sregionandproject_id. - Supported services:
- ELB (Elastic Load Balance) — one server certificate object, updated in place.
- WAF — one certificate object, updated in place.
- CDN — one domain's HTTPS configuration.
- Rollback: supported — a rollback re-runs the deploy with a previous retained certificate version, updating the same ELB/WAF object in place or rewriting the CDN domain's HTTPS configuration (Rollback). Nothing is bound or re-bound.
Prerequisites
- A Huawei Cloud account and an IAM user with an access key (AK/SK) — see Minimum access.
- No listener, protected-domain or host IDs are needed. Optionally, the ID of an existing ELB/WAF certificate object to adopt (
certificate_id) or of a CDN domain (domain_id); a CDN target otherwise resolves the domain bydomain_name.
Minimum access
Put the IAM user in a group that holds custom policies with only the actions of the services your targets use:
- ELB (in the region project the target names):
elb:certificates:list,elb:certificates:get,elb:certificates:create,elb:certificates:put. - WAF (in the region project the target names, covering its
enterprise_project_idwhen set):waf:certificate:list,waf:certificate:get,waf:certificate:create,waf:certificate:put. - CDN (under Global services, covering all enterprise projects):
cdn:configuration:queryDomainList,cdn:configuration:queryDomain,cdn:configuration:queryDomains,cdn:configuration:modifyOriginConfInfo,cdn:configuration:modifyHttpsConf. WithoutqueryDomainsa deploy still works but the unchanged-certificate skip is never taken.
Not needed: Tenant Administrator, the full-access system roles of ELB, WAF or CDN, and any delete action — the module never deletes, never binds a listener or protected domain, and never creates a CDN domain.
Create the module credential
- Settings → Distribution → Credentials → New → Huawei Cloud.
- Access Key + Secret Key (+
domain_idfor CDN targets). Stored envelope-encrypted. - Save.
Create a Huawei Cloud target
- Settings → Distribution → Targets → New. Module: Huawei Cloud.
- Fields:
- Region — e.g.
ap-southeast-1,cn-north-4. Must be a region the bundled SDK knows and, for ELB/WAF, the region of the object. Required at save for CDN too, but CDN calls ignore it. - Project ID — the region's project; shown in My Credentials → API Credentials. Ignored by CDN.
- Credential.
- Service scope: pick one:
- ELB — certificate object only. CertAutoPilot creates or updates the ELB certificate; it does not touch listeners. Bind the object to your listener once in the console.
- CDN — domain name (or
domain_id). The certificate is written straight into the domain's HTTPS configuration. Note this sets the domain's HTTPS status to on: distributing to a CDN domain that currently has HTTPS disabled will enable it. - WAF — certificate object only, same as ELB. Bind it to the protected domain once in the console.
enterprise_project_idis sent on every WAF call when set.
- Certificate name — optional. Empty = auto-generated per certificate as
cap-<token>-<domain>(token: 8-char hash derived from the certificate, stable across renewals; max 32 chars) — recommended so one target can serve multiple certificates, since ELB/WAF resolve certificates by exact name. Per certificate, the name (and ELB/WAFcertificate_idadoption or the CDN domain) can be overridden from the certificate's Distributions → Overrides drawer.
Pure-legacy targetsTargets whose remote state predates per-certificate keying re-resolve by exact name/domain lookup once per run; a manual duplicate name created in the console surfaces as a Conflict — set
certificate_idin the override to disambiguate. - Region — e.g.
- Save → health check: one authenticated list call per target against the target's own sub-service — ELB certificates filtered by the name
__healthcheck__, WAF certificates filtered by that name, or CDN domains filtered by that name (a CDN target withoutdomain_idin its credential is unhealthy before any call). It proves credentials, region/project and connectivity; it does not check the certificate object or domain the target names.
Name and identity precedence
The effective name and object for a run is resolved before the module runs, per target:
- The override for the specific target wins; otherwise the target's group row, then the Default (
*) row, contributes only itscertificate_name(acertificate_id,domain_idordomain_nameon a group or Default row is refused with 422 — one object id cannot be on many targets; a row saved before that rule is reduced to its name); otherwise the target spec; otherwise the auto name. See Per-distribution overrides. - ELB/WAF name + ID are a pair. An override that sets either replaces both verbatim (the missing half becomes empty), so an ID-only override adopts that object without renaming it and a name-only override clears a spec-pinned ID. Without an override, a spec-pinned ID keeps the spec name as-is (no auto name is injected, so the pinned object is not renamed).
- CDN domain name + ID are a pair the same way; the CDN certificate name is independent (override → spec → auto).
At deploy time ELB/WAF then resolve the object as: pinned certificate_id (verified) → ID remembered from the last run for this certificate (verified) → exact name lookup → create. Only a definitive 404 on a pinned or remembered ID falls through to the name lookup; any other error (5xx, throttle, timeout, auth) fails the target with its classified code so the next run retries — a transient error never creates a duplicate object.
Execution flow
The certificate sent is the full chain (leaf + intermediates) in the form Huawei Cloud documents: every certificate in 64-character PEM lines, one directly after the other, no blank lines between them. ACME chains (Let's Encrypt) arrive with a blank line between the certificates; the APIs accept that, but the console's Modify Certificate form re-validates the stored content and shows Invalid value, so the module re-encodes the chain first (the certificate bytes do not change). An object deployed by an earlier version with the blank lines is rewritten once on the next run, because its stored content no longer matches.
- Resolve the object (above). The ELB name lookup follows the API's paging (100 per page, up to 500 certificates); if it is cut off with no exact match the target fails with
HUAWEICLOUD_CONFLICT("name lookup incomplete") rather than creating a possible duplicate — pincertificate_idon accounts with that many same-named certificates. WAF reads one page of 100 and fails the same way when the result is incomplete. - Skip when already current: the stored certificate's SHA-256 equals the chain being deployed and the configured name is empty or equal → success, unchanged. A name-only change is deliberately not skipped, so renaming still takes effect.
- Otherwise create the object (no match) or update it in place (certificate, key and — when configured — name). For CDN, the certificate is written into the domain's HTTPS configuration. Nothing is bound: whatever already references the ELB/WAF object picks up the new material.
- Remote state
{certificate_id | domain_id, resolved_via}is stored per certificate on the target.
Because no listener or protected-domain API is called, a first ELB/WAF deployment creates a certificate object that nothing references yet. The run reports success and changed, but the VIP keeps serving the old certificate — and will keep doing so on every renewal until someone binds the object in the Huawei console.
Bind it once, then leave the name alone: renewals update that same object in place and the binding follows. Add a tls_fingerprint validation endpoint pointed at the VIP so a missing bind fails the deployment instead of passing silently. (CDN is not affected — it writes the domain configuration directly.)
Old material is replaced in place; the module never deletes an ELB/WAF object or touches cross-service references.
Rollback
Supported via previous-version re-deploy: a rollback runs the flow above with a previous retained certificate version — the same ELB/WAF object is updated in place (its fingerprint differs, so the skip does not apply), or the CDN domain's HTTPS configuration is rewritten. Nothing is re-bound, because nothing was bound by CertAutoPilot in the first place. Eligibility, the version picker, and auto-rollback: Rollback.
Troubleshooting
HUAWEICLOUD_AUTH — "Forbidden"
IAM user lacks one of the actions listed under Prerequisites in the right scope (region project for ELB/WAF, Global services for CDN), or the AK/SK is wrong. Check IAM → Users → Permissions.
HUAWEICLOUD_VALIDATION — HTTP 400
The API rejected the request content — typically an invalid PEM/key pair or a name the service refuses. Read the API message in the job log and fix the certificate or the name; the target is not retried because the same input cannot succeed.
HUAWEICLOUD_CONFLICT — ambiguous or incomplete name lookup
More than one object carries the exact name, or the listing was cut off before an exact match could be confirmed. Pin certificate_id (ELB/WAF) or set domain_name (CDN) on the target or in a per-distribution override, or remove the duplicate names in the console.
"Resource not found in region X"
Target resource lives in a different region than the target config says. ELB/WAF resources are regional — verify in the console. (CDN ignores the region.)
"Invalid project ID"
Project IDs differ per region; you can't reuse one across regions. Look up the project ID for the resource's region.
See also
Fields the setup steps do not mention
- Credential
domain_id— part of the AK/SK credential JSON. It is required for CDN (a global service): without it every CDN deploy, health check and dry run fails withCREDENTIAL_MISSING. Save-time validation does not require it, so the gap only surfaces at deploy time. - Target
enterprise_project_id— sent on every WAF call; set it when your WAF resources live in a non-default enterprise project.
Idempotent skip
All three sub-services skip the upload and report success with no change when the live certificate's content hash and the resolved name both already match. A name-only change is deliberately not skipped, so renaming still takes effect. A failed read before the skip check never fails the run — it just leads to an update.