No longer maintained, there is an official Cloudflare importer tool to import existing resources into terraform.
(Only tested with A, CAA, CNAME, MX, TXT records so far)
Requires Go >= 1.11
$ git clone [email protected]:emgag/cloudflare-terraform-import.git
$ go get && make
$ export CF_API_EMAIL="[email protected]"
$ export CF_API_KEY="..."
$ ./cti import example.org
- Copy contents of
import.tf
to your terraform config. - Review
- Run
import.sh
to import records into state