https://github.com/containeroo/cfop-generator
CLI that generates cloudflare-operator DNSRecord objects based on Cloudflare zonefiles.
https://github.com/containeroo/cfop-generator
Last synced: 29 days ago
JSON representation
CLI that generates cloudflare-operator DNSRecord objects based on Cloudflare zonefiles.
- Host: GitHub
- URL: https://github.com/containeroo/cfop-generator
- Owner: containeroo
- Created: 2024-09-25T14:40:56.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2026-02-16T18:09:51.000Z (5 months ago)
- Last Synced: 2026-02-17T00:53:00.689Z (5 months ago)
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
go install github.com/containeroo/cfop-generator@latest
```
### Run locally from this repository
```bash
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
```bash
cfop-generator -file [-proxied=true|false] [-output ]
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
```bash
# 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
```bash
cfop-generator completion bash > /usr/local/etc/bash_completion.d/cfop-generator
source /usr/local/etc/bash_completion.d/cfop-generator
```
### Zsh
```bash
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.