Terraformモジュールレジストリ
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
このAPIを使用して、Terraform CLIを操作します。
このAPIはTerraform CLIによって使用され、通常は手動での使用を意図していません。記載されていない認証方法は、将来削除される可能性があります。
特定のモジュールで利用可能なバージョンを一覧表示
特定のモジュールで利用可能なバージョンのリストを取得します。
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/versions| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトまたはサブグループが属するトップレベルグループ (ネームスペース)。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/versions"レスポンス例:
{
"modules": [
{
"versions": [
{
"version": "1.0.0",
"submodules": [],
"root": {
"dependencies": [],
"providers": [
{
"name": "local",
"version":""
}
]
}
},
{
"version": "0.9.3",
"submodules": [],
"root": {
"dependencies": [],
"providers": [
{
"name": "local",
"version":""
}
]
}
}
],
"source": "https://gitlab.example.com/group/hello-world"
}
]
}特定のモジュールの最新バージョン
特定のモジュールの最新バージョンに関する情報を取得します。
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトが属するグループ。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local"レスポンス例:
{
"name": "hello-world/local",
"provider": "local",
"providers": [
"local"
],
"root": {
"dependencies": []
},
"source": "https://gitlab.example.com/group/hello-world",
"submodules": [],
"version": "1.0.0",
"versions": [
"1.0.0"
]
}特定のモジュールの特定のバージョンを取得
特定のモジュールの特定のバージョンに関する情報を取得します。
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/1.0.0| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトが属するグループ。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0"レスポンス例:
{
"name": "hello-world/local",
"provider": "local",
"providers": [
"local"
],
"root": {
"dependencies": []
},
"source": "https://gitlab.example.com/group/hello-world",
"submodules": [],
"version": "1.0.0",
"versions": [
"1.0.0"
]
}最新のモジュールのバージョンをダウンロードするためのURLを取得
X-Terraform-Getヘッダーで、最新のモジュールのバージョンをダウンロードするためのURLを取得します
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/download| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトが属するグループ。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/download"レスポンス例:
HTTP/1.1 204 No Content
Content-Length: 0
X-Terraform-Get: /api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0/file?token=&archive=tgz内部的には、このAPIエンドポイントはpackages/terraform/modules/v1/:module_namespace/:module_name/:module_system/:module_version/downloadにリダイレクトされます
特定のモジュールのバージョンをダウンロードするためのURLを取得
X-Terraform-Getヘッダーで、特定のモジュールのバージョンをダウンロードするためのURLを取得します
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/:module_version/download| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトが属するグループ。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
module_version | 文字列 | はい | ダウンロードする特定のモジュールのバージョン。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0/download"レスポンス例:
HTTP/1.1 204 No Content
Content-Length: 0
X-Terraform-Get: /api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0/file?token=&archive=tgzモジュールをダウンロード
ネームスペースから
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/:module_version/file| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
module_namespace | 文字列 | はい | Terraformモジュールのプロジェクトが属するグループ。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
module_version | 文字列 | はい | ダウンロードする特定のモジュールのバージョン。 |
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0/file"ファイルを出力に書き込むには:
curl --header "Authorization: Bearer <personal_access_token>" \
--url "https://gitlab.example.com/api/v4/packages/terraform/modules/v1/group/hello-world/local/1.0.0/file" \
--output hello-world-local.tgzプロジェクトから
GET /projects/:id/packages/terraform/modules/:module_name/:module_system/:module_version| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
module_name | 文字列 | はい | モジュール名。 |
module_system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
module_version | 文字列 | いいえ | ダウンロードする特定のモジュールのバージョン。省略した場合、最新バージョンがダウンロードされます。 |
curl --user "<username>:<personal_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/packages/terraform/modules/hello-world/local/1.0.0"ファイルを出力に書き込むには:
curl --user "<username>:<personal_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/1/packages/terraform/modules/hello-world/local/1.0.0" \
--output hello-world-local.tgzモジュールをアップロード
PUT /projects/:id/packages/terraform/modules/:module-name/:module-system/:module-version/file| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
module-name | 文字列 | はい | モジュール名。 |
module-system | 文字列 | はい | モジュールシステムまたはプロバイダーの名前。 |
module-version | 文字列 | はい | アップロードする特定のモジュールのバージョン。 |
curl --fail-with-body \
--header "PRIVATE-TOKEN: <your_access_token>" \
--upload-file path/to/file.tgz \
--url "https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/terraform/modules/my-module/my-system/0.0.1/file"認証に使用できるトークン:
| ヘッダー | 値 |
|---|---|
PRIVATE-TOKEN | apiスコープを持つパーソナルアクセストークン。 |
DEPLOY-TOKEN | write_package_registryスコープを持つデプロイトークン。 |
JOB-TOKEN | ジョブトークン。 |
レスポンス例:
{
"message": "201 Created"
}