Agenda Infrastructure as Code
what is it?
Introduction to Terraform
putting the pieces together
Slide 6
Slide 6 text
Agenda Infrastructure as Code
what is it?
Introduction to Terraform
putting the pieces together
Terraform Lifecycle and State
expanding your knowledge
Slide 7
Slide 7 text
Infrastructure as Code
Slide 8
Slide 8 text
Infrastructure
Slide 9
Slide 9 text
Infrastructure
as Code
Slide 10
Slide 10 text
Infrastructure
as Code
▪ executable documentation
Slide 11
Slide 11 text
Infrastructure
as Code
▪ executable documentation
▪ enables collaboration
Slide 12
Slide 12 text
Infrastructure
as Code
▪ executable documentation
▪ enables collaboration
▪ safe and predictable
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
HashiCorp
Configuration Language
Slide 15
Slide 15 text
HashiCorp
Configuration
Language
Slide 16
Slide 16 text
HashiCorp
Configuration
Language
CODE EDITOR
Slide 17
Slide 17 text
HashiCorp
Configuration
Language
CODE EDITOR
service {
key = "value"
}
Slide 18
Slide 18 text
HashiCorp
Configuration
Language
CODE EDITOR
service {
key = "value"
}
Slide 19
Slide 19 text
HashiCorp
Configuration
Language
CODE EDITOR
Slide 20
Slide 20 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
}
Slide 21
Slide 21 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
}
Slide 22
Slide 22 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
}
Slide 23
Slide 23 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
Slide 24
Slide 24 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
Slide 25
Slide 25 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
Slide 26
Slide 26 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
Slide 27
Slide 27 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
Slide 28
Slide 28 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
}
Slide 29
Slide 29 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 30
Slide 30 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 31
Slide 31 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 32
Slide 32 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 33
Slide 33 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 34
Slide 34 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:${var.port}"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 35
Slide 35 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:${var.port}"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
Introducing Terraform
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
Terraform
Slide 41
Slide 41 text
Terraform 125+
Official Providers
AWS, GCP, OpenNebula, etc.
Slide 42
Slide 42 text
Terraform 125+
Official Providers
AWS, GCP, OpenNebula, etc.
175+
Community Providers
Auth0, Domino’s Pizza etc.
Slide 43
Slide 43 text
First Steps
Slide 44
Slide 44 text
Command: terraform init
TERMINAL
>
Slide 45
Slide 45 text
Command: terraform init
TERMINAL
> terraform init
Slide 46
Slide 46 text
Command: terraform init
TERMINAL
> terraform init
Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (terraform-providers/aws) 2.65.0...
Slide 47
Slide 47 text
Command: terraform init
TERMINAL
> terraform init
Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (terraform-providers/aws) 2.65.0...
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to
see any changes that are required for your infrastructure. All Terraform
commands should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget,
other commands will detect it and remind you to do so if necessary.
Slide 48
Slide 48 text
Command: terraform plan
TERMINAL
>
Slide 49
Slide 49 text
Command: terraform plan
TERMINAL
> terraform plan -out="aws.tfplan"
Slide 50
Slide 50 text
Command: terraform plan
TERMINAL
> terraform plan -out="aws.tfplan"
Terraform will perform the following actions:
# aws_instance.open_nebula will be created
+ resource "aws_instance" "open_nebula"
Plan: 1 to add, 0 to change, 0 to destroy.
This plan was saved to: aws.tfplan
Slide 51
Slide 51 text
Command: terraform plan
TERMINAL
> terraform plan -out="aws.tfplan"
Terraform will perform the following actions:
# aws_instance.open_nebula will be created
+ resource "aws_instance" "open_nebula"
Plan: 1 to add, 0 to change, 0 to destroy.
This plan was saved to: aws.tfplan
Command: terraform validate
TERMINAL
> terraform fmt
main.tf
> terraform validate
Success! The configuration is valid.
Slide 71
Slide 71 text
Command: terraform validate
TERMINAL
> terraform fmt
main.tf
> terraform validate
Success! The configuration is valid.
Slide 72
Slide 72 text
Command: terraform help
TERMINAL
> terraform help
Usage: terraform [-version] [-help] [args]
The available commands for execution are listed below.
The most common, useful commands are shown first,
followed by less common or more advanced commands.
Common commands:
apply Builds or changes infrastructure
destroy Destroy Terraform-managed infrastructure
fmt Rewrites config files to canonical format
output Read an output from a state file
Terraform State
▪ maps real-world resources to your configuration
Slide 84
Slide 84 text
Terraform State
▪ maps real-world resources to your configuration
▪ keeps track of (resource) metadata
Slide 85
Slide 85 text
Terraform State
▪ maps real-world resources to your configuration
▪ keeps track of (resource) metadata
▪ improves performance for large infrastructures
Slide 86
Slide 86 text
Terraform State
▪ maps real-world resources to your configuration
▪ keeps track of (resource) metadata
▪ improves performance for large infrastructures
▪ stored locally (by default), can be stored remotely
Slide 87
Slide 87 text
Terraform State
▪ maps real-world resources to your configuration
▪ keeps track of (resource) metadata
▪ improves performance for large infrastructures
▪ stored locally (by default), can be stored remotely
Slide 88
Slide 88 text
Review
Slide 89
Slide 89 text
Review
▪ Infrastructure as Code
Slide 90
Slide 90 text
Review
▪ Infrastructure as Code
▪ Introduction to Terraform
Slide 91
Slide 91 text
Review
▪ Infrastructure as Code
▪ Introduction to Terraform
▪ Terraform Lifecycle and State