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

Compatible provider not installing after usage of m1-terraform-provider-helper

applike-ss opened this issue · comments

I have used a non-darwin-arm64 version for the grafana provider in one project and the switched to a project that uses a grafana provider that is darwin-arm64 compatible.
When trying to do a terraform init on the latter project i get an error.

I am however not sure whether this is a flaw in the m1 helper or whether terraform itself is wrong - or my way of thinking how this should work.

Expected Behavior

Terraform can install the now available provider version

Actual Behavior

Terraform can not retrieve the list of provider versions

Steps to Reproduce (including precondition)

# install incompatible version of provider
m1-terraform-provider-helper install grafana/grafana -v 1.10.0 --custom-build-command "go build -o ~/go/bin/terraform-provider-grafana ."

terraform init
# ...
# Initializing provider plugins...
# - Finding grafana/grafana versions matching "1.35.0"...
# ╷
# │ Error: Failed to query available provider packages
# │ 
# │ Could not retrieve the list of available versions for provider
# │ grafana/grafana: no available releases match the given constraints 1.35.0
# ╵

Your Environment

  • OS: MacOS 13.2.1, M2 Pro 16" 32GB
  • m1-terraform-provider-helper version: 0.8.1
commented

You installed v1.10.0 but terraform is looking for 1.35.0. You probably have to pin the version of the provider you are using: https://developer.hashicorp.com/terraform/language/providers/requirements#version-constraints

This is the test case. v1.10.0 does not have a darwin/arm64 provider version. this is supposed to be the version i am using in an older project.

Now 1.35.0 is the version i use in a different project.

commented

Ah, now I understand the question.
When activated, the m1-helper installs all the installed providers to the ~/.terraform.d/plugins directory. Since this is global, this affects all terraform projects.
We do have the activate and deactivate commands. So when you are working on a project that does not need a darwn_arm64 provider, simply run m1-terraform-provider-helper deactivate. Then terraform will work as usual and download from the internet.

In my case that is currently not working because i indeed do have a terraform module that still uses the template provider from hashicorp (i know it's deprecated).
Hopefully that will be removed from that module soon.
However the use-case is there that you have a project that can have an outdated provider version required and another project needing a newer one.
Is there a solution for this? I do not know exactly which of the applications in doubt is causing this. I should read the code, but i have no spare time 🙈

commented

You can install multiple version of the same provider, that is no problem. You can run m1-terraform-provider-helper list to see which versions of which providers are currently locally compiled and installed.
If you specify the correct version in your terraform project, then everything should be fine.

commented

Closing this as it is not a bug.