- 특정 모듈의 사용 가능한 버전 디렉터리
- 특정 모듈의 최신 버전 가져오기
- 특정 모듈의 특정 버전 가져오기
- 최신 모듈 버전의 다운로드 URL 가져오기
- 특정 모듈 버전의 다운로드 URL 가져오기
- 모듈 다운로드
- 모듈 업로드
Terraform Module Registry API
이것은 Terraform Module Registry에 대한 API 문서입니다.
GitLab Terraform Module Registry에서 Terraform 모듈을 업로드하고 설치하는 방법에 대한 지침은 Terraform Module Registry documentation을 참조하세요.
특정 모듈의 사용 가능한 버전 디렉터리
특정 모듈에 대한 사용 가능한 버전 디렉터리을 가져옵니다.
GET packages/terraform/modules/v1/:module_namespace/:module_name/:module_system/versions
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
module_namespace
| 문자열 | 예 | 테라폼 모듈의 프로젝트 또는 하위 그룹이 속한 최상위 그룹(네임스페이스). |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
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
| 문자열 | 예 | 테라폼 모듈의 프로젝트가 속한 그룹. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
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
| 문자열 | 예 | 테라폼 모듈의 프로젝트가 속한 그룹. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
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
| 문자열 | 예 | 테라폼 모듈의 프로젝트가 속한 그룹. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
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
| 문자열 | 예 | 테라폼 모듈의 프로젝트가 속한 그룹. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
module_version
| 문자열 | 예 | 다운로드할 특정 모듈 버전. |
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
| 문자열 | 예 | 테라폼 모듈의 프로젝트가 속한 그룹. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
module_version
| 문자열 | 예 | 다운로드할 특정 모듈 버전. |
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
| 정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
module_name
| 문자열 | 예 | 모듈 이름. |
module_system
| 문자열 | 예 | 모듈 시스템 또는 공급자의 이름. |
module_version
| 문자열 | 아니요 | 다운로드할 특정 모듈 버전. 빠진 경우, 최신 버전이 다운로드됩니다. |
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
| 정수 또는 문자열 | 예 | 프로젝트의 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"
}