hands-on lab

Keeping Terraform Remote State DRY with Terragrunt

Advanced
Up to 30m
1,077
4.3/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.

Description

As Terraform configurations grow to be large and complex, the code becomes harder to manage and make changes. Terragrunt is an open-source tool that acts as a thin wrapper around Terraform, enabling configurations to be "DRYer". DRY is a popular software development practice that stands for "Don't Repeat Yourself," which means don't re-use the same software pattern, avoiding redundancy. Terragrunt adds a feature that allows Terraform remote state configurations to be defined once in code and re-used throughout multiple Terraform projects.

In this lab, you will use Terragrunt to deploy a Terraform configuration in separate environments while keeping the remote state configuration DRY.

Learning objectives

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

  • Understand how to deploy Terraform resources with Terragrunt
  • Learn how to keep the remote state configuration DRY using Terragrunt

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

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

Updates

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

 

Environment before

Environment after

About the author

Students
19,899
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

Managing Remote State with Terragrunt