0

我正在使用 TF 版本 v1.0.0(最新),并且正在尝试使用 pagerduty Tf 提供程序,并且错误日志显示无法检索可用版本的列表。下面是代码片段和完整的错误日志。

代码:

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
    }

错误:

- 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
4

1 回答 1

0

回答我的问题。

将第一个 terraform required_providers 块分离到它自己的 versions.tf 文件中已经解决了这个问题。

于 2021-06-21T21:02:32.380 回答