cflare diff

Drift Detection & Diff Engine

Drift Detection

Compare live Cloudflare edge configuration against a local backup snapshot to detect unauthorized drift.

$ cflare diff <domain> <backup-file> [options]

📖 Full Explanation

\1 acts as a Git diff for your Cloudflare edge infrastructure. It downloads live zone settings and DNS records, compares them against a previously generated backup snapshot, and displays added, modified, or deleted records in a clean colored terminal diff.

⚙️ Command Options & Flags

Option / Flag Description Default
--color Force colored terminal diff output true
--exit-code Exit with code 1 if configuration drift is detected (for CI/CD gates) false

🔬 Technical Corollary & Edge Mechanics

Identifies configuration drift introduced by engineers manually modifying settings in the Cloudflare web dashboard outside of approved infrastructure-as-code (IaC) workflows. Ideal for pre-deployment CI/CD verification.

🎯 Real-World DevOps Use Cases

CI/CD Infrastructure Drift Gate

Fail automated pipelines if production DNS or SSL settings have drifted from version control.

$ cflare diff namishkumar.in master-config.json --exit-code

Audit Verification Before Major Deployments

Review exact changes made during maintenance windows.

$ cflare diff example.com pre-maintenance.json

💻 Live Output Simulation

$ cflare diff namishkumar.in backup.json
🔍 Comparing live edge configuration with backup.json:

DNS Records:
  + A    api.namishkumar.in  -> 203.0.113.88 (Proxied: true)
  ~ A    app.namishkumar.in  -> 198.51.100.12 (was: 198.51.100.10)
  - TXT  old-verify.namishkumar.in

Zone Settings:
  ~ security_level: 'under_attack' (backup had: 'medium')

⚠ Drift detected: 1 added, 2 modified, 1 deleted.