turbot/cloudflare
steampipe plugin install cloudflare

Table: cloudflare_dns_record - Query Cloudflare DNS Records using SQL

Cloudflare DNS is a service that provides global, fast, and secure Domain Name System services. It is built on a network that is unified, distributed, and operates in real-time, providing users with reliable and highly available DNS services. It also offers DNSSEC to protect against forged DNS answers and other security threats.

Table Usage Guide

The cloudflare_dns_record table provides insights into DNS records within Cloudflare. As a network administrator, you can explore record-specific details through this table, including the type of record, associated zone, and configuration settings. Utilize it to uncover information about DNS records, such as those with certain configurations, the zones they are associated with, and their current status.

Important Notes

  • You must specify the zone_id in the where clause to query this table.

Examples

Query all DNS records for the zone

Explore all DNS records associated with a specific zone to understand its configuration and manage its settings effectively. This can be particularly useful in troubleshooting or optimizing network performance.

select
*
from
cloudflare_dns_record
where
zone_id = 'ecfee56e04ffb0de172231a027abe23b';
select
*
from
cloudflare_dns_record
where
zone_id = 'ecfee56e04ffb0de172231a027abe23b';

List MX records in priority order

Determine the areas in which MX records are prioritized within a specific zone in your Cloudflare DNS, providing a clear order of priority. This is useful for managing mail exchange servers and ensuring smooth email delivery.

select
name,
type,
priority
from
cloudflare_dns_record
where
zone_id = 'ecfee56e04ffb0de172231a027abe23b'
and type = 'MX'
order by
priority;
select
name,
type,
priority
from
cloudflare_dns_record
where
zone_id = 'ecfee56e04ffb0de172231a027abe23b'
and type = 'MX'
order by
priority;

List all records from each zone

Explore which DNS records belong to each zone in your Cloudflare account. This allows you to understand the distribution and organization of your DNS records, aiding in efficient management and troubleshooting.

select
r.*,
z.name as zone
from
cloudflare_dns_record r,
cloudflare_zone z
where
r.zone_id = z.id;
select
r.*,
z.name as zone
from
cloudflare_dns_record r,
cloudflare_zone z
where
r.zone_id = z.id;

Schema for cloudflare_dns_record

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
contenttextContent or value of the record. Changes by type, including IP address for A records and domain for CNAME records.
created_ontimestamp with time zoneWhen the record was created.
datajsonbMap of attributes that constitute the record value. Primarily used for LOC and SRV record types.
idtext=ID of the record.
lockedbooleanTrue if the record is locked.
metajsonbCloudflare metadata for this record.
modified_ontimestamp with time zoneWhen the record was last modified.
nametextDomain name for the record (e.g. steampipe.io).
prioritybigintPriority for this record, primarily used for MX records.
proxiablebooleanTrue if the record is eligible for Cloudflare's origin protection.
proxiedbooleanTrue if the record has Cloudflare's origin protection.
ttlbigintTime to live in seconds of the record.
typetextType of the record (e.g. A, MX, CNAME).
zone_idtext=Zone where the record is defined.
zone_nametextName of the zone where the record is defined.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- cloudflare

You can pass the configuration to the command with the --config argument:

steampipe_export_cloudflare --config '<your_config>' cloudflare_dns_record