Skip to content

MaT1g3R/cloudflare-ddns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare DDNS

Use terraform to manage your cloudflare DNS records.

Setup

Usage

Initial Run

You will need to run this once by hand before you can use a cron job

git clone git@github.com:MaT1g3R/cloudflare-ddns.git
cd cloudflare-ddns
cp variables.example.json variables.json
vim variables.json  # Edit the variables
terraform init
# You might run into an error in the apply step saying record already exist.
# You can delete all of your existing DNS records and let terraform to create them.
# You can also try to import the existing records into your tfstate if you are adventurous.
# https://www.terraform.io/docs/import/index.html
terraform apply -var external_ip=$(./scripts/get-external-ip) -var-file=variables.json

Cronjob

Example crontab entry (update ip every 30 minutes), note the -input=false is required to skip interactive approval of plan before applying.

*/30 * * * * cd /home/me/terraform-cloudflare && /usr/local/bin/terraform apply -input=false -var external_ip=$(./scripts/get-external-ip) -var-file variables.json

About

Use terraform to update your cloudflare DNS records

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published