terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

`get_path_to_repo_root()` includes trailing slash unlike other functions

Open tjstansell opened this issue 2 years ago • 1 comments

The path returned by get_path_to_repo_root() includes a trailing / where it looks like all other path functions do not. When building a source based on this, it causes // problems.

For instance, using the normal expression like this:

source = "${get_path_to_repo_root()}/modules//my-thing"

it actually resolves to the path ../..//modules//my-thing. This causes the entire repo to get copied as the source. So, now I have to write my expression as:

source = "${get_path_to_repo_root()}modules//my-thing"

to get the expected path of ../../modules//my-thing.

Correcting this will likely cause problems for folks. Either they lose the // they currently expect or their existing expression (like my second example above) is no longer a valid path.

tjstansell avatar Jun 22 '22 22:06 tjstansell

Created PR: https://github.com/gruntwork-io/terragrunt/pull/2212

eightseventhreethree avatar Jul 25 '22 13:07 eightseventhreethree

Resolved in v0.51.1 release.

levkohimins avatar Sep 18 '23 19:09 levkohimins