Learn Build5Nines Forum

Find answers, ask questions, and connect with our
global community of IT professionals.

Forums HashiCorp Terraform Upgrade Terraform to a Specific Version using Homebrew

  • Upgrade Terraform to a Specific Version using Homebrew

    Posted by Joshua Falken on September 22, 2023 at 11:30 am

    Use Case Explanation

    I currently have Terraform v0.11.13 installed via Homebrew, and in accordance with Terraform’s recommendations, I intend to upgrade to version v0.11.14 before proceeding with a major upgrade to v0.12.0.

    The Problem Statement

    The issue I’m encountering is that when I attempt to upgrade using either “brew upgrade terraform” or by downloading the Mac package from the Terraform website, it seems to immediately update my Terraform version to v0.12.0. This is not what I desire. How can I successfully upgrade to v0.11.14 instead?

    • This discussion was modified 2 months, 2 weeks ago by  Joshua Falken.
    Joshua Falken replied 2 months, 2 weeks ago 1 Member · 1 Reply
  • 1 Reply
  • Joshua Falken

    September 22, 2023 at 11:30 am

    Solution to Upgrading to Terraform v0.11.14

    It appears that you want to specifically upgrade your Terraform installation to version v0.11.14 and avoid jumping directly to v0.12.0. To achieve this, you can follow these steps:

    1. Check Currently Installed Versions: Before proceeding, ensure you have Terraform v0.11.13 installed. You can verify this by running the following command in your terminal:

      terraform --version

      It should display “Terraform v0.11.13” or a similar version number.

    2. Pin the Version with Homebrew: To upgrade to v0.11.14 without accidentally upgrading to v0.12.0, you can “pin” the Terraform version using Homebrew. Pinning prevents Homebrew from automatically upgrading to a newer version. Run the following command:

      brew pin terraform

      This will lock your Terraform installation at the current version, v0.11.13.

    3. Upgrade to v0.11.14: Now that Terraform is pinned, you can safely upgrade to v0.11.14:

      brew upgrade terraform@0.11

      This command explicitly instructs Homebrew to upgrade Terraform to the latest available version in the v0.11.x series, which should be v0.11.14.

    4. Verify the Upgrade: After the upgrade is complete, verify that you now have Terraform v0.11.14 installed:

      terraform --version

      It should display “Terraform v0.11.14” or a similar version number.

    5. Unpin Terraform: If you ever wish to upgrade to v0.12.0 or a later version, you can unpin Terraform using the following command:

      brew unpin terraform

      This will allow Homebrew to update to the latest available version.

    By following these steps, you can successfully upgrade Terraform to the specific version v0.11.14 while avoiding an unintentional upgrade to v0.12.0.

    • This reply was modified 2 months, 2 weeks ago by  Joshua Falken.

Log in to reply.