Cloudflare provider for octoDNS
An octoDNS provider that targets Cloudflare.
Installation
Command line
pip install octodns-cloudflare
requirements.txt/setup.py
Pinning specific versions or SHAs is recommended to avoid unplanned upgrades.
Versions
# Start with the latest versions and don't just copy what's here
octodns==0.9.14
octodns-cloudflare==0.0.1
SHAs
# Start with the latest/specific versions and don't just copy what's here
-e git+https://git@github.com/octodns/octodns.git@9da19749e28f68407a1c246dfdf65663cdc1c422#egg=octodns
-e git+https://git@github.com/octodns/octodns-cloudflare.git@ec9661f8b335241ae4746eea467a8509205e6a30#egg=octodns_cloudflare
Configuration
providers:
cloudflare:
class: octodns_cloudflare.CloudflareProvider
email: env/CLOUDFLARE_EMAIL
token: env/CLOUDFLARE_TOKEN
account_id: env/CLOUDFLARE_ACCOUNT_ID
Note: The "proxied" flag of "A", "AAAA" and "CNAME" records can be managed via the YAML provider like so:
name:
octodns:
cloudflare:
proxied: true
ttl: 120
type: A
value: 1.2.3.4
Note: All record types support "auto" ttl, which is effectively equivalent to 300s.
name:
octodns:
cloudflare:
auto-ttl: true
ttl: 120
type: A
value: 1.2.3.4
Support Information
Records
CloudflareProvider supports A, AAAA, ALIAS, CAA, CNAME, DS, LOC, MX, NAPTR, NS, PTR, SPF, SRV, SSHFP, TXT, and URLFWD. There are restrictions on CAA tag support.
Root NS Records
CloudflareProvider does not supports root NS record management. They can partially be managed in the API, errors are thrown if you include the Cloudflare name servers in the values, but the system completely ignores the values set and serves up its own regardless.
Dynamic
CloudflareProvider does not support dynamic records.
Required API Token Permissions
Required Permissions for API Token are Zone:Read, DNS:Read, and DNS:Edit.
Page Rules:Edit is also required for managing Page Rules (URLFWD) records, otherwise an authentication error will be raised.
Important Note: When using a CloudFlare token you should NOT provide an email address or you will receive an error.
An example when using Page Rules (URLFWD) records -
TTL
Cloudflare has a different minimum TTL for enterprise and non-enterprise zones. See the documentation for more information.
In the past the CloudflareProvider had a fixed minimum TTL set to 120 seconds and for backwards compatibility this is the current default.
Processors
Processor | Description |
---|
ProxyCNAME | Allows Cloudflare proxied records to be used on other providers without exposing the proxied record value. Points other providers to the relevant .cdn.cloudflare.net subdomain. Useful to allow split authority with a secondary provider while still retaining Cloudflare benefits for certain records. |
TtlToProxy | Ensure Cloudflare's proxy status is setup depending on the TTL set for the record. This can be helpful for octodns_bind.ZoneFileSource or the like. |
Developement
See the /script/ directory for some tools to help with the development process. They generally follow the Script to rule them all pattern. Most useful is ./script/bootstrap
which will create a venv and install both the runtime and development related requirements. It will also hook up a pre-commit hook that covers most of what's run by CI.