Skip to content

New API class for terraform modules project endpoints

What does this MR do and why?

To resolve Reference Terraform modules from a project (#367726 - closed), we need a new project-level endpoint. However, we don't have a separate API class for the project-level endpoints in the Terraform Registry; all endpoints are stacked inside the generic packages API class.

In this MR, I move the project-level endpoints out from the generic packages API class to a new ProjectPackages API class. That would make adding a new project-level endpoint easier. Plus we can reduce the size of Reference Terraform modules from a project (!137809 - merged)

The two project-level endpoints which are being moved to the new API class are:

  • PUT /api/v4/projects/:id/packages/terraform/modules/:module_name/:module_system/*module_version/file/authorize
  • PUT /api/v4/projects/:id/packages/terraform/modules/:module_name/:module_system/*module_version/file

Those are the endpoints that are used to publish a terraform module.

Screenshots or screen recordings

N/A

How to set up and validate locally

Publishing a terraform module should work normally as before. This project can be used to test the functionality. Clone it and then edit package.sh script to replace YOUR_TOKEN & GITLAB_API_V4_URL values with the correct ones. From the root of the project, run the script to publish a demo terraform module:

./package.sh 

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #367726 (closed)

Edited by Moaz Khalifa

Merge request reports