Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Terraform报告错误“;无法查询可用的提供程序包";_Terraform_Terraform Provider Azure - Fatal编程技术网

Terraform报告错误“;无法查询可用的提供程序包";

Terraform报告错误“;无法查询可用的提供程序包";,terraform,terraform-provider-azure,Terraform,Terraform Provider Azure,我已经为Mongodb terraform模块创建了main.tf文件,如下所示 resource "mongodbatlas_teams" "test" { org_id = null name = "MVPAdmin_Team" usernames = ["user1@email.com", "user2@email.com", "user3@ema

我已经为Mongodb terraform模块创建了main.tf文件,如下所示

resource "mongodbatlas_teams" "test" {
  org_id     = null
  name       = "MVPAdmin_Team"
  usernames  = ["user1@email.com", "user2@email.com", "user3@email.com"]
}

resource "mongodbatlas_project" "test" {
  name   = "MVP_Project"
  org_id = null

  teams {
    team_id    = null
    role_names = ["GROUP_CLUSTER_MANAGER"]

  }
  
}
resource "mongodbatlas_project_ip_access_list" "test" {
  project_id = null
  ip_address = null
  comment    = "IP address for MVP Dev cluster testing"
}

resource "mongodbatlas_cluster" "test" {
  name                = "MVP_DevCluster"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  cluster_type        = REPLICASET
  state_name          = var.state_name
  replication specs {
     num_shards= var.num_shards
     region_config {
       region_name = "AU-EA"
       electable_nodes = var.electable_nodes
       priority        = var.priority
       read_only_nodes = var.read_only_nodes
     }  
  }

  provider_backup_enabled = var.provider_backup_enabled
  auto_scaling_disk_gb_enabled = var.auto_scaling_disk_gb_enabled
  mongo_db_major_version = var.mongo_db_major_version
  provider_name = "Azure"
  provider_disk_type_name = var.provider_disk_type_name
  provider_instance_size_name = var.provider_instance_size_name



  mongodbatlas_database_user {
    username = var.username
    password = var.password
    auth_database_name = var.auth_database_name
    role_name = var.role_name
    database_name = var.database_name
  }
  mongodbatlas_database_snapshot_backup_policy {
    policy_item = var.policy_item
    frequency_type = var.frequency_type
    retention_value = var.retention_value
  
 }

 advanced_configuration {
      minimum_enabled_tls_protocol = var.minimum_enabled_tls_protocol
   no_table_scan                  = var.no_table_scan
   connection_string              = var.connection_string

 } 
}
然而,terraform init报告如下:

$ terraform init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/mongodbatlas...

Error: Failed to query available provider packages

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

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.

Did you intend to use mongodb/mongodbatlas? If so, you must specify that
source address in each module which requires that provider. To see which
modules are currently depending on hashicorp/mongodbatlas, run the following
command:
    terraform providers 


你知道哪里出了问题吗?

错误消息解释了看到此错误消息的最可能的原因:你已经直接从Terraform v0.12升级到Terraform v0.14,而没有运行

如果您首先升级到Terraform v0.13并遵循这些说明,那么升级工具应该能够给出关于此处更改内容的更具体说明,甚至可以为您自动升级配置

但是,如果您愿意,您也可以手动添加v0.13升级工具将插入的配置块,以指定您打算在此模块中将
mongodb/mongodbatlas
提供程序用作“mongodbatlas”:

terraform {
  required_providers {
    mongodbatlas = {
      source = "monogdb/mongodbatlas"
    }
  }
}

在v0.13升级指南中还有一些上面没有提到的其他注意事项,因此,如果您在尝试我上面介绍的内容后看到不同的错误消息,您可能仍然需要执行该升级指南中描述的步骤。

您最近是否从Terraform的一个版本迁移到了新版本?尝试在你的tf文件中添加类似的内容:抱歉,伙计,我没有更改tf版本。我一定会试试你的建议。非常感谢!