Gravity Keep

03 · Orbit

The commit returns. AWS catches up.

A database takes fifteen minutes; a certificate waits for DNS. So a commit returns as soon as it's written, the work runs in the background, and every resource in the tree shows where it stands and who has to act.

Convergence

Plan, act one resource at a time, read back.

  1. Compare the resolved configuration with what AWS holds for each affected resource.
  2. Order the actions by references: creates outward from what is referenced, deletes the other way.
  3. For each action, re-read the resource, recompute the action, send one Cloud Control request, wait for it, and read the result back.
  4. Record how each action ended, and update each resource's state.

Convergence always works toward the latest configuration, so a superseded commit can never undo a newer one. A resource has at most one AWS request in flight: a change from a newer commit waits for it, then is recomputed. Retries are bounded, and a failure waits for a person rather than looping.

Convergence in waves by reference: a key and log group first, then a role and the database, then the function that references them, then its alarm. WAVE 1WAVE 2WAVE 3WAVE 4 kms.key logs.log-group iam.role rds.db-instance lambda.function cloudwatch.alarm 15 minutes: a Step Functions Wait state, not a Lambda left running waits on the database
References alone set the order. There is no depends_on; if an order matters and no property says so, the template is missing a reference.

The five states

Each state says who has to act.

Every managed resource is in exactly one state, shown with a short reason. Drift that the control plane is already correcting shows as converging, so drifted always means the difference will stay until a person does something. That's the state worth alarming on.

stable

Observed matches configured.

Nobody acts
converging

Creating, updating, waiting on a reference, pending validation, or correcting drift.

The control plane, on its own
drifted

Different, and it won't be corrected on its own: report policy, a hold, a fight, a missing stateful resource.

A person decides
failed

AWS refused, retries ran out, a referenced resource failed, or the type's converging limit passed.

A person fixes it
unknown

The account can't be read, so the control plane won't claim anything.

A person restores access
eric@tidewater> show status /tidewater/lending/prod/east
acm.certificate/cdn                  converging   pending validation (DNS, 4m)
route53.record-set/cdn-validation    stable
cloudfront.distribution/site         converging   waiting on acm.certificate/cdn
rds.db-instance/main                 converging   creating (COMMIT-47, 6m, about 15m expected)
ec2.security-group/intake            converging   correcting drift (sam, console)
s3.bucket/documents                  drifted      hold 3, until 00:41
cloudwatch.alarm/errors              failed       blocked by lambda.function/fn

A namespace shows the worst state beneath it, in the order unknown, failed, drifted, converging, stable, with counts. show configuration | display status annotates the whole tree.

Waiting

Walk away, or wait for it.

A person who wants the prompt back when AWS is done uses commit and-wait. A pipeline uses wait, which ends with an exit code it can act on. A wait in a session is a subscription; from a pipeline it's a long poll that never holds a Lambda open.

Commit check shows how long the slow actions usually take, so you know before you commit whether it's a six-second bucket or a fifteen-minute database.

CommandWaits until
commit and-waitThe commit's convergence finishes
wait commit 47Everything it affected is stable, or it fails or is superseded
wait /tidewater/foundation/prodEverything beneath is stable, whatever made it otherwise
ExitMeaning
0Stable
1Failed
2Timed out while converging, drifted, or unknown
3Superseded by a newer commit

The type table

What the registry schema doesn't say.

Most types need only Cloud Control and the first three columns. The rest exist for the few that behave unusually, and stay empty until a type needs them. A type is offered for owned namespaces only once it has run in report mode without showing drift nobody caused.

ColumnSaysExample
ScopeGlobal, regional, zonal, or organizationacm.certificate: regional
StatefulRemoving it loses data, or something as costlyroute53.hosted-zone: yes
IdentityWhat others hold that recreating can't restoreiam.role: unique ID
RunnerCloud Control, or a hand-written runner for a type with special needsacm.certificate: acm-certificate
Converging limitHow long it may stay converging before it's failedacm.certificate: 72h
Typical durationWhat commit check showsrds.db-instance: about 15m
Early attributesValues that can be referenced while it's still converginga certificate's validation record
List keysHow list entries are picked, never by positionvalidation[www.tidewater.com]
ComparisonThe normaliser applied before comparingpolicies: json; rules: set
Destroy valuesWhat deletion needskms.key: waiting period

Early attributes

A certificate, pending, and the record it's waiting for.

An ACM certificate stays pending until its DNS validation record exists, and that record's value comes from the pending certificate. Strict ordering would deadlock. So the certificate stays converging, "pending validation", while its validation values are marked early in the type table: the record that reads them is created at once.

Anything that reads the certificate's ARN still waits for it to be stable, because CloudFront refuses a certificate that hasn't been issued. ACM gives up after 72 hours, and so does the converging limit.

resource acm.certificate cdn {
    placement { region us-east-1; }
    domain-name lending.tidewater.com;
    validation-method DNS;
}
resource route53.record-set cdn-validation {
    hosted-zone-id @/tidewater/foundation/prod/route53.hosted-zone/tidewater-com;
    name @./acm.certificate/cdn:validation-record-name;   early
    type CNAME; ttl 300;
    resource-records [ @./acm.certificate/cdn:validation-record-value ];
}

The rules

Convergence.

  1. CTL-025

    Convergence always works toward the latest active configuration, and every action is recomputed from the resource's current state just before it runs.

  2. CTL-026

    Each convergence action is retried a bounded number of times with backoff, and then recorded as failed with an alarm to the resource's owner.

  3. CTL-059

    A resource has at most one AWS request in flight; an action from a newer commit waits for it to finish and is then recomputed from current state.

  4. CTL-060

    Every managed resource is in exactly one state, stable, converging, drifted, failed, or unknown, shown with its reason, and a namespace shows the worst state beneath it in the order unknown, failed, drifted, converging, stable.

  5. CTL-062

    A wait succeeds only when everything it waits on is stable; drifted and unknown never count as stable.

  6. CTL-064

    Every type has a converging limit in the type table, and a create or update still converging when it runs out is failed.