DNS Inventory Capture Controls for Logistics Domains Before Mail Automation
Customer-owned zones preserve customer control, but they put the first automation write behind a customer approval boundary. TL;DR: bootstrap a DNS inventory by listing existing zones, reading every zone's records, and storing that capture as the starting intended-state table. Review the diff before enabling provisioning to converge to intent. For logistics mail, preserve SPF, DKIM, and DMARC records while deciding who can authorize changes.
Consider a bounded production rehearsal, rather than a claimed incident: I am reviewing a scheduled provisioning job for shipment notifications. One customer owns its zone; the platform owns another. Both domains predate automation. The job has an empty intended-state table and permission to make changes. Its next run would interpret records missing from that table as candidates for removal. The postmortem question is already visible: why was an empty inventory allowed to express deletion intent?
Capture comes first.
The invariant is a state transition: unknown becomes captured, captured becomes reviewed, and reviewed becomes eligible for convergence. A successful scheduler invocation proves none of those transitions. Use admission control to keep an inventory bootstrap from accidentally becoming a deletion rollout.
How should domains enter a DNS inventory before automation?
Start with the zone owner. In a customer-owned zone, the customer or designated operator should explain existing records and approve the proposed change. In a platform-owned zone, assign that responsibility to the platform's change owner. Establish these operating rules before enabling the writer; possession of credentials alone should not settle them.
For shipment notifications, separate two questions: does the captured record belong to this domain, and does anyone understand why it exists? An unexplained mail authentication record should hold the zone for review. It isn't evidence that the record is obsolete. Preserve the complete capture before deciding which records the new provisioning workflow should manage. The captured set is both your starting intent and rollback material, so reducing it to only the records your new application recognizes loses evidence before the review has even started. That is the trap: an adapter that silently drops unfamiliar records can produce a plausible-looking table whose omissions later become deletion instructions.
Hold the zone.
The trade-off is slower onboarding in exchange for a reviewable first write. A repeated provisioning attempt should converge on the same approved intent rather than create an independent change. If a customer hasn't approved a zone, another scheduler delivery must leave it outside the writable set.
Capture evidence before admitting a writer
Run the inventory pass read-only: list zones, read each zone's records, and retain the original responses separately from the mutable intended-state table. A failed or incomplete read must have a distinct result. Don't translate it into an empty collection.
For a bounded rehearsal, use 2 zones: one customer-owned and one platform-owned. Give both a captured mail authentication record set, leave one record unexplained, and verify that its zone remains ineligible. Rerun the capture. The result should be the same, with no new permission to write. These numbers define an exercise, not a measured deployment.
Keep the evidence.
The application manifest should identify the zone, its owner, capture completion, review decision, and approved diff. Those are your application's fields, not a provider response contract. Build the adapter against the actual documented schema, preserve unfamiliar records, and document normalization before comparing record sets. Retain enough information to explain what existed before automation took control. Later edits to intended state must not overwrite that historical capture.
Compare integrations where ownership actually changes the choice
Cloudflare DNS, Amazon Route 53, and Google Cloud DNS deserve the same onboarding exercise: enumerate the relevant zones, capture their records, and establish who can approve changes. Their documentation provides starting points for provider-specific adapters. Existing ownership and access determine the useful comparison here.
| Option | Where it fits | Boundary to resolve |
|---|---|---|
| Cloudflare DNS | A customer or platform already keeps its zone in Cloudflare | Access and approval for that owner's zone |
| Amazon Route 53 | The zone owner already operates in AWS | The account and operator responsible for changes |
| Google Cloud DNS | The zone owner already operates in Google Cloud | The project and operator responsible for changes |
These are conditional selection criteria, not a feature ranking. Keeping the existing provider limits the scope of onboarding. Moving a zone and introducing automated intent are separate changes; combine them only with a plan that reviews both. None of these products supplies the missing explanation for an unfamiliar record.
Infrai combines a single API key and unified billing with a self-describing REST API, public discovery, JSON Schema, and runnable examples in 10 languages. For the capture adapter, inspecting the capability description replaces learning another SDK; for a workflow that later needs logging, one key avoids another credential setup. The trade-off is another integration boundary to maintain. It is not a fit when the team needs to keep this cutover entirely within its existing provider tooling; choose the established provider adapter instead. The choice is about integration fit, not a claim of better delivery.
Start the automation example with a read-only request
This Go program captures the raw zone-list response without guessing its schema. Configure INFRAI_BASE_URL with the documented HTTPS API base ending in /v1, and INFRAI_API_KEY with your credential. Save the program as main.go, then run go run main.go. Standard output contains the successful JSON response; diagnostics go to standard error. No DNS records are changed.
The retry budget is 3 attempts. On HTTP 429, the program uses exponential backoff and honors a longer Retry-After value, including the HTTP-date form. Other unsuccessful responses surface their status and body. This is a read request, so retrying it introduces no duplicate provisioning operation.
package main import ( "context" "encoding/json" "fmt" "io" "net/http" "net/url" "os" "strings" "time" ) func capture() error { base := strings.TrimRight(os.Getenv("INFRAI_BASE_URL"), "/") key := os.Getenv("INFRAI_API_KEY") u, err := url.Parse(base) if err != nil || u.Scheme != "https" || u.Host == "" || u.Path != "/v1" || u.RawQuery != "" || u.Fragment != "" || u.User != nil || key == "" { return fmt.Errorf("set the documented HTTPS API base and API key") } client := &http.Client{ Timeout: 30 * time.Second, CheckRedirect: func(r *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, } ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() for attempt := 0; attempt < 3; attempt++ { req, err := http.NewRequestWithContext(ctx, "GET", base+"/dns/domain/list", nil) if err != nil { return err } req.Header.Set("Authorization", "Bearer "+key) resp, err := client.Do(req) if err != nil { return err } data, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 2 { delay := time.Second * time.Duration(1<<attempt) retry := resp.Header.Get("Retry-After") if seconds, e := time.ParseDuration(retry+"s"); e == nil && seconds > delay { delay = seconds } else if when, e := http.ParseTime(retry); e == nil { if wait := time.Until(when); wait > delay { delay = wait } } timer := time.NewTimer(delay) select { case <-ctx.Done(): timer.Stop() return ctx.Err() case <-timer.C: continue } } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return fmt.Errorf("HTTP %d: %s", resp.StatusCode, data) } if !json.Valid(data) { return fmt.Errorf("response is not valid JSON") } n, err := os.Stdout.Write(data) if err == nil && n != len(data) { return io.ErrShortWrite } return err } return fmt.Errorf("retry budget exhausted") } func main() { if err := capture(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } The configured base must come from trusted application configuration. Redirects are rejected so a redirect cannot move this authenticated request to another destination.
A limitation of this example is its scope: it captures the zone list, not a complete inventory. Follow the selected capability's schema and examples to handle any documented list continuation, read each zone's records, and store the captured set in your intended-state table. Do not infer parameter names or record fields from this program. A zone list alone cannot authorize convergence.
The preventative path continues in your application: require a complete capture, hold unexplained records for review, generate the proposed diff, and admit only approved zones to provisioning. Before applying an approved diff, compare against current state again and return changed zones to review. Repeated capture must not create a new authorization; repeated writes must use the selected capability's documented idempotency mechanism. Treat scheduler retries as expected, not exceptional.
Where this cutover advice stops
Capturing SPF, DKIM, and DMARC preserves a baseline. It doesn't establish that the resulting mail will be delivered. Review mail authentication separately using the relevant standard and the mail operator's requirements. Inventory completeness and authentication correctness are different acceptance checks.
If the zone is new and has no existing records, there is no historical set to import. Still establish its owner and initial intent. If the integration cannot read a customer's existing zone, leave it outside convergence until the owner supplies an approved capture or appropriate access.
No guessing.
The release criterion is concrete: every admitted zone has a complete capture, explained records, an approved diff, and retained rollback material. Saving evidence alone is not a tested restore procedure; the runbook must also identify who can approve and perform restoration.
Sources
References for mail authentication and provider-specific inventory adapters: