在创建 azurerm_public_ip 时出现错误“'Microsoft.Network/publicIPAddresses 不支持位置 'japanwest” 的可用性区域

Getting error "'Microsoft.Network/publicIPAddresses does not support availability zones at location 'japanwest " while creating azurerm_public_ip

我正在使用 terraform 在 azure 中创建 public ip 但出现以下错误并且在同一区域我可以使用 UI :

创建它
Error: creating/updating Public Ip Address: (Name "dev-hub-agw1-pip1" / Resource Group "dev-iapi"): network.PublicIPAddressesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="LocationNotSupportAvailabilityZones" Message="The resource 'Microsoft.Network/publicIPAddresses/dev-hub-agw1-pip1' does not support availability zones at location 'japanwest'."
│ 
│   with module.app-gateway.azurerm_public_ip.agw,
│   on ../modules/app-gateway/main.tf line 14, in resource "azurerm_public_ip" "agw":
│   14: resource "azurerm_public_ip" "agw" {

这是代码

resource "azurerm_public_ip" "iapi-agw-ip" {
  name                = "${var.env}-iapi-agw-ip"
  location            = var.region
  resource_group_name = var.rg_name
  allocation_method   = "Static"
  availability_zone   = "No-Zone"
}

请使用最新的azurerm版本和terraform 版本。当我在同一位置测试您的代码并成功部署时。

resource "azurerm_public_ip" "iapi-agw-ip" {
  name                = "ansuman-iapi-agw-ip"
  location            = "japanwest"
  resource_group_name = "ansumantest"
  allocation_method   = "Static"
  availability_zone   = "No-Zone"
}

输出:

注意: 最新 Terraform 版本 - v1.1.2 和最新 Azurerm 提供程序版本 - v2.90.0.