【发布时间】:2021-11-13 19:09:30
【问题描述】:
我正在使用 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"
}
我的执行:
- terraform 初始化 = 成功
- terraform validate = 配置有效
- 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
【问题讨论】:
-
1) Terraform 和 Azure 提供程序的哪个版本? 2) 如果您复制并粘贴了此代码,则说明您有隐藏字符或无效字符。删除第 14 和 15 行并手动重新键入该行。如果您在其他行上遇到类似错误,请重复此操作。
-
不确定这是否会有所帮助,但这都是我输入的。
-
不,这没有帮助。我要求的细节没有提供。另外,您使用的是什么类型的编辑器?您有一个 UTF-8 错误。您的文本文件有问题。
-
@kkdeveloper7,有什么更新吗?您能否分享您在 terraform 中使用的版本以及您使用的 cmdlt ? powershell/bash?
标签: terraform terraform-provider-azure terraform-provider-gcp azure-rm