SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Nathan Handler
nhandler@yelp.com / @nathanhandler
Terraform all the Things
● Nathan Handler
● Yelp Site Reliability Engineer
● nhandler@yelp.com / @nathanhandler
Who am I?
Yelp’s Mission
Connecting people with great
local businesses.
The Old Way
aws ec2 run-instances 
--image-id ami-abcd1234 
--count 1 
--instance-type t2.micro 
--key-name demokey 
--security-group-ids sg-1a2b3c4d 
--subnet-id subnet-d4c3b2a1 
--iam-instance-profile Name=MyInstanceProfile 
--tag-specifications 
'ResourceType=instance,Tags=[ 
{Key=Environment,Value=Production}]' 
--region us-west-1
github.com/wallix/awless
Tools should not dictate your Processes
● Version Control
● Reviewable
● Utilizes existing APIs/SDKs
● No single vendor lock-in
What are we looking for?
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-2757f631"
instance_type = "t2.micro"
}
Why not CloudFormation?
Why not CloudFormation?
What about {Chef, Puppet, Ansible, …}?
Terrafor
m
Configuration
Management
Traps, Tips, and Gotchas
Scare Factor
AWS
NS1
resource "ns1_zone" "tld" {
zone = "terraform.example"
}
resource "ns1_record" "www" {
zone = "${ns1_zone.tld.zone}"
domain = "www.${ns1_zone.tld.zone}"
type = "CNAME"
ttl = 60
answers = {
answer = "sub1.${ns1_zone.tld.zone}"
}
answers = {
answer = "sub2.${ns1_zone.tld.zone}"
}
filters = {
filter = "select_first_n"
config = {
N = 1
}
}
}
SignalFx
variable "regions" {
default = ["regionA", "regionB", "regionC", "regionD"]
}
resource "signalform_detector" "application_delay" {
count = "${length(var.regions)}"
name = "max delay - ${var.regions[count.index]}"
description = "delay in region - ${var.regions[count.index]}"
program_text = <<-EOF
filters = filter("region","${var.regions[count.index]}")
signal = data("app.delay", filter=filters).max()
detect("Processing old messages 5m", when(signal > 60, "5m"))
EOF
rule {
description = "Max delay > 60s for 5m"
severity = "Critical"
detect_label = "Processing old messages since 5m"
notifications = ["Email,foo-alerts@bar.com"]
}
}
resource "signalform_dashboard" "queue_length_dashboard" {
name = "Queue Length Dashboard"
time_range = "-1h"
variable {
property = "region"
alias = "region"
values = ["regionA"]
values_suggested = "${var.regions}"
value_required = true
restricted_suggestions = true
}
chart {
chart_id = "${signalform_list_chart.queue_length.id}"
width = 6
row = 1
}
}
resource "signalform_list_chart" "queue_length" {
name = "queue length"
program_text = <<-EOF
filters = filter("device", "dm-0")
data("iostat.queue_length", filter=filters).mean().publish()
EOF
color_by = "Dimension"
refresh_interval = 60
sort_by = "-value"
}
Discovering Dynamic Resources
Fastly / Cloudflare
resource "fastly_service_v1" "demo" {
name = "demofastly"
domain {
name = "demo.notexample.com"
comment = "demo"
}
backend {
address = "127.0.0.1"
name = "localhost"
port = 80
}
force_destroy = true
vcl {
name = "my_custom_main_vcl"
content = "${file("${path.module}/my_custom_main.vcl")}"
main = true
}
vcl {
name = "my_custom_library_vcl"
content = "${file("${path.module}/my_custom_library.vcl")}"
}
}
resource "cloudflare_record" "foobar" {
domain = "${var.cloudflare_domain}"
name = "terraform"
value = "192.168.0.11"
type = "A"
ttl = 3600
}
State Management
Remote State
Locking
Makefile Wrapper
Access Keys
Permissions
Modules
Outputs
What do Outputs look like?
Rolling Back
Automatic Applications
Generated Terraform Code
Perfect World
Questions?
www.yelp.com/careers/
We're Hiring!
@YelpEngineering
fb.com/YelpEngineers
engineeringblog.yelp.com
github.com/yelp

Weitere ähnliche Inhalte

Was ist angesagt?

Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 ViewsEyal Vardi
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
Presentation of the new OpenERP API. Raphael Collet, OpenERP
Presentation of the new OpenERP API. Raphael Collet, OpenERPPresentation of the new OpenERP API. Raphael Collet, OpenERP
Presentation of the new OpenERP API. Raphael Collet, OpenERPOdoo
 
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)Brian Swartzfager
 
20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-finalDavid Lapsley
 
Client-side Rendering with AngularJS
Client-side Rendering with AngularJSClient-side Rendering with AngularJS
Client-side Rendering with AngularJSDavid Lapsley
 
