Terrafile unable to authenticate to private GitLab registry

Hi, I’m trying to use Terrafile to manage modules published on a private GitLab registry.
When I run terraspace bundle with the following entry in Terrafile

mod "my-mdule-", source: "my-gitlab.com/terraform-modules/my-module/azurerm"

I receive the error:

ERROR: Unauthorized. Unable to lookup up module in Terraform Registry:
	my-gitlab.com/terraform-modules/my-module/azurerm
Try logging in with:
	terraform login

The module is correctly downloaded using the traditional Terraform definition

module "my_module" {
  source            = "my-gitlab.com/terraform-modules/my-module/azurerm"
  versione         = "0.0.0"
}

leveraging the credentials stored in ~/.terraformrc

credentials "my-gitlab.com" {
  token = "glpat-XXXXXXXXXXXXXXXXXXXX"
}

host "my-gitlab.com" {
  services = {
    "modules.v1" = "/api/v4/packages/terraform/modules/v1"
  }
}

The Terrafile approach also works fine when pointing directly to the GitLab repo (not the registry)

mod "my-module", source: "git@my-gitlab.com:terraform-modules/my-module/azurerm.git"

Is this a known limitation when using the GitLab registry or am I missing something?

Thanks a lot for any suggestion on how to overcome this issue

Bummer. Looks like a bug :beetle: Looks like what’s going on is that it thinks it’s a Terraform registry module instead of a private gitlab registry module.

Will have to take a look. Unsure when though :stopwatch: Will consider PRs. No sweat either way of course :+1: Use the git source instead for now.