Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform providers lock cannot upgrade and terraform init cannot specify a platform #32923

Open
grimm26 opened this issue Mar 28, 2023 · 3 comments
Labels
enhancement new new issue not yet triaged registry

Comments

@grimm26
Copy link

grimm26 commented Mar 28, 2023

Terraform Version

Terraform v1.4.2
on darwin_arm64

Use Cases

Our terraform commands run on atlantis on a linux_amd64 container. Many of my users are on darwin_arm64 machines and we are using a provider version that does not have darwin_arm64 binaries in its release (infobloxopen/infoblox v1.1.1). This causes terraform init to fail because it cannot download a provider for the user's platform. I told them to instead use terraform providers lock -platform=linux_amd64 to generate the lock file. This is fine for generating an initial lock file but it will not perform an upgrade. It tells you to use init for that.

So, init cannot be told a specific platform and providers lock cannot be told to upgrade. This is the proverbial rock and hard place.

Attempted Solutions

Right now I told them to delete the lock file before they run terraform providers lock -platform=linux_amd64 when they need to upgrade a provider version.

Proposal

Add an -upgrade flag to terraform providers lock or add a -platform flag to terraform init.

References

No response

@grimm26 grimm26 added enhancement new new issue not yet triaged labels Mar 28, 2023
@grimm26 grimm26 changed the title terraform providers lock and terraform init between a rock and a hard place terraform providers lock cannot upgrade and terraform init cannot specify a platform Mar 28, 2023
@sushant-kapoor17
Copy link

Hello @grimm26 ,
If my memory serves me right,I remember looking at a similar issue few months ago, which still remains open.

I believe there was a proposal to explore a future update like:
terraform providers lock -upgrade -platform=darwin_amd64 -platform=linux_amd64

This suggestion has been explained in detail here, if it helps.

Unfortunately, I think there are only a few workarounds which can be useful for now, which could be accommodated as a Makefile target to refresh providers for different platforms.

Hope this helps a bit.

Thanks

@kmoe kmoe added the registry label Mar 30, 2023
@jbg
Copy link

jbg commented Apr 3, 2023

The linked workaround uses init and therefore only works if all providers have an available build for the local platform where the command is being run. In OP's case, that's not the case, so init will fail. The only workaround I'm aware of is to delete the lockfile and then run providers lock.

@AndresPinerosZen
Copy link

AndresPinerosZen commented Jan 9, 2025

It's really crazy how difficult they made it.

Just let people specify the platforms in the terraform{} block and that's it. It's that simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged registry
Projects
None yet
Development

No branches or pull requests

5 participants