I'm looking for a way to set the initial value of throughput (request units) for a cosmosdb database or container via an ARM Template, and to use the same ARM template for subsequent deployments.
Here's a sample:
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"apiVersion": "2016-03-31",
"name": "DBACCOUNTNAME",
"location": "Canada Central",
"kind": "GlobalDocumentDB",
"properties": {
"consistencyPolicy": {
"defaultConsistencyLevel": "BoundedStaleness",
"maxStalenessPrefix": 100,
"maxIntervalInSeconds": 5
},
"databaseAccountOfferType": "Standard",
"locations": [ { "locationName": "Canada Central" } ],
"enableAutomaticFailover": false,
"isVirtualNetworkFilterEnabled": false
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/apis/databases",
"apiVersion": "2016-03-31",
"name": "DBACCOUNTNAME/sql/DBNAME",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/', 'DBACCOUNTNAME')]"
],
"properties": {
"resource": {
"id": "DBNAME"
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/apis/databases/containers",
"apiVersion": "2016-03-31",
"name": "DBACCOUNTNAME/sql/DBNAME/data",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/apis/databases', 'DBACCOUNTNAME', 'sql', 'DBNAME')]"
],
"properties": {
"resource": {
"id": "data",
"partitionKey": {
"paths": [ "/id" ]
}
},
"options": { "throughput": "2000" }
}
}
As you can see at the bottom, in this case our initial throughput value is 2000. The default is 400.
This ARM template works if:
- This is the first deployment, or
- This is a subsequent deployment AND the throughput has not changed in the meantime.
It does NOT work if:
- The throughput has changed (for example, we're auto-scaling it based on real-time metrics)
...
It's possible to use [reference(..)]
to get a reference to the current throughput. That can be used for subsequent updates without changing throughput, but it can't be used to initially create the resource.
...
How can I have a single ARM template which I can redeploy in this case?