linux MAC安装Terraform

葫芦的运维日志

浏览量 5127 2021/02/10 09:35

MAC安装Terraform

Brew安装

  1. 安装 Command Line Tools for Xcode 12.5 beta 下载地址: https://developer.apple.com/download/more/

  2. 安装 Brew 终端执行

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

Asdf安装

  1. brew install coreutils curl git
  2. brew install asdf

Terraform安装

  1. asdf plugin add terraform
  2. asdf install terraform 0.14.4
  3. asdf install terraform 0.12.26

Terraform使用

  1. 设置asdf global

    asdf global terraform 0.14.4
    asdf current
    terraform       0.14.4
    
  2. 使用terraform

    asdf exec terraform
    
  3. 添加 zsh配置文件

    cat ~/.zshrc
    . /usr/local/opt/asdf/asdf.sh
    
  4. 直接执行terraform

    terraform version
    Terraform v0.14.4
    
  5. 切换版本
    zi.wang@ziwangdeMacBook-Pro ~ % asdf current
    terraform       0.14.4          /Users/zi.wang/.tool-versions
    zi.wang@ziwangdeMacBook-Pro ~ % asdf global terraform 0.12.26
    zi.wang@ziwangdeMacBook-Pro ~ % asdf current
    terraform       0.12.26         /Users/zi.wang/.tool-versions
    

葫芦的运维日志

打赏

留言板

留言提交后需管理员审核通过才会显示

© 冰糖葫芦甜(bthlt.com) 2025 王梓打赏联系方式陕ICP备17005322号-1