Build a Region, Product and Resource Support Ledger
A ledger row is a promise about one product in one region. It records where the API answers, what the ceiling is, whether the zone holds stock, and how an existing object is identified. Most failed launches answer only the first question and discover the other three during the apply.
Endpoints come in two families, and the family decides the credential path. RAM and STS answer on global endpoints while compute, network, storage and key management answer per region. One provider region therefore reaches one control plane per service, and an endpoint override that disagrees with that region addresses a place where the object does not exist.
Quota is a ceiling with a narrow scope. vCPU is counted per instance family in a region, VPC and EIP counts are counted per region, and security group rules are counted per group. Quota Center prints the number for your tier, and an approval raises that ceiling and nothing else.
Capacity is a separate fact that quota cannot answer. A quota says how many instances you may hold; capacity says whether the zone has that family in stock this hour. A sold-out zone refuses an instance your quota already allows, and no increase changes that.
Import support belongs in the row because it decides ownership. Each resource page either documents an import identity for 2.2.0 or it does not, and the shape it names is the one the API accepts. A product without an import path is adopted by hand or left outside Terraform, and both choices need a name.
Activation is the gate that masquerades as a permission problem. A product that was never activated in the region returns a refusal that reads like a missing RAM action. Record the activation step beside the product instead of widening the policy until something passes.
Pin the build at the top of the ledger. Terraform 1.17.1 and provider 2.2.0 are the versions the rows were read against, and the lock file proves what init downloaded. A floating constraint turns the ledger into a description of whatever resolved that morning.
Figure 1 orders the gates so that a refusal is attributed to the layer that owns it.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
W["Workload shape
zones, family, storage"] --> R{"Region approved
for this account?"}
R -->|"no"| R1["Stop
data residency or endpoint scope"]
R -->|"yes"| P{"Product activated
in this region?"}
P -->|"no"| P1["Activate, then re-read the quota"]
P -->|"yes"| Q{"Quota ceiling
above the ask?"}
Q -->|"no"| Q1["File the increase
before the window"]
Q -->|"yes"| C{"Zone stock for
this exact family?"}
C -->|"no"| C1["Change zone or family
as a design decision"]
C -->|"yes"| I{"Import path documented
in 2.2.0?"}
I -->|"no"| I1["Own outside Terraform
or adopt by hand"]
I -->|"yes"| L["Ledger row accepted
with a build and a date"]
Q1 --> C
P1 --> Q
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class W,L primary;
class R,P,Q,C,I secondary;
class Q1,C1 warn;
class R1,P1,I1 danger;
The order matters more than the count. A regional rejection is a policy conversation, a quota rejection is a ticket, and a stock rejection is a design change.
The layers are nested, and the ledger is what flattens them. Account controls reach every region, a regional endpoint reaches one control plane, and zone capacity reaches one family on one rack.
Table 1 gives the row shape; add resource-specific identity notes underneath it.
| Ledger field | What to record | Enforced by | Cost of assuming it |
|---|---|---|---|
| Endpoint scope | Global for RAM and STS, regional for compute, network and storage | Provider region and endpoint block | The call lands in a region with no such object |
| Quota unit and scope | vCPU per family and region, EIP per region, rules per group | Quota Center and the service console | An approved increase still leaves the plan denied |
| Capacity source | Zone stock for the exact family, plus disk category | Zone and instance type data | Clean plan, failed create |
| Import identity | Simple ID, name, or composite with named separators | Resource page Import section for 2.2.0 | Import adopts a different object |
| Read path | Describe call the provider uses on refresh | Provider schema and API | Drift is invisible and the plan stays empty |
| Activation | Product state and any service-linked role | Console and the platform owner | A denial is read as a policy gap |
| Build pin | Terraform 1.17.1 with alicloud 2.2.0 | The lock file | Review against a schema you do not run |
Diagnose Unavailable Images or Instance Types
The first split is where the failure happened, not what it said. A validation error names a file, a line and an argument and arrives before any API call, while a service refusal carries a request ID from the other side. Reading that difference saves an afternoon of policy debugging on a misspelled argument.
A schema error means the pinned provider does not accept what you wrote. In 2.2.0 an argument may have been renamed, moved into a block, or removed at the major boundary, and validation catches all three for free. Nothing about the account, the region or the zone is implicated, so no amount of quota or capacity work will change the message.
An image is a regional object with an architecture. Image IDs do not travel between regions, a copied image arrives under a new identifier, and an Arm image cannot boot an x86 instance family. An image that exists in the console is therefore not evidence that it exists for the type you picked.
An instance type is offered per zone, not per region. A family that is listed for the region can still be absent in zone b, and the zone filter is what turns a regional catalogue into a launchable answer. This is the cheapest place to discover that the design needs a second vSwitch.
Resolve the image and the type together. Filtering images by instance type produces a pair that launches, while two independent lookups can each be correct and still be incompatible. That single change removes the most common class of first-apply failure.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Plan or apply fails"] --> B{"Error names a file,
a line and an argument?"}
B -->|"yes"| B1["Schema: 2.2.0 rejects
the argument you wrote"]
B -->|"no"| C{"Response carries
a request ID?"}
C -->|"no"| C1["Local: credential,
endpoint or provider config"]
C -->|"yes"| D{"What does the
message name?"}
D -->|"image"| D1["Regional ID or
architecture mismatch"]
D -->|"instance type"| D2["Family not offered
in this zone"]
D -->|"quota"| D3["Ceiling reached
in this region"]
D -->|"stock"| D4["Zone sold out
for this family"]
B1 --> E["Fix the configuration,
then plan again"]
C1 --> E
D1 --> F["Resolve image and type
in one lookup"]
D2 --> F
D3 --> G["File the increase
and keep the plan"]
D4 --> H["Move zone or family
deliberately"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class A,E,G primary;
class B,C,D secondary;
class F,H ok;
class B1,C1,D1,D2 danger;
class D3,D4 warn;
A quota refusal is a number and a capacity refusal is a place. The quota message names the ceiling and the region, while the stock message names the zone and the family. One needs a request with lead time, and the other needs a different placement decision.
Fallbacks chosen at apply time destroy determinism. A list of acceptable zones resolved by a random pick produces a different plan on every run and a state you cannot reproduce. Choose the order in configuration, record which entry was used, and treat a fallback as a reviewed change.
Storage classes are zonal as well. An ESSD performance level or a local-disk family can be unavailable in a zone that still offers the instance, so check the pair rather than the instance alone.
An empty data source result is a finding, not a bug. When the zone filter returns nothing, the plan stops before spending anything. That is the least expensive failure in the whole rehearsal, and it belongs in the change record beside the zone you rejected.
Reconcile Deprecated Fields and Imported Defaults
Import records what the API answered, and the first plan compares that answer with your configuration. Every line in the resulting diff is one of four things: a spelling the provider normalizes, a default the service filled in, a field the version changed, or a value someone else wrote. Only the last one is drift.
Identifiers normalize before they compare. Letter case, a retained product prefix and the field order inside a composite ID all affect equality even when both sides name the same object. A composite identifier with its segments reordered reads as a different object and produces a replacement rather than an update.
The API fills arguments you never wrote. A default resource group, an empty description, an implicit tag map and a false protection flag are all values the service chose. The provider stores what it read and then proposes your absence again on the next plan, which is why an imported object can diff forever without changing.
Computed values are recorded, never authored. Creation time, status, private address and the implicit route table identifier belong to the read path. Writing one into configuration creates a conflict the provider cannot resolve, and the plan keeps offering to correct it.
Deprecated aliases diff without any API change. In 2.2.0 the old and new names for a VPC still coexist, and the provider reads one of them. Configuration that uses the other produces a permanent difference that no apply can settle, which is why the rename is a separate commit from the import.
Normalization is stable, drift moves. Plan twice with refresh; a difference that survives an apply that changed nothing is normalization, while a difference that appears between two plans with no commit is drift. The refresh-only plan separates the two without touching the object.
Encode normalization and assign drift. A default the service always writes belongs in configuration as an explicit value, and a value another team changes belongs to that team in the register. An ignore rule hides the difference without deciding who owns it, and an annotation written by another controller is the only kind that earns one.
Prove the baseline before removing the old field. The import diff, the deprecated alias and the schema change each get a plan of their own, and the baseline is empty only when all three are settled. Deleting the deprecated argument first mixes three causes into one plan and loses the ability to attribute the result.
Rehearse a Change Without Releasing Unowned Addresses or Data
A replacement plan is a data question before it is a capacity question. Every destroy-and-create line needs two answers: what happens to the data the old object held, and who holds the name or address after the swap. If either answer is missing, the change has been planned but not rehearsed.
Force-new fields are wider than most teams expect. The zone, the vSwitch, the disk category, a bucket name and a VPC CIDR can each turn an edit into a destroy and a create. Read the action column before the attribute diff, because the action decides the blast radius.
Destroying an instance releases more than the instance. The system disk, an auto-assigned public address and the EIP association all go with it, and only the EIP object survives if it is declared separately and left alone. An address that returns to the pool cannot be requested back, which is why the association belongs in the rehearsal.
Retention boundaries expire on a clock. A key deletion is scheduled rather than immediate, a database keeps automated backups for a configured window, and a versioned bucket keeps every version until they are removed. Rehearsing a destroy without reading those windows rehearses a recovery you do not have.
Some objects must never be released by a plan. A shared vSwitch, a CEN attachment and the account audit trail belong to other owners, so they enter the root as reads and never as resources. A plan that can destroy one of them is a boundary defect regardless of what the diff says.
The rehearsal root is bounded by state, not by intent. A separate prefix, a separate VPC and no shared attachments mean the exercise cannot reach a neighbour even when a reference is wrong. Shared objects enter through data sources so the dependency stays visible without becoming writable.
Rehearse in the order the destroy will happen. Plan the replacement, destroy a scratch twin, restore from the snapshot or image, and only then change the real object. That order proves the recovery path exists before the plan that needs it is approved.
A removed block is not a destroy. Declaring the block with destroy disabled drops the record and leaves the object running for its new owner. Deleting the resource block instead proposes a destroy, and confusing the two is how a handover becomes an outage.
Name the recovery boundary in the change record. The snapshot, the image, the backup window and the person who can restore them are the answer to "what if the plan is wrong". A rehearsal that stops at a green apply has tested the happy path and nothing else.
Accept a Stable Plan with a Billable-Resource Inventory
Acceptance is a set of artifacts, not a feeling about the diff. The build is pinned, the imported addresses plan clean, the remaining diff is classified, the replacement was rehearsed inside a bounded root, and the billable inventory matches state. A missing item leaves the change unproven rather than nearly done.
Accept a Stable Plan with a Billable-Resource Inventory
Status: design-only. No Alibaba Cloud account, credential or billable resource was used for this article, and none of the steps below was executed. Every identifier is a placeholder; substitute your own sandbox account, region, VPC and bucket.
Prerequisites. Terraform CLI 1.17.1 with aliyun/alicloud 2.2.0, one sandbox account in one region, an OSS state bucket with versioning and a Tablestore lock table, a console-created VPC with one vSwitch in each of two zones, and one EIP that Terraform does not yet manage. The root is limited to compute, that one VPC and four imported addresses, with no shared network attachment.
Scope check. Confirm the root cannot reach a shared vSwitch, a CEN instance or the account trail before the first plan. If one appears as a resource rather than a data source, fix the boundary and restart.
- Record the build with the version command and the provider listing, then write 1.17.1 and 2.2.0 into the ledger header with the date you read them.
- Query the region for zones, instance types filtered by zone, and images filtered by type. Write the accepted triple of zone, family and image as one row, not three.
- Read Quota Center for the family's vCPU ceiling and the EIP count, and record both numbers with the request channel and the approval lead time.
- Add import blocks for the VPC, both vSwitches and the EIP at their final addresses, then plan and read every line before applying.
- Apply the import plan, remove the import blocks, and plan again. Classify each remaining line as a default, a normalization, a schema change or drift.
- Encode each normalized value in configuration, name the writer for each drift line, and confirm two consecutive plans produce the same diff.
- Create the instance in the first vSwitch, snapshot its system disk, then move it to the vSwitch in the second zone and read the action column before applying.
- Apply the replacement in the rehearsal root, restore the data from the snapshot into the new instance, and confirm the instance returns with its tag.
- Destroy the root, then search Resource Center by the ownership tag and compare the result with state for EIPs, disks and snapshots that outlived it.
| Check | Evidence | Verdict |
|---|---|---|
| Build pinned | The lock file records 1.17.1 and 2.2.0 | Pass or stop |
| Triple resolved | Zone, family and image came from one query set | Pass |
| Import clean | Imported addresses show no change on the next plan | Pass or fix HCL |
| Normalized | The same diff appears in two consecutive plans | Encode the value |
| Replacement | Action column and data answer are both written down | Pass or stop |
| Runtime | The instance answers after the restore | Pass |
| Inventory | The tag search matches the recorded addresses | Pass or assign an owner |
Expected observation. The four imported addresses settle to no change after the normalized values are encoded, and the second plan repeats the first exactly. The move in step 7 is the only destroy-and-create in the plan, and the restore in step 8 returns the instance with the same data and tag. The tag search at the end returns the same set of addresses that state records, with no unattached EIP left behind.
Failure checks. If the imported VPC diff changes between two plans with no commit, the value is drift rather than a normalization. If the replacement in step 7 arrives without a data answer, the change is unproven even when the plan is green. If the tag search finds an EIP that state does not, the root released an address it never owned. If the plan is empty but the instance was never reachable, the runtime boundary was never tested.
Cost and cleanup. One small instance, one EIP and one snapshot cost cents for a session; the VPC, vSwitches and security group are free, and the state bucket and lock table are the only persistent objects. Destroy the root, release the EIP, delete the snapshot, confirm the shared trail still holds the other principals, and remove the test prefix and temporary roles.
Release criterion. Publish the ledger row with the build, the accepted triple, the quota numbers, the import identities and the plan hashes. If any acceptance check is missing, the row stays unverified, and the next engineer inherits an honest gap instead of a false guarantee.