SlideShare a Scribd company logo
Terraform
Infrastructure as Code
- Pradeep Bhadani
About this Workshop
• Who am I?
• Workshop objective
• What we need?
Who am I?
Pradeep Bhadani
Big Data Engineer
Currently working at Hotels.com (brand of Expedia Group)
linkedin.com/in/pradeepbhadani/
Workshop Objective
• Getting started to manage AWS resource as code using Terraform
What we need?
• Access to AWS account
• Text Editor / IDE – Atom or IntelliJ
• Setup Terraform & awscli on workstation
Let’s get started
Legacy World: Problems
• Manual command
• Extensive Documents
• Human error
• Tons of shell scripts
• Time consuming process
• Boring tasks
• Hard to recover from failure
• Difficult to scale
Imagine a World
Imagine a World
• Manual commands No more manual commands
• Extensive Documents Self describing documents
• Human error No Human intervention
• Tons of shell scripts Not many shell scripts
• Time consuming process Speedy process
• Boring tasks Time for fun task
• Hard to recover from failure Fast recovery
• Difficult to scale Easy to scale
What is Infrastructure as Code (IAC) ?
• It is an approach to manage Systems, Networks etc.. through Source
code.
IAC Principles
• Consistent Infrastructure
• Easy to reproduce
• Easy to manage
• Ability to repeat
• Handles change in design
Different Tools
• Terraform
• Chef
• Ansible
• Puppet
• Salt
Terraform
Terraform allows to build, change and version our infrastructure in a
easy and efficient way
www.terraform.io
Terraform Providers
• 120+ providers
Features
• Infrastructure as Code
• Execution Plan
• State of Infrastructure
• Dependencies
• Resource Graphs
• Allow changes to infrastructure
Benefits of Terraform
• Code reuse
• Easy management of various type of resources
• Tagging resources
• Savings – Time and $$$
Terraform commands
• init
• Plan
• apply
• destroy
• fmt
• console
• ….
https://www.terraform.io/docs/commands/index.html
Lifecycle
> terraform init
> terraform plan
> terraform apply
> terraform destroy
Terraform state
• Local State
• On your workstation
• Remote State
• S3
• Consul
• Google Cloud Storage
https://www.terraform.io/docs/state/
Setup Terraform
Install Terraform
Test installation
https://www.terraform.io/intro/getting-started/install.html
$ brew install terraform
$ terraform -help
Install awscli
Install awscli package
Test installation
Configure
$ pip install awscli
$ aws help
$ aws configure
AWS Access Key ID [None]: AKIAXXXXXXEXAMPLE
AWS Secret Access Key [None]:XXXXXX/XXXXXXXEXAMPLE
Default region name [None]: us-west-2
Default output format [None]: json
Building Infra on AWS
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-west-2"
}
resource "aws_instance" ā€hello-world" {
ami = " ami-d874e0a0"
instance_type = "t2.micro"
}
Building Infra on AWS
provider "aws" {
# access_key = "ACCESS_KEY_HERE"
# secret_key = "SECRET_KEY_HERE"
profile = ā€demo"
region = "us-west-2"
}
resource "aws_instance" ā€hello-world" {
ami = " ami-d874e0a0"
instance_type = "t2.micro"
}
Other
• Terraform Interpolation:
https://www.terraform.io/docs/configuration/interpolation.html
• Terraform modules:
https://www.terraform.io/docs/modules/index.html
• Terraform Data Sources:
• https://www.terraform.io/docs/configuration/data-sources.html
Topics
• ā€œHello Worldā€ of Terraform
• Variables & outputs
• Remote execution
• userdata
• Data source
• Remote State
• Terraform Module
Demo
github.com/pradeepbhadani/tf-techknowday-workshop
Q&A
github.com/pradeepbhadani/tf-techknowday-workshop

More Related Content

What's hot (20)

