SlideShare ist ein Scribd-Unternehmen logo
1 von 22
TERRAFORM –
DEVOPS
Day-1
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
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
• Integrating Ansible with Terraform
F. Terraform Modules & Workspaces:
• DRY Principle
• Implementing EC2 module with Terraform
• Variables and Terraform Modules
• Terraform Workspace
G. Terraform State:
• Local state & Remote State
• Configuring Remote State File S3
H. Discussions
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.
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.
B. INSTALLATION & SETTING UP
LAB
• Installing Terraform – Windows users or Linux Users
• To install Terraform on any supported system:
• Find the appropriate Terraform distribution package for your system and
download it. .
• After downloading Terraform, unzip the package to a directory of your
choosing.
• Optional but highly recommended: modify the path to include the directory
that contains the Terraform binary.
• After unzipping the package run ./terraform from command
• line and continue with your code..
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.
Authentication with AWS
• Creating and Configuring IAM User
• 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"
}
• 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
• 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.
• 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.
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.

Weitere ähnliche Inhalte

Was ist angesagt?

Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowAnton Babenko
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes VMware Tanzu
 
Deploying Azure DevOps using Terraform
Deploying Azure DevOps using TerraformDeploying Azure DevOps using Terraform
Deploying Azure DevOps using TerraformAdin Ermie
 
Terraform modules and (some of) best practices
Terraform modules and (some of) best practicesTerraform modules and (some of) best practices
Terraform modules and (some of) best practicesAnton Babenko
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraformJulien Pivotto
 
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
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & IntroductionLee Trout
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Infrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsInfrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsLior Kamrat
 
Kubernetes Security Best Practices - With tips for the CKS exam
Kubernetes Security Best Practices - With tips for the CKS examKubernetes Security Best Practices - With tips for the CKS exam
Kubernetes Security Best Practices - With tips for the CKS examAhmed AbouZaid
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Amazon Web Services
 
Dockers and containers basics
Dockers and containers basicsDockers and containers basics
Dockers and containers basicsSourabh Saxena
 

Was ist angesagt? (20)

Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
Deploying Azure DevOps using Terraform
Deploying Azure DevOps using TerraformDeploying Azure DevOps using Terraform
Deploying Azure DevOps using Terraform
 
Terraform modules and (some of) best practices
Terraform modules and (some of) best practicesTerraform modules and (some of) best practices
Terraform modules and (some of) best practices
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
An introduction to terraform
An introduction to terraformAn introduction to terraform
An introduction to terraform
 
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)
 
Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
Advanced Terraform
Advanced TerraformAdvanced Terraform
Advanced Terraform
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
Terraform Basics
Terraform BasicsTerraform Basics
Terraform Basics
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Infrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & ToolsInfrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & Tools
 
Introduce to Terraform
Introduce to TerraformIntroduce to Terraform
Introduce to Terraform
 
Kubernetes Security Best Practices - With tips for the CKS exam
Kubernetes Security Best Practices - With tips for the CKS examKubernetes Security Best Practices - With tips for the CKS exam
Kubernetes Security Best Practices - With tips for the CKS exam
 
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
Using HashiCorp’s Terraform to build your infrastructure on AWS - Pop-up Loft...
 
Dockers and containers basics
Dockers and containers basicsDockers and containers basics
Dockers and containers basics
 

Ähnlich wie Terraform day1

Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1Kalkey
 
DevOps Online Training | DevOps Training
DevOps Online Training | DevOps TrainingDevOps Online Training | DevOps Training
DevOps Online Training | DevOps TrainingVisualpath Training
 
Configuration management II - Terraform
Configuration management II - TerraformConfiguration management II - Terraform
Configuration management II - TerraformXavier Serrat Bordas
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packerAlex Landa
 
The hitchhiker's guide to terraform your infrastructure
The hitchhiker's guide to terraform your infrastructureThe hitchhiker's guide to terraform your infrastructure
The hitchhiker's guide to terraform your infrastructureFernanda Martins
 
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
 
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
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformTim Berry
 
"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
 
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
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.pptKalkey
 
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
 
Terraform + ansible talk
Terraform + ansible talkTerraform + ansible talk
Terraform + ansible talkJames Strong
 
OracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdfOracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdfStefan Oehrli
 

