Exécuteur de commandes Terragrunt

VérifiéPrudence

Assiste l'exécution de commandes Terragrunt (init, plan, apply) sur des modules simples ou multiples avec run-all. Gère les dépendances et requiert confirmation avant les modifications.

Spar Skills Guide Bot
DeveloppementIntermédiaire
3002/06/2026
Claude Code
#terragrunt#terraform#infrastructure#iac#devops

Recommandé pour

Notre avis

Exécute des commandes Terragrunt (init, plan, apply, run-all, etc.) sur des projets d'infrastructure modulaire.

Points forts

  • Gère à la fois les opérations sur un seul module et sur plusieurs modules (run-all).
  • Fournit une visualisation du graphe de dépendances entre modules.
  • Inclut des vérifications de sécurité (pas de auto-approve, confirmation utilisateur requise pour apply).
  • Formate les résultats de manière structurée pour une lecture facile.

Limites

  • Nécessite que Terragrunt et Terraform soient installés dans l'environnement.
  • Ne couvre pas tous les sous-commandes avancées de Terragrunt (ex: terraform block, hclfmt).
  • La gestion d'état complexe hors Terragrunt n'est pas prise en charge.
Quand l'utiliser

Lorsque vous gérez plusieurs modules Terragrunt et que vous devez exécuter des commandes init/plan/apply de manière cohérente sur l'ensemble.

Quand l'éviter

Pour des commandes Terraform ad-hoc non liées à Terragrunt, ou lorsque vous devez modifier programmatiquement les fichiers terragrunt.hcl.

Analyse de sécurité

Prudence
Score qualité85/100

The skill uses Bash to run Terragrunt commands, including state-changing operations like apply. It mitigates risk by forbidding auto-approve and destroy, and insisting on user confirmation, but still carries inherent risk from infrastructure modifications.

Points d'attention
  • Executes terragrunt apply, which modifies infrastructure; although it instructs user confirmation, the actual enforcement depends on the agent.

Exemples

Initialize all modules
Run terragrunt init on all modules in the current project.
Show dependency graph
Show the dependency graph of my terragrunt modules.
Plan all modules with run-all
Plan changes across all modules using terragrunt run-all plan.

name: exec-tg description: Terragrunt コマンドを実行する。「terragrunt run-all」「tg plan-all」「tg apply-all」「terragrunt init」「tg init」「terragrunt して」「tg plan」「run-all apply」「モジュール一括適用」「terragrunt 実行」などで起動。 allowed-tools: [Bash, Read]

Terragrunt Executor

Terragrunt コマンドの実行を支援します。

対応操作

| 操作 | トリガー例 | コマンド | |------|-----------|----------| | 初期化 | 「tg init」「terragrunt init」 | terragrunt init | | 計画 | 「tg plan」「terragrunt plan」 | terragrunt plan | | 適用 | 「tg apply」「terragrunt apply」 | terragrunt apply | | 一括初期化 | 「run-all init」「全体 init」 | terragrunt run-all init | | 一括計画 | 「run-all plan」「全体 plan」 | terragrunt run-all plan | | 一括適用 | 「run-all apply」「全体 apply」 | terragrunt run-all apply | | 依存グラフ | 「依存関係」「graph」 | terragrunt graph-dependencies | | 出力確認 | 「output」「出力確認」 | terragrunt output |

実行手順

1. 意図の判定

ユーザーの発話から操作を判定:

  • 単一モジュール: 「tg plan」「terragrunt apply」→ 単一モジュール操作
  • 複数モジュール: 「run-all」「全体」「一括」→ run-all 操作
  • 依存関係: 「依存」「graph」→ graph-dependencies

2. 事前確認

# Terragrunt バージョン確認
terragrunt --version

# terragrunt.hcl の存在確認
ls terragrunt.hcl 2>/dev/null || ls **/terragrunt.hcl 2>/dev/null

3. コマンド実行

単一モジュール:

# init
terragrunt init

# plan
terragrunt plan

# apply(ユーザー確認後)
terragrunt apply

複数モジュール(run-all):

# init
terragrunt run-all init

# plan
terragrunt run-all plan

# apply(ユーザー確認後)
terragrunt run-all apply

依存関係の確認:

terragrunt graph-dependencies

4. 出力フォーマット

## Terragrunt 実行結果

### コマンド
terragrunt {command}

### 対象モジュール
{モジュール一覧(run-all の場合)}

### 結果
{コマンドの出力}

### サマリー
{成功/失敗と簡潔な説明}

run-all の注意事項

run-all は複数のモジュールを一括で操作するため:

  • run-all plan で全体の変更内容を確認
  • ✅ 依存関係に基づいて適切な順序で実行される
  • run-all apply は本番環境では慎重に
  • run-all destroy は直接実行しない

注意事項

  • ✅ plan は安全な読み取り操作
  • ✅ apply は必ずユーザー確認を取る
  • -auto-approve は使用しない
  • destroy / run-all destroy は直接実行しない
Skills similaires