Fix TerragruntArgs and TerraformArgs being ignored#1617
Merged
james00012 merged 2 commits intomainfrom Nov 18, 2025
Merged
Conversation
…ompatibility This PR fixes the terragrunt module to properly handle TerragruntArgs and TerraformArgs, and updates compatibility for Terragrunt v0.93.5+. **Argument Handling:** - Implement proper argument ordering: TerragruntArgs → --non-interactive → command → TerraformArgs - Replace GetCommonOptions/GetArgsForCommand with buildTerragruntArgs() for consistent argument construction - Remove deprecated -- separator approach that no longer works in newer Terragrunt versions **v0.93.5 Compatibility:** - Update command syntax from deprecated `run-all <cmd>` to new `<cmd> --all` format: - ApplyAll: `apply --all` - DestroyAll: `destroy --all` - PlanAllExitCode: `plan --all` **Stack Commands:** - Fix flag placement in stack output (-json flag now appears after command, not in TerragruntArgs) - Fix --no-color flag format for proper parsing - Add TerraformArgs support to stack commands **Terragrunt Command Updates:** - Add --non-interactive flag automatically for all Terragrunt commands (v0.93.5+) - Remove terraform-specific flags (-input=false, -auto-approve) from TgApplyAllE and TgDestroyAllE that are not supported by Terragrunt run-all commands **ValidateInputsE Function:** - Update from deprecated `validate-inputs` to new `hcl validate --inputs` command (Terragrunt v0.88.1+) - Update TestExtraArgsHelp to handle new command format in help output - Update Terragrunt version from v0.80.4 to v0.93.5 in CircleCI config Fixes #1609
Add comprehensive test coverage and documentation to complement the TerragruntArgs/TerraformArgs fix. **Test Enhancements:** - Add unit tests for core cmd.go functions: - TestValidateOptions - validates option validation logic - TestBuildTerragruntArgs - table-driven tests for arg construction - TestPrepareOptions - tests default value setting - TestEnvVarsPropagation - verifies env vars are passed through - Add E2E workflow tests in terragrunt_e2e_test.go: - TestTerragruntEndToEndIntegration - full Plan→Apply→Plan→Destroy workflow - TestStackEndToEndIntegration - stack Init→Generate→Run→Clean workflow **Documentation:** - Add README.md for terragrunt module with: - Requirements (Terragrunt + Terraform/OpenTofu) - How to specify terraform vs opentofu binary - Key concepts (Options, TerragruntArgs vs TerraformArgs) - Function reference (Stack vs Non-Stack) - Practical examples - List of unsupported terragrunt features - Compatibility notes Test Coverage: All 38 tests pass, including new unit tests and E2E tests
denis256
approved these changes
Nov 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1609
Problem
TerragruntArgs and TerraformArgs were being ignored when running terragrunt commands, affecting all terragrunt module functions.
Solution
Core Fix:
buildTerragruntArgs()with proper argument ordering:TerragruntArgs → --non-interactive → command → TerraformArgsGetCommonOptions()andGetArgsForCommand()which weren't including user-provided args<cmd> --allinstead of deprecatedrun-all <cmd>New in this PR:
Breaking Changes
Removed internal functions (low impact - use public APIs instead):
GetCommonOptions(),GetArgsForCommand(),ArgSeparatorconstantBehavior change: TerragruntArgs/TerraformArgs now work correctly (previously ignored)
Testing
All tests pass with terragrunt v0.80.4 and v0.93.5.