Use this API to interact with the Terraform CLI.
This API is used by the Terraform CLI and is generally not meant for manual consumption. Undocumented authentication methods might be removed in the future.
Retrieve latest version for a module
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}
Retrieves latest version for a specified module.
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Retrieve download URL for latest module version
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}/download
Retrieves download URL for latest module version.
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
Responses
| Code | Description | Schema |
|---|---|---|
302 | Found | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
List all available versions for a module
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}/versions
Lists all available versions for a specified module.
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not Found | — |
Get details about specific version of a module
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}/{module_version}
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
module_Path, | String | Version of the module |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Get download location for specific version of a module
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}/{module_version}/download
Download specific version of a module
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
module_Path, | String | Version of the module |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Download specific version of a module
GET /api/v4/packages/terraform/modules/v1/{module_namespace}/{module_name}/{module_system}/{module_version}/file
Parameters
| Name | Type | Description |
|---|---|---|
module_Path, | String | Group’s ID or slug |
module_Path, | String | The module name |
module_Path, | String | The module system (provider) |
module_Path, | String | Version of the module |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Download the latest version of a module
GET /api/v4/projects/{id}/packages/terraform/modules/{module_name}/{module_system}
Downloads the latest version of a specified module. This feature was introduced in GitLab 16.7.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or full path of a project |
module_Path, | String | Module name Example: infra- |
module_Path, | String | Module system Example: aws |
terraform-Query | String | Terraform get redirection flag Allowed values: 1 |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Download a specific version of a module
GET /api/v4/projects/{id}/packages/terraform/modules/{module_name}/{module_system}/{module_version}
This feature was introduced in GitLab 16.7
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or full path of a project |
module_Path, | String | Module name Example: infra- |
module_Path, | String | Module system Example: aws |
module_Path, | String | Module version |
terraform-Query | String | Terraform get redirection flag Allowed values: 1 |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Upload Terraform Module package file
PUT /api/v4/projects/{id}/packages/terraform/modules/{module_name}/{module_system}/{module_version}/file
This feature was introduced in GitLab 13.11
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or full path of a project |
module_Path, | String | Module name Example: infra- |
module_Path, | String | Module system Example: aws |
module_Path, | String | Module version |
Request body (multipart/form-data)
| Property | Type | Description |
|---|---|---|
fileRequired | String (binary) | The package file to be published (generated by Multipart middleware) |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | — |
400 | Invalid file | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Workhorse authorize Terraform Module package file
PUT /api/v4/projects/{id}/packages/terraform/modules/{module_name}/{module_system}/{module_version}/file/authorize
This feature was introduced in GitLab 13.11
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or full path of a project |
module_Path, | String | Module name Example: infra- |
module_Path, | String | Module system Example: aws |
module_Path, | String | Module version |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not Found | — |
Retrieve a Terraform state
GET /api/v4/projects/{id}/terraform/state/{name}
Retrieves a Terraform state by name for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
IDQuery | String | Terraform state lock ID Maximum length: 255 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
204 | Empty state | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
422 | Validation failure | — |
Create or update a Terraform state
POST /api/v4/projects/{id}/terraform/state/{name}
Creates or updates a Terraform state for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
Request body (multipart/form-data)
| Property | Type | Description |
|---|---|---|
fileRequired | String (binary) | The package file to be published (generated by Multipart middleware) |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
204 | No data provided | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not Found | — |
413 | Request Entity Too Large | — |
422 | Validation failure | — |
Delete a Terraform state
DELETE /api/v4/projects/{id}/terraform/state/{name}
Deletes a Terraform state for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
422 | Validation failure | — |
Authorize Terraform state upload
POST /api/v4/projects/{id}/terraform/state/{name}/authorize
Authorizes uploading a Terraform state for a specified project. This feature was introduced in GitLab 18.5.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Lock a Terraform state
POST /api/v4/projects/{id}/terraform/state/{name}/lock
Locks a Terraform state for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
CreatedRequired | String | Terraform state lock timestamp |
IDRequired | String | Terraform state lock ID Maximum length: 255 |
InfoRequired | String | Terraform info |
OperationRequired | String | Terraform operation |
PathRequired | String | Terraform path |
VersionRequired | String | Terraform version |
WhoRequired | String | Terraform state lock owner |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Conflict | — |
422 | Validation failure | — |
Unlock a Terraform state
DELETE /api/v4/projects/{id}/terraform/state/{name}/lock
Unlocks a Terraform state for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
IDQuery | String | Terraform state lock ID Maximum length: 255 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Conflict | — |
422 | Validation failure | — |
Retrieve a Terraform state version
GET /api/v4/projects/{id}/terraform/state/{name}/versions/{serial}
Retrieves a specified Terraform state version.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
serialPath, | Integer | The version number of the state |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Delete a Terraform state version
DELETE /api/v4/projects/{id}/terraform/state/{name}/versions/{serial}
Deletes a specified Terraform state version.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
namePath, | String | The name of a Terraform state |
serialPath, | Integer | The version number of the state |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesTerraformModuleVersion
| Property | Type | Description |
|---|---|---|
name | String | — |
provider | String | — |
providers | String | — |
root | String | — |
source | String | — |
submodules | String | — |
version | String | — |
versions | String | — |
APIEntitiesTerraformModuleVersions
| Property | Type | Description |
|---|---|---|
modules | String | — |