fix(terragrunt): strip double slash path separator from git URLs #7358
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Terragrunt autodiscovery was failing with "repository not found" errors for all git-based module sources. The generated git URLs contained Terragrunt's
//path separator, creating invalid repository URLs like:Root Cause
Terragrunt uses
//as a special path separator for subdirectories in module sources:When Updatecli parsed these sources, it included the
//in thebaseUrl, which was then used directly in git clone operations, causing failures.See https://community.gruntwork.io/t/relative-paths-in-terragrunt-modules/144
Solution
Strip the
//path separator and everything after it from thebaseUrlwhen parsing git sources. The full source (including//subdir) is preserved inrawSourceandevaluatedSourcefor other uses, but thebaseUrlnow contains only the clean repository URL needed for cloning.Testing
Added test cases covering:
////subdirpathAll tests pass.
Impact
Fixes repository cloning for all git-based Terragrunt modules during autodiscovery.