본문 바로가기

퍼블릭 클라우드

[iac] Packer 설치

728x90

Packer 설치

packer 다운로드

https://www.packer.io/downloads

packer 설치

brew tap hashicorp/tap
brew install hashicorp/tap/packer
> brew install hashicorp/tap/packer
==> Downloading https://releases.hashicorp.com/packer/1.8.3/packer_1.8.3_darwin_arm64.zip
######################################################################## 100.0%
==> Installing packer from hashicorp/tap
🍺  /opt/homebrew/Cellar/packer/1.8.3: 3 files, 182.0MB, built in 2 seconds
==> Running `brew cleanup packer`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

packer 버전 확인

packer --version
> packer --version
1.8.3

packer 사용법

> packer --help                                                                                                           
Usage: packer [--version] [--help] <command> [<args>]

Available commands are:
    build           build image(s) from template
    console         creates a console for testing variable interpolation
    fix             fixes templates from old versions of packer
    fmt             Rewrites HCL2 config files to canonical format
    hcl2_upgrade    transform a JSON template into an HCL2 configuration
    init            Install missing plugins or upgrade plugins
    inspect         see components of a template
    plugins         Interact with Packer plugins and catalog
    validate        check that a template is valid
    version         Prints the Packer version

주요 명령어

플러그인 설치 또는 플러그인 업그레이드

packer init .

템플릿 유효성 확인

packer validate .

HCL2 구성 파일로 다시 작성

packer fmt .

이미지 빌드

packer build .

 

참고URL

- https://learn.hashicorp.com/tutorials/packer/get-started-install-cli

 

728x90