Skip to content

clayshek/cloudflare-dns-terraform-cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloudflare-dns-terraform-cloud

Overview

Terraform config template for Cloudflare DNS, with Terraform Cloud integration via GitHub Actions.

https://blog.clayshekleton.com/Cloudflare-DNS-TF-Cloud-GitHub-Actions/

Prerequisites

Usage

  • In your Terraform Cloud organization, create new Workspace, of type API-driven workflow
  • Fork this repo (suggest a private repo). This uses the Cloudflare Terraform provider
  • Edit cloud.tf, add values for your TF Cloud Organization and Workspace name
  • Edit zone-records.auto.tfvars, add values for your Cloudflare zone id, domain suffix, and values for DNS records.
  • In Terraform Cloud, create a new Token for GitHub Actions to use
  • Add a new Actions Secret to your GitHub repo, named TF_API_TOKEN, for the token created in prior step
  • In Cloudflare, create an API token, using "Edit zone DNS" token template, to enable updating the zone in scope
  • Add a new Actions Secret to your GitHub repo, named CLOUDFLARE_API_TOKEN for the token created in prior step
  • If all is setup correctly, updates to your repo's main branch should start an Action initiated run in Terraform Cloud, and update the Cloudflare DNS zone

References: