In this Meetup we will give a short introduction to Terraform and how you can use the tool to manage DNS records on Cloudflare in a convenient and audit-proof way.
2. Our Situation
- DNS Provider Cloudflare
- 6 Root Domains
- 250 DNS Records
- Manual Managed
- Tasks:
- Migration to new Kubernetes cluster - switch every DNS entry
- Disaster Recovery easy way to change loadbalancer IP
5. 1. Import all Zones
cf-terraforming generate --email <email> --key <key> --resource-type cloudflare_zone > zones.tf
cf-terraforming import --email <email> --key <key> --resource-type cloudflare_zone > imports.sh
2. Import all DNS Records for Zones
cf-terraforming generate --email <email> --key <key> -z <zone_id> --resource-type cloudflare_record >
records.tf
cf-terraforming import --email <email> --key <key> -z <zone_id> --resource-type cloudflare_record >
imports.sh
Tool
https://github.com/cloudflare/cf-terraforming
Importing Existing Ressources
6. Terraform State File & Backends
State File contain all information about infrastructure, internal relationships,
and secrets in PLAIN TEXT
Use Encrypted Cloud Backend (e.g. Postgres, S3 …)
backend "s3" {
key = "meetup-state/terraform.tfstate"
bucket = "uninow-terraform"
region = "eu-central-1"
}
8. Checkout
uninow.io - Next week: Slides
Upcoming Meetup:
07.04.22 Algolia: How to build a modern search experience
05.05.22 Lottie: Creating cool Animations for React and React Native
06.06.22 Continuous Deployment with GitHub Actions and ArgoCD
07.07.22 React Native App Testing with Detox
04.08.22 Building a full Disaster Recovery for Kubernetes