Brew Terraform
- Brew Terraform Update
- Install Specific Terraform Version
- Brew Terraform 13
- Brew Install Version
- Brew Terraform Switch
- Install Terraform
Use asdf
to switch terraform versions
asdf-vm
or asdf
is a CLI tool that manages multiple language runtime versions on a per-project basis. It’s like gvm
, nvm
, rbenv
, and pyenv
and more.
Purpose
- Homebrew’s package index. Tool to build, change, and version infrastructure.
- Brew remove packageName As you may have guessed by now, the remove and uninstall commands are exactly the same, and get the same result; the removal of the Homebrew package. For example, to remove and uninstall Telnet (assuming you installed telnet on the Mac with Homebrew anyway), you would use the following command string.
- On macOS, run brew install terraform if you don’t have it already and check your setup with: $ terraform version Terraform v0.14.2 And that’s all the preparation that is needed.
- This tutorial also appears in: Use Cases. Kubernetes (K8S) is an open-source workload scheduler with focus on containerized applications. You can use the Terraform Kubernetes provider to interact with resources supported by Kubernetes.
This post shows you how to install and configure multiple versions of terraform using asdf
. I used brew on OSX to install asdf
in a bash shell. There are also instructions to install with git using linux bash, ZSH, and fish on Getting Started with asdf-vim.
Procedure
Install Terraform by unzipping it and moving it to a directory included in your system's PATH. You can find the SHA256 checksums for Terraform 0.15.0 online and you can verify the checksums signature file which has been signed using HashiCorp's GPG key. You can also download older versions of Terraform from the releases service.
Install asdf with brew
Successful output includes
Test for a successful instal using the asdf version command
Successful output includes a version number like this
Configure your shell to use asdf using your .bash_profile
To test, cat your ~/.bash_profile and filter for asdf. You should see this output from the cat command
Test your ASDF_DIR and PATH is set properly env and filtering for asdf. You should see an ASDF_DIR
entry as well as a PATH entry that includes /.asdf/shims
Install dependencies for plugins
Successful output from brew includes a Summary
and a Pouring
for each dependency. This shows output for libxml
Now, we have asdf
installed and configured in our shell, and we’ll install the terraform plugin and manage between v.0.11 and v.0.12.
Install Terraform plugin for asdf
Brew Terraform Update
Successful output includes Cloning
from the reop and Unpacking
the objects
List versions of terraform
Successful output includes a list versions like this
We chose to install the latest version at the time of this writing, 0.12.5 as well as the latest version of terraform 0.11; which is 0.11.14
Install the latest v 0.11.x terraform using asdf
expected output includes
Install the latest v 0.12.x terraform using asdf
expected output includes
Set the global terraform version to 0.12.5
there is NO expected output from this command. test with the terraform --verison
command
expected output includes a terraform version number
Test the current version of terraform using asdf
expected output includes a terraform version
Switch to the older version of terraform using asdf
to set the global version pf asdf
expected output includes a terraform version number
Test the current version of terraform using asdf
expected output includes a terraform version
You have now installed asdf
, added the plugin for terraform, installed two different versions of terraform, and you can switch between those versions using the asdf global
command. Nice work.
- 3Homebrew (Option 1)
- 5Verify Install
Purpose
This article gives a couple options on how to install or setup Terraform on a macOS Sierra system. The first optional way is to use HomeBrew. Which simplifies the install process and makes updating easy too.
Prerequisites
- Homebrew (IF going Homebrew way instead of downloading zip.)
Homebrew (Option 1)
The easiest and quickest way to install Terraform is using Homebrew.
Install Example
A symlink will be created for the binary /usr/local/bin/terraform -> ./Cellar/terraform/0.9.1/bin/terraform Red obsidian meaning.
Upgrading
Manually (Option 2)
Install Specific Terraform Version
The versions seem to be bottled up very quickly with HomeBrew so I see little reason why to do a manual install, but this is how you do it.
- Download binary zip from HashiCorp
- https://www.terraform.io/downloads.html
- Unzip
- Copy binary to a place in the path such as /usr/local/bin/terraform
Brew Terraform 13
Verify Install
A simple test that the binary is in the path and such is to call the version.