jsiebens / terraform-equinix-faasd

Terraform Module for how to deploy a faasd instance on Equinix Metal
MIT License
2 stars 1 forks source link

provider registry registry.terraform.io does not have a provider named │ registry.terraform.io/hashicorp/metal #1

Closed alexellis closed 3 years ago

alexellis commented 3 years ago

I may be doing something wrong here, but:

lex@alex-nuc8:~/dev/derek-equinixmetal$ terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/metal...
- Finding equinix/metal versions matching ">= 3.0.0"...
- Finding hashicorp/random versions matching ">= 3.1.0"...
- Installing equinix/metal v3.2.0...
- Installed equinix/metal v3.2.0 (signed by a HashiCorp partner, key ID 1A65631C7288685E)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hashicorp/metal: provider registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/metal
│ 
│ Did you intend to use equinix/metal? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on
│ hashicorp/metal, run the following command:
│     terraform providers

terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/metal]
├── module.faasd
│   ├── provider[registry.terraform.io/hashicorp/random] >= 3.1.0
│   └── provider[registry.terraform.io/equinix/metal] >= 3.0.0
└── module.metal

HCL

data "metal_project" "project" {
  name = "Derek"
  project_id = "redacted"

}

resource "metal_project_ssh_key" "access" {
  name       = "access"
  public_key = "ssh-rsa redacted"
  project_id = local.project_id
}

module "faasd" {
  source = "github.com/jsiebens/terraform-equinix-faasd"

  name       = "derek.openfaas.com"
  project_id = data.metal_project.project.id

  plan = "c3.small.x86"
  metro = "am"
  ufw_enabled = true
  project_ssh_key_ids = [metal_project_ssh_key.access.id]
}

There is no complete example in the repository, so I copied the example given. See also #2

alexellis commented 3 years ago

This happens with the following terraform versions: v1.0.0 and v1.0.8 (latest)

jsiebens commented 3 years ago

Because you are creating Equinix Metal resources in the root module too (metal_project_ssh_key), the provider needs to be configured there as well.

An example is now available to illustrate this. See commit 1f7567a5c5931e9d78a3e21b25fa866522e0bd3f