-
-
Notifications
You must be signed in to change notification settings - Fork 958
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
Add --terragrunt-include-module-prefix option #2493
Conversation
This PR adds a flag to enable the prepending of prefixes. Also it may be reasonable to trim the prefix to be relative to a common parent of the modules or to cwd (or other place) - please guide me what is the suggested approach. In logs |
pf.beginningOfANewLine = false | ||
} | ||
|
||
buf.WriteByte(b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why output should be buffered and not directly written to pf.writer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not want to call the underlying pf.writer
for each character as it may degrade performance.
This buffering does not cross single .Write()
call span so it will not create a "typical" buffered i/o effect.
Still, it needs an additional memory and one copying of the input []byte
. If you feel there is more efficient way I would be more than happy to apply it.
**CLI Arg**: `--terragrunt-include-module-prefix` | ||
**Environment Variable**: `TERRAGRUNT_INCLUDE_MODULE_PREFIX` (set to `true`) | ||
|
||
When this flag is set output from Terraform sub-commands is prefixed with module name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, output include module path, not module name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the doc.
|
||
### terragrunt-include-module-prefix | ||
|
||
**CLI Arg**: `--terragrunt-include-module-prefix` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed that terragrunt-include-module-prefix
is not listed in the help output
$ terragrunt --help | grep terragrunt-include-module-prefix
$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included the info in help output. Is there any other place the help should be updated?
51427d4
to
feed3c4
Compare
Added tests for PrefixWriter for a complete picture. Somehow missed that initially. |
|
feed3c4
to
677f935
Compare
Fixed. |
Thanks! Where did this end up? Is the prefix the absolute path, or a relative path of some kind? I didn't see an example in the changed files... |
Tested to find the answer myself, it is the absolute path... |
Yeah, it's the absolute path:
That takes up a lot of screen real-estate. It would be great if the path could be relative to the
|
* refactor: modularize testCommandOutputOrder for easier reuse * feat: prepend TerragruntOptions.OutputPrefix to subcommand's output * feat: add TerragruntOptions.IncludeModulePrefix
As a workaround you can utilize something like this |
Description
Fixes #1194 .
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added
--terragrunt-include-module-prefix
flag to include module dir prefix in Terraform outputMigration Guide