Show / Hide Table of Contents

Class Cluster

mongodbatlas..Cluster provides a Cluster resource. The resource lets you create, edit and delete clusters. The resource requires your Project ID.

NOTE: Groups and projects are synonymous terms. You may find group_id in the official documentation.

IMPORTANT: <br> &#8226; Free tier cluster creation (M0) is not supported via API or by this Provider. <br> &#8226; Shared tier clusters (M2, M5) cannot be upgraded to higher tiers via API or by this Provider. <br> &#8226; Changes to cluster configurations can affect costs. Before making changes, please see Billing. <br> &#8226; If your Atlas project contains a custom role that uses actions introduced in a specific MongoDB version, you cannot create a cluster with a MongoDB version less than that version unless you delete the custom role.

Example Usage

Example AWS cluster

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var cluster_test = new Mongodbatlas.Cluster(&quot;cluster-test&quot;, new Mongodbatlas.ClusterArgs
    {
        AutoScalingDiskGbEnabled = true,
        DiskSizeGb = 100,
        MongoDbMajorVersion = &quot;4.0&quot;,
        NumShards = 1,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderBackupEnabled = true,
        ProviderDiskIops = 300,
        ProviderEncryptEbsVolume = true,
        ProviderInstanceSizeName = &quot;M40&quot;,
        ProviderName = &quot;AWS&quot;,
        ProviderRegionName = &quot;US_EAST_1&quot;,
        ProviderVolumeType = &quot;STANDARD&quot;,
        ReplicationFactor = 3,
    });
}

}

Example Azure cluster.

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var test = new Mongodbatlas.Cluster(&quot;test&quot;, new Mongodbatlas.ClusterArgs
    {
        AutoScalingDiskGbEnabled = true,
        MongoDbMajorVersion = &quot;4.0&quot;,
        NumShards = 1,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderBackupEnabled = true,
        ProviderDiskTypeName = &quot;P6&quot;,
        ProviderInstanceSizeName = &quot;M30&quot;,
        ProviderName = &quot;AZURE&quot;,
        ProviderRegionName = &quot;US_EAST_2&quot;,
        ReplicationFactor = 3,
    });
}

}

Example GCP cluster

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var test = new Mongodbatlas.Cluster(&quot;test&quot;, new Mongodbatlas.ClusterArgs
    {
        AutoScalingDiskGbEnabled = true,
        DiskSizeGb = 40,
        MongoDbMajorVersion = &quot;4.0&quot;,
        NumShards = 1,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderBackupEnabled = true,
        ProviderInstanceSizeName = &quot;M30&quot;,
        ProviderName = &quot;GCP&quot;,
        ProviderRegionName = &quot;US_EAST_4&quot;,
        ReplicationFactor = 3,
    });
}

}

Example Multi Region cluster

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var cluster_test = new Mongodbatlas.Cluster(&quot;cluster-test&quot;, new Mongodbatlas.ClusterArgs
    {
        ClusterType = &quot;REPLICASET&quot;,
        DiskSizeGb = 100,
        NumShards = 1,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderBackupEnabled = true,
        ProviderDiskIops = 300,
        ProviderInstanceSizeName = &quot;M10&quot;,
        ProviderName = &quot;AWS&quot;,
        ProviderVolumeType = &quot;STANDARD&quot;,
        ReplicationSpecs = 
        {
            new Mongodbatlas.Inputs.ClusterReplicationSpecArgs
            {
                NumShards = 1,
                RegionsConfig = 
                {

                    {
                        { &quot;electableNodes&quot;, 3 },
                        { &quot;priority&quot;, 7 },
                        { &quot;readOnlyNodes&quot;, 0 },
                        { &quot;regionName&quot;, &quot;US_EAST_1&quot; },
                    },

                    {
                        { &quot;electableNodes&quot;, 2 },
                        { &quot;priority&quot;, 6 },
                        { &quot;readOnlyNodes&quot;, 0 },
                        { &quot;regionName&quot;, &quot;US_EAST_2&quot; },
                    },

                    {
                        { &quot;electableNodes&quot;, 2 },
                        { &quot;priority&quot;, 5 },
                        { &quot;readOnlyNodes&quot;, 2 },
                        { &quot;regionName&quot;, &quot;US_WEST_1&quot; },
                    },
                },
            },
        },
    });
}

}

