hands-on lab

Creating DRY Terraform Environments with Terragrunt

Advanced
Up to 40m
994
4.6/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Lab description

Using Terraform in multiple environments can fall prey to Copy/Paste syndrome, where Terraform code changes are copied back and forth between multiple repositories. This can work for small teams that are diligent at making sure the environments are in sync. However, for large teams that require scalable configurations, this can quickly become unmanageable and prone to human error. Terragrunt can be used with version-controlled modules to create infrastructure code that eliminates unnecessary code to allow developers to focus on modifying just the values that matter.  

In this lab, you will use Terragrunt to create a development environment from production code by modifying a single file. 

Learning objectives

Upon completion of this lab, you will be able to:

  • Create reusable environments with modules and Terragrunt
  • Learn how to create local values in Terragrunt to use throughout child folder configurations

Intended audience

This lab is intended for:

  • Individuals familiar with using Terraform and how to deploy resources
  • Individuals interested in learning how to use Terragrunt to increase Terraform's effectiveness
  • Enterprises looking to scale their Terraform codebase

Prerequisites

You should be familiar with:

  • Cloud Services
  • DevOps
  • Basic understanding of Terraform modules and variables
  • Basic understanding of Terragrunt and keeping remote state DRY

The following course and lab can be used to fulfill the prerequisites:

Updates

January 9th, 2024 - Lab updated to utilize CodeTour IDE

Environment before

Environment after

About the author
Students
19,575
Labs
42
Courses
1
Learning paths
15

Luke is a Site Reliability Engineer at Microsoft. His background is infrastructure development using Terraform and in 2021 he was awarded the HashiCorp Ambassador award. He is an Azure DevOps Engineer Expert, Azure Administrator Associate, and HashiCorp Certified - Terraform Associate.

Covered topics
Lab steps
Creating a DRY Terraform Environment with Terragrunt