Linux

MAC安装Terraform

2021/02/10 09:35 5140 次阅读王梓
★ 打赏
✸ ✸ ✸

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
    
✸ ✸ ✸

📜 版权声明

本文作者:王梓 | 原文链接:https://www.bthlt.com/note/368-MAC安装Terraform

出处:葫芦的运维日志 | 转载请注明出处并保留原文链接

📜 留言板

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