Open sybereal opened 1 year ago
According to the comment in the source code, the source url should use Terraform's module source syntax
for example: module "consul" { source = "github.com/hashicorp/example" }
Therefore, the url, which works for go-getter, may not work for terragrunt.
go-getter supports using glob patterns in the subdirectory part after the double-slash, as long as there is only one match. This is incredibly useful when dealing with repository tar balls, as these usually have a top-level directory wrapping the repository contents.
My use case is the following: to reduce external dependencies (Git), we wanted to configure Terragrunt to download our module sources as a tar ball from the GitHub API using the
https://api.github.com/repos/:org/:repo/tarball/:ref
API, using a fine-grained PAT as the basic auth password to limit access to only the modules repository.The problem is that the tar balls this API produces have a top-level directory name following the pattern
${org}-${repo}-${commit-sha}
, even when the ref is a branch or tag. Forgo-getter
itself, this isn't an issue. I rango-getter https://dummy:$GITHUB_TOKEN@api.github.com/repos/org/repo/tarball/vX.Y.Z//org-repo-*/submodule?archive=tgz submodule
and it worked perfectly fine; thesubmodule
directory contained the correct files from that tag.However, when attempting to use an URL like this with Terragrunt, it fails with
Working dir org-repo-*/submodule from source https://dummy:$GITHUB_TOKEN@api.github.com/repos/org/repo/tarball/vX.Y.Z//org-repo-*/submodule?archive=tgz does not exist
.Minimal repro
I'm using the https://github.com/hashicorp/learn-terraform-modules-create repo because it was the first example repository I found. I've used comments to represent the command outputs to simplify pasting.