kreuzwerker / m1-terraform-provider-helper

CLI to support with downloading and compiling terraform providers for Mac with M1 chip

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Looks like completely different provider version is compiled

grumpper opened this issue · comments

I am trying to compile 2 versions of the AWS provider (in my case 2.20.0 and 2.10.0). 2.20.0 fails and then when I try 2.10.0 it detaches the HEAD to the 2.20.0 commit so even if it succeeds I will have essentially 2.20.0 branded as 2.10.0 which is terrible.

Expected Behavior

HEAD should detach to the proper commit for the version provided as argument

Actual Behavior

HEAD detaches to the commit of the last attempt regardless if it's successful or not.
Deactivating and activating the tool again does not fix it.

Steps to Reproduce (including precondition)

Try to compile any two provider versions one after another.

Screenshot on This Problem (if possible)

Different versions
Same versions

Your Environment

  • OS: MacOS 12.3.1
  • m1-terraform-provider-helper version: 0.5.1

The console output is misleading. The HEAD is now at XXX comes from this line https://github.com/kreuzwerker/m1-terraform-provider-helper/blob/main/internal/app/install.go#L130
The git reset --hard && git clean -d -f -q basically gets rid of any non-commited files in the repo, and outputs the current checked out commit.
We checkout the specified version in https://github.com/kreuzwerker/m1-terraform-provider-helper/blob/main/internal/app/install.go#L135 (which does not produce any output).

You can check it yourself by taking a look at what is checked out inside $HOME/.m1-terraform-provider-helper/terraform-provider-aws:

  • cd $HOME/.m1-terraform-provider-helper/terraform-provider-aws && git checkout master && git pull (get latest master)
  • m1-terraform-provider-helper install hashicorp/aws -v v2.36.0
  • cd $HOME/.m1-terraform-provider-helper/terraform-provider-aws && git log: Shows for me 907e76d4b11205d817067e581ecaab474fd0aa61 as the latest commit hash, which is for the v2.36.0 tag

But we definitely should/could rework the console output to avoid confusion