CLI Reference¶
Learn the key commands and workflows for Cultivator.
Common Flags¶
These flags are available on plan, apply, and destroy:
| Flag | Description | Default |
|---|---|---|
--config |
Path to config file | (none) |
--root |
Root directory for terragrunt modules | . |
--env |
Environment filter | (none) |
--include |
Relative paths to include (comma-separated or repeated) | (none) |
--exclude |
Relative paths to exclude (comma-separated or repeated) | (none) |
--tags |
Tag filters (comma-separated or repeated) | (none) |
--parallelism |
Max parallel executions | CPU count |
--non-interactive |
Add -input=false to Terragrunt commands |
false |
--dry-run |
Print commands without executing them | false |
--graph |
Show Mermaid dependency graph | false |
--changed-only |
Only execute modules with changed files | false |
--base |
Git base reference for --changed-only |
HEAD |
Available Commands¶
Plan¶
Run terragrunt plan on matching stacks.
Command-specific options:
--destroy- runterragrunt plan -destroy
Apply¶
Run terragrunt apply on matching stacks.
Command-specific options:
--auto-approve- add-auto-approve
Destroy¶
Run terragrunt destroy on matching stacks.
Command-specific options:
--auto-approve- add-auto-approve
Doctor¶
Verify your environment and configuration. Checks for Terragrunt in PATH, validates the config file (if provided), and confirms the root directory exists.
Flags: --config, --root
Version¶
Print version information.
Example output:
CLI Examples¶
Plan specific environment¶
Plan specific stacks¶
Plan excluding experimental stacks¶
Plan only stacks with specific tags¶
Plan with custom parallelism¶
Magic Mode: Plan only changed modules¶
Compare current branch against main and only run plan on modules that have file changes.
CLI Arguments & Flags¶
Positional Arguments¶
Cultivator supports a positional argument for the module path. This is a shorthand for filtering to a specific module.
Note: The path is automatically normalized (e.g., removing leading ./ or trailing /terragrunt.hcl).
Environment Variables¶
| Variable | Values | Default | Description |
|---|---|---|---|
CULTIVATOR_LOG_LEVEL |
debug, info, warning, error |
info |
Minimum log level. |
CULTIVATOR_ROOT |
path | . |
Root directory for discovery. |
CULTIVATOR_ENV |
string | Environment filter. | |
CULTIVATOR_INCLUDE |
comma-separated paths | Paths to include. | |
CULTIVATOR_EXCLUDE |
comma-separated paths | Paths to exclude. | |
CULTIVATOR_TAGS |
comma-separated tags | Tag filters. | |
CULTIVATOR_PARALLELISM |
integer | CPU count | Max parallel executions. |
CULTIVATOR_NON_INTERACTIVE |
true, false |
false |
Force non-interactive mode. |
CULTIVATOR_DRY_RUN |
true, false |
false |
Enable dry-run mode. |
CULTIVATOR_SHOW_GRAPH |
true, false |
false |
Enable Mermaid graph output. |
CULTIVATOR_CHANGED_ONLY |
true, false |
false |
Enable Magic Mode (Git changes). |
CULTIVATOR_BASE_REF |
string | HEAD |
Git base reference for Magic Mode. |
Example — enable Magic Mode in CI:
Debugging and Verbose Logging¶
If you are experiencing issues with module discovery or filtering, you can enable verbose logging by setting the CULTIVATOR_LOG_LEVEL environment variable to debug.
Verbose mode provides detailed information about:
- Starting the discovery process with normalized paths.
- Directories being skipped (e.g.,
.git,node_modules). - Filter matching logic (include/exclude/environment/tags).
- Dependency extraction for each module.
This is especially useful for troubleshooting why a specific module was or was not included in the execution set.
Output Format¶
Cultivator produces human-readable text output by default, organized by module with clear section headers:
=== plan: live/prod/vpc ===
Running terragrunt plan in /path/to/live/prod/vpc...
[output from terragrunt]
=== plan: live/prod/app ===
Running terragrunt plan in /path/to/live/prod/app...
[output from terragrunt]
Each stack shows:
- Module path
- Terragrunt output and any errors
- Clear demarcation for easy scanning
Implementation note: Cultivator automatically appends
-no-colorto every Terragrunt invocation to produce clean, parseable output in CI environments.
Binary Invocation¶
Local development (after building):
CI/CD environments (pre-compiled/downloaded binaries in PATH):
Both forms are equivalent. The difference:
./cultivator- Runs binary in current directory (local builds)cultivator- Runs binary found in system PATH (CI/production installs)
Exit Codes¶
0- Success (all stacks executed successfully)1- Failure (one or more stacks failed)2- Usage error (invalid flags or arguments)
Execution Metrics¶
Cultivator automatically tracks and reports execution time:
- Per-module duration: Displayed in the logs for each module upon completion.
- Total duration: Displayed at the end of the command execution.
These metrics help identify infrastructure bottlenecks and optimize CI/CD runtime.
Summary Table¶
At the end of each execution, Cultivator displays a summary table with the following information:
- Module: The relative path to the module.
- Command: The Terragrunt command executed.
- Status:
SUCCESSorFAILURE. - Duration: The time taken to execute the module.
- Notes: Additional context, such as exit codes or error messages.
This table provides a high-level overview of the entire run, making it easy to identify failed modules in large projects.
Standard Workflow¶
For pull requests + main branch merges:
- PR triggers plan:
-
Review plan output
-
Merge PR
-
Main branch triggers apply:
See Features for more about what Cultivator can do.