1

I'm on TF version v1.0.0(latest) and am trying to make use of the pagerduty Tf provider and the error log says could not retrieve teh list of available versions. Below is the code snippet and complete error log.

Code:

terraform {
      required_providers {
       pagerduty  = {
          source = "PagerDuty/pagerduty"
          version = "~> 1.9.8"
        }
      }
    }
    
    provider "pagerduty" {
      token = var.token
    }
    
    
    
    resource "pagerduty_service" "example" {
      name                    = "My Web App"
      auto_resolve_timeout    = 14400
      acknowledgement_timeout = 600
      escalation_policy       = var.policy
    }
    
    resource "pagerduty_service_integration" "apiv2" {
      name = "API V2"
      type = "events_api_v2_inbound_integration"
      service = pagerduty_service.example.id
    }

Error:

- Finding latest version of hashicorp/pagerduty...
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hashicorp/pagerduty: provider registry
│ registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/pagerduty
│ 
│ Did you intend to use pagerduty/pagerduty? If so, you must specify that source address in each module which
│ requires that provider. To see which modules are currently depending on hashicorp/pagerduty, run the following
│ command:
│     terraform providers
user8211795
  • 37
  • 1
  • 7
  • 1
    Can you edit the code in the question to be runnable please? Ideally it should take the form of a [mcve]. Right now it's missing the provider name before the `= {` on the third line which means that Terraform can't even parse it and that's the important part that will be causing your error. – ydaetskcoR Jun 21 '21 at 19:07
  • The updated version inits completely fine? – ydaetskcoR Jun 22 '21 at 08:51
  • No. It still gave me the same error. – user8211795 Jun 22 '21 at 16:22

1 Answers1

0

Answering my question.

Separating the first terraform required_providers blocks into its own versions.tf file has solved the issue.

user8211795
  • 37
  • 1
  • 7