SlideShare a Scribd company logo
Terraform
Best Practices and Deep Dive
Wojciech Krysmann
June 2018
Agenda: What?
How?
Why?
/wkrysmann
4
+43
Countries
+350M
+5,000
Employees
+4B
+35
Offices
MAU
Events/Day
5
Horizontals
New Ventures CarsReal Estate
Verticals
What?
7
Manual
Semi-automated
Infrastructure as code
Collaborative infrastructure as code
Evolution?
8
Manual
Semi-automated
Infrastructure as code
Collaborative infrastructure as code
Evolution?
Revolution!
9
Manual
Collaborative infrastructure as code
How?
11
Rules
12
Greenfield
13
Greenfieldmanual
changesNo
14
Automation
15
General best-practices
DO’s DONT’s
● Review plan prior to apply
● Save plan to file, and apply from it
● $ terraform fmt
● Enable bucket versioning for tfstate
● Do not use ‘-target’
● Do not keep too many resources in one
directory
● Do not create bucket per tfstate
● Don’t keep secrets in repo unencrypted
● Don’t try to build abstract / general
purpose modules
16
Implementation
17
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
18
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
Infrastructure repo
Infrastructure repo
⇐ Provider
⇐ Environment
⇐ Region
⇐ Project
⇐ Service
⇐ Code
⇐ Service
⇐ Code
Infrastructure repo
22
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
⇐ infrastructure catalog
⇐ Provider
⇐ Environment
⇐ Region
⇐ Code
App repo
main.tf (infra repo)
main.tf (app repo)
main.tf (app repo)
Data feed from infra repo ⇒
Data feed from infra repo ⇒
27
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
Outputs
Data sources
Workflow
31
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
32
IaaS workflow
Commit
Hook
Build
Deploy
...
33
Application
● Application code
● Runtime environment
Platform as a Service
● Instance
● Queue
● Database
Infrastructure as a Service
● VPC, Network, Gateways, ...
● DNS
● CDN
{
{Infrastructure
Service(s)
Feeds data
34
PaaS workflow
Commit
Hook
Build
Deploy
AMI-ID
Apply
35
Build
36
Deploy
Why?
38
Automating / Packer worflowWhat’s
your
IP?
What’s the
subnet of
Apollo 11?
Could you
whitelist my
service?
Atmosphere 2018: Wojciech Krysmann- INFRA AS CODE - TERRAFORM DEEP DIVE AND BEST PRACTICES
Atmosphere 2018: Wojciech Krysmann- INFRA AS CODE - TERRAFORM DEEP DIVE AND BEST PRACTICES
41
10.100.0.0/24
172.26.0.0/16
10.0.0.0/8192.168.0.0/24
10.255.255
10.100.0.0/24
42
10.100.0.0/24
172.26.0.0/16
10.0.0.0/8192.168.0.0/24
10.255.255
10.100.0.0/24
Let’s
have a
peering
No.
Granularity = faster, safer deploy
Centralisation = control, predictability
44
CDNasCod
Mon
No! I will
apply now
I will apply
now
45
Infra as Code
DNSasCode
CDNasCode
Monitorin
as Co
46
Infra as Code
DNSasCode
CDNasCode
Garlic as
Code
Platform as Code
Thank you!
Q & A?
#weAreHiring

More Related Content

PDF
Red Hat Summit 2017 - LT107508 - Better Managing your Red Hat footprint with ...
PDF
Storing your data in the cloud: doing right reversim 2018
PDF
Historical RDAP
PDF
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
PPTX
Pomerania Cloud case study - Openstack Day Warsaw 2017
PDF
Mobicents Summit 2012 - Alexandre Mendonca - Mobicents jDiameter
PPTX
SC4 Hangout - Luigi Selmi, Transport pilot architecture
PDF
Why Spark for large scale data analysis
Red Hat Summit 2017 - LT107508 - Better Managing your Red Hat footprint with ...
Storing your data in the cloud: doing right reversim 2018
Historical RDAP
Apache Flink Training Workshop @ HadoopCon2016 - #2 DataSet API Hands-On
Pomerania Cloud case study - Openstack Day Warsaw 2017
Mobicents Summit 2012 - Alexandre Mendonca - Mobicents jDiameter
SC4 Hangout - Luigi Selmi, Transport pilot architecture
Why Spark for large scale data analysis

What's hot (20)

PDF
Golang in TiDB (GopherChina 2017)
PDF
Ceph Day Santa Clara Welcome
PDF
Distributed Timeseries Database In Go (gophercon India 17)
PDF
CEPH DAY BERLIN - WELCOME
ODP
FOSSAsia 2016 - Shared storage management in the virtualization world
PDF
OpenNebulaConf2017EU: Growing into the Petabytes for Fun and Profit by Michal...
PDF
OpenNebulaConf2017EU: Welcome Talk State and Future of OpenNebula by Ignacio ...
PDF
OpenNebulaConf2017EU: Enabling Dev and Infra teams by Lodewijk De Schuyter,De...
PDF
Hadoop @ eBuddy
PDF
Monitoring your shiny new docker environment
PDF
OpenNebulaConf2017EU: Transforming an Old Supercomputer into a Cloud Platform...
PPTX
BDE SC4 Hangout - Hajira Jabeen, general architecture
PPTX
Talend connect BE Vincent Harcq - Talend ESB - DI
PDF
Head in the clouds @ bol.com
PPTX
CHAOS Platform presentation, The Royal Library in Copenhagen.
PPTX
Case Study
PDF
MongoDB .local Houston 2019: MongoDB Atlas Data Lake Technical Deep Dive
PDF
Technical Debt: An Anycast Story
PDF
GIS on Rails by Oleksandr Kychun
PDF
Globe Infographics
Golang in TiDB (GopherChina 2017)
Ceph Day Santa Clara Welcome
Distributed Timeseries Database In Go (gophercon India 17)
CEPH DAY BERLIN - WELCOME
FOSSAsia 2016 - Shared storage management in the virtualization world
OpenNebulaConf2017EU: Growing into the Petabytes for Fun and Profit by Michal...
OpenNebulaConf2017EU: Welcome Talk State and Future of OpenNebula by Ignacio ...
OpenNebulaConf2017EU: Enabling Dev and Infra teams by Lodewijk De Schuyter,De...
Hadoop @ eBuddy
Monitoring your shiny new docker environment
OpenNebulaConf2017EU: Transforming an Old Supercomputer into a Cloud Platform...
BDE SC4 Hangout - Hajira Jabeen, general architecture
Talend connect BE Vincent Harcq - Talend ESB - DI
Head in the clouds @ bol.com
CHAOS Platform presentation, The Royal Library in Copenhagen.
Case Study
MongoDB .local Houston 2019: MongoDB Atlas Data Lake Technical Deep Dive
Technical Debt: An Anycast Story
GIS on Rails by Oleksandr Kychun
Globe Infographics
Ad

Similar to Atmosphere 2018: Wojciech Krysmann- INFRA AS CODE - TERRAFORM DEEP DIVE AND BEST PRACTICES (20)

PPTX
"Continuously delivering infrastructure using Terraform and Packer" training ...
PDF
Gotchas using Terraform in a secure delivery pipeline
PDF
Best Practices of Infrastructure as Code with Terraform
PDF
Infrastructure as Code with Terraform
PDF
Agiles Peru 2019 - Infrastructure As Code
PDF
Infrastructure as Code with Terraform
PPTX
Infrastructure as Code with Terraform.pptx
PDF
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
PDF
DevOps Fest 2020. immutable infrastructure as code. True story.
PDF
Workshop Infrastructure as Code - Suestra
PDF
Terraform in action
PPTX
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
PPTX
Immutable infrastructure isn’t the answer
PPTX
Terraform
PDF
Infrastructure as code managing servers in the cloud Morris 2024 scribd download
PPTX
Reusable, composable, battle-tested Terraform modules
PDF
Infrastructure as code managing servers in the cloud Morris
PPTX
Infrastructure as Code Presentation v5.pptx
PDF
Platform - Technical architecture
PPTX
Terraform - The Road to Self-Service
"Continuously delivering infrastructure using Terraform and Packer" training ...
Gotchas using Terraform in a secure delivery pipeline
Best Practices of Infrastructure as Code with Terraform
Infrastructure as Code with Terraform
Agiles Peru 2019 - Infrastructure As Code
Infrastructure as Code with Terraform
Infrastructure as Code with Terraform.pptx
Hashidays London 2017 - Evolving your Infrastructure with Terraform By Nicki ...
DevOps Fest 2020. immutable infrastructure as code. True story.
Workshop Infrastructure as Code - Suestra
Terraform in action
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
Immutable infrastructure isn’t the answer
Terraform
Infrastructure as code managing servers in the cloud Morris 2024 scribd download
Reusable, composable, battle-tested Terraform modules
Infrastructure as code managing servers in the cloud Morris
Infrastructure as Code Presentation v5.pptx
Platform - Technical architecture
Terraform - The Road to Self-Service
Ad

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
Approach and Philosophy of On baking technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
Spectroscopy.pptx food analysis technology
Approach and Philosophy of On baking technology
20250228 LYD VKU AI Blended-Learning.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

Atmosphere 2018: Wojciech Krysmann- INFRA AS CODE - TERRAFORM DEEP DIVE AND BEST PRACTICES