Skip to content

Conversation

@eugenestarchenko
Copy link
Contributor

@eugenestarchenko eugenestarchenko commented Dec 31, 2025

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:

https://github.com/seedcx/tf-aws-network//

Root Cause

Terragrunt uses // as a special path separator for subdirectories in module sources:

source = "git::https://github.com/org/repo//subdir?ref=v1.0.0"

When Updatecli parsed these sources, it included the // in the baseUrl, 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 the baseUrl when parsing git sources. The full source (including //subdir) is preserved in rawSource and evaluatedSource for other uses, but the baseUrl now contains only the clean repository URL needed for cloning.

Testing

Added test cases covering:

  • Git URL with trailing //
  • Git URL with //subdir path

All tests pass.

Impact

Fixes repository cloning for all git-based Terragrunt modules during autodiscovery.

Terragrunt uses '//' as a path separator for subdirectories in module
sources (e.g., git::https://github.com/org/repo//subdir?ref=v1.0.0).

When Updatecli generates git SCM configurations, it was including this
'//' in the repository URL, causing git clone failures with 'repository
not found' errors.

This fix strips the '//' path separator and everything after it from
the baseUrl when parsing git sources, ensuring clean repository URLs
for cloning.

Added test cases:
- git URL with trailing '//'
- git URL with '//subdir' path

Fixes: Repository not found errors for all git-based module sources
Copy link
Member

@olblak olblak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request with the tests

@olblak olblak added bug Something isn't working resource-terragrunt labels Jan 1, 2026
@olblak olblak merged commit 4c46860 into updatecli:main Jan 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working resource-terragrunt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants