Cloudflare CLI: adopting existing DNS and routes

Exact identities, an explicit plan, verification and replay without new POSTs. An unknown creation outcome stops automatic retries.

Hands place a transparent diagram over a map of connected nodes.
Hands place a transparent diagram over a map of connected nodes.

Adopting existing objects through the CLI

The educational E-01 hostname already works through Cloudflare: seven exact no-script routes and one proxied A record were created manually. I have now tested a separate CLI lifecycle: plan, apply with explicit adopt-existing, independent verify and exact replay. This run brings existing state into a managed process while preserving its identity.

The boundary matters: adoption does not turn manual creation into CLI creation. It confirms that the command recognized the agreed objects, checked their surroundings and saved a new local confirmation.

Exact objects within the whole zone

The seven route identities and one DNS identity matched the manual step’s results exactly. Verification read complete inventories: 38 DNS records and 21 routes. Finding a similar name or one correct pattern is insufficient: unrelated records and routes must also remain unchanged.

Permitted writes are limited to seven defined no-script routes and one proxied A for the selected hostname. This is not a general zone editor. Cloudflare settings, Worker code, other hosts and deletion are outside the capability. Adopting existing identities does not grant permission to delete them.

The plan bounds replay

The plan binds verified inputs to the exact expected state; application requires its exact SHA256 and an explicit choice to adopt existing objects. The command must not silently switch between creating and adopting. They are different actions with different histories.

All four phases succeeded against the real Cloudflare service. There were no new POSTs, and no routes or DNS record were created. Application saved a new local adoption record; separate verify and exact replay made no writes. The confirmed state checksum remained the same.

When another POST is forbidden

If a POST leaves it unknown whether the provider created an object, the safe outcome is to stop. Even a similar object in a later GET does not establish who created it or which request caused it. Automatically repeating POST or attributing that object to the current operation is unsafe.

A saved, confirmed POST response is different. It supplies the created object’s identity, allowing GET reconciliation without a second POST. That distinguishes an unknown write outcome from a known response followed by a contradictory list. Adopting previously created objects is another separately selected mode, rather than a way to disguise an unknown result.

Keeping roles and evidence separate

DNS, routes and Custom Domains reader profiles remain separate. One role’s permissions need not expand merely because another check needs an additional GET. API tokens and authentication material are not sent to the origin for this provider operation.

Successful verify checks state in Cloudflare. The server firewall, local TLS and actual edge responses have separate practical checks from the preceding steps. Matching DNS and routes does not replace them: even a correct record does not establish that the server responds with the required password protection and headers.

First creation needs its own run

This establishes adoption of existing provider state, independent verification and replay without new writes. First creation through the new CLI was tested with HTTP fixtures, rather than by creating new objects on the real Cloudflare service. That bounds the result: adoption works on existing objects, while simulated first creation does not replace a real first-creation check.

  1. Platform Engineering Worker routes: collisions before creating a DNS record
  2. Operations & Security A separate Cloudflare DNS token for the educational E-01
  3. Operations & Security Adopting protected HTTPS with the CLI without a restart
  4. Operations & Security Connecting E-01 through Cloudflare while keeping password protection
  5. Platform Engineering Timeout after an external request: when the outcome is unknown

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article