Terraform 在创建 Azure 服务总线队列时仍停留在创建步骤和超时状态

问题描述 投票:0回答:1

Error Message

Terraform apply 成功创建了 Azure 服务总线队列,但未在 terraform 状态下更新它。根据默认超时策略,它在 30 分钟后仍停留在创建步骤和超时状态。

我尝试使用旧的 terraform 和 azurerm 版本运行该计划,但问题仍然相同。

在同一 Azure 服务总线命名空间中创建 Azure 服务总线主题时,不存在此问题。

networking terraform azureservicebus azure-servicebus-queues azure-rm
1个回答
0
投票

在创建 Azure 服务总线队列时,Terraform 仍停留在创建步骤和超时状态:- -

在最新的 Azure RM 提供程序版本中,有一个名为 timeouts 的属性,用于申请服务总线队列等任何资源。如果您已应用

timeout
字段,请考虑将超时增加到
60m
或更长,如图所示。

resource "azurerm_servicebus_queue" "main" {
  timeouts {
    create = "80m"
    update = "xxx"
    delete = "xx"
  }
}

注意: 通过将

.tf
文件的
azurerm_servicebus_queue
的 terraform 配置与 terraform 注册表中的模板结构进行一次比较来验证它。

检查完上述所有内容后,我尝试在我的环境中部署服务总线队列,并能够成功执行,如图所示。

provider "azurerm"{
features{}
}
data "azurerm_resource_group" "example" {
  name     = "caroline"
}

resource "azurerm_servicebus_namespace" "example" {
  name                = "jahservicebus-namespace"
  location            = data.azurerm_resource_group.example.location
  resource_group_name = data.azurerm_resource_group.example.name
  sku                 = "Standard"
}

resource "azurerm_servicebus_queue" "example" {
  name         = "tfex_servicebus_queue"
  namespace_id = azurerm_servicebus_namespace.example.id

  enable_partitioning = true
   timeouts {
    create = "80m"
    update = "xxx"
    delete = "xx"
  }
}

部署成功:

enter image description here

enter image description here

enter image description here

enter image description here

如果 terraform 需要升级,也可能会发生这种情况。在部署资源之前,请运行

terraform init -upgrade

如果问题仍然存在,请使用

AzCLI
 删除 
az cache purge
中的缓存,然后重新启动资源。为了避免冲突,请使用
rm terraform.tfstate
命令删除当前状态文件。

© www.soinside.com 2019 - 2024. All rights reserved.