Terraform stuck at still creating step and timeouts while creating Azure Service Bus Queue

538 views Asked by At

Error Message

Terraform apply is successful creating the Azure Service Bus Queue but, not updating it in the terraform state. It gets stuck at in still creating step and timeout after 30 minutes as per the default timeout policy.

I tried running the plan using the old terraform and azurerm version but the issue is still the same.

This issue isn't there while creating Azure Service Bus Topics within the same Azure Service Bus Namespace.

2

There are 2 answers

0
Saurav Garg On BEST ANSWER

The Timeout issue for me was with argument named lock_duration. For which the value passed was P0DT0H5M0S but it is expecting for short formatted string like PT5M.

Don't know why this was happening as it is ISO 8601 timespan duration format.

1
Jahnavi On

Terraform stuck at still creating step and timeouts while creating Azure Service Bus Queue:- -

In the latest Azure RM provider versions, there is a property called timeouts to apply for any resource like service bus queue. If you've already applied the timeout field, consider increasing the timeout to 60m or more as shown.

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

Note: Verify the terraform configuration of your .tf file's azurerm_servicebus_queue by comparing it to the template structure from the terraform registry once.

After checking all the above, I tried deploying a service bus queue in my environment and was able to perform it successfully as shown.

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"
  }
}

Deployment succeeded:

enter image description here

enter image description here

enter image description here

enter image description here

This can also happen if terraform requires an upgrade. Before deploying the resource, run terraform init -upgrade.

If the issue persists, delete the cache in AzCLI using az cache purge and relaunch the resource. To avoid conflicts, use the rm terraform.tfstate command to remove the current state file.