Example Global cluster

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var cluster_test = new Mongodbatlas.Cluster(&quot;cluster-test&quot;, new Mongodbatlas.ClusterArgs
    {
        ClusterType = &quot;GEOSHARDED&quot;,
        DiskSizeGb = 80,
        NumShards = 1,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderBackupEnabled = true,
        ProviderDiskIops = 240,
        ProviderInstanceSizeName = &quot;M30&quot;,
        ProviderName = &quot;AWS&quot;,
        ProviderVolumeType = &quot;STANDARD&quot;,
        ReplicationSpecs = 
        {
            new Mongodbatlas.Inputs.ClusterReplicationSpecArgs
            {
                NumShards = 2,
                RegionsConfig = 
                {

                    {
                        { &quot;electableNodes&quot;, 3 },
                        { &quot;priority&quot;, 7 },
                        { &quot;readOnlyNodes&quot;, 0 },
                        { &quot;regionName&quot;, &quot;US_EAST_1&quot; },
                    },
                },
                ZoneName = &quot;Zone 1&quot;,
            },
            new Mongodbatlas.Inputs.ClusterReplicationSpecArgs
            {
                NumShards = 2,
                RegionsConfig = 
                {

                    {
                        { &quot;electableNodes&quot;, 3 },
                        { &quot;priority&quot;, 7 },
                        { &quot;readOnlyNodes&quot;, 0 },
                        { &quot;regionName&quot;, &quot;EU_CENTRAL_1&quot; },
                    },
                },
                ZoneName = &quot;Zone 2&quot;,
            },
        },
    });
}

}

Example AWS Shared Tier cluster

using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;

