How to downgrade Terraform to 0.11.x on Arch Linux

The latest minor version of terraform, the 0.12.x series, dropped recently and in true bleeding edge Arch Linux fashion, I’m already running it.

Thing is though, the latest release of terraform, even though it’s a minor point release, does include breaking changes from the 0.11.x series.

If you’re running Arch and don’t want to run the latest version of a specific package, you will need to downgrade to the version you’d like to.

For me, that was version 0.11.14 of terraform which incidentally, I had never installed since I didn’t run any upgrades between 0.11.13 being released and 0.12.0 coming out.

Sourcing from the locally stored cache

For the sake of conversation, if you did have the specific version you want to downgrade to previously installed, you can reference it from your local cache as such:

su -c 'pacman -U /var/cache/pacman/pkg/terraform-0.11.13-1-x86_64.pkg.tar.xz'

Sourcing from the Arch Linux Archive

Since I wanted to downgrade to 0.11.14, I needed to find the version out on the Arch Linux Archive (ALA). The packages are indexed by first letter, so it didn’t take much to find the terraform package I needed

Having downloaded both the archive as well as the signature, I was able to verify that everything was on the up and up:

pacman-key --verify ~/Downloads/terraform-0.11.14-1-x86_64.pkg.tar.xz.sig

Installing the downgraded package

And then downgrade the package to the specific version I had downloaded:

su -c 'pacman -U ~/Downloads/terraform-0.11.14-1-x86_64.pkg.tar.xz'

Once the downgrade finished, I verified that I was in fact running version 0.11.14:

terraform --version

Success! But we’re not done yet.

Pinning the downgraded package version

Because Arch is a rolling release, it sees the terraform package as out of date compared to the version upstream. Because of it, the next time I run an upgrade, I’ll overwrite my downgraded package with the latest one.

To circumvent this behavior, we need to list the package in our /etc/pacman.conf file as part of our “ignored packages:

su -c 'vim /etc/pacman.conf'

Once open, search for IgnorePkg, which is probably commented out if you’ve
never added any packages before. Uncomment it if it is, and simply add
terraform to your list of packages to ignore when upgrading:

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg = terraform

And now the package won’t be upgraded. Don’t believe me? You can try to reinstall terraform, which will alert you to the fact that the package is being ignored, and requesting confirmation to proceed:

su -c 'pacman -S terraform'

Keep in mind, this really isn’t intended as a permanent solution. Given enough time, dependencies will end up growing stale and pinning an old version like this can lead to bigger problems if left alone.

Next steps for me will be to look further into the breaking changes between 0.11.x and 0.12.x and come up with a migration plan to get us to the latest version.

Once that happens, I can remove terraform from /etc/pacman.conf and upgrade terraform back to it’s bleeding edge glory!

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

If you found this article helpful, please consider buying me a coffee.