MongoCluster

class MongoCluster : KotlinCustomResource

Manages a MongoDB Cluster using vCore Architecture.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-rg",
location: "East US",
});
const exampleMongoCluster = new azure.cosmosdb.MongoCluster("example", {
name: "example-mc",
resourceGroupName: example.name,
location: example.location,
administratorUsername: "adminTerraform",
administratorPassword: "QAZwsx123",
shardCount: 1,
computeTier: "Free",
highAvailabilityMode: "Disabled",
storageSizeInGb: 32,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-rg",
location="East US")
example_mongo_cluster = azure.cosmosdb.MongoCluster("example",
name="example-mc",
resource_group_name=example.name,
location=example.location,
administrator_username="adminTerraform",
administrator_password="QAZwsx123",
shard_count=1,
compute_tier="Free",
high_availability_mode="Disabled",
storage_size_in_gb=32)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-rg",
Location = "East US",
});
var exampleMongoCluster = new Azure.CosmosDB.MongoCluster("example", new()
{
Name = "example-mc",
ResourceGroupName = example.Name,
Location = example.Location,
AdministratorUsername = "adminTerraform",
AdministratorPassword = "QAZwsx123",
ShardCount = 1,
ComputeTier = "Free",
HighAvailabilityMode = "Disabled",
StorageSizeInGb = 32,
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"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 := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-rg"),
Location: pulumi.String("East US"),
})
if err != nil {
return err
}
_, err = cosmosdb.NewMongoCluster(ctx, "example", &cosmosdb.MongoClusterArgs{
Name: pulumi.String("example-mc"),
ResourceGroupName: example.Name,
Location: example.Location,
AdministratorUsername: pulumi.String("adminTerraform"),
AdministratorPassword: pulumi.String("QAZwsx123"),
ShardCount: pulumi.Int(1),
ComputeTier: pulumi.String("Free"),
HighAvailabilityMode: pulumi.String("Disabled"),
StorageSizeInGb: pulumi.Int(32),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.cosmosdb.MongoCluster;
import com.pulumi.azure.cosmosdb.MongoClusterArgs;
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) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-rg")
.location("East US")
.build());
var exampleMongoCluster = new MongoCluster("exampleMongoCluster", MongoClusterArgs.builder()
.name("example-mc")
.resourceGroupName(example.name())
.location(example.location())
.administratorUsername("adminTerraform")
.administratorPassword("QAZwsx123")
.shardCount("1")
.computeTier("Free")
.highAvailabilityMode("Disabled")
.storageSizeInGb("32")
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-rg
location: East US
exampleMongoCluster:
type: azure:cosmosdb:MongoCluster
name: example
properties:
name: example-mc
resourceGroupName: ${example.name}
location: ${example.location}
administratorUsername: adminTerraform
administratorPassword: QAZwsx123
shardCount: '1'
computeTier: Free
highAvailabilityMode: Disabled
storageSizeInGb: '32'

Preview Feature GeoReplicas)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-rg",
location: "East US",
});
const exampleMongoCluster = new azure.cosmosdb.MongoCluster("example", {
name: "example-mc",
resourceGroupName: example.name,
location: example.location,
administratorUsername: "adminTerraform",
administratorPassword: "QAZwsx123",
shardCount: 1,
computeTier: "M30",
highAvailabilityMode: "ZoneRedundantPreferred",
storageSizeInGb: 64,
previewFeatures: ["GeoReplicas"],
});
const exampleGeoReplica = new azure.cosmosdb.MongoCluster("example_geo_replica", {
name: "example-mc-geo",
resourceGroupName: example.name,
location: "Central US",
sourceServerId: exampleMongoCluster.id,
sourceLocation: exampleMongoCluster.location,
createMode: "GeoReplica",
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-rg",
location="East US")
example_mongo_cluster = azure.cosmosdb.MongoCluster("example",
name="example-mc",
resource_group_name=example.name,
location=example.location,
administrator_username="adminTerraform",
administrator_password="QAZwsx123",
shard_count=1,
compute_tier="M30",
high_availability_mode="ZoneRedundantPreferred",
storage_size_in_gb=64,
preview_features=["GeoReplicas"])
example_geo_replica = azure.cosmosdb.MongoCluster("example_geo_replica",
name="example-mc-geo",
resource_group_name=example.name,
location="Central US",
source_server_id=example_mongo_cluster.id,
source_location=example_mongo_cluster.location,
create_mode="GeoReplica")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-rg",
Location = "East US",
});
var exampleMongoCluster = new Azure.CosmosDB.MongoCluster("example", new()
{
Name = "example-mc",
ResourceGroupName = example.Name,
Location = example.Location,
AdministratorUsername = "adminTerraform",
AdministratorPassword = "QAZwsx123",
ShardCount = 1,
ComputeTier = "M30",
HighAvailabilityMode = "ZoneRedundantPreferred",
StorageSizeInGb = 64,
PreviewFeatures = new[]
{
"GeoReplicas",
},
});
var exampleGeoReplica = new Azure.CosmosDB.MongoCluster("example_geo_replica", new()
{
Name = "example-mc-geo",
ResourceGroupName = example.Name,
Location = "Central US",
SourceServerId = exampleMongoCluster.Id,
SourceLocation = exampleMongoCluster.Location,
CreateMode = "GeoReplica",
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"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 := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-rg"),
Location: pulumi.String("East US"),
})
if err != nil {
return err
}
exampleMongoCluster, err := cosmosdb.NewMongoCluster(ctx, "example", &cosmosdb.MongoClusterArgs{
Name: pulumi.String("example-mc"),
ResourceGroupName: example.Name,
Location: example.Location,
AdministratorUsername: pulumi.String("adminTerraform"),
AdministratorPassword: pulumi.String("QAZwsx123"),
ShardCount: pulumi.Int(1),
ComputeTier: pulumi.String("M30"),
HighAvailabilityMode: pulumi.String("ZoneRedundantPreferred"),
StorageSizeInGb: pulumi.Int(64),
PreviewFeatures: pulumi.StringArray{
pulumi.String("GeoReplicas"),
},
})
if err != nil {
return err
}
_, err = cosmosdb.NewMongoCluster(ctx, "example_geo_replica", &cosmosdb.MongoClusterArgs{
Name: pulumi.String("example-mc-geo"),
ResourceGroupName: example.Name,
Location: pulumi.String("Central US"),
SourceServerId: exampleMongoCluster.ID(),
SourceLocation: exampleMongoCluster.Location,
CreateMode: pulumi.String("GeoReplica"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.cosmosdb.MongoCluster;
import com.pulumi.azure.cosmosdb.MongoClusterArgs;
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) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-rg")
.location("East US")
.build());
var exampleMongoCluster = new MongoCluster("exampleMongoCluster", MongoClusterArgs.builder()
.name("example-mc")
.resourceGroupName(example.name())
.location(example.location())
.administratorUsername("adminTerraform")
.administratorPassword("QAZwsx123")
.shardCount("1")
.computeTier("M30")
.highAvailabilityMode("ZoneRedundantPreferred")
.storageSizeInGb("64")
.previewFeatures("GeoReplicas")
.build());
var exampleGeoReplica = new MongoCluster("exampleGeoReplica", MongoClusterArgs.builder()
.name("example-mc-geo")
.resourceGroupName(example.name())
.location("Central US")
.sourceServerId(exampleMongoCluster.id())
.sourceLocation(exampleMongoCluster.location())
.createMode("GeoReplica")
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-rg
location: East US
exampleMongoCluster:
type: azure:cosmosdb:MongoCluster
name: example
properties:
name: example-mc
resourceGroupName: ${example.name}
location: ${example.location}
administratorUsername: adminTerraform
administratorPassword: QAZwsx123
shardCount: '1'
computeTier: M30
highAvailabilityMode: ZoneRedundantPreferred
storageSizeInGb: '64'
previewFeatures:
- GeoReplicas
exampleGeoReplica:
type: azure:cosmosdb:MongoCluster
name: example_geo_replica
properties:
name: example-mc-geo
resourceGroupName: ${example.name}
location: Central US
sourceServerId: ${exampleMongoCluster.id}
sourceLocation: ${exampleMongoCluster.location}
createMode: GeoReplica

Import

MongoDB Clusters can be imported using the resource id, e.g.

$ pulumi import azure:cosmosdb/mongoCluster:MongoCluster example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster

Properties

Link copied to clipboard

The Password associated with the administrator_username for the MongoDB Cluster.

Link copied to clipboard

The administrator username of the MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val computeTier: Output<String>?

The compute tier to assign to the MongoDB Cluster. Possible values are Free, M10, M20, M25, M30, M40, M50, M60, M80, and M200.

Link copied to clipboard

The list of connection_strings blocks as defined below.

Link copied to clipboard
val createMode: Output<String>?

The creation mode for the MongoDB Cluster. Possibles values are Default and GeoReplica. Defaults to Default. Changing this forces a new resource to be created.

Link copied to clipboard

The high availability mode for the MongoDB Cluster. Possibles values are Disabled and ZoneRedundantPreferred.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val location: Output<String>

The supported Azure location where the MongoDB Cluster exists. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>

The name which should be used for the MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val previewFeatures: Output<List<String>>?

The preview features that can be enabled on the MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard

The Public Network Access setting for the MongoDB Cluster. Possibles values are Disabled and Enabled. Defaults to Enabled.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The name of the resource group in which to create the MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val shardCount: Output<Int>?

The Number of shards to provision on the MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val sourceLocation: Output<String>?

The location of the source MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val sourceServerId: Output<String>?

The ID of the replication source MongoDB Cluster. Changing this forces a new resource to be created.

Link copied to clipboard
val storageSizeInGb: Output<Int>?

The size of the data disk space for the MongoDB Cluster.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags to assign to the MongoDB Cluster.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val version: Output<String>?

The version for the MongoDB Cluster. Possibles values are 5.0, 6.0 and 7.0.