PDF
Introduction to Kubernetes and Google Container Engine (GKE)
Opsta
Ā 
PPTX
Terraform modules restructured
Ami Mahloof
Ā 
PDF
Helm – The package manager for Kubernetes
FabianRosenthal1
Ā 
PDF
Terraform
Marcelo Serpa
Ā 
PPTX
DevOps with Kubernetes
EastBanc Tachnologies
Ā 
PPTX
Kubernetes for Beginners: An Introductory Guide
Bytemark
Ā 
PDF
Docker Introduction
Robert Reiz
Ā 
PDF
kubernetes - minikube - getting started
Munish Mehta
Ā 
PDF
Introduction to Docker Compose
Ajeet Singh Raina
Ā 
PPT
Docker introduction
Phuc Nguyen
Ā 
PDF
Terraform introduction
Jason Vance
Ā 
PDF
Getting Started with Kubernetes
VMware Tanzu
Ā 
PDF
Creating AWS infrastructure using Terraform
Knoldus Inc.
Ā 
PPTX
Kubernetes & Google Kubernetes Engine (GKE)
Akash Agrawal
Ā 
PPTX
Terraform
Phil Wilkins
Ā 
PPTX
Maven
Harshit Choudhary
Ā 
PPTX
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
Alex Cachia
Ā 
PPTX
Terraform
Adam Vincze
Ā 
PPTX
Transforming Organizations with CI/CD
Cprime
Ā 
PPTX
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
Simplilearn
Ā 
Introduction to Kubernetes and Google Container Engine (GKE)
Opsta
Ā 
Terraform modules restructured
Ami Mahloof
Ā 
Helm – The package manager for Kubernetes
FabianRosenthal1
Ā 
Terraform
Marcelo Serpa
Ā 
DevOps with Kubernetes
EastBanc Tachnologies
Ā 
Kubernetes for Beginners: An Introductory Guide
Bytemark
Ā 
Docker Introduction
Robert Reiz
Ā 
kubernetes - minikube - getting started
Munish Mehta
Ā 
Introduction to Docker Compose
Ajeet Singh Raina
Ā 
Docker introduction
Phuc Nguyen
Ā 
Terraform introduction
Jason Vance
Ā 
Getting Started with Kubernetes
VMware Tanzu
Ā 
Creating AWS infrastructure using Terraform
Knoldus Inc.
Ā 
Kubernetes & Google Kubernetes Engine (GKE)
Akash Agrawal
Ā 
Terraform
Phil Wilkins
Ā 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
Alex Cachia
Ā 
Terraform
Adam Vincze
Ā 
Transforming Organizations with CI/CD
Cprime
Ā 
What Is A Docker Container? | Docker Container Tutorial For Beginners| Docker...
Simplilearn
Ā 

Similar to Terraform: Infrastructure as Code (20)

PDF
Terraform In Action Meap V10 Meap Scott Winkler
heyenpardis0
Ā 
PPTX
Infrastructure as code, using Terraform
Harkamal Singh
Ā 
PPTX
Terraform day1
Gourav Varma
Ā 
PPTX
Infrastructure as Code with Terraform.pptx
Samuel862293
Ā 
PDF
Infrastructure as Code with Terraform
Pedro J. Molina
Ā 
PDF
Infrastructure as Code with Terraform and Ansible
DevOps Meetup Bern
Ā 
PPTX
Terraform infraestructura como código
Victor Adsuar
Ā 
PPTX
Terraform Basics
Mohammed Fazuluddin
Ā 
PDF
Provisioning infrastructure to AWS using Terraform – Exove
Exove
Ā 
PDF
Infrastructure as Code with Terraform
Tim Berry
Ā 
PDF
Best Practices of Infrastructure as Code with Terraform
DevOps.com
Ā 
PDF
DevOps Online Training
Visualpath Training
Ā 
PDF
Infrastructure as Code & Terraform 101
Kristoffer Ahl
Ā 
PDF
Introductory Overview to Managing AWS with Terraform
Michael Heyns
Ā 
PDF
Infrastructure as code
Aakash Singhal
Ā 
PPTX
Terraform day 1
Kalkey
Ā 
PPTX
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
AkwasiBoateng6
Ā 
PPTX
Terraform: Taming the Machines Through Continuous Integration
Justin Rice
Ā 
PDF
Introduce to Terraform
Samsung Electronics
Ā 
PPTX
Terraform infrastructure as code for mere mortals
Anderson Carvalho
Ā 
Terraform In Action Meap V10 Meap Scott Winkler
heyenpardis0
Ā 
Infrastructure as code, using Terraform
Harkamal Singh
Ā 
Terraform day1
Gourav Varma
Ā 
Infrastructure as Code with Terraform.pptx
Samuel862293
Ā 
Infrastructure as Code with Terraform
Pedro J. Molina
Ā 
Infrastructure as Code with Terraform and Ansible
DevOps Meetup Bern
Ā 
Terraform infraestructura como código
Victor Adsuar
Ā 
Terraform Basics
Mohammed Fazuluddin
Ā 
Provisioning infrastructure to AWS using Terraform – Exove
Exove
Ā 
Infrastructure as Code with Terraform
Tim Berry
Ā 
Best Practices of Infrastructure as Code with Terraform
DevOps.com
Ā 
DevOps Online Training
Visualpath Training
Ā 
Infrastructure as Code & Terraform 101
Kristoffer Ahl
Ā 
Introductory Overview to Managing AWS with Terraform
Michael Heyns
Ā 
Infrastructure as code
Aakash Singhal
Ā 
Terraform day 1
Kalkey
Ā 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
AkwasiBoateng6
Ā 
Terraform: Taming the Machines Through Continuous Integration
Justin Rice
Ā 
Introduce to Terraform
Samsung Electronics
Ā 
Terraform infrastructure as code for mere mortals
Anderson Carvalho
Ā 
Ad

