Name: cf2tf
Owner: Brave Software
Description: A Terraform importer for Cloudflare resources, inspired by terraforming
Created: 2017-08-24 04:30:02.0
Updated: 2018-04-18 16:57:12.0
Pushed: 2018-02-15 16:00:16.0
Size: 26
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Terraform importer for Cloudflare resources inspired by terraforming.
clone https://github.com/brave/cf2tf
install -g
You must export your Cloudflare credentials:
rt CLOUDFLARE_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
rt CLOUDFLARE_EMAIL=xxx@xxx.xxx
2tf --help
ands:
s import dns records
ons:
help Show help [boolean]
tfstate output tfstate [default: false]
2tf dns --help
f dns
ons:
help Show help [boolean]
tfstate output tfstate [default: false]
zone limit to a particular zone by name [default: ""]
The following example shows simulated output for a domain mysite.com
which has a single record, an apex CNAME to mysite.org
2tf dns --zone mysite.com > main.tf
t main.tf
"resource": {
"cloudflare_record": {
"mysite_com_CNAME_mysite_org": {
"domain": "mysite.com",
"name": "mysite.com",
"value": "mysite.org",
"type": "CNAME",
"proxied": false
}
}
}
2tf dns --zone mysite.com --tfstate > terraform.tfstate
t terraform.tfstate
"version": 1,
"serial": 1,
"modules": [
{
"path": [
"root"
],
"outputs": {},
"resources": {
"cloudflare_record.mysite_com_CNAME_mysite_org": {
"type": "cloudflare_record",
"depends_on": [],
"primary": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"attributes": {
"domain": "mysite.com",
"hostname": "mysite.com",
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "mysite.com",
"priority": "0",
"proxied": "false",
"ttl": "1",
"type": "CNAME",
"value": "mysite.org",
"zone_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"meta": {
"schema_version": "1"
},
"tainted": false
},
"deposed": [],
"provider": ""
}
},
"depends_on": []
}
]
Unlike terraforming, cf2tf outputs in the Terraform JSON configuration format. This can easily converted to hcl format via a tool like json2hcl.