Portal Community

dns/import

Import DNS records from a BIND-format zone file (RFC 1035) into a Cloudflare zone.

Non-destructive import: Existing records are not overwritten. Records in the zone file that match existing records are skipped and counted in recordsSkipped. No existing records are deleted.

When to Use

Configuration

Connection

FieldTypeRequiredDescription
ApiTokenstringrequiredScoped Cloudflare API Token with DNS.Edit permission. Store in BizFirst Credentials Manager.

Operation Fields

FieldTypeRequiredDescription
ZoneIdstringrequired32-character hexadecimal Zone ID to import records into.
FileContentstringrequiredFull BIND zone file content as a string (RFC 1035 format). Read from S3, a file node, or a variable.

Sample Configuration

{
  "resource": "dns",
  "operation": "import",
  "connection": {
    "ApiToken": "{{ $credentials.cloudflare_dns_edit }}"
  },
  "ZoneId": "023e105f4ecef8ad9ca31a8372d0c353",
  "FileContent": "{{ $node.ReadS3File.output.body }}"
}

Sample BIND Zone File (FileContent)

$ORIGIN example.com.
$TTL 3600
@       IN  SOA   ns1.example.com. admin.example.com. (
                  2024010101 ; serial
                  3600       ; refresh
                  900        ; retry
                  604800     ; expire
                  300 )      ; minimum TTL
@       IN  NS    ns1.example.com.
@       IN  A     198.51.100.4
www     IN  CNAME example.com.
mail    IN  A     198.51.100.5
@       IN  MX    10 mail.example.com.
@       IN  TXT   "v=spf1 include:_spf.example.com ~all"

Validation Errors

CodeConditionResolution
MISSING_API_TOKENApiToken is emptySet the ApiToken credential with DNS.Edit permission
MISSING_ZONE_IDZoneId is emptyProvide the Zone ID
UNKNOWN_ERRORInvalid zone file format or API errorValidate zone file syntax — Cloudflare requires valid RFC 1035 format

Output

Success Port

FieldTypeDescription
recordsAddedintegerNumber of records successfully added to the zone
recordsSkippedintegerNumber of records skipped because they already exist
totalRecordsParsedintegerTotal records found in the zone file

Error Port

On failure, the error port receives an object with code and message.

Sample Output

{
  "recordsAdded": 5,
  "recordsSkipped": 1,
  "totalRecordsParsed": 6
}

Expression Reference

ExpressionReturns
{{ $node.DnsImport.output.recordsAdded }}Count of newly created records
{{ $node.DnsImport.output.recordsSkipped }}Count of already-existing records skipped
{{ $node.DnsImport.output.totalRecordsParsed }}Total records in the zone file

Node Policies & GuardRails

PolicyDetail
Validate zone file before importRun the zone file through a BIND syntax validator before passing it to this node — malformed files return errors
Require DNS.Edit tokenImport creates records and requires write permission
Store ApiToken in Credentials ManagerNever hardcode the token in configuration JSON
Import is non-destructiveExisting records are never overwritten — safe to import the same file multiple times; duplicates are skipped
Verify counts post-importCompare recordsAdded + recordsSkipped against totalRecordsParsed — if they do not match, some records failed silently

Examples

Example 1: Automated Provider Migration

Trigger: migration workflow initiated by ops team. Steps: (1) Read zone file from S3 bucket uploaded by the team. (2) Call dns/import with the file content. (3) Compare totalRecordsParsed against the expected count. (4) Send a Slack summary with recordsAdded and recordsSkipped counts.

Example 2: Restore from Backup

Connect to a Webhook trigger for "DNS restore" requests. Read the latest zone file from the dns-backups S3 bucket. Call dns/import. Log the restoration event with timestamp and record counts to the incident management system.

Example 3: Nightly Zone File Sync

A scheduled workflow reads a canonical zone file stored in a Git repository via an HTTP Request node. Calls dns/import to synchronize any new records added to the source of truth. Skipped records confirm no-change for existing entries. Alerts on recordsAdded > 0 for awareness.