Take Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksNodejsFoundation
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xEyal Vardi
 
Scala for the web Lightning Talk
Scala for the web Lightning TalkScala for the web Lightning Talk
Scala for the web Lightning TalkGiltTech
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS ServicesEyal Vardi
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORMOdoo
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0Eyal Vardi
 
Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片cfc
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOdoo
 
Take Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksNodejsFoundation
 

Was ist angesagt? (20)

Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Angular 2.0 Views
Angular 2.0 ViewsAngular 2.0 Views
Angular 2.0 Views
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Presentation of the new OpenERP API. Raphael Collet, OpenERP
Presentation of the new OpenERP API. Raphael Collet, OpenERPPresentation of the new OpenERP API. Raphael Collet, OpenERP
Presentation of the new OpenERP API. Raphael Collet, OpenERP
 
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
 
20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final20141001 delapsley-oc-openstack-final
20141001 delapsley-oc-openstack-final
 
Client-side Rendering with AngularJS
Client-side Rendering with AngularJSClient-side Rendering with AngularJS
Client-side Rendering with AngularJS
 
Rest with-spray
Rest with-sprayRest with-spray
Rest with-spray
 
Take Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorks
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Scala for the web Lightning Talk
Scala for the web Lightning TalkScala for the web Lightning Talk
Scala for the web Lightning Talk
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORM
 
Lucene
LuceneLucene
Lucene
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片Contagion的Ruby/Rails投影片
Contagion的Ruby/Rails投影片
 
Owl: The New Odoo UI Framework
Owl: The New Odoo UI FrameworkOwl: The New Odoo UI Framework
Owl: The New Odoo UI Framework
 
Take Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorks
 
Internal Hive
Internal HiveInternal Hive
Internal Hive
 
Thinking Beyond ORM in JPA
Thinking Beyond ORM in JPAThinking Beyond ORM in JPA
Thinking Beyond ORM in JPA
 

Ähnlich wie Scale 16x: Terraform all the Things

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverFastly
 
performance vamos dormir mais?
performance vamos dormir mais?performance vamos dormir mais?
performance vamos dormir mais?tdc-globalcode
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationSean Chittenden
 
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...InfluxData
 
Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningUchit Vyas ☁
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricksbcoca
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteBram Vogelaar
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
Node js introduction
Node js introductionNode js introduction
Node js introductionAlex Su
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as CodeAllan Shone
 
Intro to-rails-webperf
Intro to-rails-webperfIntro to-rails-webperf
Intro to-rails-webperfNew Relic
 
Icinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them allIcinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them allIcinga
 
Icinga Camp San Diego 2016 - Apify them all
Icinga Camp San Diego 2016 - Apify them allIcinga Camp San Diego 2016 - Apify them all
Icinga Camp San Diego 2016 - Apify them allIcinga
 

Ähnlich wie Scale 16x: Terraform all the Things (20)

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Terraform at Scale
Terraform at ScaleTerraform at Scale
Terraform at Scale
 
Perl basics for pentesters part 2
Perl basics for pentesters part 2Perl basics for pentesters part 2
Perl basics for pentesters part 2
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, EverAltitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
 
Polyglot parallelism
Polyglot parallelismPolyglot parallelism
Polyglot parallelism
 
performance vamos dormir mais?
performance vamos dormir mais?performance vamos dormir mais?
performance vamos dormir mais?
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern Automation
 
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...
Scott Anderson [InfluxData] | InfluxDB Tasks – Beyond Downsampling | InfluxDa...
 
Monkey man
Monkey manMonkey man
Monkey man
 
Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure Provisioning
 
Ansible tips & tricks
Ansible tips & tricksAnsible tips & tricks
Ansible tips & tricks
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
Zendcon 09
Zendcon 09Zendcon 09
Zendcon 09
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Managing Infrastructure as Code
Managing Infrastructure as CodeManaging Infrastructure as Code
Managing Infrastructure as Code
 
Intro to-rails-webperf
Intro to-rails-webperfIntro to-rails-webperf
Intro to-rails-webperf
 
Icinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them allIcinga Camp San Diego: Apify them all
Icinga Camp San Diego: Apify them all
 
