terramate
terramate copied to clipboard
[FEATURE] add source generator meta to generated comment
Is your feature request related to a problem? Please describe. When reviewing generated code, it's hard to determine which parent stack generated the item
Describe the solution you'd like
I would like to see the current generated message
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
To include the invoking generator that created it.
// TERRAMATE: "dev/app/stack.tm.hcl" GENERATED AUTOMATICALLY DO NOT EDIT
Describe alternatives you've considered
Some alternatives would be a way to list all the generated files in a given stack via cli terramate generate --list --chdir dev/app
where the output might look like, and list would force and output for each generated item in the stack regardless if there is a modification.
Code generation report
Successes:
[ ] /dev/app
[ ] provider.tf - Generated from (dev/stack.tm.hcl)
[ ] backend.tf - Generated from (dev/app/stack.tm.hcl)
Hi @delconis
Have you tried the terramate debug show generate-origins
?
For each generated file, it shows the file and line/column where it comes from.
Let me know if it helps you.
Fun fact: Terramate used to include the file name in the header but it caused too many stacks being triggered for changes (when using tm run --changed ...
) whenever someone refactored the generated file names. See here the PR that removed it: https://github.com/terramate-io/terramate/pull/710
closing as we have a command to get the information, please reopen when needed.