Skip to content

Simplify terragrunt function names#1621

Merged
james00012 merged 1 commit intomainfrom
fix/rename-run-all-functions-1618
Nov 18, 2025
Merged

Simplify terragrunt function names#1621
james00012 merged 1 commit intomainfrom
fix/rename-run-all-functions-1618

Conversation

@james00012
Copy link
Copy Markdown
Contributor

@james00012 james00012 commented Nov 18, 2025

Description

Simplifies function names by removing the Tg prefix, following Terragrunt's own simplification of removing terragrunt- prefixes from CLI flags.

⚠️ BREAKING CHANGE: All function names have been updated. Users will need to update their test code when upgrading.

Changes

Function renames:

  • ApplyAll (was TgApplyAll)
  • DestroyAll (was TgDestroyAll)
  • PlanAllExitCode (was TgPlanAllExitCode)
  • Init (was TgInit)
  • StackGenerate, StackRun, StackClean (removed Tg prefix)
  • Output, OutputJson, OutputAll (removed Tg prefix)

All tests and documentation updated.

Migration Guide

// Before
terragrunt.TgApplyAll(t, options)
defer terragrunt.TgDestroyAll(t, options)
terragrunt.TgInit(t, options)

// After
terragrunt.ApplyAll(t, options)
defer terragrunt.DestroyAll(t, options)
terragrunt.Init(t, options)

Simple find-replace: Remove Tg prefix from all terragrunt function calls.

Benefits

  • Simpler, cleaner API
  • Package name already indicates these are terragrunt functions
  • Consistent with Terragrunt CLI simplification
  • Less typing, easier to read

Fixes #1618

@yhakbar
Copy link
Copy Markdown
Contributor

yhakbar commented Nov 18, 2025

@james00012 Why do this? We just removed the terragrunt- prefixes for flags in Terragrunt :)

It seems odd that we'd prefix them like this terragrunt.TgApplyAll(t, options)

@james00012
Copy link
Copy Markdown
Contributor Author

@james00012 Why do this? We just removed the terragrunt- prefixes for flags in Terragrunt :)

It seems odd that we'd prefix them like this terragrunt.TgApplyAll(t, options)

Yeah that's a good idea.

@james00012 james00012 force-pushed the fix/rename-run-all-functions-1618 branch from bec705c to ce2716b Compare November 18, 2025 01:11
Remove the terragrunt- prefix from flags and update function names to match
standard terraform module naming conventions.

Changes:
- ApplyAll (was TgApplyAll)
- ApplyAllE (was TgApplyAllE)
- DestroyAll (was TgDestroyAll)
- DestroyAllE (was TgDestroyAllE)
- PlanAllExitCode (was TgPlanAllExitCode)
- PlanAllExitCodeE (was TgPlanAllExitCodeE)
- Init (was TgInit)
- InitE (was TgInitE)
- StackGenerate (was TgStackGenerate)
- StackGenerateE (was TgStackGenerateE)
- StackRun (was TgStackRun)
- StackRunE (was TgStackRunE)
- StackClean (was TgStackClean)
- StackCleanE (was TgStackCleanE)
- Output (was TgOutput)
- OutputE (was TgOutputE)
- OutputJson (was TgOutputJson)
- OutputJsonE (was TgOutputJsonE)
- OutputAll (was TgOutputAll)
- OutputAllE (was TgOutputAllE)
- Update all tests to use new function names
- Update README documentation and examples

Benefits:
- Simpler, cleaner function names
- Consistent with Terragrunt removing terragrunt- prefix from flags
- Easier to type and read
- Package name already indicates these are terragrunt functions

Fixes #1618
@james00012 james00012 force-pushed the fix/rename-run-all-functions-1618 branch from ce2716b to b055a89 Compare November 18, 2025 01:14
@james00012 james00012 changed the title Rename run-all functions to use Tg prefix for consistency Simplify terragrunt function names Nov 18, 2025
james00012 added a commit that referenced this pull request Nov 18, 2025
Update ValidateAll and OutputAll to follow the same naming convention
as PR #1621 (no Tg prefix). This ensures consistency across all
terragrunt module functions.
func TgStackGenerate(t testing.TestingT, options *Options) string {
out, err := TgStackGenerateE(t, options)
// StackGenerate calls terragrunt stack generate and returns stdout/stderr
func StackGenerate(t testing.TestingT, options *Options) string {
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 appears that StackGenerate() is not being used at all. I think we should have tests to track that it is used and will not fail

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.

Hi @denis256, most of the current tests are focused on calling Stack*E. If needed, I can add tests for StackGenerate as well, even without checking for errors—but since it’s just a simple wrapper, I think covering one of the functions should be sufficient.

func TgStackRun(t testing.TestingT, options *Options) string {
out, err := TgStackRunE(t, options)
// StackRun calls terragrunt stack run and returns stdout/stderr
func StackRun(t testing.TestingT, options *Options) string {
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.

StackRun() is not used

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.

ditto.

// This command cleans up the generated stack files created by stack generate or stack run
func TgStackClean(t testing.TestingT, options *Options) string {
out, err := TgStackCleanE(t, options)
func StackClean(t testing.TestingT, options *Options) string {
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.

StackClean() is not invoked in any test

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.

ditto.

@james00012 james00012 merged commit ac5ebc1 into main Nov 18, 2025
2 of 3 checks passed
@james00012 james00012 deleted the fix/rename-run-all-functions-1618 branch November 18, 2025 23:35
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.

Rename run-all functions to use Tg prefix for consistency

3 participants