class MyStack : Stack
{
public MyStack()
{
    var cluster_test = new Mongodbatlas.Cluster(&quot;cluster-test&quot;, new Mongodbatlas.ClusterArgs
    {
        AutoScalingDiskGbEnabled = &quot;false&quot;,
        BackingProviderName = &quot;AWS&quot;,
        DiskSizeGb = &quot;2&quot;,
        MongoDbMajorVersion = &quot;4.2&quot;,
        ProjectId = &quot;&lt;YOUR-PROJECT-ID>&quot;,
        ProviderInstanceSizeName = &quot;M2&quot;,
        ProviderName = &quot;TENANT&quot;,
        ProviderRegionName = &quot;US_EAST_1&quot;,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Cluster
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Mongodbatlas
Assembly: Pulumi.Mongodbatlas.dll
Syntax
public class Cluster : CustomResource

Constructors

View Source

Cluster(String, ClusterArgs, CustomResourceOptions)

Create a Cluster resource with the given unique name, arguments, and options.

Declaration
public Cluster(string name, ClusterArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ClusterArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AdvancedConfiguration

Declaration
public Output<ClusterAdvancedConfiguration> AdvancedConfiguration { get; }
Property Value
Type Description
Output<ClusterAdvancedConfiguration>
View Source

AutoScalingDiskGbEnabled

Specifies whether disk auto-scaling is enabled. The default is true.

  • Set to true to enable disk auto-scaling.
  • Set to false to disable disk auto-scaling.
Declaration
public Output<bool> AutoScalingDiskGbEnabled { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

BackingProviderName

Cloud service provider on which the server for a multi-tenant cluster is provisioned.

Declaration
public Output<string> BackingProviderName { get; }
Property Value
Type Description
Output<System.String>
View Source

BackupEnabled

Legacy Option - Set to true to enable Atlas continuous backups for the cluster.

Declaration
public Output<bool?> BackupEnabled { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

BiConnector

Specifies BI Connector for Atlas configuration on this cluster. BI Connector for Atlas is only available for M10+ clusters. See BI Connector below for more details.

Declaration
public Output<ClusterBiConnector> BiConnector { get; }
Property Value
Type Description
Output<ClusterBiConnector>
View Source

ClusterId

The cluster ID.

Declaration
public Output<string> ClusterId { get; }
Property Value
Type Description
Output<System.String>
View Source

ClusterType

Specifies the type of the cluster that you want to modify. You cannot convert a sharded cluster deployment to a replica set deployment.

Declaration
public Output<string> ClusterType { get; }
Property Value
Type Description
Output<System.String>
View Source

ConnectionStrings

Set of connection strings that your applications use to connect to this cluster. More info in Connection-strings. Use the parameters in this object to connect your applications to this cluster. To learn more about the formats of connection strings, see Connection String Options. NOTE: Atlas returns the contents of this object after the cluster is operational, not while it builds the cluster.

  • connection_strings.standard - Public mongodb:// connection string for this cluster.
  • connection_strings.standard_srv - Public mongodb+srv:// connection string for this cluster. The mongodb+srv protocol tells the driver to look up the seed list of hosts in DNS. Atlas synchronizes this list with the nodes in a cluster. If the connection string uses this URI format, you don’t need to append the seed list or change the URI if the nodes change. Use this URI format if your driver supports it. If it doesn’t, use connectionStrings.standard.
  • connection_strings.aws_private_link - Private-endpoint-aware mongodb://connection strings for each interface VPC endpoint you configured to connect to this cluster. Returned only if you created a AWS PrivateLink connection to this cluster.
  • connection_strings.aws_private_link_srv - Private-endpoint-aware mongodb+srv://connection strings for each interface VPC endpoint you configured to connect to this cluster. Returned only if you created a AWS PrivateLink connection to this cluster. Use this URI format if your driver supports it. If it doesn’t, use connectionStrings.awsPrivateLink.
  • connection_strings.private - Network-peering-endpoint-aware mongodb://connection strings for each interface VPC endpoint you configured to connect to this cluster. Returned only if you created a network peering connection to this cluster.
  • connection_strings.private_srv - Network-peering-endpoint-aware mongodb+srv://connection strings for each interface VPC endpoint you configured to connect to this cluster. Returned only if you created a network peering connection to this cluster.
Declaration
public Output<ClusterConnectionStrings> ConnectionStrings { get; }
Property Value
Type Description
Output<ClusterConnectionStrings>
View Source

DiskSizeGb

The size in gigabytes of the server’s root volume. You can add capacity by increasing this number, up to a maximum possible value of 4096 (i.e., 4 TB). This value must be a positive integer.

Declaration
public Output<double> DiskSizeGb { get; }
Property Value
Type Description
Output<System.Double>
View Source

EncryptionAtRestProvider

Set the Encryption at Rest parameter. Possible values are AWS, GCP, AZURE or NONE. Requires M10 or greater and for backup_enabled to be false or omitted.

Declaration
public Output<string> EncryptionAtRestProvider { get; }
Property Value
Type Description
Output<System.String>
View Source

Labels

Array containing key-value pairs that tag and categorize the cluster. Each key and value has a maximum length of 255 characters. You cannot set the key Infrastructure Tool, it is used for internal purposes to track aggregate usage.

Declaration
public Output<ImmutableArray<ClusterLabel>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ClusterLabel>>
View Source

MongoDbMajorVersion

Version of the cluster to deploy. Atlas supports the following MongoDB versions for M10+ clusters: 3.6, 4.0, or 4.2. You must set this value to 4.2 if provider_instance_size_name is either M2 or M5.

Declaration
public Output<string> MongoDbMajorVersion { get; }
Property Value
Type Description
Output<System.String>
View Source

MongoDbVersion

Version of MongoDB the cluster runs, in major-version.minor-version format.

Declaration
public Output<string> MongoDbVersion { get; }
Property Value
Type Description
Output<System.String>
View Source

MongoUri

Base connection string for the cluster. Atlas only displays this field after the cluster is operational, not while it builds the cluster.

Declaration
public Output<string> MongoUri { get; }
Property Value
Type Description
Output<System.String>
View Source

MongoUriUpdated

Lists when the connection string was last updated. The connection string changes, for example, if you change a replica set to a sharded cluster.

Declaration
public Output<string> MongoUriUpdated { get; }
Property Value
Type Description
Output<System.String>
View Source

MongoUriWithOptions

connection string for connecting to the Atlas cluster. Includes the replicaSet, ssl, and authSource query parameters in the connection string with values appropriate for the cluster.

Declaration
public Output<string> MongoUriWithOptions { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

Name of the cluster as it appears in Atlas. Once the cluster is created, its name cannot be changed.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

NumShards

Number of shards to deploy in the specified zone.

Declaration
public Output<int?> NumShards { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Paused

Flag that indicates whether the cluster is paused or not.

Declaration
public Output<bool> Paused { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

PitEnabled

  • Flag that indicates if the cluster uses Point-in-Time backups. If set to true, provider_backup_enabled must also be set to true.
Declaration
public Output<bool> PitEnabled { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

ProjectId

The unique ID for the project to create the database user.

Declaration
public Output<string> ProjectId { get; }
Property Value
Type Description
Output<System.String>
View Source

ProviderBackupEnabled

Flag indicating if the cluster uses Cloud Provider Snapshots for backups.

Declaration
public Output<bool?> ProviderBackupEnabled { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ProviderDiskIops

The maximum input/output operations per second (IOPS) the system can perform. The possible values depend on the selected providerSettings.instanceSizeName and diskSizeGB.

Declaration
public Output<int> ProviderDiskIops { get; }
Property Value
Type Description
Output<System.Int32>
View Source

ProviderDiskTypeName

Azure disk type of the server’s root volume. If omitted, Atlas uses the default disk type for the selected providerSettings.instanceSizeName. Example disk types and associated storage sizes: P4 - 32GB, P6 - 64GB, P10 - 128GB, P20 - 512GB, P30 - 1024GB, P40 - 2048GB, P50 - 4095GB. More information and the most update to date disk types/storage sizes can be located at https://docs.atlas.mongodb.com/reference/api/clusters-create-one/.

Declaration
public Output<string> ProviderDiskTypeName { get; }
Property Value
Type Description
Output<System.String>
View Source

ProviderEncryptEbsVolume

If enabled, the Amazon EBS encryption feature encrypts the server’s root volume for both data at rest within the volume and for data moving between the volume and the instance.

Declaration
public Output<bool> ProviderEncryptEbsVolume { get; }
Property Value
Type Description
Output<System.Boolean>
View Source

ProviderInstanceSizeName

Atlas provides different instance sizes, each with a default storage capacity and RAM size. The instance size you select is used for all the data-bearing servers in your cluster. See Create a Cluster providerSettings.instanceSizeName for valid values and default resources.

Declaration
public Output<string> ProviderInstanceSizeName { get; }
Property Value
Type Description
Output<System.String>
View Source

ProviderName

Cloud service provider on which the servers are provisioned.

Declaration
public Output<string> ProviderName { get; }
Property Value
Type Description
Output<System.String>
View Source

ProviderRegionName

Physical location of your MongoDB cluster. The region you choose can affect network latency for clients accessing your databases. Requires the Atlas Region name, see the reference list for AWS, GCP, Azure. Do not specify this field when creating a multi-region cluster using the replicationSpec document or a Global Cluster with the replicationSpecs array.

Declaration
public Output<string> ProviderRegionName { get; }
Property Value
Type Description
Output<System.String>
View Source

ProviderVolumeType

The type of the volume. The possible values are: STANDARD and PROVISIONED. PROVISIONED required if setting IOPS higher than the default instance IOPS.

Declaration
public Output<string> ProviderVolumeType { get; }
Property Value
Type Description
Output<System.String>
View Source

ReplicationFactor

Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.

Declaration
public Output<int> ReplicationFactor { get; }
Property Value
Type Description
Output<System.Int32>
View Source

ReplicationSpecs

Configuration for cluster regions. See Replication Spec below for more details.

Declaration
public Output<ImmutableArray<ClusterReplicationSpec>> ReplicationSpecs { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ClusterReplicationSpec>>
View Source

SnapshotBackupPolicies

current snapshot schedule and retention settings for the cluster.

Declaration
public Output<ImmutableArray<ClusterSnapshotBackupPolicy>> SnapshotBackupPolicies { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ClusterSnapshotBackupPolicy>>
View Source

SrvAddress

Connection string for connecting to the Atlas cluster. The +srv modifier forces the connection to use TLS/SSL. See the mongoURI for additional options.

Declaration
public Output<string> SrvAddress { get; }
Property Value
Type Description
Output<System.String>
View Source

StateName

Current state of the cluster. The possible states are:

  • IDLE
  • CREATING
  • UPDATING
  • DELETING
  • DELETED
  • REPAIRING
Declaration
public Output<string> StateName { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, ClusterState, CustomResourceOptions)

Get an existing Cluster resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Cluster Get(string name, Input<string> id, ClusterState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ClusterState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Cluster
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.