Logo Terragrunt Skill

Terragrunt Skill

Cộng đồng
jfr992
terragrunt-skill

Use for Terragrunt work (0.68 to 1.2; OpenTofu or Terraform): building an infrastructure catalog, explicit stacks (terragrunt.stack.hcl), units wrapping OpenTofu/Terraform modules, live repos with a root.hcl hierarchy, remote state and locking (S3 lockfile, DynamoDB, GCS, azurerm), multi-account/multi-env with role assumption, classic Gruntwork live repos (_envcommon), migrating a terralith, exploring repos (find, list, dag), wiring dependencies (autoinclude, values), expansion blocks (for_each/count), the Content Addressable Store (CAS), OCI and versioned module sources, upgrading to 1.2, and CI/CD pipelines (GitHub Actions, GitLab).

Tổng quan

Nhà phát hànhjfr992
Kho mãterragrunt-skill
Tên kỹ năngterragrunt-skill
Sao
29
Bản fork
7
Tệp đi kèm
33
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 33 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được jfr992 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Terragrunt Skill trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/jfr992/terragrunt-skill/tree/main/skills/terragrunt-skill
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jfr992/terragrunt-skill.git /tmp/terragrunt-skill
mkdir -p .claude/skills
cp -r /tmp/terragrunt-skill/skills/terragrunt-skill .claude/skills/terragrunt-skill
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Terragrunt Skill trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Terragrunt Skill ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Terragrunt Skill với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Terragrunt Infrastructure Skill

Overview

This skill provides guidance for infrastructure using Terragrunt with OpenTofu, following a three-repository pattern:

  1. Infrastructure Catalog - Units and stacks that reference modules from separate repos
  2. Infrastructure Live - Environment-specific deployments consuming the catalog
  3. Module Repos - Separate repositories for each OpenTofu module (independent versioning)

Step 0: Detect Versions

Before giving commands, check terragrunt --version, .terragrunt-version, mise.toml/.tool-versions, terragrunt_version_constraint in root.hcl, and whether tofu or terraform is installed. This skill defaults to TG 1.2 + OpenTofu ≥ 1.10. For older Terragrunt (0.68+), Terraform, or classic layouts, follow version-compatibility.md: use run-all/--terragrunt-* on < 0.77.22, classic layouts on < 0.78, no autoinclude on < 1.1, no expansion on < 1.2, and no state encryption on Terraform.

Choosing an Architecture

Default recommendation: explicit stacks — the catalog + terragrunt.stack.hcl + values pattern this skill teaches. Units are generated from stack files; configuration flows through values; no per-unit boilerplate.

Supported alternative: classic implicit stacks — the original Gruntwork pattern: account/region/env/component directory hierarchy, per-level .hcl variable files, shared component config in _envcommon/ via include + expose. Any directory of units is an implicit stack. Use it when the repo already follows it, when the footprint is too small to justify a catalog, or when the team isn't ready for stacks. See classic-live-structure.md.

Orthogonal choice: module organization — modules monorepo (modules/ + examples/, one tag versions all, //modules/x?ref= sourcing) vs module-per-repo (independent versioning). Either works with either architecture. See modules-monorepo.md.

Migrating classic → stacks: follow the official Terralith to Terragrunt guide.

Quick Navigation

TopicReference
Version compatibility (TG 0.68→1.2, OpenTofu vs Terraform)version-compatibility.md
Naming conventionsnaming.md
Catalog structurecatalog-structure.md
Live repo structurelive-structure.md
Classic live structure (implicit stacks)classic-live-structure.md
Modules monorepomodules-monorepo.md
Discovery commands (find/list/dag)discovery-commands.md
Root/account/env configsroot-config.md
Unit dependenciesdependencies.md
Expansion (for_each/count)expansion.md
Catalog scaffoldingcatalog-scaffolding.md
Stack commandsstack-commands.md
Patterns & best practicespatterns.md
State managementstate-management.md
Multi-account setupmulti-account.md
Performance optimizationperformance.md
Content Addressable Store (CAS)cas.md
CI/CD pipelines (shared + IAM/OIDC setup)cicd-pipelines.md
GitLab CI pipelinescicd-gitlab.md
GitHub Actions pipelinescicd-github.md

Core Concepts

Values Pattern

Units receive configuration through values.xxx:

hcl
inputs = {
  name        = values.name
  environment = values.environment
  instance_class = try(values.instance_class, "db.t3.medium")  # Optional with default
}

Dependency Wiring (autoinclude first)

Since Terragrunt 1.1, declare dependencies in the stack file with autoinclude so catalog units stay dependency-agnostic. See dependencies.md for the full pattern.

Reference Resolution (legacy)

Older catalogs resolve symbolic references like "../acm" to dependency outputs inside the unit:

hcl
inputs = {
  acm_certificate_arn = try(values.acm_certificate_arn, "") == "../acm" ?
    dependency.acm.outputs.acm_certificate_arn :
    values.acm_certificate_arn
}

Keep it when maintaining an existing catalog; prefer autoinclude for new work.

Module Sourcing

Units reference modules via Git URL with version from values:

hcl
terraform {
  source = "git::git@github.com:YOUR_ORG/modules/rds.git//app?ref=${values.version}"
}

For catalog-internal references (units/stacks/modules in the same repo), Terragrunt 1.1+ allows plain relative paths with update_source_with_cas = true — stack generate rewrites them to content-addressed references, so no URL pinning or version plumbing is needed. See cas.md.

Common Operations

Create New Unit

  1. Create units/<name>/terragrunt.hcl
  2. Reference module via Git URL with ${values.version}
  3. Use values.xxx for inputs
  4. Add dependencies with mock outputs
  5. Wire dependencies via autoinclude in the stack (legacy: "../unit" reference resolution)

Create New Stack

  1. Create stacks/<name>/terragrunt.stack.hcl
  2. Define locals for computed values
  3. Add unit blocks referencing catalog units
  4. Pass values including version and dependency paths

Deploy to New Environment

  1. Create environment directory structure
  2. Add env.hcl with state_bucket_suffix
  3. Add stack files referencing catalog and run terragrunt stack generate
  4. Run terragrunt backend bootstrap --all to create state resources (or pass --backend-bootstrap on the first run). Do not use run --all -- backend bootstrap: everything after -- goes to OpenTofu/Terraform.

Best Practices

  1. Pin module versions - Use Git tags in values.version
  2. Pin catalog versions - Use refs in unit source URLs
  3. Wire dependencies with autoinclude - legacy "../unit" resolution only in existing catalogs
  4. Provide mock outputs - Enable plan/validate without dependencies
  5. Auto-detect features - length(keys(try(values.X, {}))) > 0
  6. Override paths - try(values.X_path, "../default")
  7. Separate state per environment - Use state_bucket_suffix

Common Pitfalls

  1. Git refspec error - Use //path?ref=branch NOT ?ref=branch//path
  2. Heredoc in ternary - Wrap in parentheses: condition ? (\n<<-EOF\n...\nEOF\n) : ""
  3. Missing mock outputs - Always provide for plan/validate
  4. Hardcoded paths - Use local paths only for testing

Upgrading to 1.2

  1. base64gzip() output changed - may force resource replacement; base64gzip_compat exists as an experiment.
  2. Generated files are read-only - stored in CAS as links; set mutable = true on a generate block that must be edited (see cas.md).
  3. S3 bootstrap no longer adds a root-access bucket policy - set enable_bucket_root_access = true if you relied on it.
  4. Dependency outputs read from state by default - S3/GCS/azurerm; encrypted state and other backends fall back to output; opt out with --no-dependency-fetch-output-from-state (see performance.md).

Docs Lookup

Prefer the Terragrunt docs MCP server https://mcp.docs.terragrunt.com/mcp (public beta) when available; otherwise https://docs.terragrunt.com.

Version Management

  • Development: Branch refs (ref=feature-branch)
  • Testing: RC tags (ref=v1.0.0-rc1)
  • Production: Stable tags (ref=v1.0.0)

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Terragrunt Skill làm được gì?

Use for Terragrunt work (0.68 to 1.2; OpenTofu or Terraform): building an infrastructure catalog, explicit stacks (terragrunt.stack.hcl), units wrapping OpenTofu/Terraform modules, live repos with a root.hcl hierarchy, remote state and locking (S3 lockfile, DynamoDB, GCS, azurerm), multi-account/multi-env with role assumption, classic Gruntwork live repos (_envcommon), migrating a terralith, exploring repos (find, list, dag), wiring dependencies (autoinclude, values), expansion blocks (for_each/count), the Content Addressable Store (CAS), OCI and versioned module sources, upgrading to 1.2,...

Vì sao nên dùng Terragrunt Skill trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Terragrunt Skill là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Terragrunt Skill trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/jfr992/terragrunt-skill/tree/main/skills/terragrunt-skill. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Terragrunt Skill?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Terragrunt Skill với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Terragrunt Skill với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Terragrunt Skill có miễn phí không?

Có. Kỹ năng này được jfr992 phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