SlideShare a Scribd company logo
Terraform
Everything is Code
HELLO!
I am smalltown (Tom Tsai)
I am here because I want to share
something with you
You can find me at
smalltown@awsug.tw
2
3
Demo Code:
https://goo.gl/ubspPP
Why Coding?!
4
Handmade?
5
6
7
8
就 警
是 察
這 叔
個 叔
人 !
Benefits!!
▪ Reproducible
▪ Save Your Valuable Time
▪ Avoid Human Error
▪ Not Out of Date Like Document
9
DevOpsDays Taipei 2017 - Terraform: Everything Is Code
11
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
12
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
Infrastructure As Code in 200X...
13
YA! I can write code to
manage server
package 'tar' do
version '1.16.1'
action :install
end
Infrastructure As Code in 200X...
▪ Provision Procedure CM
Tool
14
Document:
- Easy Out of Date
- Hard to Maintain
Infrastructure As Code in 201X...
15
YA! I can write code to
manage cloud resource
resource "aws_s3_bucket" "b" {
bucket = "my_tf_test_bucket"
acl = "private"
tags { Name = "My bucket" }
}
Infrastructure As Code in 201X...
▪ Cloud Resource
Infrastructure As Code Tool
16
Document:
- Easy Out of Date
- Hard to Maintain
Google
Cloud Deployment Manager
Azure
Resource Manager
AWS
CloudFormation
Infrastructure As Code in 202X...
17
YA! I can write code to
manage cloud provider
resource "cloud_provider" "poc" {
type = "AWS"
region = "American"
feature = ["LB", "K8S"]
}
Infrastructure As Code in 202X...
▪ Cloud Provider Cloud
Provider As Code tool
18
Document:
- Easy Out of Date
- Hard to Maintain
19
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
My Tool Choose Guideline
20
用 HashiCorp
出的就對了!!
My Tool Choose Guideline
21
自從用了 HashiCorp 之後長高了
,變壯了,考試都得一百分呢!
呿...
不就只是長大了而已,我也會啊!
My Tool Choose Guideline
▪
▪
▪
▪
▫
▫
▫
22
Why Terrafrom?
23
Meet Requirement Yes Yes Yes Yes
Documentation Yes Yes Yes Yes
CLI Tool Yes Yes Yes Yes
Configuration Win Yes Yes Yes
Modularization Win Yes Yes Yes
Native No Yes Yes Yes
Cross Platform Yes No No No
Feeling Good Bad - -
24
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
Whole Picture
25
Makefile
Initial Backend
Get Modules
Plan Resources
Apply Resources
Test Resources
1. Init backend if
not exist
2. Get modules
from source
3. Plan desired
state with previous
one
4. Apply
resource, save
state to backend
5. Test resources
Folder Structure
26
COnfigurations
27
terrform.tfvars
variables.tf
s3.tf
bucket = "devopsdays_taipei"
acl = "public-read"
variable "bucket" {}
variable "acl" {}
resource "aws_s3_bucket" "app_s3" {
bucket = "${var.bucket}"
acl = "${var.acl}"
}
Generated Dynamic
Backends
▪
▫
▫
▫
▪ “Here”
28
Modules
▪ Don’t Reinventing The Wheel !
▪ Modules Are Used to Create Reusable
Components In Terraform
▪ Sources: Refer To “Here”
29
Testing
▪
▪ !
▪
30
Makefile
▪
▪
▪
▫
▫
31
Of Course, Version COntrol
▪
▪
32
33
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
Last Mile
▪
▪
▪
▪
▪
34
Yes, Integrate CI/CD Framework
35
Buildbot Drone Concourse
Ref
36
Infrastructure = Code
Why Terraform
Best My Practice
Integrate CI/CD Case Study
How To Rolling Update AWS ASG
37 Ref
How TO MainTain K8S Cluster
38 Ref
Exception: serverLess
39
Ref
請洽 AWS TW UG Cliff Lu (呂昭寬)
THANKS!
Any questions?
40

More Related Content

PDF
COSCUP 2017 - infrastructure As Code
PDF
Cloud Native User Group: Shift-Left Testing IaC With PaC
PDF
Infrastructure as code with Terraform
PDF
Kubernetes Summit 2018 - Kubernetes: Stateless -> Stateful
PDF
Managing GCP Projects with Terraform (devfest Pisa 2018)
PDF
Terraform
PDF
The 2nd half. Scaling to the next^2
PDF
Kubernetes User Group: 維運 Kubernetes 的兩三事
COSCUP 2017 - infrastructure As Code
Cloud Native User Group: Shift-Left Testing IaC With PaC
Infrastructure as code with Terraform
Kubernetes Summit 2018 - Kubernetes: Stateless -> Stateful
Managing GCP Projects with Terraform (devfest Pisa 2018)
Terraform
The 2nd half. Scaling to the next^2
Kubernetes User Group: 維運 Kubernetes 的兩三事

What's hot (20)

PDF
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
PDF
Reporting Large Environment Zabbix Database
PDF
TW SEAT - DevOps: Security 干我何事?
PDF
Micro services infrastructure with AWS and Ansible
PPTX
Externalized Spring Boot App Configuration
PDF
Using amazon web services with cold fusion 11
PDF
Kubernetes Summit 2019 - Harden Your Kubernetes Cluster
PDF
reBuy on Kubernetes
PDF
Wido den hollander cloud stack and ceph
PDF
RGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming Xie
PDF
Developing a user-friendly OpenResty application
PDF
Rihards Olups - Zabbix 3.0: Excited for new features?
PDF
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
PDF
Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017
PPTX
Node.js Internals and V8 / Operating System Interaction
PPTX
Taking Cloud to Extremes: Scaled-down, Highly Available, and Mission-critical...
PPTX
how to mesure web performance metrics
PDF
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
PDF
High Available Drupal
PDF
Global deduplication for Ceph - Myoungwon Oh
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
Reporting Large Environment Zabbix Database
TW SEAT - DevOps: Security 干我何事?
Micro services infrastructure with AWS and Ansible
Externalized Spring Boot App Configuration
Using amazon web services with cold fusion 11
Kubernetes Summit 2019 - Harden Your Kubernetes Cluster
reBuy on Kubernetes
Wido den hollander cloud stack and ceph
RGW Beyond Cloud: Live Video Storage with Ceph - Shengjing Zhu, Yiming Xie
Developing a user-friendly OpenResty application
Rihards Olups - Zabbix 3.0: Excited for new features?
Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!
Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017
Node.js Internals and V8 / Operating System Interaction
Taking Cloud to Extremes: Scaled-down, Highly Available, and Mission-critical...
how to mesure web performance metrics
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
High Available Drupal
Global deduplication for Ceph - Myoungwon Oh
Ad

Similar to DevOpsDays Taipei 2017 - Terraform: Everything Is Code (20)

PPTX
Terraform - The Road to Self-Service
PDF
DevOps Fest 2020. immutable infrastructure as code. True story.
PPTX
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
PPTX
Simplified CI/CD Flows for Salesforce via SFDX - Downunder Dreamin - Sydney
PDF
2019 StartIT - Boosting your performance with Blackfire
PPTX
Enterprise Development on a Shoestring Budget
PDF
Terraform: Infrastructure as Code
PDF
Version Control in Machine Learning + AI (Stanford)
PDF
EuroPython 2011 - How to build complex web applications having fun?
PDF
Comment améliorer le quotidien des Développeurs PHP ?
PPTX
Terraform Best Practices for Infrastructure Scaling
PDF
Simplicity 2.0 - Get the power back
PDF
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
PDF
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
PDF
Luis Majano The Battlefield ORM
PDF
Digital Forensics and Incident Response in The Cloud
PPTX
Power features in .NET 4: Investigating the features of .NET 4 which you don’...
PDF
OpenCL Programming 101
PPTX
Dev/Test in the Cloud - F
PDF
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
Terraform - The Road to Self-Service
DevOps Fest 2020. immutable infrastructure as code. True story.
There and Back Again (My DevOps journey) - DevOps Days Copenhagen 2018
Simplified CI/CD Flows for Salesforce via SFDX - Downunder Dreamin - Sydney
2019 StartIT - Boosting your performance with Blackfire
Enterprise Development on a Shoestring Budget
Terraform: Infrastructure as Code
Version Control in Machine Learning + AI (Stanford)
EuroPython 2011 - How to build complex web applications having fun?
Comment améliorer le quotidien des Développeurs PHP ?
Terraform Best Practices for Infrastructure Scaling
Simplicity 2.0 - Get the power back
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Devops Columbia October 2020 - Gabriel Alix: A Discussion on Terraform
Luis Majano The Battlefield ORM
Digital Forensics and Incident Response in The Cloud
Power features in .NET 4: Investigating the features of .NET 4 which you don’...
OpenCL Programming 101
Dev/Test in the Cloud - F
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
Ad

