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

时间:2020-08-28 20:45:17

标签: azure terraform init

在运行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"
    }```

1 个答案:

答案 0 :(得分:0)

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

首先在main.tf文件中,

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

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

terraform init -upgrade
terraform init
terraform plan
terraform apply