Skip to content

Conversation

@busser
Copy link
Owner

@busser busser commented Jun 27, 2025

Summary

This PR adds a new --terragrunt flag that provides improved compatibility with Terragrunt, addressing the issues reported in #105.

Changes

  • Add --terragrunt flag: A convenient alternative to --terraform-bin=terragrunt that automatically enables terragrunt-specific features
  • Custom version parsing: Implements terragrunt-specific version parsing that handles deprecation warnings and output format differences
  • Use terragrunt run -- version: Avoids deprecation warnings in newer terragrunt versions
  • Comprehensive tests: Added unit tests and end-to-end integration tests
  • Updated documentation: README now recommends the new flag over the manual approach
  • Error handling: Prevents conflicting usage of --terragrunt with --terraform-bin

Usage

# New recommended way
tfautomv --terragrunt

# Still works but not recommended  
tfautomv --terraform-bin=terragrunt

# Properly rejected
tfautomv --terragrunt --terraform-bin=tofu  # Error: cannot use both flags

Technical Details

The implementation:

  • Uses terragrunt run -- version to avoid deprecation warnings
  • Implements regex-based parsing for terragrunt's output format
  • Maintains backward compatibility with existing --terraform-bin usage
  • Adds comprehensive test coverage for edge cases

Testing

  • ✅ All existing unit tests pass
  • ✅ All existing end-to-end tests pass
  • ✅ New TestE2E_TerragruntFlag integration test
  • ✅ New unit tests for version parsing logic

Fixes #105

- Add --terragrunt flag as a convenient alternative to --terraform-bin=terragrunt
- Implement custom version parsing for terragrunt that handles deprecation warnings
- Use 'terragrunt run -- version' to avoid deprecation warnings in newer versions
- Add comprehensive unit tests for terragrunt version parsing
- Add end-to-end test for --terragrunt flag functionality
- Update documentation to recommend --terragrunt flag over --terraform-bin
- Prevent conflicting usage of --terragrunt with --terraform-bin

Fixes #105
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.

Doesn't work with new terragrunt

2 participants