Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Change detection for uncommitted files #1398

Open
cwe1ss opened this issue Jan 27, 2024 · 1 comment
Open

[FEATURE] Change detection for uncommitted files #1398

cwe1ss opened this issue Jan 27, 2024 · 1 comment
Labels
enhancement New feature or request planned

Comments

@cwe1ss
Copy link

cwe1ss commented Jan 27, 2024

Is your feature request related to a problem? Please describe.
The current change detection feature using the --changed-flag seems to only work once a change has been committed.

But there are use-cases, where I would like to execute Terramate scripts on changed stacks only, even before I have committed any files:

  • Local build scripts: To run terraform init, terraform validate, terraform-docs, ... via a VS Code build task on demand
  • Pre-commit hooks: To validate any changed stacks before the commit is accepted

It takes too long to run these scripts against all stacks within the entire repository every time, so having this additional change detection would be a massive time-saver.

Pre-commit (and pre-commit-terraform) have some support for this by sending the changed files to the hook, but this does not work with Terramate's advanced features like Terraform module change detection to detect dependant stacks or File Watchers.

E.g., if I change a file within my reusable module modules/my-module, I would also like to run my build script & pre-commit hook against any stacks that use that module.

Describe the solution you'd like
An option within the CLI that uses the locally changed files (unstaged & staged) as the input for the change detection logic - either integrated into the existing --changed flag, or via a new flag.

Describe alternatives you've considered
Using pre-commit with custom scripts, or manually parsing git diff --name-only to find changed stacks. But as described, both options will not detect dependant stacks.

Additional context
See discussion on discord: https://discord.com/channels/1088753599951151154/1088769572305383484/threads/1200441992233099384

@cwe1ss cwe1ss added the enhancement New feature or request label Jan 27, 2024
@mariux
Copy link
Contributor

mariux commented Apr 17, 2024

@cwe1ss this is a great idea and we have now decided to put it on the next priorities. We do not have an ETA yet, but the desired change request has been accepted and the team will plan the changes now. cc @i4ki

@mariux mariux added the planned label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

2 participants