Back to plugin list
cloudflare
Official

Cloudflare

The CloudQuery Cloudflare plugin pulls configuration out of Cloudflare resources and loads it into any supported CloudQuery destination

Publisher

cloudquery

Repositorygithub.com
Latest version

v6.1.2

Type

Source

Platforms
Date Published

Nov 16, 2023

Price

Free

Set up process


brew install cloudquery/tap/cloudquery

1. Download CLI and login

See installation options

2. Create source and destination configs

Plugin configuration

cloudquery sync cloudflare.yml postgresql.yml

3. Run the sync

CloudQuery sync

Overview

Cloudflare Source Plugin

The CloudQuery Cloudflare plugin pulls configuration out of Cloudflare resources and loads it into any supported CloudQuery destination (e.g. PostgreSQL, BigQuery, Snowflake, and more).

Authentication

In order to fetch information from Cloudflare, cloudquery needs to be authenticated. There are a few options for authentication:
  • Export the CLOUDFLARE_API_TOKEN environment variable
  • Export the CLOUDFLARE_EMAIL and CLOUDFLARE_API_KEY environment variables
  • Specify either the api_token or api_email, api_key parameters in the YAML configuration (See Configuration for more details).
The plugin requires only read permissions. To start, Cloudflare has a read all resources API token template that will grant CloudQuery the necessary permissions to fetch information from Cloudflare. As necessary, those permissions can be refined and modified further to meet your needs.

Query Examples

Find all zones with dev_mode enabled

SELECT id, account_id, host_name, name, original_ns FROM cloudflare_zones WHERE dev_mode = true;

Find all DNS records

SELECT id, account_id, zone_id, name, type FROM cloudflare_dns_records;


Configuration

Cloudflare Source Plugin Configuration Reference

Example

This example syncs from Cloudflare to a Postgres destination, using in-line api_token authentication (instead of the CLOUDFLARE_API_TOKEN environment variable). The (top level) source spec section is described in the Source Spec Reference.
kind: source
# Common source-plugin configuration
spec:
  name: cloudflare
  path: cloudquery/cloudflare
  registry: cloudquery
  version: "v5.0.13"
  tables: ["*"]
  destinations: ["postgresql"]

  # Cloudflare specific configuration
  spec:
    # Optional parameters
    # api_token: ""
    # api_email: ""
    # api_key: ""
    # accounts: []
    # zones: []
    # concurrency: 10000

Cloudflare Spec

This is the (nested) spec used by the Cloudflare source plugin.
  • api_token (string, optional. Default: empty): An API token to access Cloudflare resources. This can also be set with the CLOUDFLARE_API_TOKEN environment variable. An API token authentication is preferred over API email and key authentication. If api_token is specified, api_email and api_key shouldn't be specified.
  • api_email (string, optional. Default: empty): API email to access Cloudflare resources. If api_email is specified, api_key should also be specified. This can also be set with the CLOUDFLARE_EMAIL environment variable. If api_email is used, api_token shouldn't be specified.
  • api_key (string, optional. Default: empty): API key to access Cloudflare resources. If api_key is used, api_email should also be specified. This can also be set with the CLOUDFLARE_API_KEY environment variable. If api_key is used, api_token shouldn't be specified.
  • accounts ([]string, optional. Default: empty): List of accounts to target. If empty, all available accounts will be targeted.
  • zones ([]string, optional. Default: empty): List of zones to target. If empty, all available zones will be targeted.
  • concurrency (int, optional, default: 10000): A best effort maximum number of Go routines to use. Lower this number to reduce memory usage.


Subscribe to product updates

Be the first to know about new features.