terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

Enhancement request: TERRAGRUNT_INCLUDE_MODULE_PREFIX strip pwd

Open bushong1 opened this issue 2 years ago • 5 comments
trafficstars

It would be great if there were an option to strip the pwd from the output of TERRAGRUNT_INCLUDE_MODULE_PREFIX=1. It's great that now we can read the terraform output and easily figure out which module is running, but for systems that have a deep directory structure, it's easy for the output to get spammed across the terminal since it lists the whole pwd.

[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-1] 
[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-1] Initializing the backend...
[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-1]  
[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-2/submodule] 
[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-2/submodule] Initializing the backend...
[/home/charles/working/customer/my-project-name/my-infrastructure-directory/some-subdirectory/this-environment/terraform-module-2/submodule] 

It would be great it the output were configurable to be just:

[./terraform-module-1] 
[./terraform-module-1] Initializing the backend...
[./terraform-module-1]  
[./terraform-module-2/submodule] 
[./terraform-module-2/submodule] Initializing the backend...
[./terraform-module-2/submodule] 

bushong1 avatar Apr 14 '23 13:04 bushong1

I came here to request the same!

Tested to find the answer myself, it is the absolute path...

Yeah, it's the absolute path:

[/home/sysop/code/github/dhirschfeld/azure-infra-test/terraform/dev/network]

That takes up a lot of screen real-estate. It would be great if the path could be relative to the cwd - i.e. running in the dev folder that would be:

[./network]

Originally posted by @dhirschfeld in https://github.com/gruntwork-io/terragrunt/issues/2493#issuecomment-1537609208

dhirschfeld avatar May 08 '23 01:05 dhirschfeld

Bump!

This gist https://gist.github.com/antonbabenko/675049186e54b770b4789886d2056639#file-bash_profile attempts to do that, but doesn't completely work for me.

Also, it feels like this should be a native terragrunt cli implementation.

stv-io avatar Jun 08 '23 15:06 stv-io

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.

github-actions[bot] avatar Nov 12 '24 02:11 github-actions[bot]

Ugh, a stale bot! 🤢

dhirschfeld avatar Nov 12 '24 03:11 dhirschfeld

Possibly resolved by https://github.com/gruntwork-io/terragrunt/pull/3338?

dhirschfeld avatar Nov 12 '24 03:11 dhirschfeld

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.

github-actions[bot] avatar Feb 12 '25 02:02 github-actions[bot]

This is the default now! Sorry this went stale.

yhakbar avatar Feb 19 '25 03:02 yhakbar