SlideShare a Scribd company logo
1 of 21
TERRAFORM – DEVOPS
@2020 copyright KalKey training
TERRAFORM
A. Introduction:
• What is Terrafrom
• Why use Terraform
• Providers
B. Installation & Setting up Lab
• Installing Terraform – Windows users
• Installing Terraform – Linux users
• Setting up AWS Account
C. Deploying Infrastructure with Terraform
• Creating First EC2 Instance with Terraform
• Understanding Resources and Providers
• Destroying Infrastructure with Terraform
• Terraform state
@2020 copyright KalKey training
D. Interpolation, Attributes & Variables:
• Attributes and Output Values
• Referencing Cross-Account Resource Attributes
• Terraform Variables
E. Terraform Provisioners
• Understanding Provisioners in
Terraform
• Implementing remote-exec
provisioners
• Implementing local-exec
provisioners
@2020 copyright KalKey training
F. Terraform Modules & Workspaces:
• DRY Principle
• Implementing EC2 module with Terraform
• Variables and Terraform Modules
• Terraform Workspace
G. Discussions
@2020 copyright KalKey training
A. INTRODUCTION
What is Terraform?
• Terraform is a tool for building, changing, and versioning
infrastructure safely and efficiently. Terraform can manage existing
and popular service providers as well as custom in-house solutions.
• Configuration files describe to Terraform the components needed
to run a single application or your entire datacenter. Terraform
generates an execution plan describing what it will do to reach the
desired state, and then executes it to build the described
infrastructure. As the configuration changes, Terraform is able to
determine what changed and create incremental execution plans
which can be applied.
• The infrastructure Terraform can manage includes low-level
components such as compute instances, storage, and networking, as
well as high-level components such as DNS entries, SaaS features, etc.
@2020 copyright KalKey training
Key Features:
Infrastructure as Code
Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your
datacenter to be versioned and treated as you would any other code. Additionally, infrastructure
can be shared and re-used.
Execution Plans
Terraform has a "planning" step where it generates an execution plan. The execution plan shows
what Terraform will do when you call apply. This lets you avoid any surprises when Terraform
manipulates infrastructure.
Change Automation
Complex changesets can be applied to your infrastructure with minimal human interaction. With
the previously mentioned execution plan and resource graph, you know exactly what Terraform
will change and in what order, avoiding many possible human errors.
@2020 copyright KalKey training
@2020 copyright KalKey training
@2020 copyright KalKey training
@2020 copyright KalKey training
B. INSTALLATION & SETTING UP LAB
• yum update
• yum install wget unzip
• sudo wget https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip
• mv terraform_0.12.2_linux_amd64.zip /usr/local/bin/
• cd /usr/local/bin/
• unzip ./terraform_0.12.2_linux_amd64.zip
• terraform –v
@2020 copyright KalKey training
@2020 copyright KalKey training
C. Deploying Infrastructure with Terraform
• Creating First EC2 Instance with Terraform
1. Go to AWS console and launch an ec2 instance to manage or create the
infrastructure . Install terraform on that and configure the environment path.
2. Now create a file with terraform code with .tf extension to launch an ec2-instance
.
3. It can be written in HCL (Hashicorp Configuration Language) or JSON.
@2020 copyright KalKey training
Authentication with AWS
@2020 copyright KalKey training
• Creating and Configuring IAM User
@2020 copyright KalKey training
• Example:
provider "aws" {
region = "us-west-2"
access_key = "PUT-YOUR-ACCESS-KEY-HERE"
secret_key = "PUT-YOUR-SECRET-KEY-HERE"
}
resource "aws_instance" "myec2" {
ami = "ami-082b5a644766e0e6f"
instance_type = "t2.micro"
}
@2020 copyright KalKey training
• Commands :
1. $ terraform init // initializing and installing the plugins
2. $ terraform validate // validating the terraform files
3. $ terraform plan //testing the configuration files before run
4. $ terraform apply //applying and running the code mentioned
inside the terraform files
@2020 copyright KalKey training
@2020 copyright KalKey training
• Destroying Infrastructure with Terraform
terraform destroy // destroy all resources mention in the .tf file
terraform destroy -target aws_instance.myec2 // destroy the target only
=> After destroying the resources do comment out the resources inside terraform
file. Otherwise it will recreate again
Infrastructure managed by Terraform will be destroyed. This will ask for
confirmation before destroying. The terraform destroy command terminates
resources defined in your Terraform configuration. This command is the
reverse of terraform apply in that it terminates all the resources specified by
the configuration. It does not destroy resources running elsewhere that are
not described in the current configuration.
@2020 copyright KalKey training
• Terraform State
Terraform must store state about your managed infrastructure and configuration. This state is
used by Terraform to map real world resources to your configuration, keep track of metadata,
and to improve performance for large infrastructures. This state is stored by default in a
local file named "terraform.
Desired State:
It is the state where you have defined in your configuration, with the actual state of your
existing resources.
Current State:
Current configuration which is running in the environment and mentioned in the local file.
@2020 copyright KalKey training
@2020 copyright KalKey training
To refresh the current state:
terraform refresh
 Scenario:
If you change a parameter manually in any services inside AWS and then you want to
roll back to previous value then it is mandatory to have it inside the desired state files.
@2020 copyright KalKey training

More Related Content

What's hot

(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014Amazon Web Services
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesSlideTeam
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as codeAxel Quack
 
Deploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSDeploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSLaura Frank Tacho
 
Terraform day 2
Terraform day 2Terraform day 2
Terraform day 2Kalkey
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For DevelopmentLaura Frank Tacho
 
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Adin Ermie
 
Infrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformInfrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformAdin Ermie
 
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Amazon Web Services
 
Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh CodeOps Technologies LLP
 
Securing Containers - Sathyajit Bhat - Adobe
Securing Containers - Sathyajit Bhat - AdobeSecuring Containers - Sathyajit Bhat - Adobe
Securing Containers - Sathyajit Bhat - AdobeCodeOps Technologies LLP
 
Aeolus - Clouds Flying in Assembly
Aeolus - Clouds Flying in AssemblyAeolus - Clouds Flying in Assembly
Aeolus - Clouds Flying in Assemblylutter
 
Azure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesAzure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesWojciech Barczyński
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014Amazon Web Services
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSCodeOps Technologies LLP
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with TerraformKnoldus Inc.
 
Container Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and KubernetesContainer Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and KubernetesWill Hall
 
How Cloudify uses Chef as a Foundation for PaaS
How Cloudify uses Chef as a Foundation for PaaSHow Cloudify uses Chef as a Foundation for PaaS
How Cloudify uses Chef as a Foundation for PaaSNati Shalom
 

What's hot (20)

(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
(APP309) Running and Monitoring Docker Containers at Scale | AWS re:Invent 2014
 
Final terraform
Final terraformFinal terraform
Final terraform
 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
 
Deploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKSDeploying a Kubernetes App with Amazon EKS
Deploying a Kubernetes App with Amazon EKS
 
Terraform day 2
Terraform day 2Terraform day 2
Terraform day 2
 
Using Docker For Development
Using Docker For DevelopmentUsing Docker For Development
Using Docker For Development
 
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
 
Infrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using TerraformInfrastructure-as-Code (IaC) using Terraform
Infrastructure-as-Code (IaC) using Terraform
 
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
 
Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh Monitoring on Kubernetes using Prometheus - Chandresh
Monitoring on Kubernetes using Prometheus - Chandresh
 
Securing Containers - Sathyajit Bhat - Adobe
Securing Containers - Sathyajit Bhat - AdobeSecuring Containers - Sathyajit Bhat - Adobe
Securing Containers - Sathyajit Bhat - Adobe
 
Cooling Tower
Cooling TowerCooling Tower
Cooling Tower
 
Aeolus - Clouds Flying in Assembly
Aeolus - Clouds Flying in AssemblyAeolus - Clouds Flying in Assembly
Aeolus - Clouds Flying in Assembly
 
Azure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesAzure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challenges
 
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
(APP313) NEW LAUNCH: Amazon EC2 Container Service in Action | AWS re:Invent 2014
 
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWSServerless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
Serverless Architectural Patterns 
and Best Practices - Madhu Shekar - AWS
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with Terraform
 
Container Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and KubernetesContainer Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and Kubernetes
 
How Cloudify uses Chef as a Foundation for PaaS
How Cloudify uses Chef as a Foundation for PaaSHow Cloudify uses Chef as a Foundation for PaaS
How Cloudify uses Chef as a Foundation for PaaS
 

Similar to Terraform day 1

Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.pptKalkey
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerCalvin French-Owen
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs PulumiHoaiNam307
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxLinode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxAkwasiBoateng6
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Deploy resources on Azure using IaC (Azure Terraform)
Deploy  resources on Azure using IaC (Azure Terraform)Deploy  resources on Azure using IaC (Azure Terraform)
Deploy resources on Azure using IaC (Azure Terraform)George Grammatikos
 
Terraform with OCI
Terraform with OCITerraform with OCI
Terraform with OCIJeSam Kim
 
"Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ..."Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ...Anton Babenko
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based TerraformAndrew Kirkpatrick
 
Collaborative Terraform with Atlantis
Collaborative Terraform with AtlantisCollaborative Terraform with Atlantis
Collaborative Terraform with AtlantisFerenc Kovács
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformTim Berry
 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...Alex Cachia
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxMrJustbis
 
Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Katherine Golovinova
 
Hashicorp-Certified-Terraform-Associate-v3-edited.pptx
Hashicorp-Certified-Terraform-Associate-v3-edited.pptxHashicorp-Certified-Terraform-Associate-v3-edited.pptx
Hashicorp-Certified-Terraform-Associate-v3-edited.pptxssuser0d6c88
 

Similar to Terraform day 1 (20)

Terraform day1
Terraform day1Terraform day1
Terraform day1
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.ppt
 
Terraform training 🎒 - Basic
Terraform training 🎒 - BasicTerraform training 🎒 - Basic
Terraform training 🎒 - Basic
 
Introduction to IAC and Terraform
Introduction to IAC and Terraform Introduction to IAC and Terraform
Introduction to IAC and Terraform
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and Power
 
Terraform vs Pulumi
Terraform vs PulumiTerraform vs Pulumi
Terraform vs Pulumi
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptxLinode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Getting Started with Terraform
Getting Started with TerraformGetting Started with Terraform
Getting Started with Terraform
 
Terraform
TerraformTerraform
Terraform
 
Deploy resources on Azure using IaC (Azure Terraform)
Deploy  resources on Azure using IaC (Azure Terraform)Deploy  resources on Azure using IaC (Azure Terraform)
Deploy resources on Azure using IaC (Azure Terraform)
 
Terraform with OCI
Terraform with OCITerraform with OCI
Terraform with OCI
 
"Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ..."Continuously delivering infrastructure using Terraform and Packer" training ...
"Continuously delivering infrastructure using Terraform and Packer" training ...
 
Self-service PR-based Terraform
Self-service PR-based TerraformSelf-service PR-based Terraform
Self-service PR-based Terraform
 
Collaborative Terraform with Atlantis
Collaborative Terraform with AtlantisCollaborative Terraform with Atlantis
Collaborative Terraform with Atlantis
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
A brief introduction to IaC with Terraform by Kenton Robbins (codeHarbour May...
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptx
 
Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?Infrastructure as Code for Azure: ARM or Terraform?
Infrastructure as Code for Azure: ARM or Terraform?
 
Hashicorp-Certified-Terraform-Associate-v3-edited.pptx
Hashicorp-Certified-Terraform-Associate-v3-edited.pptxHashicorp-Certified-Terraform-Associate-v3-edited.pptx
Hashicorp-Certified-Terraform-Associate-v3-edited.pptx
 

More from Kalkey

Docker advance topic (2)
Docker advance topic (2)Docker advance topic (2)
Docker advance topic (2)Kalkey
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Kalkey
 
Sonarqube
SonarqubeSonarqube
SonarqubeKalkey
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicKalkey
 
Jenkins introduction
Jenkins introductionJenkins introduction
Jenkins introductionKalkey
 
Ansible day 3
Ansible day 3Ansible day 3
Ansible day 3Kalkey
 
Cloud computing 1
Cloud computing  1Cloud computing  1
Cloud computing 1Kalkey
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2Kalkey
 
Adnible day 2.ppt
Adnible day   2.pptAdnible day   2.ppt
Adnible day 2.pptKalkey
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.pptKalkey
 
Linux day 3ppt
Linux day 3pptLinux day 3ppt
Linux day 3pptKalkey
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.pptKalkey
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.pptKalkey
 
Docker advance topic
Docker advance topicDocker advance topic
Docker advance topicKalkey
 

More from Kalkey (16)

Docker advance topic (2)
Docker advance topic (2)Docker advance topic (2)
Docker advance topic (2)
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Nexus
NexusNexus
Nexus
 
Sonarqube
SonarqubeSonarqube
Sonarqube
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Jenkins introduction
Jenkins introductionJenkins introduction
Jenkins introduction
 
Intro
IntroIntro
Intro
 
Ansible day 3
Ansible day 3Ansible day 3
Ansible day 3
 
Cloud computing 1
Cloud computing  1Cloud computing  1
Cloud computing 1
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
 
Adnible day 2.ppt
Adnible day   2.pptAdnible day   2.ppt
Adnible day 2.ppt
 
Shell programming 1.ppt
Shell programming  1.pptShell programming  1.ppt
Shell programming 1.ppt
 
Linux day 3ppt
Linux day 3pptLinux day 3ppt
Linux day 3ppt
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.ppt
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
 
Docker advance topic
Docker advance topicDocker advance topic
Docker advance topic
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

Terraform day 1

  • 1. TERRAFORM – DEVOPS @2020 copyright KalKey training
  • 2. TERRAFORM A. Introduction: • What is Terrafrom • Why use Terraform • Providers B. Installation & Setting up Lab • Installing Terraform – Windows users • Installing Terraform – Linux users • Setting up AWS Account C. Deploying Infrastructure with Terraform • Creating First EC2 Instance with Terraform • Understanding Resources and Providers • Destroying Infrastructure with Terraform • Terraform state @2020 copyright KalKey training
  • 3. D. Interpolation, Attributes & Variables: • Attributes and Output Values • Referencing Cross-Account Resource Attributes • Terraform Variables E. Terraform Provisioners • Understanding Provisioners in Terraform • Implementing remote-exec provisioners • Implementing local-exec provisioners @2020 copyright KalKey training
  • 4. F. Terraform Modules & Workspaces: • DRY Principle • Implementing EC2 module with Terraform • Variables and Terraform Modules • Terraform Workspace G. Discussions @2020 copyright KalKey training
  • 5. A. INTRODUCTION What is Terraform? • Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. • Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied. • The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc. @2020 copyright KalKey training
  • 6. Key Features: Infrastructure as Code Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used. Execution Plans Terraform has a "planning" step where it generates an execution plan. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure. Change Automation Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors. @2020 copyright KalKey training
  • 10. B. INSTALLATION & SETTING UP LAB • yum update • yum install wget unzip • sudo wget https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip • mv terraform_0.12.2_linux_amd64.zip /usr/local/bin/ • cd /usr/local/bin/ • unzip ./terraform_0.12.2_linux_amd64.zip • terraform –v @2020 copyright KalKey training
  • 12. C. Deploying Infrastructure with Terraform • Creating First EC2 Instance with Terraform 1. Go to AWS console and launch an ec2 instance to manage or create the infrastructure . Install terraform on that and configure the environment path. 2. Now create a file with terraform code with .tf extension to launch an ec2-instance . 3. It can be written in HCL (Hashicorp Configuration Language) or JSON. @2020 copyright KalKey training
  • 13. Authentication with AWS @2020 copyright KalKey training
  • 14. • Creating and Configuring IAM User @2020 copyright KalKey training
  • 15. • Example: provider "aws" { region = "us-west-2" access_key = "PUT-YOUR-ACCESS-KEY-HERE" secret_key = "PUT-YOUR-SECRET-KEY-HERE" } resource "aws_instance" "myec2" { ami = "ami-082b5a644766e0e6f" instance_type = "t2.micro" } @2020 copyright KalKey training
  • 16. • Commands : 1. $ terraform init // initializing and installing the plugins 2. $ terraform validate // validating the terraform files 3. $ terraform plan //testing the configuration files before run 4. $ terraform apply //applying and running the code mentioned inside the terraform files @2020 copyright KalKey training
  • 18. • Destroying Infrastructure with Terraform terraform destroy // destroy all resources mention in the .tf file terraform destroy -target aws_instance.myec2 // destroy the target only => After destroying the resources do comment out the resources inside terraform file. Otherwise it will recreate again Infrastructure managed by Terraform will be destroyed. This will ask for confirmation before destroying. The terraform destroy command terminates resources defined in your Terraform configuration. This command is the reverse of terraform apply in that it terminates all the resources specified by the configuration. It does not destroy resources running elsewhere that are not described in the current configuration. @2020 copyright KalKey training
  • 19. • Terraform State Terraform must store state about your managed infrastructure and configuration. This state is used by Terraform to map real world resources to your configuration, keep track of metadata, and to improve performance for large infrastructures. This state is stored by default in a local file named "terraform. Desired State: It is the state where you have defined in your configuration, with the actual state of your existing resources. Current State: Current configuration which is running in the environment and mentioned in the local file. @2020 copyright KalKey training
  • 21. To refresh the current state: terraform refresh  Scenario: If you change a parameter manually in any services inside AWS and then you want to roll back to previous value then it is mandatory to have it inside the desired state files. @2020 copyright KalKey training