terraform azure 块不足
terraform azure insufficient blocks
这是我的地形规划
terraform {
required_providers {
azure = {
source = "hashicorp/azurerm"
version = "=3.5.0"
}
}
backend "s3" {
encrypt = true
bucket = "terraform"
region = "us-east-1"
key = "aws/tgw_peer/us-east-1/terraform.tfstate"
}
}
provider "azurerm" {
features {}
}
data "azurerm_virtual_network" "vnet" {
resource_group_name = var.resource_group_name
name = var.vnet_name
}
当我执行 terraform plan
时,出现以下错误:
╷
│ Error: Insufficient features blocks
│
│ on <empty> line 0:
│ (source code not available)
│
│ At least 1 "features" blocks are required.
╵
azurerm 提供程序块中显然有一个功能块。但是,错误未指定文件名这一事实告诉我,问题可能出在其他地方。
我究竟做错了什么?
Terraform 版本 1.1.6
required_providers
块中的提供商名称错误,您已将其设置为 azure
,而应为 azurerm
。如何配置提供程序的示例:
terraform {
required_providers {
azurerm = { # <--- Note that it is azurerm
source = "hashicorp/azurerm"
version = "3.5.0"
}
}
}
provider "azurerm" {
# Configuration options
}
这是我的地形规划
terraform {
required_providers {
azure = {
source = "hashicorp/azurerm"
version = "=3.5.0"
}
}
backend "s3" {
encrypt = true
bucket = "terraform"
region = "us-east-1"
key = "aws/tgw_peer/us-east-1/terraform.tfstate"
}
}
provider "azurerm" {
features {}
}
data "azurerm_virtual_network" "vnet" {
resource_group_name = var.resource_group_name
name = var.vnet_name
}
当我执行 terraform plan
时,出现以下错误:
╷
│ Error: Insufficient features blocks
│
│ on <empty> line 0:
│ (source code not available)
│
│ At least 1 "features" blocks are required.
╵
azurerm 提供程序块中显然有一个功能块。但是,错误未指定文件名这一事实告诉我,问题可能出在其他地方。
我究竟做错了什么?
Terraform 版本 1.1.6
required_providers
块中的提供商名称错误,您已将其设置为 azure
,而应为 azurerm
。如何配置提供程序的示例:
terraform {
required_providers {
azurerm = { # <--- Note that it is azurerm
source = "hashicorp/azurerm"
version = "3.5.0"
}
}
}
provider "azurerm" {
# Configuration options
}