2

我正在尝试创建 azure databrick 集群,但是当我尝试运行 terraform init 时,我看到以下错误。我该如何纠正这一点。所以基本上如何在 terraform 中使用不同的提供者。Terraform 版本是 Terraform v0.14.5

当我运行 terraform init 时,出现以下错误

Initializing the backend...

  Initializing provider plugins...
        - Finding hashicorp/azurerm versions matching "~> 2.33"...
        - Finding latest version of hashicorp/databricks...
        - Installing hashicorp/azurerm v2.45.1...
        - Installed hashicorp/azurerm v2.45.1 (signed by HashiCorp)

       Error: Failed to query available provider packages

           Could not retrieve the list of available versions for provider
           hashicorp/databricks: provider registry registry.terraform.io does not have a
           provider named registry.terraform.io/hashicorp/databricks

           If you have just upgraded directly from Terraform v0.12 to Terraform v0.14
           then please upgrade to Terraform v0.13 first and follow the upgrade guide for
           that release, which might help you address this problem.
4

1 回答 1

4

如果您将提供者简单地指定为databrics,那么它将被解析到hashicorp命名空间中(如您在消息中所见:Finding latest version of hashicorp/databricks...)。要正确解决它,您需要将其定义放入 Terraform 本身的块中,如下所示(您可以从文档required_providers中的“USE PROVIDER”按钮复制它):

terraform {
  required_providers {
    databricks = {
      source  = "databrickslabs/databricks"
      version = "0.3.0"
    }
  }
}
于 2021-02-02T19:12:13.770 回答