Manage Cloudflare DNS records
Manage Cloudflare DNS records on a zone
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set cloudflare-ts-dnscd pulumi-examples/cloudflare-ts-dnsManages a set of DNS records on a
Cloudflare zone — an A record, a CNAME, and a TXT record.
Prerequisites#
-
A domain already added to Cloudflare as a zone.
-
Create a Cloudflare API token with DNS edit permissions, and export it:
Terminal window export CLOUDFLARE_API_TOKEN=<your-token>
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init dev -
Set the zone to manage (find the zone ID on your domain’s overview page in the Cloudflare dashboard):
Terminal window pulumi config set zoneId <your-zone-id> -
Install dependencies and deploy:
Terminal window npm installpulumi up -
Inspect the created records:
Terminal window pulumi stack output records
Cleaning up#
pulumi destroypulumi stack rm dev