Terraform: Up & Running

By Yevgeniy Brikman

This book is the fastest way to get up and running with Terraform, an open source tool that allows you to define your infrastructure as code and to deploy and manage that infrastructure across a variety of public cloud providers (e.g., AWS, Azure, Google Cloud, DigitalOcean) and private cloud and virtualization platforms (e.g. OpenStack, VMWare).

This is a hands-on-tutorial that not only teaches you DevOps principles, but also walks you through code examples that you can try at home. You'll go from deploying a basic "Hello, World" Terraform example all the way up to running a full tech stack (server cluster, load balancer, database) that can support a large amount of traffic and a large team of developers—all in the span of just a few chapters.

By the time you're done, you'll be ready to use Terraform in the real world.

Order Now

About the book

This book is for Sysadmins, Operations Engineers, Release Engineers, Site Reliability Engineers, DevOps Engineers, Infrastructure Developers, Full Stack Developers, Engineering Managers, CTOs, and anyone else responsible for the code after it has been written. If you're the one managing infrastructure, deploying code, configuring servers, scaling clusters, backing up data, monitoring apps, and responding to alerts at 3AM, then this book is for you.

Ch 1: Why Terraform

How DevOps is transforming the way we run software; an overview of infrastructure as code tools, including configuration management, orchestration, and server templating; the benefits of infrastructure as code; a comparison of Terraform, Chef, Puppet, Ansible, Salt Stack, and CloudFormation.

Ch 2: Terraform Syntax

Installing Terraform; an overview of Terraform syntax; an overview of the Terraform CLI tool; how to deploy a single server; how to deploy a web server; how to deploy a cluster of web servers; how to deploy a load balancer; how to clean up resources you've created.

Ch 3: Terraform state

What is Terraform state; how to store state so multiple team members can access it; how to lock state files to prevent concurrency issues; how to isolate state files to limit the damage from errors; a best-practices file and folder layout for Terraform projects; how to use read-only state.

Ch 4: Terraform modules

What are modules; how to create a basic module; how to make a module configurable; versioned modules; module tips and tricks; using modules to define reusable, configurable pieces of infrastructure.

Ch 5: Terraform tips & tricks

Advanced Terraform syntax; loops; if-statements; if-else statements; interpolation functions; zero-downtime, rolling deployment; common Terraform gotchas and pitfalls.

Ch 6: Using Terraform as a team

Version control; the golden rule of Terraform; coding guidelines; Terraform style; automated testing for Terraform; documentation; a workflow for teams; automation with Terraform.

Code samples

The book includes dozens of code samples. You can find the code here: https://github.com/brikis98/terraform-up-and-running-code.

About the author

Yevgeniy Brikman

Yevgeniy (Jim) Brikman is the co-founder of Gruntwork, a company that offers DevOps as a Service. Gruntwork makes extensive use of Terraform to help customers get up and running on AWS with DevOps best practices and world-class infrastructure, all in just 1-2 weeks.

Jim is also the author of another O'Reilly book called Hello, Startup: A Programmer's Guide to Building Products, Technologies, and Teams, which has a 4.9/5 rating on Amazon and 4.5/5 rating on GoodReads. Previously, he worked as a software engineer at LinkedIn, TripAdvisor, Cisco Systems, and Thomson Financial and got his BS and Masters at Cornell University. For more info, check out ybrikman.com.

Buy now

Terraform: Up & Running is available at the online stores below and at your local bookstore.

News

Subscribe to the Terraform: Up & Running Newsletter! Get the latest news, blog posts, and talks on Terraform and DevOps. No spam, ever.

Terraform training at Velocity Conference

I'll be running a 2-day training course at Velocity Conference in NYC. Learn Terraform through real-world examples: deploy servers, DBs, and load balancers on AWS; build immutable infrastructure with Docker and Packer; put it all together in a continuous delivery pipeline.

Sign up for the course today! »

Why Use Terraform?

Learn what Terraform does, and how it compares to Chef, Puppet, Ansible, CloudFormation, and other tools.

Read the article on O'Reilly Radar »

Terraform: Up & Running is published!

The final version of Terraform: Up & Running has been published and the ebook and print edition are now available online and in your local bookstores!

Get your copy now! »

Early Release

The early release of Terraform: Up & Running is now available! Grab a copy of the ebook before the final version is done so you can start learning today. You'll receive new chapters and updates as they are written, plus the final ebook bundle when the book is released.

Get your copy at the O'Reilly Store »

An intro to Docker, Terraform, and Amazon ECS

This talk is a very quick intro to Docker, Terraform, and Amazon's EC2 Container Service (ECS). In just 15 minutes, you'll see how to take two apps (a Rails frontend and a Sinatra backend), package them as Docker containers, run them using Amazon ECS, and to define all of the infrastructure-as-code using Terraform.

See the presentation on SlideShare »