GB Gabriel Butoeru
← All articles
IaC 26/06/2026 · 1 min read · butoerugabriel

Advanced Terraform: Writing Reusable Modules with Terragrunt

Introduction

As infrastructure scales to accommodate multiple business divisions and distinct deployment environments, standard Terraform configurations often become repetitive. You find yourself copy-pasting the same resource definitions across separate directories. Terragrunt keeps your Terraform configurations DRY (Don’t Repeat Yourself).

Using Terragrunt Inputs

Terragrunt decouples your generic infrastructure blueprints from their environment-specific deployment arguments. Instead of repeating resources, author a simple terragrunt.hcl config file:

include "root" {
  path = find_in_parent_folders()
}

terraform {
  source = "../../../modules//web_app"
}

inputs = {
  instance_type  = "t3.xlarge"
  instance_count = 5
  environment    = "production"
}