Icinga Camp San Diego 2016 - Apify them all
Icinga Camp San Diego 2016 - Apify them allIcinga Camp San Diego 2016 - Apify them all
Icinga Camp San Diego 2016 - Apify them all
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Kürzlich hochgeladen (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Scale 16x: Terraform all the Things

Hinweis der Redaktion

  1. My name is Nathan Handler I work as a Site Reliability Engineer on the Operations team at Yelp Here is my email address and Twitter handle; feel free to contact me at any time
  2. Yelp's Mission is connecting people with great local businesses
  3. Yelp used to be run out of traditional datacenters. Adding a new server involved manually adjusting bind dns records, imaging the machine, and adding the host to Puppet so it could be properly configured.
  4. Suddenly, a wild cloud appeared! What do we do? How do we transition our workflows to be able to handle the cloud and the challenges it provides?
  5. We became very familiar with the AWS Console Each time we needed to launch an instance, we would click through this 7 page form Documenting this process is tough. We can include annotated screenshots, but they can't be easily searched and are painful to update. Luckily, Amazon has a command line interface (CLI) that we can use to ease this process...
  6. Unfortunately, this CLI is not the easiest to work with Lots of arguments are required to launch an instance It is quite easy to forget one (i.e. we often forgot to include the --iam-instance-profile) However, with these commands, we can at least document them in runbooks easily
  7. To help deal with the long/ugly commands, we created an internal tool (that we unfortunately never got around to open sourcing) similar to awless shown above. With this tooling, launching a single host is straightforward and easy. Code review is still tough. All we can do is review the command that is going to be run. We are still left guessing if it will do the right thing.
  8. With all three of these approaches, we are making changes in production, without a test suite, without code review, and without a version control system that we can use to easily rollback. This is crazy! We should be using tools that support our workflow. Our tools should not define our workflow.
  9. What are we looking for? We want a tool that is version control friendly. We need to be able to see who made changes, when, and why. Changes need to be reviewable using standard code review tools. Needing someone to watch over your shoulder is not acceptable It needs to utilize existing APIs/SDKs. A tool that uses Selenium to click through the web console would be too brittle and error prone Finally, the tool can't lock us in to a single vendor. We wanted to have the ability to migrate to a new vendor without having to learn a new tool and port all of our infra to it.
  10. We opted to use HashiCorp's Terraform, which checks all of those boxes
  11. What does terraform look like? In this simple example, we use the AWS provider to launch an ec2 instance. For this simple case, we only specify an instance type and ami. However, terraform is powerful enough to configure every aspect of these instances including networking and attached volume settings
  12. A common question asked when I mention we are a big user of AWS is why we don't use CloudFormation. CloudFormation can handle managing AWS resources...
  13. ...but what about NS1, signal fx, fastly, cloudflare, and other non-AWS resources? By using Terraform, we manage all of these resources with one common tool
  14. Terraform will create and manage the underlying resources for you. However, this just gives you a box You still need a classic configuration management tool to add stuff to the box and manage the contents after the box is up and running
  15. As with any tool, Terraform is not perfect. Here are a few of the gotchas that we encountered along the way
  16. One of the first hurdles we had to overcome with Terraform was the scare factor. In addition to being a new tool (to us), Terraform has the potential to modify (and thus break or destroy) all of our infrastructure While it does produce a plan of what changes it is planning to make, these plans can be a bit confusing and hard to understand at first It took us a while before we really got comfortable enough with Terraform to fully embrace it and not be afraid. There is no good way around this other than making lots of changes, reviewing a lot of plans, and testing in a staging environment until you build confidence
  17. One of the key hurdles we had to solve with AWS was how to manage resources in multiple AWS accounts While terraform does now have a concept of workspaces, we've opted to have separate directories for our different dev, stage, and prod regions. This makes it very obvious what environment we are modifying and means that a change in a dev region has zero chance of affecting prod It also splits up our infrastructure making it easier for multiple users to work on Terraform in parallel A tfvars file specifes the AWS account being managed. Additional tooling that I'll talk about later parses this file and sets the necessary environment variables based on ~/.aws/credentials
  18. Managing DNS in Terraform feels pretty natural. For records, you specify a zone, domain, type, and ttl. This works fine for a small number of records. However, we have a LOT of domains. It took the provider ~15 minutes to make a simple change (as it would try to refresh its local state) This made it slow to iterate and posed a problem during outages when trying to make DNS changes in a hurry. We ultimately worked around this by separating out our more critical DNS infrastructure into a separate state file
  19. Here is a sample of what managing NS1 with Terraform might look like. In this example, a zone is being created and then referenced in a new www CNAME record containing multiple answers and a filter, which shows that Terraform can even configure NS1 specific aspects of records.
  20. Last year, we created and open sourced a SignalFx Terraform provider called SignalForm.
  21. Using SingalForm, it is possible to manage SignalFx detectors, charts, and dashboards By managing these resources alongside our infrastructure, we can ensure that when we launch in a new region that detectors and dashboards get automatically created We can do other interesting stuff as well such as generating custom dashboards for each of our services
  22. While creating these dashboards, we frequently had to run `terraform destroy` to revert to a clean slate and then re-create everything. This was generally fine as we don't require perfect uptime from all of our dashboards However, re-creating a dashboard changed its URL. How can we easily keep track of where to find our dashboards? First solution involved a CLI tool that would output the URL for each SignalForm'ed dashboard Eventually, we created a provider for our internal URL shortener allowing us to generate memorable short URLs for each SingalForm'ed dashboard
  23. There weren't really any unexpected surprises with these providers. Due to rather significant differences in capabilities and features in the two providers, we haven't created a module to wrap the two and keep the configs in sync Instead, we manually configure each of them individually
  24. As you can see, the Terraform fastly provider supports fully configuring a fastly service. In this example, we define a domain, backend, and some custom vcl.
  25. The cloudflare provider is lot more simple. In this example, we define a simple A record. Cloudflare does not provide the same level of customization support as Fastly.
  26. Terraform maintains a local state file to map its resources to real world infra This file is updated after every change. Initially, we committed this file to git alongside our terraform code. However, it was quite common for users to forget to add this file after making a change. This would lead to Terraform not being aware of recently created infra and trying to re-create it (and other problems). By the nature of this file, it was also problematic if multiple people attempted to edit terraform at the same time
  27. We started out with local state as it is the default in Terraform and it made it easy to manually inspect the file as we were getting started However, terraform also supports storing this state file remotely To make sure that we would never forget to commit the state file again, we transitioned to managing the file in S3 At the time, we had to write some tooling to handle copying our existing file to S3. Now, terraform handles this in a rather seamless manner.
  28. We worked around the issue of multiple people simultaneously editing terraform by implementing locking via zookeeper Terraform versions greater than 0.9.0 have built-in locking capabilities for certain backends In the case of S3, this locking is done via DynamoDB
  29. We wrapped most of the core Terraform functionality inside of a Makefile This makes it possible to do any necessary setup before applying terraform and take some actions afterwards. It also gives us a way to support using multiple different versions of terraform for different parts of our infrastructure
  30. Each tool Terraform interacts with requires API keys. In some cases, like AWS, we have multiple accounts and therefore multiple API keys. Our Makefile has a target that will set all of the necessary environment variables for Terraform. It parses Terraform variables to determine the correct AWS profile to use. Other keys are pulled from dotfiles in the user's home directory
  31. By having Terraform manage all of our infrastructure, we had to start re-thinking permissions. Suddenly, adding a tag to an ec2 instance required s3 access (to update the remote state file) And launching a new machine required NS1 access to create its DNS records
  32. Terraform providers give you the core building blocks to model your infrastructure Modules in terraform behave similar to modules in other tools and allow you to group related components together into an easily reusable component They allow you to abstract away most of the implementation details and instead focus on modeling your infrastructure in a way that lines up with concepts familar to your developers
  33. When you apply terraform, it will handle creating all of the necessary resources. However, you often need to be able to find and interact with these resources afterwards. A common example is needing to add the IP address of a freshly launched server to a topology file somewhere. Outputs allow you to easily expose and retrieve these key attributes from among the thousands of non-essential attributes stored in Terraform.
  34. So what do Outputs actually look like? In this case, we define an output named 'ip' that has a value of an AWS elastic IP address's public ip. We could have just as easily defined an output corresponding to a Spot Fleet Request ID or an EC2 IP. When we run 'terraform apply', it clearly shows the outputs. We can also use the 'terraform output' command to manually query these values.
  35. Many companies require writing up change control documentation before shipping changes in production. A common component of such a document is a section explaining the planned rollback procedure in the event of issues Terraform makes this relatively easy. `git revert` and `terraform apply`. While this will restore your infrastructure to how it was before, it will not necessarily restore the systems running on that infra
  36. Automatically applying terraform is an issue we are currently working on. It is a bit scary as Terraform isn't the best about dealing with errors and will happily leave the infrastructure in a partially applied state However, it is necessary as we grow and have more people touching terraform at the same time Another issue with such a workflow is the tool doing the automatic applications (i.e. Jenkins) would need to have full access to AWS and all other vendors we use Automatic applications will also help cleanup our infrastructure in the event that it is manually modified outside of terraform (it will get brought back in sync)
  37. Certain tasks are quite hard to model in Terraform natively You can specify a `count` as a sort of loop and basic conditionals As your Terraform code grows and becomes more complex, you might want to consider creating a traditional script (python, golang, bash, etc) to output terraform code You can still use the traditional terraform tooling to apply/manage the changes; your code will just be simpler
  38. In a perfect world, launching in a new region would be as simple as adding the region to a list. The servers would get launched, dns records and dashboards created, and all is well in the world. While this is technically all possible with Terraform, in reality, it is a bit challenging in practice As noted, we were forced to separate our infrastructure into multiple state files for performance and isolation reasons Our method for doing this makes it difficult to easily share variables among a subset of folders We also often want to gradually launch a new region to be sure each of the various components functions correctly While we haven't quite achieved this perfect world scenario, Terraform has greatly simplified our infra management
  39. Questions?
  40. We're Hiring
  41. Here are some links if you want to learn more about Yelp