首页 > 解决方案 > Terraform 计划引发提供程序插件错误

问题描述

我正在使用 terraform 进行小型 POC,但无法运行terraform plan

我的代码:

terraform {
  backend "azurerm" {
    storage_account_name = "appngqastorage"
    container_name       = "terraform"
    key                  = "qa.terraform.tfstate"
    access_key = "my access key here"
  }
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 2.77"
    }
  }
}

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "qa_resource_group" {
  location = "East US"
  name = "namehere"
} 

我的执行:

  1. terraform init = 成功
  2. terraform validate = 配置有效
  3. terraform plan = 抛出异常

错误:

│ Error: Plugin error
│
│   with provider["registry.terraform.io/hashicorp/azurerm"],
│   on main.tf line 15, in provider "azurerm":
│   15: provider"azurerm"{
│
│ The plugin returned an unexpected error from plugin.(*GRPCProvider).ConfigureProvider: rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8

标签: terraformterraform-provider-azureterraform-provider-gcpazure-rm

解决方案


在深入挖掘之后,我能够找出问题所在。

我正在进行的当前项目已在多个地区使用。因此,在测试工作时,我正在交换我的区域,以便正确测试特定区域中显示的数据。这次运行terraform apply我的 Windows 配置时,它指向了另一个区域,而不是美国。

这个线程帮助我理解。


推荐阅读