Schedule icon
Webhook icon
Loop icon
Request icon
Script icon
If icon
SlackIncomingWebhook icon
OutputValues icon

Detect Cloudflare DNS Record Drift with Hourly Sweeps

Guard Cloudflare DNS with Kestra. Sweep zone records hourly and alert Slack on drift.

Categories
Infrastructure

A stray DNS edit can take down mail, apps, or TLS. This blueprint sweeps configurable Cloudflare zones every hour, snapshots A/AAAA/CNAME/TXT records via the API, and posts a Slack summary for review. A webhook trigger enables on-demand sweeps after change windows.

How it works

  1. hourly_sweep (io.kestra.plugin.core.trigger.Schedule, cron 0 * * * *) launches the run; on_demand_webhook allows ad-hoc sweeps.
  2. sweep_zones (io.kestra.plugin.core.flow.Loop, concurrency 4) fans out across inputs.zones.
  3. fetch_records (io.kestra.plugin.core.http.Request) lists up to 100 records per zone with allowFailed: true.
  4. diff_records (io.kestra.plugin.scripts.python.Script) filters to inputs.allowed_record_types and builds a summary.
  5. report_drift (io.kestra.plugin.core.flow.If) posts to Slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) for review.
  6. emit_sweep_metrics (io.kestra.plugin.core.output.OutputValues) exports coverage for audit history.

What you get

  • Hourly snapshots across any number of zones.
  • Type-filtered record summaries with TTLs.
  • Failure alert if the guard itself errors.

Who it's for

  • NetOps teams owning public DNS and TLS.
  • Platform teams guarding deploy-related DNS edits.
  • Security teams watching for dangling-record takeovers.

Prerequisites

  • A Cloudflare API token with DNS read on the zones.
  • Slack Incoming Webhook URL.

Secrets

  • CLOUDFLARE_API_TOKEN: token used to list DNS records.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook for summaries and failure alerts.
  • WEBHOOK_KEY: auth key for the on-demand webhook trigger.

Quick start

  1. Set CLOUDFLARE_API_TOKEN, SLACK_WEBHOOK_URL, and WEBHOOK_KEY secrets.
  2. Edit zones and allowed_record_types inputs.
  3. Run once manually to verify API access.
  4. Enable the hourly_sweep schedule.

How to extend

  • Persist snapshots to KV and diff against last run for true drift alerts.
  • Auto-restore unexpected records via the Upsert task.
  • Page on TXT changes affecting SPF/DKIM deliverability.

Links

Inputs

  • zones (ARRAY of STRING): Cloudflare zone identifiers.
  • allowed_record_types (ARRAY of STRING): DNS types to snapshot.

Outputs

  • emit_sweep_metrics.values.zones_swept: number of zones swept.
  • emit_sweep_metrics.values.swept_at: run timestamp for audit reports.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.