Skip to content

Conversation

@james00012
Copy link
Contributor

@james00012 james00012 commented Nov 7, 2025

Fixes #1609

This PR fixes the terragrunt module to properly handle TerragruntArgs and TerraformArgs, and updates compatibility for Terragrunt v0.93.5+.

Terragrunt Module Changes

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

Terraform Module Changes

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

CI Updates

  • Update Terragrunt version from v0.80.4 to v0.93.5 in CircleCI config

Testing

All previously failing tests now pass:

  • ✅ TestTgApplyAllTgError
  • ✅ TestTgApplyAllError
  • ✅ TestTgApplyUseLockNoError
  • ✅ TestExtraArgsHelp

@james00012 james00012 force-pushed the fix-terragrunt-args-1609 branch 2 times, most recently from 184cc78 to 8dc5bf2 Compare November 10, 2025 13:49
@james00012 james00012 marked this pull request as ready for review November 13, 2025 04:39
@james00012 james00012 force-pushed the fix-terragrunt-args-1609 branch 3 times, most recently from 59e5655 to f227589 Compare November 14, 2025 21:02
@denis256
Copy link
Member

Some of the tests fail for OpenTofu

=== NAME  TestTgInit
    init_test.go:24: 
        	Error Trace:	/home/circleci/project/modules/terragrunt/init_test.go:24
        	Error:      	"time=2025-11-14UTC21:17:28Z level=info msg=Downloading Terraform configurations from .. into ./.terragrunt-cache/HNjlx8Ikea9ZG8cXlAlmCSdkQ2A/ul4fGZhqpa-s4SOYRLrrZCN__Lk\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=Initializing the backend...\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=Initializing provider plugins...\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=OpenTofu has been successfully initialized!\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=You may now begin working with OpenTofu. Try running \"tofu plan\" to see\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=any changes that are required for your infrastructure. All OpenTofu commands\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=should now work.\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=If you ever set or change modules or backend configuration for OpenTofu,\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=rerun this command to reinitialize your working directory. If you forget, other\ntime=2025-11-14UTC21:17:29Z level=stdout tf-path=tofu msg=commands will detect it and remind you to do so if necessary." does not contain "Terraform has been successfully initialized!"
        	Test:       	TestTgInit
--- FAIL: TestTgInit (2.00s)

@james00012 james00012 force-pushed the fix-terragrunt-args-1609 branch 3 times, most recently from 28a774c to ddb7100 Compare November 16, 2025 02:58
…ompatibility

This PR fixes the terragrunt module to properly handle TerragruntArgs and
TerraformArgs, and updates compatibility for Terragrunt v0.93.5+.

## Terragrunt Module Changes

**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

## Terraform Module Changes

**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

## CI Updates

- Update Terragrunt version from v0.80.4 to v0.93.5 in CircleCI config

Fixes #1609
@james00012 james00012 force-pushed the fix-terragrunt-args-1609 branch from ddb7100 to 7a9748d Compare November 16, 2025 04:19
@james00012 james00012 marked this pull request as draft November 16, 2025 19:42
@james00012 james00012 closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Options "TerragruntArgs" are ignored

3 participants