IaC

Terragrunt Playground

Terragrunt is a thin Terraform wrapper that adds DRY configurations, remote state management, and dependency ordering for large IaC projects..

Get access to the Terragrunt playground with one click

Welcome to the Terragrunt Playground!

Terragrunt 0.68 — the DRY wrapper for Terraform. Eliminate repeated configuration, manage remote state automatically, and enforce dependency ordering across large multi-module infrastructure projects.

What’s Pre-installed

  • Terragrunt 0.68 with alias tg
  • Terraform 1.12 with alias tf
  • Shell: bash with vim, nano, curl, wget, git, jq

Quick Start

terragrunt --version
tg --version
tf --version

Common Workflows

# Create a root terragrunt.hcl
mkdir -p /tmp/tg-demo/modules/storage
cat > /tmp/tg-demo/modules/storage/main.tf <<'EOF'
terraform {
  required_providers {
    local = { source = "hashicorp/local" }
  }
}
variable "env" {}
resource "local_file" "data" {
  content  = "env=${var.env}"
  filename = "/tmp/${var.env}-data.txt"
}
EOF

cat > /tmp/tg-demo/modules/storage/terragrunt.hcl <<'EOF'
terraform { source = ".//" }
inputs = { env = "dev" }
EOF

cd /tmp/tg-demo/modules/storage
tg init && tg plan && tg apply -auto-approve
cat /tmp/dev-data.txt

Advanced Tips

# DRY root config (shared across modules)
cat > /tmp/tg-demo/terragrunt.hcl <<'EOF'
remote_state {
  backend = "local"
  config = {
    path = "${path_relative_to_include()}/terraform.tfstate"
  }
}
EOF

# Run-all for multiple modules
tg run-all plan
tg run-all apply --terragrunt-non-interactive

# Dependency graph
tg graph-dependencies

Session Notes

  • Session lasts 1 hour.
  • Uses local backend state — no remote state configuration needed for learning.