O'Reilly logo
live online training icon Live Online training

Terraform: Getting Started

How to Install, Setup and Use Terraform

Topic: Web Ops & Performance
Sean Kane

  • Are there parts of your infrastructure that you still have to stand up manually or via a collection of scripts?
  • Do you struggle to keep documentation about that setup process current?
  • Do you dread the day when you need to spin up a new region for the business?

Terraform is a tool that makes it possible to document and automate the creation, modification, and destruction of almost anything that can be managed by an API. This means that it is finally conceivable to automate the management of everything that your software stacks needs to actually run in any environment, including cloud resources, DNS entries, CDN configuration, and much more.

This class will introduce you to Hashicorp’s open source and free Terraform tool and teach you everything that you need to know to get started using it to standardize and simplify the way that you define and manage all of your infrastructure resources.

What you'll learn-and how you can apply it

By the end of this live, hands-on, online course, you’ll understand: - How to use Terraform to simplify your ability to repeatedly setup, manage, and teardown complex infrastructure environments.

And you’ll be able to:

  • Write typical Terraform configuration files
  • Use Terraform to stand-up, modify, and delete infrastructure components.
  • Utilize remote state and additional data sources

This training course is for you because...

  • You need to understand how to simplify infrastructure management for engineers.


  • Basic comfort with the Unix command line is helpful.
  • Basic comfort using REST APIs

Recommended preparation:

  • A modern computer and OS
  • Recent Linux, OS X, or Windows 10
  • Reliable and fast internet connectivity
  • Download and run the Hashicorp Terraform installer for your OS
  • A graphical web browser
  • A text editor
  • Git client
  • Optionally, it may be useful to have the following command-line tools installed and available: tar, wget, curl, jq, and an SSH client

Recommended follow-up: - Read Terraform: Up and Running (book)

About your instructor

  • Sean Kane is lead site reliability engineer at New Relic. He’s had a long career in production operations, with many diverse roles across a broad range of industries. In addition to spending his spare time writing, teaching, and speaking about modern production operations, Sean is an avid traveler, hiker, and camper. He lives in the US Pacific Northwest with his wife, children, and dogs.


The timeframes are only estimates and may vary according to how the class is progressing

Introduction (15 minutes)

  • Presentation: Terraform Overview
  • Demo: Example of the Potential
  • Presentation: Terraform Terminology
  • Exercise: Installing the Tools

Defining the Infrastructure (40 minutes)

  • Presentation: Overview of the Code
  • During this section we will review a working terraform codebase.
    • Hashicorp Configuration Language
    • Terraform Backends
    • Terraform Providers
    • Variables
    • Resources
    • Outputs
    • State
  • This code will be used by the instructor to spin up some cloud resources:
    • Server (AWS EC2 instance)
    • Load Balancer (AWS ALB)
    • Firewall Rules (AWS Security Groups)
    • DNS entry (NS1)
    • etc.
    • Examine the simple Todo API that we will be using throughout class
  • Break (5 minutes)

Extending Terraform (55 minutes)

  • Exercise: Installing a Custom Provider
    • Add terraform support for our Todo API
  • Exercise: Using Terraform
    • Configure the provider
  • Presentation: Overview of the new Provider
    • What is a provider capable of?
  • Exercise: Managing an API with Terraform
    • Create Todos
    • Update Todos
    • Delete Todos
    • Read existing Todos (data sources)
    • Import Existing Todos
  • Break (5 minutes)

Advanced Considerations (60 minutes)

  • Exercise: Manipulating Terraform State
  • Presentation: Overview of Modules
    • Custom code that can setup multiple resources in a repeatable fashion.
  • Presentation: Review a Todo module
  • Exercise: Apply the Todo Module
  • Exercise: Tearing Down Infrastructure
  • Review