Skip to content

Cannot use with OpenTofu #20

@marefr

Description

@marefr

Description

Thanks for a great project. Using OpenTofu with these modules seems impossible. I have currently downloaded your repository and copied all modules into my repo. But it would be very nice if I didn't have to do that. But maybe you just want to support terraform? That's also fine, but why I opened this issue to understand.

Module

flash-nodes

Module Version

1.4

Terraform Version

1.11 (opentofu)

Steps to Reproduce

  1. Use the following code
terraform {
  required_version = "~> 1.11"

  required_providers {
    time = {
      source  = "registry.opentofu.org/hashicorp/time"
      version = "~> 0.13"
    }

    turingpi = {
      source  = "registry.terraform.io/freed-dev-llc/turingpi"
      version = "~> 1.4"
    }
  }
}

provider "turingpi" {
  endpoint = var.turingpi_endpoint
  username = var.turingpi_username
  password = var.turingpi_password
}

module "talos_image" {
  source  = "registry.terraform.io/freed-dev-llc/modules/turingpi//modules/talos-image"
  version = "~> 1.4"

  talos_version = var.talos_version
  architecture  = var.talos_architecture
  preset        = "longhorn"
}
  1. Run tofu init

Expected Behavior

No error / should init successfully

Actual Behavior

Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider freed-dev-llc/turingpi: provider registry registry.opentofu.org does not have a provider named
│ registry.opentofu.org/freed-dev-llc/turingpi
│
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are
│ currently depending on freed-dev-llc/turingpi, run the following command:
│     tofu providers
│
│ If you believe this provider is missing from the registry, please submit a issue on the OpenTofu Registry https://github.com/opentofu/registry/issues/new/choose
> tofu providers
Providers required by configuration:
.
├── provider[registry.terraform.io/freed-dev-llc/turingpi] ~> 1.4
├── provider[registry.opentofu.org/hashicorp/time] ~> 0.13
├── provider[registry.opentofu.org/hashicorp/vault] ~> 5.9
├── module.talos_image
│   ├── provider[registry.opentofu.org/hashicorp/http] >= 3.0.0
│   ├── provider[terraform.io/builtin/terraform]
│   └── provider[registry.opentofu.org/hashicorp/local]
└── module.flash
    └── provider[registry.opentofu.org/freed-dev-llc/turingpi] >= 1.0.0

Problem seems to be that your modules refer to the turingpi provider in the following way:

required_providers {
    turingpi = {
      source  = "freed-dev-llc/turingpi"
    }
  }

An update to use the following should make both terraform and OpenTofu work:

required_providers {
    turingpi = {
      source  = "registry.terraform.io/freed-dev-llc/turingpi"
    }
  }

Or, to keep the existing provider reference in modules, publish freed-dev-llc/turingpi provider to OpenTofu registry, https://search.opentofu.org/docs/providers/adding.

Terraform Configuration

Error Output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions