Skip to content

Terragrunt non-interactive arguments/env var changes. #146

@kaorihinata

Description

@kaorihinata

Describe the bug
Arguments/environment variables for Terragrunt support are changing which is causing warnings to appear at the top of Terragrunt output:

07:23:17.251 WARN   The `--terragrunt-non-interactive` flag is deprecated and will be removed in a future version of Terragrunt. Use `--non-interactive` instead.
07:23:17.251 WARN   The `TERRAGRUNT_FORWARD_TF_STDOUT` environment variable is deprecated and will be removed in a future version of Terragrunt. Use `TG_TF_FORWARD_STDOUT=true` instead.

This may also be a good opportunity to replace a flag with an environment variable (or maybe even remove the Terragrunt check at line 195 of internal/task/task.go entirely if you don't mind the extra environment variables.)

  • --terragrunt-non-interactive has been replaced with --non-interactive, but we also have TERRAGRUNT_NON_INTERACTIVE, or the new flag which does not produce a warning, TG_NON_INTERACTIVE.
  • TERRAGRUNT_FORWARD_TF_STDOUT is also being replaced with TG_TF_FORWARD_STDOUT.

For the environment variables, providing both at the same time doesn't seem to be a problem, and the older TERRAGRUNT_* forms go quite far back (TERRAGRUNT_FORWARD_TF_STDOUT goes back to the output changes that made it necessary in the first place, and TERRAGRUNT_NON_INTERACTIVE has been there for years.)

I tested the following on internal/task/task.go. It removed the warnings and should cover older versions as well:

@@ -195,4 +195,8 @@
 	if task.Program == "terragrunt" && f.terragrunt {
+		// Flags for older Terragrunt.
 		task.AdditionalEnv = append(task.AdditionalEnv, "TERRAGRUNT_FORWARD_TF_STDOUT=1")
-		task.Args = append(task.Args, "--terragrunt-non-interactive")
+		task.AdditionalEnv = append(task.AdditionalEnv, "TERRAGRUNT_NON_INTERACTIVE=1")
+		// Flags for newer Terragrunt.
+		task.AdditionalEnv = append(task.AdditionalEnv, "TG_TF_FORWARD_STDOUT=1")
+		task.AdditionalEnv = append(task.AdditionalEnv, "TG_NON_INTERACTIVE=1")
 	}

Setup (please complete the following information):

  • OS [e.g. Ubuntu, macOS] macOS Sonoma (15.5)
  • Shell [e.g. zsh, fish] zsh
  • Terminal Emulator [e.g. kitty, iterm] iTerm
  • Terminal Multiplexer [e.g. tmux] tmux

To Reproduce

  • Create a simple terraform module with an empty terragrunt.hcl file.
  • Using pug, plan a run of that module.

Expected behavior
Terragrunt output without deprecation warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions