Getting Started with Terraform

Build, combine, and launch infrastructure in a fast, secure, and effective manner

Getting Started with Terraform

This ebook is included in a Mapt subscription
Kirill Shirinkin

Build, combine, and launch infrastructure in a fast, secure, and effective manner
$10.00
$39.99
RRP $31.99
RRP $39.99
eBook
Print + eBook
Preview in Mapt

Book Details

ISBN 139781786465108
Paperback206 pages

Book Description

Terraform is a tool used to efficiently build, configure, and improve production infrastructure. It can manage existing infrastructure as well as create custom in-house solutions.

This book shows you when and how to implement infrastructure as a code practices with Terraform. It covers everything necessary to set up complete management of infrastructure with Terraform, starting with the basics of using providers and resources.

This book is a comprehensive guide that begins with very small infrastructure templates and takes you all the way to managing complex systems, all using concrete examples that evolve over the course of the book. It finishes with the complete workflow of managing a production infrastructure as code – this is achieved with the help of version control and continuous integration. At the end of this book, you will be familiar with advanced techniques such as multi-provider support and multiple remote modules.

Table of Contents

Chapter 1: Infrastructure Automation
What is Infrastructure as Code and why is it needed?
Declarative vs Procedural tools for Infrastructure as Code
Infrastructure as Code in the Cloud
Requirements for infrastructure provisioner
Which tools exist for infrastructure provisioning?
A short overview of Terraform
Journey ahead and how to read this book
Summary
Chapter 2: Deploying First Server
History of Terraform
Preparing work environment
The many Terraform providers
Short introduction to AWS
Using Elastic Compute Cloud
Configuring AWS provider
Creating EC2 instance with Terraform
Working with state
Handling resource updates
Destroying everything we've built
Summary
Chapter 3: Resource Dependencies and Modules
Creating AWS Virtual Private Cloud
Understanding dependency graph
Playing with Terraform graph
Controlling dependencies with depends_on and ignore_changes
Making sense of our template
Removing duplication with modules
Configuring modules
Retrieving module data with outputs
Using root module outputs
Summary
Chapter 4: Storing and Supplying Configuration
Understanding variables
Configuring data sources
Exploring Terraform configuration resources
Taking a quick look at Consul
Summary
Chapter 5: Connecting with Other Tools
Returning data with outputs
Testing servers with Inspec
Provisioners
Reprovisioning machines with null_resource
Using third-party plugins
Summary
Chapter 6: Scaling and Updating Infrastructure
Counting servers
Bringing in high availability
Load balancing and simulating conditionals
Immutable Infrastructure
Baking images with Packer
Rolling out AMI upgrades with Terraform
Performing blue-green deployments
Refreshing infrastructure
Importing resources
Summary
Chapter 7: Collaborative Infrastructure
Version control with Git 101
Moving templates to Git
Protecting secrets in a Git repository
Storing state files remotely
Connecting remote states together
Storing modules remotely
Locking state files with Terragrunt
Moving infrastructure updates to the CI pipeline
Integration testing of Terraform modules
Summary
Chapter 8: Future of Terraform
Infrastructure as Code and Terraform replacements
Learning AWS and compiling Terraform
Learning Consul
Provisioning and configuration management
Immutable Infrastructure
Collaboration and CI/CD
The many tools around Terraform
The rapid development of Terraform
Closing thoughts on the future of Terraform
Summary

What You Will Learn

  • Understand what Infrastructure as Code (IaC) means and why it matters
  • Install, configure, and deploy Terraform
  • Take full control of your infrastructure in the form of code
  • Manage complete complete infrastructure, starting with a single server and scaling beyond any limits
  • Discover a great set of production-ready practices to manage infrastructure
  • Set up CI/CD pipelines to test and deliver Terraform stacks
  • Construct templates to simplify more complex provisioning tasks

Authors

Table of Contents

Chapter 1: Infrastructure Automation
What is Infrastructure as Code and why is it needed?
Declarative vs Procedural tools for Infrastructure as Code
Infrastructure as Code in the Cloud
Requirements for infrastructure provisioner
Which tools exist for infrastructure provisioning?
A short overview of Terraform
Journey ahead and how to read this book
Summary
Chapter 2: Deploying First Server
History of Terraform
Preparing work environment
The many Terraform providers
Short introduction to AWS
Using Elastic Compute Cloud
Configuring AWS provider
Creating EC2 instance with Terraform
Working with state
Handling resource updates
Destroying everything we've built
Summary
Chapter 3: Resource Dependencies and Modules
Creating AWS Virtual Private Cloud
Understanding dependency graph
Playing with Terraform graph
Controlling dependencies with depends_on and ignore_changes
Making sense of our template
Removing duplication with modules
Configuring modules
Retrieving module data with outputs
Using root module outputs
Summary
Chapter 4: Storing and Supplying Configuration
Understanding variables
Configuring data sources
Exploring Terraform configuration resources
Taking a quick look at Consul
Summary
Chapter 5: Connecting with Other Tools
Returning data with outputs
Testing servers with Inspec
Provisioners
Reprovisioning machines with null_resource
Using third-party plugins
Summary
Chapter 6: Scaling and Updating Infrastructure
Counting servers
Bringing in high availability
Load balancing and simulating conditionals
Immutable Infrastructure
Baking images with Packer
Rolling out AMI upgrades with Terraform
Performing blue-green deployments
Refreshing infrastructure
Importing resources
Summary
Chapter 7: Collaborative Infrastructure
Version control with Git 101
Moving templates to Git
Protecting secrets in a Git repository
Storing state files remotely
Connecting remote states together
Storing modules remotely
Locking state files with Terragrunt
Moving infrastructure updates to the CI pipeline
Integration testing of Terraform modules
Summary
Chapter 8: Future of Terraform
Infrastructure as Code and Terraform replacements
Learning AWS and compiling Terraform
Learning Consul
Provisioning and configuration management
Immutable Infrastructure
Collaboration and CI/CD
The many tools around Terraform
The rapid development of Terraform
Closing thoughts on the future of Terraform
Summary

Book Details

ISBN 139781786465108
Paperback206 pages
Read More

Read More Reviews