Node.js adopting

TERRAFORM

The Challenge

The request

The risks

  • Two domains: iojs.org and nodejs.org
  • In total +60 DNS Records
  • In 30 days:
    • Requests: 2.78B
    • Data transfer: 1.84 PB
    • Page Views: 666.15M
    • Visits: 653.43M
    • API Requests: 64.47M

Cloudflare Instance

In the past...

Who?

Node.js - day to day

Structure:

Community

Build WG

Some of the Node.js Build ARM resources: 3 generations of Raspberry Pi and other ARMv7 & ARM64 hardware

Our mission is to provide Node.js Project and libuv with solid computing infrastructure in order to improve the quality of the software itself by targeting correctness, speed and compatibility and to ensure streamlined delivery of binaries and source code to end-users.

The plan

Terraform lifecycle

This tool is ideal if you already have Cloudflare resources defined but want to start managing them via Terraform, and don't want to spend the time to manually write the Terraform configuration to describe them.

cloudflare/cf-terraforming

Cloudflare Terraforming

TL;DR: Migration

cf-terraforming generate 
--resource-type "cloudflare_record" 
--token YOUR_TOKEN  
--zone YOUR_ZONE 
> dns_iojs_org.tf

Generate the files:

Import the state:

cf-terraforming generate 
--resource-type "cloudflare_record" 
--token YOUR_TOKEN  
--zone YOUR_ZONE 
> dns_iojs_org.tf
resource "cloudflare_record" "terraform_managed_resource_0f6b6757054fdba56c054cca6aecc9be" {
  name    = "iojs.org"
  proxied = false
  ttl     = 1
  type    = "A"
  value   = "138.197.224.240"
  zone_id = "REDACTED"
}

resource "cloudflare_record" "terraform_managed_resource_3e025abdebca0ae6576a71a2c26d2c1b" {
  name    = "www"
  proxied = false
  ttl     = 1
  type    = "A"
  value   = "138.197.224.240"
  zone_id = "REDACTED"
}

....

The generated content:

cf-terraforming import 
--resource-type "cloudflare_record" 
--token YOUR_TOKEN  
--zone YOUR_ZONE 
> dns_iojs_org.tf

The Strategy

The keys

Eliminate Risk

  • Use READ-ONLY tokens
  • Avoid polluting production environments/repos

Clear communication

Progressive adoption

  • Limit the decision makers
  • Share conclusions/changes/next steps in regular basis
  • Share regular updates with stakeholders
  • Build isolated POCs with a limit scope
  • Share knowledge and provide support

The code

The POC

Delete

Create

Update

The PR

Q&A