Mongo Database
Manages a Mongo Database within a Cosmos DB Account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.cosmosdb.getAccount({
name: "tfex-cosmosdb-account",
resourceGroupName: "tfex-cosmosdb-account-rg",
});
const exampleMongoDatabase = new azure.cosmosdb.MongoDatabase("example", {
name: "tfex-cosmos-mongo-db",
resourceGroupName: example.then(example => example.resourceGroupName),
accountName: example.then(example => example.name),
throughput: 400,
});
Content copied to clipboard
import pulumi
import pulumi_azure as azure
example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
resource_group_name="tfex-cosmosdb-account-rg")
example_mongo_database = azure.cosmosdb.MongoDatabase("example",
name="tfex-cosmos-mongo-db",
resource_group_name=example.resource_group_name,
account_name=example.name,
throughput=400)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.CosmosDB.GetAccount.Invoke(new()
{
Name = "tfex-cosmosdb-account",
ResourceGroupName = "tfex-cosmosdb-account-rg",
});
var exampleMongoDatabase = new Azure.CosmosDB.MongoDatabase("example", new()
{
Name = "tfex-cosmos-mongo-db",
ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
AccountName = example.Apply(getAccountResult => getAccountResult.Name),
Throughput = 400,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
Name: "tfex-cosmosdb-account",
ResourceGroupName: "tfex-cosmosdb-account-rg",
}, nil)
if err != nil {
return err
}
_, err = cosmosdb.NewMongoDatabase(ctx, "example", &cosmosdb.MongoDatabaseArgs{
Name: pulumi.String("tfex-cosmos-mongo-db"),
ResourceGroupName: pulumi.String(example.ResourceGroupName),
AccountName: pulumi.String(example.Name),
Throughput: pulumi.Int(400),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
import com.pulumi.azure.cosmosdb.MongoDatabase;
import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
.name("tfex-cosmosdb-account")
.resourceGroupName("tfex-cosmosdb-account-rg")
.build());
var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
.name("tfex-cosmos-mongo-db")
.resourceGroupName(example.resourceGroupName())
.accountName(example.name())
.throughput(400)
.build());
}
}
Content copied to clipboard
resources:
exampleMongoDatabase:
type: azure:cosmosdb:MongoDatabase
name: example
properties:
name: tfex-cosmos-mongo-db
resourceGroupName: ${example.resourceGroupName}
accountName: ${example.name}
throughput: 400
variables:
example:
fn::invoke:
function: azure:cosmosdb:getAccount
arguments:
name: tfex-cosmosdb-account
resourceGroupName: tfex-cosmosdb-account-rg
Content copied to clipboard
Import
Cosmos Mongo Database can be imported using the resource id
, e.g.
$ pulumi import azure:cosmosdb/mongoDatabase:MongoDatabase db1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/mongodbDatabases/db1
Content copied to clipboard
Properties
Link copied to clipboard
The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
Link copied to clipboard
An autoscale_settings
block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
Link copied to clipboard
The throughput of the MongoDB collection (RU/s). Must be set in increments of 100
. The minimum value is 400
. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.