Unable to authenticate to Terraform Module Registry with deploy token
Summary
Unable to authenticate (getting a 401
) to Terraform Module Registry in Project A, with deploy token
, when trying to publish via curl command terraform modules created in a pipeline in Project B.
The command is very similar to what is described in the Publish a Terraform Module section of the docs.
Steps to reproduce
Create a terraform module and try to publish it to a Terraform Module Registry in another project by using:
curl --header "DEPLOY-TOKEN: <deploy_token>" \
--upload-file path/to/file.tgz \
"https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/terraform/modules/my-module/my-system/0.0.1/file"
The deploy token has the proper scope, but running the command still results in a 401
.
Proposal
- Triage the issue. It is probable that the registry is behaving as expected and that the something is missing in the
curl
command. - Then:
- If the issue is valid, identify the problem and fix it.
- Otherwise, write a comment here explaining the way to get it working with curl. If it makes sense, also update the documentation .
Edited by Hordur Freyr Yngvason