Skip to content

feat: Add terragrunt stack clean command and improve module#1582

Merged
james00012 merged 2 commits intomainfrom
feat/terragrunt-improvements
Aug 21, 2025
Merged

feat: Add terragrunt stack clean command and improve module#1582
james00012 merged 2 commits intomainfrom
feat/terragrunt-improvements

Conversation

@james00012
Copy link
Copy Markdown
Contributor

Summary

This PR enhances the terragrunt module with the missing stack clean command and improves code maintainability through refactoring.

Changes

  • Add terragrunt stack clean command: Implements the last missing stack subcommand to remove the .terragrunt-stack directory
  • Add TgInit functions: Provides general terragrunt init functions alongside stack-specific ones
  • Refactor command execution: Eliminates ~50 lines of duplicate code by creating a unified executeTerragruntCommand function
  • Improve naming consistency: Replace "Terragrunt" with "Tg" throughout comments and test function names
  • Add comprehensive tests: Three test scenarios for stack clean (after generate, non-existent stack, after run)

Testing

All existing tests pass. New tests added for stack clean functionality:

  • TestTgStackClean: Verifies clean after generate
  • TestTgStackCleanNonExistentStack: Verifies clean works when stack doesn't exist
  • TestTgStackCleanAfterRun: Verifies clean after running stack commands

Breaking Changes

None. All existing functionality preserved with backward compatibility.

- Add terragrunt stack clean command to remove .terragrunt-stack directory
- Refactor to eliminate code duplication between stack and regular commands
- Replace 'Terragrunt' with 'Tg' in comments for consistency
- Add comprehensive tests for stack clean functionality
- Improve code organization with unified executeTerragruntCommand function
- Add TgInit and TgInitE as general terragrunt init functions
- Update all tests to use TgInit instead of TgStackInit for clarity
- Rename initStackArgs to initArgs to match new function names
@james00012 james00012 merged commit a906469 into main Aug 21, 2025
2 of 3 checks passed
@james00012 james00012 deleted the feat/terragrunt-improvements branch August 21, 2025 02:27
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