Trouble while creating azure DocumentDB instance using Terraform.

Debashish Behera 5 Reputation points
2026-08-25T09:16:50.36+00:00

Hi There,

what are the general troubleshooting way to debug the following issue :

"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"UnprocessableEntity\",\"message\":\"The create operation failed. An unexpected error occurred while processing the request. Tracking id: ***.\"}]}}"

The TF script for creating the same is as follows :

resource "azapi_resource" "mongo_cluster" {
  type      = "Microsoft.DocumentDB/mongoClusters@2025-09-01"
  name      = "***"
  location  = "eastus2"
  parent_id = azurerm_resource_group.rg.id

  body = {
    properties = {
      administrator = {
        userName = "***"
        password = "***"
      }
      # Change the password while creating in other subscription
      serverVersion = "8.0"

      compute = {
        tier = "M10"
      }

      storage = {
        sizeGb = 32
        type   = "PremiumSSD"
      }

      sharding = {
        shardCount = 1
      }

      highAvailability = {
        targetMode = "Disabled"
      }

      backup = {}

      publicNetworkAccess = "Enabled"

      dataApi = {
        mode = "Disabled"
      }

      authConfig = {
        allowedModes = ["NativeAuth"]
      }

      createMode = "Default"
    }
  }
}

Any advice, recommendation or suggestion is welcome.

Azure DocumentDB
Azure DocumentDB

A scalable, fully managed NoSQL database for JSON documents with fast queries and automatic indexing


1 answer

Sort by: Most helpful
  1. Megha Ramakrishnan 495 Reputation points
    2026-08-25T10:51:42.4666667+00:00

    Hi @Debashish Behera

    Welcome to Microsoft Q&A.

    Thank you for sharing the error details and your Terraform configuration. The ResourceOperationFailure with UnprocessableEntity indicates that the request failed validation during provisioning.

    Based on your configuration, can you try updating the below values:

    1. Unsupported server version

    • Azure Cosmos DB for MongoDB clusters currently support versions such as 4.2, 4.4, 5.0, and 6.0 (preview).

    1. High availability setting

    • highAvailability.targetMode = "Disabled" may not be supported for the M10 tier. Most production tiers require HA enabled.

    Please update your configuration and re‑run terraform apply.

    • If the error persists, check the Activity Log in Azure Portal for more detailed error codes tied to the tracking ID.

    If provisioning continues to fail, please share:

    • Whether you are using Cosmos DB for MongoDB vCore clusters or another deployment type.

    • Any additional error details from the Activity Log.

    Help make this community better for everyone: if this answer resolved your issue, please accept it or leave an upvote. If not, share more details in a comment so we can continue the discussion and find the right solution.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.