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