Open KiaraGrouwstra opened 7 months ago
A workaround is to specify the full path of the plugin, e.g. source = "registry.terraform.io/hashicorp/nomad"
.
Do you know about the current status of the opentofu registry? Is is a mirror of the terraform registry or something else?
They have a separate submission process, so it must not be just a mirror: https://github.com/opentofu/registry/tree/main#adding-providers-modules-or-gpg-keys-to-the-opentofu-registry
A workaround is to specify the full path of the plugin, e.g.
source = "registry.terraform.io/hashicorp/nomad"
.
Then I would propose this as a solution (instead of just a workaround).
hm, long-term that would seem a bit like making opentofu a second-class citizen in nixpkgs, whereas it would seem more likely given its license and broad backing it will outlive terraform
hm, long-term that would seem a bit like making opentofu a second-class citizen in nixpkgs, whereas it would seem more likely given its license and broad backing it will outlive terraform
Having a default registry other than it's own is not making it a second-class citizen. Take podman as an example, despite having it's own (partly so) registry quay.io, still mostly uses docker.io as the default.
opentofu seems to use its own registry by default rather than terraform's
Unfortunately, it seems like OpenTofu doesn't have a choice - the Terraform Registry's ToS doesn't allow OpenTofu to use it (source).
It doesn't look like we're downloading providers from the registry, so we shouldn't be running afoul of that clause. We just need to use a different folder name for Terraform (registry.terraform.io
) and OpenTofu (registry.opentofu.org
). I don't think that's impossible to implement (at least, after a brief glance at the terraform-providers
implementation).
https://github.com/NixOS/nixpkgs/pull/269106
I've got a draft PR that will drop the terraform registry in favour of just using the provider github repos directly, it'll be simple to include an option to use either registry.terraform.io
or registry.opentofu.org
in that PR.
I plan to finish the PR sometime in the next few weeks.
A workaround I found for now, which implies rebuilding the providers:
{
lib,
opentofu,
}: let
# HACK https://github.com/NixOS/nixpkgs/issues/283015
tofuProvider = provider:
provider.override (oldArgs: {
provider-source-address =
lib.replaceStrings
["https://registry.terraform.io/providers"]
["registry.opentofu.org"]
oldArgs.homepage;
});
in
opentofu.withPlugins (ps:
builtins.map tofuProvider [
ps.aws
ps.hcloud
])
A workaround is to specify the full path of the plugin, e.g.
source = "registry.terraform.io/hashicorp/nomad"
.
Does not seem to work anymore. Due to the aforementioned T&Cs, OpenTofu seem to be forcing the providers to their own registry. https://github.com/opentofu/opentofu/issues/1478
Guess we have to package the opentofu registry now.
Describe the bug
opentofu.withPlugins
still fails to overrideregistry.terraform.io
toregistry.opentofu.org
. as a result of this, it will fail to find used plugins, searching in a nix store path containingregistry.terraform.io
rather thanregistry.opentofu.org
.Steps To Reproduce
Steps to reproduce the behavior:
use
opentofu.withPlugins
use a plugin in a
.tf
, e.g.:run
tofu init
find error not unlike:
Expected behavior
plugins work using opentofu as well
Screenshots
-
Additional context
withPlugins
as well as its derivatives likefull
andpassthru
.Notify maintainers
@gmemstr @nickcao @zowoq
Metadata