terragrunt

Provide Terragrunt expertise for platform teams: Terragrunt is a lightweight wrapper for Terraform and OpenTofu to keep configurations DRY, manage remote state, and coordinate multi-module deployments. Helps leverage layered configuration, dependency management, and before/after hooks to manage large-scale infrastructure across environments and AWS accounts.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
7

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "terragrunt" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-494f853d423b7b55a80adb2fe6c3a8b885e6987ecaf2d64e8ec73691d5350b42. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Provide Terragrunt expertise for platform teams: Terragrunt is a lightweight wrapper for Terraform and OpenTofu to keep configurations DRY, manage remote state, and coordinate multi-module deployments. Helps leverage layered configuration, dependency management, and before/after hooks to manage large-scale infrastructure across environments and AWS accounts.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: terragrunt
description: >-
  You are an expert in Terragrunt, the thin wrapper for Terraform and
  OpenTofu that provides extra tools for keeping configurations DRY, managing
  remote state, and orchestrating multi-module deployments. You help platform
  teams manage large-scale infrastructure across multiple environments and AWS
  accounts using Terragrunt's hierarchical configuration, dependency
  management, and before/after hooks.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Infrastructure & DevOps
  tags:
    - iac
    - terraform
    - dry
    - infrastructure
    - multi-environment
    - orchestration

Terragrunt — DRY Terraform/OpenTofu Wrapper

You are an expert in Terragrunt, the thin wrapper for Terraform and OpenTofu that provides extra tools for keeping configurations DRY, managing remote state, and orchestrating multi-module deployments. You help platform teams manage large-scale infrastructure across multiple environments and AWS accounts using Terragrunt's hierarchical configuration, dependency management, and before/after hooks.

Core Capabilities

DRY Configuration

# infrastructure/terragrunt.hcl — Root config (inherited by all children)
remote_state {
  backend = "s3"
  generate = {
    path      = "backend.tf"
    if_exists = "overwrite"
  }
  config = {
    bucket         = "company-terraform-state"
    key            = "${path_relative_to_include()}/terraform.tfstate"
    region         = "us-east-1"
    encrypt        = true
    dynamodb_table = "terraform-locks"
  }
}

generate "provider" {
  path      = "provider.tf"
  if_exists = "overwrite"
  contents  = <<EOF
provider "aws" {
  region = "${local.region}"
  default_tags {
    tags = {
      Environment = "${local.environment}"
      ManagedBy   = "terragrunt"
    }
  }
}
EOF
}

locals {
  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
  region_vars  = read_terragrunt_config(find_in_parent_folders("region.hcl"))
  env_vars     = read_terragrunt_config(find_in_parent_folders("env.hcl"))

  account_id   = local.account_vars.locals.account_id
  region       = local.region_vars.locals.region
  environment  = local.env_vars.locals.environment
}
## Directory Structure

infrastructure/
├── terragrunt.hcl                        # Root config (shared settings)
├── modules/                              # Reusable Terraform modules
│   ├── vpc/
│   ├── ecs-service/
│   └── rds/
├── production/
│   ├── account.hcl                       # account_id = "111111111111"
│   ├── us-east-1/
│   │   ├── region.hcl                    # region = "us-east-1"
│   │   ├── env.hcl                       # environment = "production"
│   │   ├── vpc/
│   │   │   └── terragrunt.hcl
│   │   ├── api/
│   │   │   └── terragrunt.hcl
│   │   └── database/
│   │       └── terragrunt.hcl
└── staging/
    ├── account.hcl                       # account_id = "222222222222"
    └── us-east-1/
        ├── region.hcl
        ├── env.hcl                       # environment = "staging"
        ├── vpc/
        ├── api/
        └── database/
# infrastructure/production/us-east-1/api/terragrunt.hcl
include "root" {
  path = find_in_parent_folders()
}

terraform {
  source = "../../../modules/ecs-service"
}

dependency "vpc" {
  config_path = "../vpc"
}

dependency "database" {
  config_path = "../database"
}

inputs = {
  service_name    = "api"
  vpc_id          = dependency.vpc.outputs.vpc_id
  subnet_ids      = dependency.vpc.outputs.private_subnet_ids
  database_url    = dependency.database.outputs.connection_string
  desired_count   = 3                     # Production: 3 instances
  cpu             = 512
  memory          = 1024
  container_image = "company/api:latest"
}

Commands

# Run in a single module
cd infrastructure/production/us-east-1/api
terragrunt plan
terragrunt apply

# Run across ALL modules (respects dependencies)
cd infrastructure/production/us-east-1
terragrunt run-all plan
terragrunt run-all apply

# Run only modules that changed
terragrunt run-all apply --terragrunt-include-dir api --terragrunt-include-dir database

# Graph dependencies
terragrunt graph-dependencies | dot -Tpng > deps.png

Installation

brew install terragrunt
# Or download from https://terragrunt.gruntwork.io/
# Works with both Terraform and OpenTofu

Best Practices

  1. Hierarchical configs — Use find_in_parent_folders() to inherit settings; override only what changes per environment
  2. Dependencies — Declare dependency blocks; Terragrunt applies in the right order and passes outputs as inputs
  3. Remote state per module — Use path_relative_to_include() for unique state keys; never share state between modules
  4. run-all for orchestration — terragrunt run-all apply deploys entire environments respecting dependency order
  5. Separate modules from live config — Reusable modules in modules/; environment configs reference them via source
  6. Account/region hierarchy — Structure folders by account → region → environment → service; each level has its .hcl
  7. Before/after hooks — Use hooks for validation, linting (tflint), or notifications before/after apply
  8. Works with OpenTofu — Set TERRAGRUNT_TFPATH=tofu to use OpenTofu instead of Terraform

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • Terragrunt 是基础设施即代码领域的高价值工具,解决多环境、多账户下的 DRY 配置和依赖管理痛点
  • 面向平台团队和 DevOps 工程师,具有明确的实用场景和广泛受众
Trigger Precision92/100

Highlights

  • 触发描述精准完整,明确限定为 Terragrunt 专家角色
  • 覆盖 Terragrunt 核心功能关键词,边界清晰不易误触
Structure and Standards85/100

Areas to improve

  • 缺少独立 When to Use 章节 Reported severity: Minor

    文档结构完整但未设置显式的 "When to Use" 章节

    Recommendation: 建议在 Core Capabilities 前增加 "When to Use" 章节,明确说明适用场景(如:多环境部署、需要 DRY 配置、复杂依赖管理等)

Highlights

  • 文档结构清晰,包含配置示例、目录结构、命令用法和最佳实践
  • frontmatter 完整,代码示例丰富且符合官方语法
Execution Reliability82/100

Highlights

  • 工具来源明确,参数示例正确,覆盖主要使用场景
  • 提及与 OpenTofu 的兼容性,增强实用性
Evidence Verifiability (mean of the first four)87/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 160
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • terragrunt.gruntwork.io

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.