我正在尝试在Azure存储帐户中设置带有远程后端的Terraform。我想使用服务原理向Azure认证Terraform并遇到一些困难。这就是我所做的。
terraform {
required_version = ">= 0.12"
backend "azurerm" {
resource_group_name = "terraformstate-rg"
storage_account_name = "theNameOfSa"
container_name = "terraformstate"
key = "dev.terraform.tfstate"
}
}
# Configure the Azure provider
provider "azurerm" {
client_id = "xxxx"
client_secret = var.terraformSpClientSecret
subscription_id = "xxxx"
tenant_id = "xxxx"
environment = "public"
version = ">= 2.5.0"
features {}
}
当我从Vs Code或PyCharm运行Terraform Init时,出现以下错误: 无法获取现有工作空间:构建授权者时出错:存储帐户密钥格式错误:输入字节0处的base64数据非法
我不明白为什么会收到此错误,因为我根本没有在后端块配置中使用“ access_key”参数。