Skip to content

Instantly share code, notes, and snippets.

@straubt1
Created June 14, 2022 18:38
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save straubt1/033e9bbe76005c354a458868f914d2de to your computer and use it in GitHub Desktop.
Save straubt1/033e9bbe76005c354a458868f914d2de to your computer and use it in GitHub Desktop.
Notes to install Terraform on M1

Installing the amd64 version of Terraform on Mac with M1

Not all Terraform providers are built for arm64.

One solution here is to install Terraform as amd64 which can be easily done from the downloads page.

However, for those who are using and switching between versions of Terraform often, a more streamlined approach is desirable.

Enter asdf.

Install asdf

Update ~/.zshrc to include:

plugins=(asdf)

Install asdf with git:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf

Reload your shell

. ~/.zshrc
asdf info

Install Terraform

Install asdf Terraform profile with:

asdf plugin-add terraform https://github.com/asdf-community/asdf-hashicorp.git

Install terraform with:

# Override to install amd64, install specific version (can be "latest")
export TF_VERSION="latest"
export ASDF_HASHICORP_OVERWRITE_ARCH="amd64"

# install and set globally
asdf install terraform ${TF_VERSION}
asdf global terraform ${TF_VERSION}

# show version for good measure
terraform -v

Note: This can also go into your .zshrc file for future use on a specific version

terraform_install () {
  export TF_VERSION=$1
  export ASDF_HASHICORP_OVERWRITE_ARCH="amd64"

  # install and set globally
  asdf install terraform ${TF_VERSION}
  asdf global terraform ${TF_VERSION}

  # terraform version for good measure
  terraform -v
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment