Evandro Pomatti
Evandro Pomatti

Reputation: 15144

Can't create multiple Cosmos MongoDB collections at the same time

Trying to create two Collections at the same time throws me this error:

The specified type system value 'TypedJsonBson' is invalid.

Judging by the response log, and the fact that the error is occurring at the apply phase, I suspect it is something with the API.

Samples:


Workaround

It is possible to avoid this problem by creating one Collection at a time.

depends_on = [
  azurerm_cosmosdb_mongo_collection.example
]

Upvotes: 0

Views: 362

Answers (2)

Nancy Xiong
Nancy Xiong

Reputation: 28264

I tried your terraform main.tf files on my local PowerShell, it works fine. So the terraform configuration file should be correct.

enter image description here

I would suggest running terraform apply on the Azure cloud shell. You could remove the old terraform.tfstate file and .terraform folder and re-run terraform init locally or verify other reasons on your working environment.

Upvotes: 1

Mark Brown
Mark Brown

Reputation: 8763

Yes, if Terraform has a means to specify that parent resources need to exist before child resources can be created then you should use this because ARM requires this for any resource to be created.

Upvotes: 0

Related Questions