packer inspect 명령어 레퍼런스

packer inspect 명령어 레퍼런스

packer inspect 명령어는 템플릿을 받아서 그 템플릿이 정의하는 여러 구성 요소를 출력해요. HCL 자체를 들여다보지 않고도 템플릿에 대해 빠르게 파악하는 데 도움이 되죠. 이 명령어는 템플릿이 받는 변수들, 정의한 builder, 정의한 provisioner와 그 실행 순서 같은 것들을 알려줘요.

출처: Packer 공식 문서

본문

The packer inspect command takes a template and outputs the various components a template defines. This can help you quickly learn about a template without having to dive into the HCL itself. The command will tell you things like what variables a template accepts, the builders it defines, the provisioners it defines and the order they'll run, and more.

이 명령어는 machine-readable 출력을 켜두면 특히 유용해요. 이 경우 구성 요소를 기계가 파싱할 수 있는 방식으로 출력해요.

이 명령어는 각 구성 요소의 실제 설정은 검증하지 않아요(그건 validate 명령어의 몫이에요). 다만 템플릿의 문법은 필연적으로 검증하게 돼요.

예시 (Example)

기본 템플릿을 기준으로 출력이 어떻게 생겼는지 보여줄게요:

$ packer inspect template.pkr.hcl
> input-variables:

var.aws_access_key: "<sensitive>"
var.aws_secret_key: "<sensitive>"

> local-variables:

> builds:

  > <unnamed build 0>:

    sources:

      amazon-ebs.foo
      amazon-instance.bar
      virtualbox-iso.basic

    provisioners:

      shell

    post-processors:

      <no post-processor>