hcp-packer-iteration
hcp-packer-iteration
공식 (Official)
이 데이터 소스는 deprecated 처리됐어요. 대신
hcp-packer-version데이터 소스를 사용하세요.
HCP Packer Iteration 데이터 소스는 HCP Packer 레지스트리에서 iteration에 대한 정보를 가져와요. 이 정보는 다양한 Packer 빌더의 소스 이미지를 위해 HCP를 조회하는 데 사용할 수 있어요.
HCP Packer를 시작하려면 HCP Packer 문서를 참고하거나 Get Started with HCP Packer 튜토리얼을 시도해 보세요.
참고: 비활성화되거나 삭제된 레지스트리의 메타데이터를 참조하려 하면 오류가 발생해요. 관리자가 레지스트리를 수동으로 비활성화하거나 삭제할 수 있고, HCP Packer는 결제 문제가 있는 레지스트리를 자동으로 비활성화해요. 문의 사항이 있으면 HashiCorp Support에 연락하세요.
출처: Packer 공식 문서
본문
폐기된 iteration (Revoked Iterations)
iteration이 폐기(revoked)되면 hcp-packer-iteration 데이터 소스는 실패하고 Packer는 빌드를 진행하지 않아요. 폐기된 이미지로 새 이미지를 빌드하는 것은 규정을 위반하는 것이에요.
폐기 예정으로 예약된 iteration은 폐기 날짜까지 여전히 유효한 것으로 간주돼요.
기본 예시 (Basic Example)
아래는 완전히 동작하는 예시예요. 이미지 iteration에 대한 정보를 저장하고, 이를 변수로 접근할 수 있어요.
data "hcp-packer-iteration" "hardened-source" {
bucket_name = "hardened-ubuntu-16-04"
channel = "packer-test"
}
전체 예시 (Full Example)
이 데이터 소스는 hcp-packer-image 데이터 소스와 함께 사용해 채널(channel)로 이미지 ID를 가져올 수 있어요. iteration 데이터 소스에 채널 이름을 제공하고, 이미지 데이터 소스 안에서 iteration 소스를 사용하며, 소스(sources) 블록 안에서 이미지 데이터 소스를 사용해요.
# Retrieves information about the HCP Packer "iteration"; an "iteration" can be
# thought of as all the metadata created by a single call of `packer build`.
data "hcp-packer-iteration" "hardened-source" {
bucket_name = "hardened-ubuntu-16-04"
channel = "packer-test"
}
# Retrieves information about the HCP Packer "image"; an image can be thought
# of as all the metadata (including the artifact names) created by a single
# "source" builder; this can include multiple images so we provide a cloud
# region to disambiguate.
data "hcp-packer-image" "foo" {
bucket_name = "hardened-ubuntu-16-04"
iteration_id = data.hcp-packer-iteration.hardened-source.id
cloud_provider = "aws"
region = "us-east-1"
}
# This source uses the output from a previous Packer build. By using the
# HCP Packer registry in this way, you can easily create build pipelines where
# a single base image can be customized in multiple secondary layers.
source "amazon-ebs" "packer-secondary" {
source_ami = data.hcp-packer-image.foo.id
...
}
설정 참조 (Configuration Reference)
설정 옵션은 아래에서 필수(required)와 선택(optional) 두 범주로 정리돼 있어요. 각 범주 안에서 사용 가능한 옵션은 알파벳순으로 정렬되어 설명돼요.
필수 (Required):
bucket_name(string) — 이미지가 들어 있는 버킷의 이름이에요.channel(string) — 이미지를 가져올 때 사용할 채널의 이름이에요.
현재 이 데이터 소스에는 선택 필드가 없지만, 향후 필터링 필드를 추가할 예정이에요.
출력 필드 (Output Fields):
author_id(string) — iteration을 만든 사람이에요.bucket_name(string) — iteration을 가져온 버킷의 이름이에요.complete(bool) —true면 이 iteration은 "사용 준비가 된" 것으로 간주되고, list iterations 요청에서include_incomplete플래그가"false"여도 반환돼요. 참고로 채널을 사용해 iteration을 가져오면 이 값은 항상"true"예요. 채널은 완료되지 않은 iteration에 할당될 수 없거든요.created_at(string) — iteration이 생성된 날짜예요.fingerprint(string) — 빌드의 지문(fingerprint)이에요. 이 iteration을 만든 Packer 빌드가 설정한 git sha나 기타 고유 식별자일 수 있어요.id(string) — iteration ID예요. UUID와 유사한 고유 식별자인 ULID예요. iteration이 처음 생성될 때 HCP Packer Registry가 만들고, 이 iteration에 고유해요.incremental_version(int32) — iteration에 할당된 버전 번호예요. 정수이며, iteration이 "complete"로 표시되면 HCP Packer Registry가 만들어요. 새 iteration이 "complete"로 표시되면 HCP Packer가 할당하는 버전은 항상 이전 iteration 버전 중 가장 높은 값에 1을 더한 값이에요.updated_at(string) — 이 iteration이 마지막으로 업데이트된 날짜예요.channel_id(string) — 이미지 iteration 조회에 사용된 채널의 ID예요.