Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestParseTerragruntOptionsFromArgs(t *testing.T) {
},

{
args: []string{"plan", doubleDashed(run.ConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath, "--terragrunt-non-interactive"},
args: []string{"plan", doubleDashed(run.ConfigFlagName), "/some/path/" + config.DefaultTerragruntConfigPath, "-non-interactive"},
expectedOptions: mockOptions(t, "/some/path/"+config.DefaultTerragruntConfigPath, workingDir, []string{"plan"}, true, "", false, false, defaultLogLevel, false),
},

Expand Down
2 changes: 1 addition & 1 deletion cli/commands/run/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const (

// NewFlags creates and returns global flags.
func NewFlags(opts *options.TerragruntOptions, prefix flags.Prefix) cli.Flags {
tgPrefix := prefix.Prepend(flags.TgPrefix)
tgPrefix := flags.Prefix{flags.TgPrefix}
terragruntPrefix := flags.Prefix{flags.TerragruntPrefix}
terragruntPrefixControl := flags.StrictControlsByCommand(opts.StrictControls, CommandName)
legacyLogsControl := flags.StrictControlsByCommand(opts.StrictControls, CommandName, controls.LegacyLogs)
Expand Down
4 changes: 2 additions & 2 deletions cli/flags/global/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ func NewFlagsWithDeprecatedMovedFlags(opts *options.TerragruntOptions) cli.Flags
// and we create new strict controls each time we call `commands.New` which will then be evaluated,
// we need to clear `Strict Controls` to avoid them being displayed and causing duplicate warnings, for example, log output:
//
// WARN The global `--terragrunt-no-auto-init` flag has moved to the `run` command and will not be accessible as a global flag in a future version of Terragrunt. Use `run --no-auto-init` instead.
// WARN The `--terragrunt-no-auto-init` flag is deprecated and will be removed in a future version of Terragrunt. Use `--no-auto-init` instead.
// WARN The global `--no-auto-init` flag has moved to the `run` command and will not be accessible as a global flag in a future version of Terragrunt. Use `run --no-auto-init` instead.
// WARN The `--no-auto-init` flag is deprecated and will be removed in a future version of Terragrunt. Use `--no-auto-init` instead.
cmdOpts := opts.Clone()
cmdOpts.StrictControls = nil

Expand Down
12 changes: 6 additions & 6 deletions config/config_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,16 +808,16 @@ func getCleanedTargetConfigPath(configPath string, workingPath string) string {
// GetTerragruntSourceForModule returns the source path for a module based on the source path of the parent module and the
// source path specified in the module's terragrunt.hcl file.
//
// If one of the xxx-all commands is called with the --terragrunt-source parameter, then for each module, we need to
// build its own --terragrunt-source parameter by doing the following:
// If one of the xxx-all commands is called with the --source parameter, then for each module, we need to
// build its own --source parameter by doing the following:
//
// 1. Read the source URL from the Terragrunt configuration of each module
// 2. Extract the path from that URL (the part after a double-slash)
// 3. Append the path to the --terragrunt-source parameter
// 3. Append the path to the --source parameter
//
// Example:
//
// --terragrunt-source: /source/infrastructure-modules
// --source: /source/infrastructure-modules
// source param in module's terragrunt.hcl: git::git@github.com:acme/infrastructure-modules.git//networking/vpc?ref=v0.0.1
//
// This method will return: /source/infrastructure-modules//networking/vpc
Expand Down Expand Up @@ -914,7 +914,7 @@ func sopsDecryptFile(ctx *ParsingContext, params []string) (string, error) {
)

// Set environment variables from the TerragruntOptions.Env map.
// This is especially useful for integrations with things like the `terragrunt-auth-provider` flag,
// This is especially useful for integrations with things like the `auth-provider` flag,
// which can set environment variables that are used for decryption.
//
// Due to the fact that sops doesn't expose a way of explicitly setting authentication configurations
Expand Down Expand Up @@ -974,7 +974,7 @@ func getSopsFileFormat(sourceFile string) (string, error) {
return format, nil
}

// Return the location of the Terraform files provided via --terragrunt-source
// Return the location of the Terraform files provided via --source
func getTerragruntSourceCliFlag(ctx *ParsingContext) (string, error) {
return ctx.TerragruntOptions.Source, nil
}
Expand Down
2 changes: 1 addition & 1 deletion config/dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ func setupTerragruntOptionsForBareTerraform(ctx *ParsingContext, workingDir stri
// the one we retrieved from the config.
targetTGOptions.IAMRoleOptions = options.MergeIAMRoleOptions(iamRoleOpts, targetTGOptions.OriginalIAMRoleOptions)

// Make sure to assume any roles set by TERRAGRUNT_IAM_ROLE
// Make sure to assume any roles set by TG_IAM_ROLE
if err := creds.NewGetter().ObtainAndUpdateEnvIfNecessary(ctx, targetTGOptions,
externalcmd.NewProvider(targetTGOptions),
amazonsts.NewProvider(targetTGOptions),
Expand Down
4 changes: 2 additions & 2 deletions config/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ type InvalidSourceURLError struct {
}

func (err InvalidSourceURLError) Error() string {
return fmt.Sprintf("The --terragrunt-source parameter is set to '%s', but the source URL in the module at '%s' is invalid: '%s'. Note that the module URL must have a double-slash to separate the repo URL from the path within the repo!", err.TerragruntSource, err.ModulePath, err.ModuleSourceURL)
return fmt.Sprintf("The --source parameter is set to '%s', but the source URL in the module at '%s' is invalid: '%s'. Note that the module URL must have a double-slash to separate the repo URL from the path within the repo!", err.TerragruntSource, err.ModulePath, err.ModuleSourceURL)
}

type InvalidSourceURLWithMapError struct {
Expand All @@ -161,7 +161,7 @@ type InvalidSourceURLWithMapError struct {
}

func (err InvalidSourceURLWithMapError) Error() string {
return fmt.Sprintf("The --terragrunt-source-map parameter was passed in, but the source URL in the module at '%s' is invalid: '%s'. Note that the module URL must have a double-slash to separate the repo URL from the path within the repo!", err.ModulePath, err.ModuleSourceURL)
return fmt.Sprintf("The --source-map parameter was passed in, but the source URL in the module at '%s' is invalid: '%s'. Note that the module URL must have a double-slash to separate the repo URL from the path within the repo!", err.ModulePath, err.ModuleSourceURL)
}

type ParsingModulePathError struct {
Expand Down
6 changes: 3 additions & 3 deletions configstack/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ func (module *TerraformModule) findModuleInPath(targetDirs []string) bool {
// applied. If the user selects "yes", then Terragrunt will apply that module as well.
// Note that we skip the prompt for `run-all destroy` calls. Given the destructive and irreversible nature of destroy, we don't
// want to provide any risk to the user of accidentally destroying an external dependency unless explicitly included
// with the --terragrunt-include-external-dependencies or --terragrunt-include-dir flags.
// with the --queue-include-external or --queue-include-dir flags.
func (module *TerraformModule) confirmShouldApplyExternalDependency(ctx context.Context, dependency *TerraformModule, opts *options.TerragruntOptions) (bool, error) {
if opts.IncludeExternalDependencies {
opts.Logger.Debugf("The --terragrunt-include-external-dependencies flag is set, so automatically including all external dependencies, and will run this command against module %s, which is a dependency of module %s.", dependency.Path, module.Path)
opts.Logger.Debugf("The --queue-include-external flag is set, so automatically including all external dependencies, and will run this command against module %s, which is a dependency of module %s.", dependency.Path, module.Path)
return true, nil
}

Expand Down Expand Up @@ -556,7 +556,7 @@ func (modules TerraformModules) flagUnitsThatRead(opts *options.TerragruntOption
return modules
}

// flagExcludedDirs iterates over a module slice and flags all entries as excluded listed in the terragrunt-exclude-dir CLI flag.
// flagExcludedDirs iterates over a module slice and flags all entries as excluded listed in the queue-exclude-dir CLI flag.
func (modules TerraformModules) flagExcludedDirs(opts *options.TerragruntOptions) TerraformModules {
// If we don't have any excludes, we don't need to do anything.
if len(opts.ExcludeDirs) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion configstack/running_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (module *RunningModule) waitForDependencies() error {

if doneDependency.Err != nil {
if module.Module.TerragruntOptions.IgnoreDependencyErrors {
module.Module.TerragruntOptions.Logger.Errorf("Dependency %s of module %s just finished with an error. Module %s will have to return an error too. However, because of --terragrunt-ignore-dependency-errors, module %s will run anyway.", doneDependency.Module.Path, module.Module.Path, module.Module.Path, module.Module.Path)
module.Module.TerragruntOptions.Logger.Errorf("Dependency %s of module %s just finished with an error. Module %s will have to return an error too. However, because of --queue-ignore-errors, module %s will run anyway.", doneDependency.Module.Path, module.Module.Path, module.Module.Path, module.Module.Path)
} else {
module.Module.TerragruntOptions.Logger.Errorf("Dependency %s of module %s just finished with an error. Module %s will have to return an error too.", doneDependency.Module.Path, module.Module.Path, module.Module.Path)
return ProcessingModuleDependencyError{module.Module, doneDependency.Module, doneDependency.Err}
Expand Down
2 changes: 1 addition & 1 deletion configstack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ func (stack *Stack) resolveTerraformModule(ctx context.Context, terragruntConfig

// If `childTerragruntConfig.ProcessedIncludes` contains the path `terragruntConfigPath`, then this is a parent config
// which implies that `TerragruntConfigPath` must refer to a child configuration file, and the defined `IncludeConfig` must contain the path to the file itself
// for the built-in functions `read-terragrunt-config()`, `path_relative_to_include()` to work correctly.
// for the built-in functions `read_terragrunt_config()`, `path_relative_to_include()` to work correctly.
var includeConfig *config.IncludeConfig

if stack.childTerragruntConfig != nil && stack.childTerragruntConfig.ProcessedIncludes.ContainsPath(terragruntConfigPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ When reading Terragrunt HCL configurations, you might read in a computed configu
# computed.hcl

locals {
computed_value = run_cmd("--quiet", "python3", "-c", "print('Hello,')")
computed_value = run_cmd("--terragrunt-quiet", "python3", "-c", "print('Hello,')")
}
```

Expand Down Expand Up @@ -1431,7 +1431,7 @@ with external feature flag services like [LaunchDarkly](https://launchdarkly.com
# terragrunt.hcl

feature "feature_name" {
default = run_cmd("--quiet", "<command-to-fetch-feature-flag-value>")
default = run_cmd("--terragrunt-quiet", "<command-to-fetch-feature-flag-value>")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ remote_state {
}
```

If the command you are running has the potential to output sensitive values, you may wish to redact the output from appearing in the terminal. To do so, use the special `--quiet` argument which must be passed as one of the first arguments to `run_cmd()`:
If the command you are running has the potential to output sensitive values, you may wish to redact the output from appearing in the terminal. To do so, use the special `--terragrunt-quiet` argument which must be passed as one of the first arguments to `run_cmd()`:

```hcl
super_secret_value = run_cmd("--quiet", "./decrypt_secret.sh", "foo")
super_secret_value = run_cmd("--terragrunt-quiet", "./decrypt_secret.sh", "foo")
```

**Note:** This will prevent terragrunt from displaying the output from the command in its output. However, the value could still be displayed in the OpenTofu/Terraform output if OpenTofu/Terraform does not treat it as a [sensitive value](https://www.terraform.io/docs/configuration/outputs.html#sensitive-suppressing-values-in-cli-output).
Expand Down Expand Up @@ -767,10 +767,10 @@ carrot
- Output contains multiple times `uuid3`, +1 more output comparing to `uuid1` and `uuid2` - because `uuid3` is declared in locals and inputs which add one more evaluation
- Output contains only once `uuid4` since it is declared only once in `inputs`, `inputs` is not evaluated twice

You can modify this caching behavior to ignore the existing directory if you know the command you are running is not dependent on the current directory path. To do so, use the special `--global-cache` argument which must be passed as one of the first arguments to `run_cmd()` (and can be combined with `--quiet` in any order):
You can modify this caching behavior to ignore the existing directory if you know the command you are running is not dependent on the current directory path. To do so, use the special `--terragrunt-global-cache` argument which must be passed as one of the first arguments to `run_cmd()` (and can be combined with `--terragrunt-quiet` in any order):

```hcl
value = run_cmd("--global-cache", "--quiet", "/usr/local/bin/get-account-map")
value = run_cmd("--terragrunt-global-cache", "--terragrunt-quiet", "/usr/local/bin/get-account-map")
```

## read_terragrunt_config
Expand Down Expand Up @@ -912,7 +912,7 @@ Some example use cases are:

## read_tfvars_file

`read_tfvars_file(file_path)` reads a `.tfvars` or `.tfvars.json` file and returns a map of the variables defined in it.
`read_tfvars_file(file_path)` reads a `.tfvars` or `.tfvars.json` file and returns a map of the variables defined in it.

This is useful for reading variables from a `.tfvars` file, merging them into the inputs, or using them in a `locals` block:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar:

import { Aside, Badge, LinkCard } from '@astrojs/starlight/components';

These are the rules that Terragrunt maintainers endeavor to follow when working on the CLI.
These are the rules that Terragrunt maintainers endeavor to follow when working on the CLI.

Whenever we break these rules, that is a bug and should be reported. The maintainers will either fix the behavior, or update the rules to reflect the reason for the discrepancy.

Expand Down Expand Up @@ -46,7 +46,7 @@ In addition, if you find that a certain pattern that's reliably followed in the
<details>
<summary><Badge text="Example" variant="note" /></summary>

`--provider-cache`: The system is the `provider cache` server. The Provider Cache Server be enabled if this flag is set.
`--provider-cache`: The system is the `provider cache` server. The Provider Cache Server be enabled if this flag is set.

For brevity, prefer this to flags like `--provider-cache-enable`.
</details>
Expand Down Expand Up @@ -89,7 +89,7 @@ In addition, if you find that a certain pattern that's reliably followed in the

For example, the [terragrunt-include-module-prefix](https://terragrunt.gruntwork.io/docs/reference/cli-options/#terragrunt-include-module-prefix) flag was previously opt-in, but users were better served with the behavior being opt-out. To preserve backwards compatibility until the next release, the flag remained, but to use it, users had to set it via `--terragrunt-include-module-prefix=false`.

In this scenario, whenever applicable, a different flag will be made available that does obey this rule (like [forward-tf-stdout](https://terragrunt.gruntwork.io/docs/reference/cli-options/#forward-tf-stdout)).
In this scenario, whenever applicable, a different flag will be made available that does obey this rule (like [tf-forward-stdout](https://terragrunt.gruntwork.io/docs/reference/cli-options/#tf-forward-stdout)).
</details>

When a flag prevents something from happening that Terragrunt would do by default, it will be proceeded by the prefix `no`/ `non`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ write DRY, reusable infrastructure. But how do we figure out what
went wrong in the rare case that they _don't_ play well?

Terragrunt provides a way to configure logging level through the `--log-level`
command flag. Additionally, Terragrunt provides `--debug-inputs`, that can be used
command flag. Additionally, Terragrunt provides `--inputs-debug`, that can be used
to generate `terragrunt-debug.tfvars.json`.

For example you could use it like this to debug an `apply` that's producing
unexpected output:

```shell
terragrunt apply --log-level debug --debug-inputs
terragrunt apply --log-level debug --inputs-debug
```

Running this command will do two things for you:
Expand Down Expand Up @@ -94,7 +94,7 @@ elements, but you know that the cluster only has 4 VMs in it! What's happening?
Let's figure it out. Run this:

```shell
terragrunt apply --log-level debug --debug-inputs
terragrunt apply --log-level debug --inputs-debug
```

After applying, you will see this output on standard error
Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/02_features/01-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ This idea is inspired by Kief Morris' blog post [Using Pipelines to Manage Envir

## Working locally

If you’re testing changes to a local copy of the `modules` repo, you can use the `--source` command-line option or the `TERRAGRUNT_SOURCE` environment variable to override the `source` parameter. This is useful to point Terragrunt at a local checkout of your code so you can do rapid, iterative, make-a-change-and-rerun development:
If you’re testing changes to a local copy of the `modules` repo, you can use the `--source` command-line option or the `TG_SOURCE` environment variable to override the `source` parameter. This is useful to point Terragrunt at a local checkout of your code so you can do rapid, iterative, make-a-change-and-rerun development:

```bash
cd live/stage/app
Expand Down
Loading
Loading