This document introduces infrastructure as code (IaC) using Terraform and provides examples of deploying infrastructure on AWS including:
- A single EC2 instance
- A single web server
- A cluster of web servers using an Auto Scaling Group
- Adding a load balancer using an Elastic Load Balancer
It also discusses Terraform concepts and syntax like variables, resources, outputs, and interpolation. The target audience is people who deploy infrastructure on AWS or other clouds.
2. Who is this workshop for?
2
Everyone whom deploy infrastructure in-house or cloud based
environments. This is a beginner’s workshop
You will need to have an AWS account set up already with Terraform
v0.9.3 installed. You will also need to have git install to download the
workshop material.
https://www.terraform.io
https://github.com/jasonvance/terraform-introduction
https://aws.amazon.com/account/
3. Who am I?
I am Jason Vance, Sr. Site Reliability Engineer for Accela, Inc.
Graphic Designer turned System Administrator turned Engineer.
You can find me at @jasonsvance
3
4. What is
Infrastructure as
Code (IaC)?
IaC grew as a response to the difficulty
posed from two pieces of disruptive
technology – utility computing and
second-generation web frameworks.
4
6. What IaC enables you to do:
■ Manage infrastructure via
source control
■ Apply testing to
infrastructure
■ Avoid written
documentation of
infrastructure
■ Enable collaboration
6
18. Purpose of Terraform State
Mapping to the Real World
Terraform requires some sort of
database to map Terraform
config to the real world.
Metadata
Terraform needs to store more
than just resource mappings.
Terraform must keep track of
metadata such as dependencies.
Performance
In addition to basic mapping,
Terraform stores a cache of the
attribute values for all resources
in the state. This is the most
optional feature of Terraform
state and is done only as a
performance improvement.
Syncing
The primary motivation people
have for using remote state files
is in an attempt to improve using
Terraform with teams. State files
can easily result in conflicts when
two people modify infrastructure
at the same time.
18