Ähnlich wie Terraform day1 (20)

Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1
 
DevOps Online Training | DevOps Training
DevOps Online Training | DevOps TrainingDevOps Online Training | DevOps Training
DevOps Online Training | DevOps Training
 
Terraform training 🎒 - Basic
Terraform training 🎒 - BasicTerraform training 🎒 - Basic
Terraform training 🎒 - Basic
 
Configuration management II - Terraform
Configuration management II - TerraformConfiguration management II - Terraform
Configuration management II - Terraform
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packer
 
The hitchhiker's guide to terraform your infrastructure
The hitchhiker's guide to terraform your infrastructureThe hitchhiker's guide to terraform your infrastructure
The hitchhiker's guide to terraform your infrastructure
 
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...
 
TA-002-P.pdf
TA-002-P.pdfTA-002-P.pdf
TA-002-P.pdf
 
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 tfstate
Terraform tfstateTerraform tfstate
Terraform tfstate
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
"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 ...
 
Terraform Abstractions for Safety and Power
Terraform Abstractions for Safety and PowerTerraform Abstractions for Safety and Power
Terraform Abstractions for Safety and Power
 
Introduction to IAC and Terraform
Introduction to IAC and Terraform Introduction to IAC and Terraform
Introduction to IAC and Terraform
 
Debasihish da final.ppt
Debasihish da final.pptDebasihish da final.ppt
Debasihish da final.ppt
 
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
 
Terraform + ansible talk
Terraform + ansible talkTerraform + ansible talk
Terraform + ansible talk
 
Terraform
TerraformTerraform
Terraform
 
OracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdfOracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdf
 

Mehr von Gourav Varma

Jenkins introduction
Jenkins introductionJenkins introduction
Jenkins introductionGourav Varma
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)Gourav Varma
 
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)Gourav Varma
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01Gourav Varma
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2Gourav Varma
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linuxGourav Varma
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01Gourav Varma
 
Docker advance topic (2)
Docker advance topic (2)Docker advance topic (2)
Docker advance topic (2)Gourav Varma
 

Mehr von Gourav Varma (20)

Jenkins introduction
Jenkins introductionJenkins introduction
Jenkins introduction
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Aws day 4
Aws day 4Aws day 4
Aws day 4
 
Aws day 3
Aws day 3Aws day 3
Aws day 3
 
Aws day 2
Aws day 2Aws day 2
Aws day 2
 
Ansible day 4
Ansible day 4Ansible day 4
Ansible day 4
 
Ansible day 3
Ansible day 3Ansible day 3
Ansible day 3
 
Adnible day 2.ppt
Adnible day   2.pptAdnible day   2.ppt
Adnible day 2.ppt
 
Ansible day 1.ppt
Ansible day 1.pptAnsible day 1.ppt
Ansible day 1.ppt
 
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Dev ops
Dev opsDev ops
Dev ops
 
Shell programming 2
Shell programming 2Shell programming 2
Shell programming 2
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Version control git day01
Version control   git day01Version control   git day01
Version control git day01
 
Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Docker advance topic (2)
Docker advance topic (2)Docker advance topic (2)
Docker advance topic (2)
 

Kürzlich hochgeladen

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 

Kürzlich hochgeladen (20)

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 

Terraform day1

  • 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
  • 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 • Integrating Ansible with Terraform
  • 4. F. Terraform Modules & Workspaces: • DRY Principle • Implementing EC2 module with Terraform • Variables and Terraform Modules • Terraform Workspace G. Terraform State: • Local state & Remote State • Configuring Remote State File S3 H. Discussions
  • 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.
  • 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.
  • 7.
  • 8.
  • 9.
  • 10. B. INSTALLATION & SETTING UP LAB • Installing Terraform – Windows users or Linux Users • To install Terraform on any supported system: • Find the appropriate Terraform distribution package for your system and download it. . • After downloading Terraform, unzip the package to a directory of your choosing. • Optional but highly recommended: modify the path to include the directory that contains the Terraform binary. • After unzipping the package run ./terraform from command • line and continue with your code..
  • 11.
  • 12.
  • 13. 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.
  • 15. • Creating and Configuring IAM User
  • 16. • 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" }
  • 17. • 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
  • 18.
  • 19. • 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.
  • 20. • 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.
  • 21.
  • 22. 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.