Getting Error: Failed to query available provider packages

I am building a new terraform provider named lightstep-incident-response. My main.tf file has block of code below:
terraform {

  • required_providers {*
  • lightstep-incident-response = {*
  •  version = "1.0"*
    
  •  source  = "lightstep/lightstep-incident-response"*
    
  • }*
  • }*
    }

provider “lightstep-incident-response” {

  • base_url = “” //Enter Tenant URL*
  • api_token = “” //Enter User API Token*
    }

When I run terraform init, I get below error:
Error: Failed to query available provider packages

│ Could not retrieve the list of available versions for provider lightstep/lightstep-incident-response: provider registry registry.terraform.io does not have a provider
│ named Terraform Registry

│ 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 lightstep/lightstep-incident-response, run the following command:
│ terraform providers

The hashicorp doc says if it doesn’t find the provider with source in registry, it searched in local terraform.d/plugins dir. But it doesnt look like its searching in my local dir. I tried options mentioned in few other links none helped. Looking for help here.

@priyajagyasi01, I would recommend to use new dev_overrides option: CLI Configuration | Terraform by HashiCorp

tl:dr;

  1. add to your terraform.rc (depending on your OS system) dev_overrides block, e.g.
    provider_installation {
      dev_overrides {
        "local/lightstep-incident-response" = "<path-to-you-build-binary>"
      }
    
      direct {}
    }
    
  2. Use local/lightstep-incident-response provider in your main.tf

With this approach you’ll be able to switch dev and prod provider versions later and know exactly what you’re using.

2 Likes