Skip to content

Cloudflare ​

Status: available · package wg-flow-plugin-cloudflare 0.1.1 · provider cloudflare · category dns.

The plugin calls the Cloudflare API v4 and sends zones, DNS, storage, databases and load balancers into inventory. It needs an API Token. A Global API Key is not accepted. The token stays in the agent YAML.

Token permissions: Zone Read and DNS Read for zones. Storage, databases and load balancers also need Account → Workers R2 Storage → Read, Workers KV Storage → Read, D1 → Read and Load Balancing → Read. A missing permission (often 403 on R2) skips that product; the rest of the collect continues.

Workers, Pages, Tunnels and Queues are not emitted in 0.1.1.

Install ​

The agent must be connected to the API.

bash
docker compose exec agent wg-flow-agent plugin install cloudflare
# or
wg-flow-agent plugin install cloudflare

Then the local UI → Connections → cloudflare, or YAML.

What lands in inventory ​

Cloudflare objectresource_typeNotes
Zonedomainapex, provider_resource_id is the zone name. paused → stopped
Hostname from A / AAAA / CNAMEdomainchild FQDN such as www.example.com. Apex, *, and _dmarc are not duplicated as domains
DNS recorddnsprovider_resource_id = dns:{record_id}
R2 bucketstorager2:{account_id}:{name}
Workers KVstoragekv:{namespace_id}
D1databased1:{uuid}, engine sqlite
Hyperdrivedatabasehyperdrive:{id}, origin host and database name
Zone load balancerload_balancerlb:{id}. enabled: false → stopped
Load balancer poolload_balancerlb-pool:{id}

In the console, domains are grouped by apex, same as SpaceWeb and Prometheus.

Collection pieces can be turned off separately: zones, DNS, storage, databases, load balancers. If zones are off and DNS or LB is on, the zone list is still fetched so records and balancers can be walked, but apex domains are not stored. An error on one zone or product does not stop the rest of the collect.

An empty account_id means every zone and account the token can see. Several Cloudflare accounts are several sources.

YAML ​

yaml
plugins:
  cloudflare:
    enabled: true
    sources:
      - id: account
        provider_account: "cf-main"
        sync_interval_seconds: 300
        url: "https://api.cloudflare.com/client/v4"
        token: "…"
        account_id: ""
        collect_zones: true
        collect_dns: true
        collect_storage: true
        collect_databases: true
        collect_load_balancers: true

Source fields ​

FieldRequiredDescription
idyesLog key (cloudflare/account)
provider_accountyesAccount label in inventory
urlnoDefault https://api.cloudflare.com/client/v4
tokenyesAPI Token; masked in the UI
account_idnoLimit collection to one account
collect_zones / collect_dns / collect_storage / collect_databases / collect_load_balancersnoDefault true
sync_interval_secondsnoMinimum 300

Check ​

bash
wg-flow-agent status
wg-flow-agent dry-run

JSON shows provider: cloudflare. Health calls GET /user/tokens/verify and treats the token as live only when status=active. The token itself is not stored in inventory.

Common errors ​

SymptomWhat to check
401 / 403 on zonesAPI Token, not a Global API Key; Zone Read and DNS Read
403 on R2, empty storageAccount → Workers R2 Storage → Read
Token is not activethe token is disabled in Cloudflare
Empty zonesaccount_id belongs to this token; collect_zones is not off
No subdomainscollect_dns is on; the record is A/AAAA/CNAME, not a wildcard or _label
No storage / database / LBthe product exists on the account; the matching collect_* is on; token permissions
Sync accepted>0, created=0, seen=0SaaS quota or read-only subscription; the payload reached the API but upsert did not create rows
Duplicates with SpaceWeb / Prometheusdifferent provider is expected; merge in the console