More from smalltown (20)

PDF
DevOpsDays Taipei 2025 - 為什麼你裝了一堆 O11y 工具,卻沒人用?🤷
PDF
DevOpsDays Taipei 2025 - 🚒 DevOps 救火隊的逆襲:如何擺脫永無止境的電話鈴聲
PDF
Kubernetes Summit 2024 - How GenAI Help you in K8s Ops
PDF
DevOpsDays Taipei 2024 - Evolution of DevOps: Lessons Learned from a Growing ...
PDF
SHOPLINE 職人聊天室: 警報管理 - 從系統和制度下手 By smalltown
PDF
Kubernetes Summit 2023: Head First Kubernetes
PDF
SRE Conference 2022 - How to Build a Healthy On-Call Culture
PDF
Kubernetes Summit 2021: Multi-Cluster - The Good, the Bad and the Ugly
PDF
DevOpsDays Taipei 2021 - How FinTech Embrace Change Management
PDF
Kubernetes Summit 2020 - DevOps: Where is My PodPod
PDF
CDK Meetup: Rule the World through IaC
PDF
AWS re:Invent re:Cap 2019: My ElasticSearch Journey on AWS
PDF
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
PDF
HashiCorp Vault Workshop:幫 Credentials 找個窩
PDF
Cloud Native User Group: Prometheus Day 2
PDF
DevOpsDays - DevOps: Security 干我何事?
PDF
AgileTW Feat. DevOpsTW: 維運 Kubernetes 的兩三事
PDF
Docker Summit 2016 - Kubernetes: Sweets and Bitters
PDF
AWS Connect 2017 - Container (feat. AWS)
PDF
DevOps Summit 2016 - The immutable Journey
DevOpsDays Taipei 2025 - 為什麼你裝了一堆 O11y 工具,卻沒人用?🤷
DevOpsDays Taipei 2025 - 🚒 DevOps 救火隊的逆襲:如何擺脫永無止境的電話鈴聲
Kubernetes Summit 2024 - How GenAI Help you in K8s Ops
DevOpsDays Taipei 2024 - Evolution of DevOps: Lessons Learned from a Growing ...
SHOPLINE 職人聊天室: 警報管理 - 從系統和制度下手 By smalltown
Kubernetes Summit 2023: Head First Kubernetes
SRE Conference 2022 - How to Build a Healthy On-Call Culture
Kubernetes Summit 2021: Multi-Cluster - The Good, the Bad and the Ugly
DevOpsDays Taipei 2021 - How FinTech Embrace Change Management
Kubernetes Summit 2020 - DevOps: Where is My PodPod
CDK Meetup: Rule the World through IaC
AWS re:Invent re:Cap 2019: My ElasticSearch Journey on AWS
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
HashiCorp Vault Workshop:幫 Credentials 找個窩
Cloud Native User Group: Prometheus Day 2
DevOpsDays - DevOps: Security 干我何事?
AgileTW Feat. DevOpsTW: 維運 Kubernetes 的兩三事
Docker Summit 2016 - Kubernetes: Sweets and Bitters
AWS Connect 2017 - Container (feat. AWS)
DevOps Summit 2016 - The immutable Journey

Recently uploaded (20)

PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
System and Network Administraation Chapter 3
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Transform Your Business with a Software ERP System
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
System and Network Administration Chapter 2
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
history of c programming in notes for students .pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
medical staffing services at VALiNTRY
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administraation Chapter 3
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Transform Your Business with a Software ERP System
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
System and Network Administration Chapter 2
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
history of c programming in notes for students .pptx
top salesforce developer skills in 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
wealthsignaloriginal-com-DS-text-... (1).pdf
medical staffing services at VALiNTRY
Digital Systems & Binary Numbers (comprehensive )
How to Migrate SBCGlobal Email to Yahoo Easily
Operating system designcfffgfgggggggvggggggggg
Computer Software and OS of computer science of grade 11.pptx
Design an Analysis of Algorithms II-SECS-1021-03

DevOpsDays Taipei 2017 - Terraform: Everything Is Code