- 특정 모듈에 대한 사용 가능한 버전 디렉터리
- 특정 모듈의 최신 버전
- 특정 모듈의 특정 버전 가져오기
- 최신 모듈 버전 다운로드 URL 가져오기
- 특정 모듈 버전 다운로드 URL 가져오기
- 모듈 다운로드
- 모듈 업로드
Terraform Module Registry API
Tier: Free, Premium, Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
이것은 Terraform Module Registry의 API 문서입니다.
이 API는 Terraform CLI에서 사용되며 일반적으로 매뉴얼 소비를 위한 것은 아닙니다. 문서화되지 않은 인증 방법은 향후 제거될 수 있습니다.
GitLab Terraform Module Registry에서 Terraform 모듈을 업로드하고 설치하는 방법에 대한 지침은 Terraform Module Registry documentation을 참조하세요.
특정 모듈에 대한 사용 가능한 버전 디렉터리
특정 모듈에 대한 사용 가능한 버전 디렉터리을 가져옵니다.
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/versions
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
module_namespace
| string | yes | Terraform 모듈의 프로젝트 또는 하위 그룹이 속한 최상위 그룹 (네임스페이스)입니다. |
module_name
| string | yes | 모듈 이름입니다. |
module_system
| string | yes | 모듈 시스템 또는 공급자의 이름입니다. |
curl --header "Authorization: Bearer <personal_access_token>" "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
| string | yes | Terraform 모듈의 프로젝트가 속한 그룹입니다. |
module_name
| string | yes | 모듈 이름입니다. |
module_system
| string | yes | 모듈 시스템 또는 공급자의 이름입니다. |
curl --header "Authorization: Bearer <personal_access_token>" "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
| string | yes | Terraform 모듈의 프로젝트가 속한 그룹입니다. |
module_name
| string | yes | 모듈 이름입니다. |
module_system
| string | yes | 모듈 시스템 또는 공급자의 이름입니다. |
curl --header "Authorization: Bearer <personal_access_token>" "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
| string | yes | Terraform 모듈의 프로젝트가 속한 그룹입니다. |
module_name
| string | yes | 모듈 이름입니다. |
module_system
| string | yes | 모듈 시스템 또는 공급자의 이름입니다. |
curl --header "Authorization: Bearer <personal_access_token>" "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
| string | yes | Terraform 모듈의 프로젝트가 속한 그룹입니다. |
module_name
| string | yes | 모듈 이름입니다. |
module_system
| string | yes | 모듈 시스템 또는 공급자의 이름입니다. |
module_version
| string | yes | 다운로드할 특정 모듈 버전입니다. |
curl --header "Authorization: Bearer <personal_access_token>" "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
| string | yes | Terraform 모듈 프로젝트가 속한 그룹. |
module_name
| string | yes | 모듈 이름. |
module_system
| string | yes | 모듈 시스템 또는 제공자의 이름. |
module_version
| string | yes | 다운로드할 특정 모듈 버전. |
curl --header "Authorization: Bearer <personal_access_token>" "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>" "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
| integer/string | yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
module_name
| string | yes | 모듈 이름. |
module_system
| string | yes | 모듈 시스템 또는 제공자의 이름. |
module_version
| string | no | 다운로드할 특정 모듈 버전. 미입력 시 최신 버전이 다운로드됩니다. |
curl --user "<username>:<personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/terraform/modules/hello-world/local/1.0.0"
결과를 파일에 작성하려면:
curl --user "<username>:<personal_access_token>" "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
| integer 또는 string | yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
module-name
| string | yes | 모듈 이름. |
module-system
| string | yes | 모듈 시스템 또는 제공자의 이름. |
module-version
| string | yes | 업로드할 특정 모듈 버전. |
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"
}