提供者hashicorp/azurerm不支持​​资源类型│“azurerm_lb_backend_address_pool_address”

问题描述

我正在尝试使用 terraform 在 azure 中创建负载均衡器,但出现此错误

错误:无效的资源类型 │ │ 在 12-lb.tf 第 43 行,在资源“azurerm_lb_backend_address_pool_address”“示例”中: │ 43:资源“azurerm_lb_backend_address_pool_address”“示例”{
│ │ 提供者hashicorp/azurerm不支持​​资源类型 │ “azurerm_lb_backend_address_pool_address”。

这是我的 12-lb.tf

resource "azurerm_lb" "example" {
  name                = "classiclb"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "Standard"

  frontend_ip_configuration {
    name                          = "classiclb"
    subnet_id                     = azurerm_subnet.vm.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_lb_backend_address_pool" "example" {
  loadbalancer_id = azurerm_lb.example.id
  name            = "classiclb"
}

resource "azurerm_lb_probe" "example" {
  resource_group_name = azurerm_resource_group.example.name
  loadbalancer_id     = azurerm_lb.example.id
  name                = "classiclb"
  port                = 80
  interval_in_seconds = 10
  number_of_probes    = 3
  protocol            = "Http"
  request_path        = "/"
}

resource "azurerm_lb_rule" "example" {
  resource_group_name            = azurerm_resource_group.example.name
  loadbalancer_id                = azurerm_lb.example.id
  name                           = "classiclb"
  protocol                       = "Tcp"
  frontend_port                  = 80
  backend_port                   = 80
  frontend_ip_configuration_name = "classiclb"
  backend_address_pool_id        = azurerm_lb_backend_address_pool.example.id
  probe_id                       = azurerm_lb_probe.example.id
}

# the below is to be only used by when the sku of LB is set to Standard ony 
resource "azurerm_lb_backend_address_pool_address" "example" {
  name                    = "classiclb"
  backend_address_pool_id = azurerm_lb_backend_address_pool.example.id
  virtual_network_id      = azurerm_virtual_network.example.id
  ip_address              = azurerm_linux_virtual_machine.example.private_ip_address
}

# the below is to be only used by when the sku of LB is set to Basic 
# resource "azurerm_network_interface_backend_address_pool_association" "example" {
#   network_interface_id    = azurerm_network_interface.example.id
#   ip_configuration_name   = "internall"
#   backend_address_pool_id = azurerm_lb_backend_address_pool.example.id
# }

为什么不支持资源 azurerm_lb_backend_address_pool_address

解决方法

为什么不支持资源azurerm_lb_backend_address_pool_address?

您有 旧版本 azurem 提供程序。您必须升级