setting up terraform v0.14.0 on Apple M1
Asked Answered
C

5

22

Any pointers how to setup Terraform v0.14.0 on a Apple M1 , as tfenv doesn't support v0.14.0 on Apple M1

tfenv install v0.14.0
Installing Terraform v0.14.0
Downloading release tarball from https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_darwin_arm64.zip
curl: (22) The requested URL returned error: 403

Tarball download failed
Coppersmith answered 24/3, 2022 at 17:25 Comment(0)
L
19

If you are using tfenv, you can override the architecture with TFENV_ARCH environment variables: TFENV_ARCH=amd64. See docs.

If you are not using tfenv:

Terraform is a simple executable, you can download it and unzip it from here: https://releases.hashicorp.com/terraform/0.14.0/:

wget https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_darwin_amd64.zip

unzip terraform_0.14.0_darwin_amd64.zip

Please note, there is no arm64 build for osx, but the amd64 works just fine on a Mac M1.

Now you can copy the extracted executable in a folder like /usr/local/bin, which should be on your PATH, so you can run terraform command from anywhere in your system.

Lasso answered 24/3, 2022 at 17:44 Comment(1)
I want to use 0.13 and it works just fine by changing the version number. Thx!Ridenour
C
43

You can set the env var TFENV_ARCH and use tfenv

TFENV_ARCH=amd64 tfenv install 0.14.0
Cotsen answered 13/4, 2022 at 21:7 Comment(0)
L
19

If you are using tfenv, you can override the architecture with TFENV_ARCH environment variables: TFENV_ARCH=amd64. See docs.

If you are not using tfenv:

Terraform is a simple executable, you can download it and unzip it from here: https://releases.hashicorp.com/terraform/0.14.0/:

wget https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_darwin_amd64.zip

unzip terraform_0.14.0_darwin_amd64.zip

Please note, there is no arm64 build for osx, but the amd64 works just fine on a Mac M1.

Now you can copy the extracted executable in a folder like /usr/local/bin, which should be on your PATH, so you can run terraform command from anywhere in your system.

Lasso answered 24/3, 2022 at 17:44 Comment(1)
I want to use 0.13 and it works just fine by changing the version number. Thx!Ridenour
C
1

tfswitch You switch between different versions of terraform : https://tfswitch.warrensbox.com/

Cautery answered 30/3, 2023 at 14:53 Comment(0)
R
0

Hello! Setting up Terraform v0.14.0 on an Apple M1 machine can be smoothly done using one of the two following methods: Both of these methods leverage the power of version managers, allowing you to easily switch between different Terraform versions without much hassle.

Option 1: Using tfswitch

The tfswitch tool is a handy utility that allows you to switch between different Terraform versions easily. If you haven't already installed it on your machine, you can do so using Homebrew. Once installed, switching to Terraform version 0.14.0 is a straightforward process.

# Install tfswitch if you haven't done so.
brew install warrensbox/tap/tfswitch

# Switch to Terraform version 0.14.0
tfswitch 0.14.0

This command will download and switch your Terraform to version 0.14.0, making it the active version for your projects.

Option 2: Using tfenv

Another excellent tool for managing Terraform versions is tfenv. It's similar to tfswitch but specifically tailored for Terraform. Installing tfenv and then using it to install a specific Terraform version is also quite simple.

# Install tfenv if you haven't already
brew install tfenv

# Install and use Terraform version 0.14.0.
tfenv install 0.14.0

Note: It seems there might be a typo in your original script under Option 2, where it says tfenv install 0.7.0. Assuming you're aiming for Terraform version 0.14.0, you should use tfenv install 0.14.0 as shown above.

Both methods are efficient for managing different versions of Terraform on your machine, especially on an Apple M1, ensuring you can work on various projects that may require different versions. Pick the one that best suits your workflow, or feel free to have both at your disposal for greater flexibility.

Roo answered 14/3 at 5:56 Comment(0)
L
0

you can use tenv instead of tfenv : https://github.com/tofuutils/tenv

Lieutenancy answered 1/5 at 12:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.