'Github Actions Homebrew Install Terraform version lags behind

In GitHub actions, you have the luxury of installing packages with homebrew. At least, that was my opinion up until recently. I personally think homebrew is a clean way to install packages with minimal lines of code. Locally (on my Mac), I developed and tested my code with Terraform v1.1.7 and deployed them with the help of the following workflow job:

jobs:
  infrastructure:
    name: Terraform
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup
        run: brew install terraform && brew install terragrunt
      - name: Apply
        run: |
          terragrunt run-all apply \
          --terragrunt-non-interactive

However, the pipeline failed and said that only v1.1.6 is available (see the message below). Does this mean that the homebrew packages within Github Actions lag some versions behind? Since the version on my laptop installed was v1.1.7 and the Homebrew formula also showed v1.1.7. For every distro, that version was released weeks before I encountered this problem.

Error: Unsupported Terraform Core version

on main.tf line 2, in terraform: 2: required_version = ">=1.1.7"

This configuration does not support Terraform version 1.1.6. To proceed, either choose another supported Terraform version or update this version constraint. Version constraints are normally set for good reason, so updating the constraint may lead to other errors or unexpected behavior.

Note: I know that I can use alternatives like apt or even the official HashiCorp Github Action. I just want to understand why the versions lagged behind. And if this is a common issue, I might better switch to one of the alternatives.



Solution 1:[1]

I have no idea why you saw the lagging, technically, it shouldn't. But if you see it next time, you can also raise in the homebrew discussions for quick handling.

I have just ran the flow myself, the installations for terraform and terragrunt works for me well. (github action run ref)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 chenrui