Skip to content

CLI that generates cloudflare-operator DNSRecord objects based on Cloudflare zonefiles.

Notifications You must be signed in to change notification settings

containeroo/cfop-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cfop-generator

cfop-generator converts a Cloudflare zone export file into Cloudflare Operator DNSRecord YAML manifests.

Requirements

  • Go 1.26.0+ if building from source.
  • A Cloudflare zone export file (plain text) as input.

Install

Build from source

go install github.com/containeroo/cfop-generator@latest

Run locally from this repository

go run . -file ./testdata/example.com.txt

Auth and setup

  • cfop-generator does not call Cloudflare APIs and does not require API credentials.
  • Authentication is handled later by the controller/operator that applies the generated YAML.
  • Export your zone file from Cloudflare first, then pass it with -file.

Usage

cfop-generator -file <zonefile> [-proxied=true|false] [-output <path>]
cfop-generator completion bash|zsh
cfop-generator version

Important flags

  • -file (required): path to the exported zone file.
  • -proxied (default true): sets spec.proxied for generated records.
  • -output (optional): writes output to a file using file mode 0600.

Examples

# Print YAML to stdout
cfop-generator -file ./example.com.txt

# Disable proxying in generated records
cfop-generator -file ./example.com.txt -proxied=false

# Write secure output file (mode 0600)
cfop-generator -file ./example.com.txt -output ./records.yaml

Shell completion

Completion scripts are generated by the CLI and are produced during release builds (they are not stored as static tracked assets in this repository).

Bash

cfop-generator completion bash > /usr/local/etc/bash_completion.d/cfop-generator
source /usr/local/etc/bash_completion.d/cfop-generator

Zsh

mkdir -p "${fpath[1]}"
cfop-generator completion zsh > "${fpath[1]}/_cfop-generator"
autoload -Uz compinit && compinit

Security notes

  • Zone files can contain infrastructure details; treat them as sensitive.
  • Prefer -output for local files so generated manifests are written with restrictive permissions (0600).
  • Review generated manifests before committing or sharing them.

Behavior notes

  • SOA and NS records are skipped.
  • MX and SRV records are validated for expected field counts.
  • Output order is deterministic for stable diffs and reproducible output.

About

CLI that generates cloudflare-operator DNSRecord objects based on Cloudflare zonefiles.

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •