SlideShare a Scribd company logo
Building infrastructure
with Terraform
Radek Simko
$ whoami
radeksimko
}
twitter.com/
google.com/+
linkedin.com/in/
github.com/
Building infrastructure with Terraform (Google)
Provisioning of the past
● manual
● Shell, Perl
● extra knowledge required
○ bottleneck for team growth
● pure-ops task
○ devs & ops talking over a wall
Building infrastructure with Terraform (Google)
Provisioning today
● Chef, Puppet, Salt, Ansible
● knowledge codified
● de facto serves as documentation
● faster
● less error prone
● brings devs and ops closer
Infrastructure today
Hashicorp
Vagrant
● Virtualbox
● VMWare
● Docker
● AWS
● Google Cloud
● ...
Terraform
● AWS
● Azure
● Digital Ocean
● Google Cloud
● Docker
● OpenStack
● ...
Other solutions
● AWS CloudFormation
● Google Deployment Manager
● Heat (OpenStack)
● Puppet Cloud Provisioner
● Ansible
● SaltStack
● ...
XML
JSON
YAML
- states:
- QC: Quebec
- ON: Ontario
- BC: British Columbia
- YT: Yukon Territory
[
{
"states": [
{
"QC": "Quebec"
},
{
"true": "Ontario"
},
{
"BC": "British Columbia"
},
{
"YT": "Yukon Territory"
YAML
#cloud-config
_discovery_url: &ETCD_DISCOVERY_URL
url: "https://discovery.etcd.io/5416cf2db"
coreos:
fleet:
<<: *FLEET_METADATA
public-ip: $private_ipv4
etcd:
<<: *ETCD_DISCOVERY_URL
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
Building infrastructure with Terraform (Google)
Building infrastructure with Terraform (Google)
jsonnet
● 20% project of Dave Cunningham
● Turing-complete language
● allows building more abstraction layers
● compatible w/ Terraform
DSL
● referencing
● reusability (DRY)
● human-readability
Demo 1
Basic two-tier app (POC)
https://github.com/radeksimko/terraform-examples/tree/master/google-two-tier-simple
DSL
● provider
● resource (ID + reference name)
● count attribute
● variable
● output
● provisioner
● Reference: ${TYPE.NAME.ATTRIBUTE}
● Expansion: ${TYPE.NAME.*.ATTRIBUTE}
Provisioners
● local-exec
● remote-exec
● chef
● …
Demo 2
Two-tier app (Scalable)
https://github.com/radeksimko/terraform-examples/tree/master/google-two-tier-scalable
DSL - built-in functions
● file(path)
● format("web-%03d", count.index+1)
● formatlist("https://%s:%s/", aws_instance.
foo.*.public_dns, var.port)
● lookup(map, key)
● ...
How does it work?
Why Terraform? (overview)
● Provider-agnostic
● DSL (yet JSON-compatible)
Why Terraform?
● open to community
○ missing feature or bug != support ticket
Why Terraform?
● doesn’t “own” your whole account or resource “type”
Why Terraform?
● core features
○ aware of dependency graph between resources
○ transparent state (pros/cons)
■ resources import (in the future)
■ detailed plan
■ maintenance & atomicity & sharing in the team
State
...
"google_compute_firewall.consul_admin_node": {
"type": "google_compute_firewall",
"primary": {
"id": "consul-admin-firewall",
"attributes": {
"allow.#": "1",
"allow.803338340.ports.#": "1",
"allow.803338340.ports.1685985038": "22",
"allow.803338340.protocol": "tcp",
"id": "consul-admin-firewall",
"name": "consul-admin-firewall",
"network": "default",
"self_link": "https://www.googleapis.com/compute/v1/projects/skilled-bee-777/global/firewalls/consul-
admin-firewall",
"source_tags.#": "1",
"source_tags.3928264908": "consul-web-ui",
"target_tags.#": "1",
"target_tags.1747926572": "consul-node"
}
}
},
...
State
● terraform.tfstate (default)
● Atlas
● S3
● Consul
● HTTP
● OpenStack’ Swift
State - setup
terraform remote config 
-backend=consul 
-backend-config="address=demo.consul.io:80" 
-backend-config="path=tf"
State - referencing
resource "terraform_remote_state" "network" {
backend = "atlas"
config {
name = "timeinc/network-prod"
}
}
resource "google_compute_firewall" "default" {
network = "${terraform_remote_state.network.network-name}"
...
Modules
module "consul" {
source = "github.com/hashicorp/consul/terraform/aws"
servers = 3
}
variable "servers" {
default = 2
}
$ terraform get
Modules
./module/outputs.tf
output "ip" {
value = "${google_compute_instance.default.public_ip}"
}
./main.tf
module "consul" {
…
${module.consul.ip}
Demo 3
Consul cluster
https://github.com/radeksimko/terraform-examples/tree/master/google-consul-module
New provider?
~/.terraformrc:
providers {
privatecloud = "/path/to/privatecloud"
}
Custom provider?
package main
import (
"github.com/hashicorp/terraform/plugin"
)
func main() {
plugin.Serve(new(MyPlugin))
}
Under the hood - provider
● helper/schema
What’s next?
● Kubernetes provider
● Google backend service (HTTP LB)
● …
↓ SLIDES ↓
$ whoami
radeksimko
}
twitter.com/
google.com/+
linkedin.com/in/
github.com/
slideshare.net/

More Related Content

PDF
Terraform in action
Damien Pacaud
 
PDF
Terraform: Configuration Management for Cloud Services
Martin Schütte
 
PDF
Terraforming the Kubernetes Land
Radek Simko
 
PDF
Infrastructure as Code in Google Cloud
Radek Simko
 
PDF
Declarative & workflow based infrastructure with Terraform
Radek Simko
 
PDF
Terraform 0.9 + good practices
Radek Simko
 
PDF
Everything as Code with Terraform
All Things Open
 
PPTX
Effective terraform
Calvin French-Owen
 
Terraform in action
Damien Pacaud
 
Terraform: Configuration Management for Cloud Services
Martin Schütte
 
Terraforming the Kubernetes Land
Radek Simko
 
Infrastructure as Code in Google Cloud
Radek Simko
 
Declarative & workflow based infrastructure with Terraform
Radek Simko
 
Terraform 0.9 + good practices
Radek Simko
 
Everything as Code with Terraform
All Things Open
 
Effective terraform
Calvin French-Owen
 

What's hot (20)

PDF
Terraform: Cloud Configuration Management (WTC/IPC'16)
Martin Schütte
 
PDF
Infrastructure as Code with Terraform
Mario IC
 
PPTX
Infrastructure as Code: Introduction to Terraform
Alexander Popov
 
PDF
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
OpenCredo
 
PDF
Terraform: An Overview & Introduction
Lee Trout
 
PPTX
Terraform
Phil Wilkins
 
PDF
Terraform and cloud.ca
CloudOps2005
 
PPTX
"Continuously delivering infrastructure using Terraform and Packer" training ...
Anton Babenko
 
PPTX
Terraform Modules and Continuous Deployment
Zane Williamson
 
PDF
Infrastructure as code with Terraform
Sam Bashton
 
PPTX
Terraform at Scale
Calvin French-Owen
 
PDF
Case Study: Using Terraform and Packer to deploy go applications to AWS
Patrick Bolduan
 
PDF
Terraform – Infrastructure as Code (Kielux'18)
Martin Schütte
 
PDF
Rapid Infrastructure Provisioning
Uchit Vyas ☁
 
PDF
Best Practices of Infrastructure as Code with Terraform
DevOps.com
 
PPTX
Scaling terraform environments infracoders sydney 30 nov 2017
William Tsoi
 
PDF
Building infrastructure as code using Terraform - DevOps Krakow
Anton Babenko
 
PDF
Ground Control to Nomad Job Dispatch
Michael Lange
 
PDF
Refactoring terraform
Nell Shamrell-Harrington
 
PDF
Terraform Introduction
soniasnowfrog
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Martin Schütte
 
Infrastructure as Code with Terraform
Mario IC
 
Infrastructure as Code: Introduction to Terraform
Alexander Popov
 
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
OpenCredo
 
Terraform: An Overview & Introduction
Lee Trout
 
Terraform
Phil Wilkins
 
Terraform and cloud.ca
CloudOps2005
 
"Continuously delivering infrastructure using Terraform and Packer" training ...
Anton Babenko
 
Terraform Modules and Continuous Deployment
Zane Williamson
 
Infrastructure as code with Terraform
Sam Bashton
 
Terraform at Scale
Calvin French-Owen
 
Case Study: Using Terraform and Packer to deploy go applications to AWS
Patrick Bolduan
 
Terraform – Infrastructure as Code (Kielux'18)
Martin Schütte
 
Rapid Infrastructure Provisioning
Uchit Vyas ☁
 
Best Practices of Infrastructure as Code with Terraform
DevOps.com
 
Scaling terraform environments infracoders sydney 30 nov 2017
William Tsoi
 
Building infrastructure as code using Terraform - DevOps Krakow
Anton Babenko
 
Ground Control to Nomad Job Dispatch
Michael Lange
 
Refactoring terraform
Nell Shamrell-Harrington
 
Terraform Introduction
soniasnowfrog
 
Ad

Viewers also liked (20)

PPTX
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
 
PPTX
Comprehensive Terraform Training
Yevgeniy Brikman
 
PDF
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
Stephane Jourdan
 
PPTX
Managing AWS infrastructure using CloudFormation
Anton Babenko
 
PPTX
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Docker, Inc.
 
PPTX
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman
 
PDF
Dust.js
Yevgeniy Brikman
 
PDF
CloudFormation vs Terraform vs Ansible
Mattias Gees
 
PDF
Startup DNA: Speed Wins
Yevgeniy Brikman
 
PDF
Rapid prototyping
Yevgeniy Brikman
 
PPTX
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Nati Shalom
 
PPTX
Startup Ideas and Validation
Yevgeniy Brikman
 
PDF
Build Features, Not Apps
Natasha Murashev
 
PDF
Infrastructure as code: Cloud-Umgebungen mit Terraform verwalten
inovex GmbH
 
PDF
Terraform
Christophe Marchal
 
PPTX
Enabling Microservices Frameworks to Solve Business Problems
Ken Owens
 
PDF
Rooting Out Root: User namespaces in Docker
Phil Estes
 
PDF
Terraform始めました
w1mvy pine
 
PPTX
Navy advancementcenter v2
Tony Astro - Veteran Counselor & Entrepreneur
 
PDF
ContainerDays Boston 2016: "Autopilot: Running Real-world Applications in Con...
DynamicInfraDays
 
An intro to Docker, Terraform, and Amazon ECS
Yevgeniy Brikman
 
Comprehensive Terraform Training
Yevgeniy Brikman
 
Using Terraform.io (Human Talks Montpellier, Epitech, 2014/09/09)
Stephane Jourdan
 
Managing AWS infrastructure using CloudFormation
Anton Babenko
 
Orchestrating Docker with Terraform and Consul by Mitchell Hashimoto
Docker, Inc.
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Yevgeniy Brikman
 
CloudFormation vs Terraform vs Ansible
Mattias Gees
 
Startup DNA: Speed Wins
Yevgeniy Brikman
 
Rapid prototyping
Yevgeniy Brikman
 
Orchestration tool roundup kubernetes vs. docker vs. heat vs. terra form vs...
Nati Shalom
 
Startup Ideas and Validation
Yevgeniy Brikman
 
Build Features, Not Apps
Natasha Murashev
 
Infrastructure as code: Cloud-Umgebungen mit Terraform verwalten
inovex GmbH
 
Enabling Microservices Frameworks to Solve Business Problems
Ken Owens
 
Rooting Out Root: User namespaces in Docker
Phil Estes
 
Terraform始めました
w1mvy pine
 
ContainerDays Boston 2016: "Autopilot: Running Real-world Applications in Con...
DynamicInfraDays
 
Ad

Similar to Building infrastructure with Terraform (Google) (20)

PDF
Infrastructure as Code with Terraform
Pedro J. Molina
 
PDF
Infrastructure as Code with Terraform
Tim Berry
 
PDF
Terraform at Scale - All Day DevOps 2017
Jonathon Brouse
 
PDF
Terraform introduction
Jason Vance
 
PDF
Workshop Infrastructure as Code - Suestra
Mario IC
 
PDF
Infrastructure as Code - Terraform - Devfest 2018
Mathieu Herbert
 
PDF
Terraforming your Infrastructure on GCP
Samuel Chow
 
PDF
Terraform - Taming Modern Clouds
Nic Jackson
 
PDF
Infrastructure as Code with Terraform
Mathieu Herbert
 
PDF
Understanding AWS with Terraform
Knoldus Inc.
 
PDF
TIAD : Automating the modern datacenter
The Incredible Automation Day
 
PDF
Infrastructure as code terraformujeme cloud
ViliamPucik
 
PDF
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
NETWAYS
 
PDF
DevOps Braga #9: Introdução ao Terraform
DevOps Braga
 
PDF
London HUG 12/4
London HashiCorp User Group
 
PDF
Agiles Peru 2019 - Infrastructure As Code
Mario IC
 
PPTX
Infrastructure as Code with Terraform.pptx
Samuel862293
 
PDF
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
PDF
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 
PDF
Terraform-2.pdf
rutiksankapal21
 
Infrastructure as Code with Terraform
Pedro J. Molina
 
Infrastructure as Code with Terraform
Tim Berry
 
Terraform at Scale - All Day DevOps 2017
Jonathon Brouse
 
Terraform introduction
Jason Vance
 
Workshop Infrastructure as Code - Suestra
Mario IC
 
Infrastructure as Code - Terraform - Devfest 2018
Mathieu Herbert
 
Terraforming your Infrastructure on GCP
Samuel Chow
 
Terraform - Taming Modern Clouds
Nic Jackson
 
Infrastructure as Code with Terraform
Mathieu Herbert
 
Understanding AWS with Terraform
Knoldus Inc.
 
TIAD : Automating the modern datacenter
The Incredible Automation Day
 
Infrastructure as code terraformujeme cloud
ViliamPucik
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
NETWAYS
 
DevOps Braga #9: Introdução ao Terraform
DevOps Braga
 
Agiles Peru 2019 - Infrastructure As Code
Mario IC
 
Infrastructure as Code with Terraform.pptx
Samuel862293
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 
Terraform-2.pdf
rutiksankapal21
 

Recently uploaded (20)

PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Doc9.....................................
SofiaCollazos
 
The Future of Artificial Intelligence (AI)
Mukul
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 

Building infrastructure with Terraform (Google)