π οΈ How to Install Terragrunt
Terragrunt is a thin wrapper around Terraform that provides extra tools for managing configurations, remote backends, dependencies, and DRY (Don’t Repeat Yourself) practices.
Letβs walk through the steps to install it.
π§βπ» Step-by-Step: Installing Terragrunt
β Prerequisites
Make sure Terraform is already installed on your system.
If not, check out: π§± Install Terraform & Azure CLI
πͺ For Windows
Download the latest Terragrunt
.exe:
Visit the Terragrunt releases page.Find the latest version and download
terragrunt_windows_amd64.exe.Rename and move it to a directory in your PATH:
Rename-Item .\terragrunt_windows_amd64.exe terragrunt.exe Move-Item .\terragrunt.exe "C:\Program Files\Terragrunt\terragrunt.exe"Add the folder (e.g.,
C:\Program Files\Terragrunt) to your Environment Variables βPath.Restart your terminal and test:
terragrunt --version
π For macOS
- Using Homebrew:
brew install terragrunt - Verify the installation:
terragrunt --version
π§ For Linux
- Download the latest binary:
curl -L -o terragrunt https://github.com/gruntwork-io/terragrunt/releases/latest/download/terragrunt_linux_amd64 - Move it to your bin folder and make it executable:
chmod +x terragrunt sudo mv terragrunt /usr/local/bin/ - Verify:
terragrunt --version
π Directory Structure (Optional Best Practice)
Once installed, you can start structuring your project like this:
project-root/
βββ terragrunt.hcl
βββ env/
βββ dev/
βββ terragrunt.hcl
βββ prod/
βββ terragrunt.hcl
π― Final Notes
Terragrunt is often used in CI/CD pipelines and large enterprise setups.
You only need to install it once per machine.
Always match your Terragrunt version to the Terraform version it supports.