More from Pradeep Bhadani (10)

PDF
GDG_Wroclaw_ Deploying_Cloud_Infrastructure_using_Terraform.pdf
Pradeep Bhadani
Ā 
PDF
MiniSPA2022_Build_and_Test_Cloud_Infrastructure_using_Terraform_Modules.pdf
Pradeep Bhadani
Ā 
PDF
Introduction to Google Cloud Platform
Pradeep Bhadani
Ā 
PDF
Getting started with BigQuery
Pradeep Bhadani
Ā 
PDF
Provision GCP resources using Terraform @ GDG Craiova
Pradeep Bhadani
Ā 
PDF
Introduction to Terraform and Google Cloud Platform
Pradeep Bhadani
Ā 
PDF
Hey Terraform, build me GCP Infrastructure
Pradeep Bhadani
Ā 
PDF
Hey Terraform, build me GCP Infrastructure
Pradeep Bhadani
Ā 
PDF
Cloud: Shift in the Mindset
Pradeep Bhadani
Ā 
PDF
GDG London Workshop: Build GCP infrastructure with Terraform
Pradeep Bhadani
Ā 
GDG_Wroclaw_ Deploying_Cloud_Infrastructure_using_Terraform.pdf
Pradeep Bhadani
Ā 
MiniSPA2022_Build_and_Test_Cloud_Infrastructure_using_Terraform_Modules.pdf
Pradeep Bhadani
Ā 
Introduction to Google Cloud Platform
Pradeep Bhadani
Ā 
Getting started with BigQuery
Pradeep Bhadani
Ā 
Provision GCP resources using Terraform @ GDG Craiova
Pradeep Bhadani
Ā 
Introduction to Terraform and Google Cloud Platform
Pradeep Bhadani
Ā 
Hey Terraform, build me GCP Infrastructure
Pradeep Bhadani
Ā 
Hey Terraform, build me GCP Infrastructure
Pradeep Bhadani
Ā 
Cloud: Shift in the Mindset
Pradeep Bhadani
Ā 
GDG London Workshop: Build GCP infrastructure with Terraform
Pradeep Bhadani
Ā 
Ad

Recently uploaded (20)

PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
Ā 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
Ā 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
Ā 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
Ā 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
Ā 
PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
Ā 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
Ā 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
Ā 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
Ā 
PDF
šŸš€ Let’s Build Our First Slack Workflow! šŸ”§.pdf
SanjeetMishra29
Ā 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
Ā 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
Ā 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
Ā 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
Ā 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
Ā 
PDF
ā€œA Re-imagination of Embedded Vision System Design,ā€ a Presentation from Imag...
Edge AI and Vision Alliance
Ā 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
Ā 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
Ā 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
Ā 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
Ā 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
Ā 
CapCut Pro PC Crack Latest Version Free Free
josanj305
Ā 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
Ā 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
Ā 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
Ā 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
Ā 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
Ā 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
Ā 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
Ā 
šŸš€ Let’s Build Our First Slack Workflow! šŸ”§.pdf
SanjeetMishra29
Ā 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
Ā 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
Ā 
Kubernetes - Architecture & Components.pdf
geethak285
Ā 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
Ā 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
Ā 
ā€œA Re-imagination of Embedded Vision System Design,ā€ a Presentation from Imag...
Edge AI and Vision Alliance
Ā 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
Ā 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
Ā 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
Ā 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
Ā 

Terraform: Infrastructure as Code