Skip to content

Add missing terragrunt commands: ValidateAll, RunAll, FormatAll, OutputListAll#1622

Merged
james00012 merged 2 commits intomainfrom
feat/add-missing-terragrunt-commands
Nov 20, 2025
Merged

Add missing terragrunt commands: ValidateAll, RunAll, FormatAll, OutputListAll#1622
james00012 merged 2 commits intomainfrom
feat/add-missing-terragrunt-commands

Conversation

@james00012
Copy link
Copy Markdown
Contributor

@james00012 james00012 commented Nov 18, 2025

Summary

Adds missing terragrunt command wrappers to improve test coverage and flexibility:

  • ValidateAll - Validate all terragrunt configurations without init
  • RunAll - Generic wrapper to run any terraform command across all modules
  • FormatAll - Format all terragrunt.hcl files using hclfmt
  • OutputListAll - Get list of all stack output variable names

Each function includes both wrapper and error-returning (E) variants with comprehensive test coverage.

Benefits

  • 95% command coverage - Support for all commonly-used terragrunt operations
  • Future-proof - RunAll enables testing new terraform commands without code changes
  • Better validation - ValidateAll checks configurations before expensive init/plan
  • Output introspection - OutputListAll enables dynamic output validation in tests

Test Coverage

All 28 exported functions now have complete test coverage (51 test functions total).

Breaking Changes

None - this PR only adds new functions without modifying existing APIs.

@james00012 james00012 force-pushed the feat/add-missing-terragrunt-commands branch 3 times, most recently from d7c9023 to 50f36e9 Compare November 18, 2025 01:14
@james00012 james00012 changed the title Add missing terragrunt commands: TgValidateAll and TgOutputAll Add ValidateAll and OutputAll commands Nov 18, 2025
@james00012 james00012 force-pushed the feat/add-missing-terragrunt-commands branch from 50f36e9 to 94d5b98 Compare November 18, 2025 01:20
@james00012 james00012 marked this pull request as draft November 18, 2025 01:21
@james00012 james00012 changed the title Add ValidateAll and OutputAll commands Add missing terragrunt commands and remove Tg prefix Nov 18, 2025
@james00012 james00012 force-pushed the feat/add-missing-terragrunt-commands branch from 0389eab to 71f9568 Compare November 18, 2025 23:53
@james00012 james00012 changed the title Add missing terragrunt commands and remove Tg prefix Add ValidateAll and OutputAll terragrunt commands Nov 18, 2025
@james00012 james00012 marked this pull request as ready for review November 19, 2025 00:01
@james00012 james00012 changed the title Add ValidateAll and OutputAll terragrunt commands Add missing terragrunt commands with flexible RunAll support Nov 19, 2025
@james00012 james00012 force-pushed the feat/add-missing-terragrunt-commands branch from 71f9568 to cd27bb3 Compare November 19, 2025 00:18
@james00012 james00012 changed the title Add missing terragrunt commands with flexible RunAll support Add missing terragrunt commands: ValidateAll, RunAll, FormatAll, OutputListAll Nov 19, 2025
Add ValidateAll, OutputAll, RunAll, OutputListAll, and FormatAll functions with comprehensive tests.

New Functions:
- ValidateAll/ValidateAllE - runs terragrunt validate --all
- OutputAll/OutputAllE - gets all stack outputs as a map
- OutputListAll/OutputListAllE - gets list of all output variable names
- RunAll/RunAllE - runs any terraform command with --all flag
- FormatAll/FormatAllE - formats all terragrunt.hcl files

Testing:
- Added wrapper tests for all exported functions (both E and non-E variants)
- All 28 exported functions now have complete test coverage
- Updated README with usage examples
@james00012 james00012 force-pushed the feat/add-missing-terragrunt-commands branch from cd27bb3 to 690fade Compare November 19, 2025 04:50
Copy link
Copy Markdown
Member

@denis256 denis256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to add support for the new CLI commands as well, either in this PR or in a follow-up

"github.com/stretchr/testify/require"
)

func TestFormatAll(t *testing.T) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is failing on the new Terragrunt version after CLI redesign

TestFormatAll 2025-11-19T15:22:35Z logger.go:67: time=2025-11-19GMT15:22:35Z level=error msg=unknown command: "hclfmt". Terragrunt no longer forwards unknown commands by default. Use 'terragrunt run -- hclfmt ...' or a supported shortcut. Learn more: https://terragrunt.gruntwork.io/docs/migrate/cli-redesign/#use-the-new-run-command

https://terragrunt.gruntwork.io/docs/migrate/cli-redesign/#use-the-newly-renamed-commands

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm interesting. Let me tackle this in a follow-up PR and I'll upgrade the terragrunt version to the latest one for the circleCI so it catches this as well going forward.

@james00012 james00012 merged commit c45e788 into main Nov 20, 2025
2 of 3 checks passed
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.

2 participants