Skip to content

Commit

Permalink
Add stack run * documentation (#3778)
Browse files Browse the repository at this point in the history
* Add terragrunt stack run * documentation

* Markdown lint fixes
  • Loading branch information
denis256 authored Jan 16, 2025
1 parent 70700e7 commit 2a3a00a
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion docs/_docs/04_reference/02-cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ Notes:
The `terragrunt stack` commands provide an interface for managing collections of Terragrunt units defined in `terragrunt.stack.hcl` files.
These commands simplify the process of handling multiple infrastructure units by grouping them into a "stack", reducing code duplication and streamlining operations across environments.

#### generate

The `terragrunt stack generate` command is used to generate a stack of `terragrunt.hcl` files based on the configuration provided in the `terragrunt.stack.hcl` file.

Given the following `terragrunt.stack.hcl` configuration:
Expand All @@ -769,7 +771,7 @@ unit "app2" {
```

Running:
Executing generate:

```bash
terragrunt stack generate
Expand All @@ -785,6 +787,37 @@ Will create the following directory structure:
└── terragrunt.hcl
```

#### run

The `terragrunt stack run *` command enables users to execute IaC commands across all units defined in the `terragrunt.stack.hcl` file.
This feature facilitates efficient orchestration of operations on multiple units, simplifying workflows for managing complex infrastructure stacks.

**Examples:**

Run a plan on each unit:

```bash
terragrunt stack run plan
```

Apply changes for each unit:

```bash
terragrunt stack run apply
```

Destroy all units:

```bash
terragrunt stack run destroy
```

**Note:**

Before executing the specified command, the `terragrunt stack run *` command will automatically generate the stack by creating
the `.terragrunt-stack` directory using the `terragrunt.stack.hcl` configuration file.
This ensures that all units are up-to-date before running the requested operation.

## CLI options

Terragrunt forwards all options to OpenTofu/Terraform. The only exceptions are `--version` and arguments that start with the
Expand Down

0 comments on commit 2a3a00a

Please sign in to comment.