Terraform-Azure RM-错误:无法实例化提供程序“ azuread”以获取架构:无法识别的远程插件消息:

问题描述

在运行runnig terraform验证或terraform计划时出现此错误。奇怪的是,该代码曾经在我的VsCode终端窗口中正常工作。如果从Azure Command Shell运行,则相同的代码可以很好地执行。任何指针都很棒。


Error: Failed to instantiate provider "azuread" to obtain schema: Unrecognized remote plugin message: 

This usually means that the plugin is either invalid or simply
needs to be recompiled to support the latest protocol.



Error: Failed to instantiate provider "azurerm" to obtain schema: Unrecognized remote plugin message: 

This usually means that the plugin is either invalid or simply
needs to be recompiled to support the latest protocol.```

Here's the provider information:

    ```terraform {
     required_version = "0.12.9"
    }
    provider "azurerm" {
      version = "2.11"
      subscription_id = "my first subscription id goes here"
      features {}
    }
    provider "azurerm" {
      version = "2.11"
      alias           = "shared"
      subscription_id = "my second subscription id goes here"
      features {}
    }
    provider "azuread" {
      version = "0.11.0"
    }```

解决方法

通过使用波纹管更改为我解决了同样的问题,

首先在main.tf文件中,

provider "azurerm" {
 version = "=2.0.0"
 features { }  
}

然后从 Visual Studio Code 运行升级命令以部署资源,

terraform init -upgrade
terraform init
terraform plan
terraform apply 

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...