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

Support for OpenTofu #52

Open
hauleth opened this issue Nov 14, 2023 · 5 comments
Open

Support for OpenTofu #52

hauleth opened this issue Nov 14, 2023 · 5 comments

Comments

@hauleth
Copy link

hauleth commented Nov 14, 2023

It would be handy to have description how to use it with OpenTofu. Right now with:

terraform = pkgs.opentofu.withPlugins (plugins: [
  plugins.ovh
  providers.Backblaze.b2
]);

I am getting:

╷
│ Error: Required plugins are not installed
│ 
│ The installed provider plugins are not consistent with the packages selected in the dependency lock file:
│   - registry.terraform.io/backblaze/b2: there is no package for registry.terraform.io/backblaze/b2 0.8.1 cached in .terraform/providers
│   - registry.terraform.io/ovh/ovh: there is no package for registry.terraform.io/ovh/ovh 0.26.0 cached in .terraform/providers
│ 
│ OpenTofu uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this configuration, run:
│   tofu init
╵

When I try to run it.

@hauleth
Copy link
Author

hauleth commented Nov 14, 2023

Ok, found workaround (for now) - you can use full name registry.terraform.io/ovh/ovh instead of just ovh/ovh in your provider spec and it will work right now.

@zimbatm
Copy link
Member

zimbatm commented Nov 15, 2023

This is probably a change that OpenTofu had to implement due to HashiCorp's licencing of registry.terraform.io. Legally you're not allowed to use their API unless sanctioned by HashiCorp.

@manveru
Copy link
Contributor

manveru commented Nov 27, 2023

Since I just hit the same issue, I worked around that by directly fetching the provider info from https://github.com/opentofu/registry-stable
Here's my implementation, could be a bit nicer if there was an option of passing the src directly to the original mkTerraformProvider, but it works well enough.
https://gist.github.com/manveru/bcd2b4e0d3a30abbdec19573083b34b7

@zimbatm
Copy link
Member

zimbatm commented Feb 24, 2024

I didn't notice before that https://github.com/opentofu/registry has a full list of providers. Using that as a database might make sense instead of building our own.

@kvendingoldo
Copy link

At this moment if you need to have a support of Terraform as well as OpenTofu (and Terragrunt :) ) in one tool you can use https://github.com/tofuutils/tenv which my team wrote some months ago. A lot of users switched to that tool to unify version management in the world of Terraform.

You're welcome to open any issues or contribute to tenv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants