GlobalClusterConfig
mongodbatlas.GlobalClusterConfig
provides a Global Cluster Configuration resource.
NOTE: Groups and projects are synonymous terms. You may find group_id in the official documentation.
Examples Usage
Example Global cluster
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const test = new mongodbatlas.Cluster("test", {
projectId: "<YOUR-PROJECT-ID>",
diskSizeGb: 80,
backupEnabled: false,
providerBackupEnabled: true,
clusterType: "GEOSHARDED",
providerName: "AWS",
providerDiskIops: 240,
providerInstanceSizeName: "M30",
replicationSpecs: [
{
zoneName: "Zone 1",
numShards: 1,
regionsConfigs: [{
regionName: "EU_CENTRAL_1",
electableNodes: 3,
priority: 7,
readOnlyNodes: 0,
}],
},
{
zoneName: "Zone 2",
numShards: 1,
regionsConfigs: [{
regionName: "US_EAST_2",
electableNodes: 3,
priority: 7,
readOnlyNodes: 0,
}],
},
],
});
const config = new mongodbatlas.GlobalClusterConfig("config", {
projectId: test.projectId,
clusterName: test.name,
managedNamespaces: [{
db: "mydata",
collection: "publishers",
customShardKey: "city",
}],
customZoneMappings: [{
location: "CA",
zone: "Zone 1",
}],
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
test = mongodbatlas.Cluster("test",
project_id="<YOUR-PROJECT-ID>",
disk_size_gb=80,
backup_enabled=False,
provider_backup_enabled=True,
cluster_type="GEOSHARDED",
provider_name="AWS",
provider_disk_iops=240,
provider_instance_size_name="M30",
replication_specs=[
mongodbatlas.ClusterReplicationSpecArgs(
zone_name="Zone 1",
num_shards=1,
regions_configs=[mongodbatlas.ClusterReplicationSpecRegionsConfigArgs(
region_name="EU_CENTRAL_1",
electable_nodes=3,
priority=7,
read_only_nodes=0,
)],
),
mongodbatlas.ClusterReplicationSpecArgs(
zone_name="Zone 2",
num_shards=1,
regions_configs=[mongodbatlas.ClusterReplicationSpecRegionsConfigArgs(
region_name="US_EAST_2",
electable_nodes=3,
priority=7,
read_only_nodes=0,
)],
),
])
config = mongodbatlas.GlobalClusterConfig("config",
project_id=test.project_id,
cluster_name=test.name,
managed_namespaces=[mongodbatlas.GlobalClusterConfigManagedNamespaceArgs(
db="mydata",
collection="publishers",
custom_shard_key="city",
)],
custom_zone_mappings=[mongodbatlas.GlobalClusterConfigCustomZoneMappingArgs(
location="CA",
zone="Zone 1",
)])
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
class MyStack : Stack
{
public MyStack()
{
var test = new Mongodbatlas.Cluster("test", new Mongodbatlas.ClusterArgs
{
ProjectId = "<YOUR-PROJECT-ID>",
DiskSizeGb = 80,
BackupEnabled = false,
ProviderBackupEnabled = true,
ClusterType = "GEOSHARDED",
ProviderName = "AWS",
ProviderDiskIops = 240,
ProviderInstanceSizeName = "M30",
ReplicationSpecs =
{
new Mongodbatlas.Inputs.ClusterReplicationSpecArgs
{
ZoneName = "Zone 1",
NumShards = 1,
RegionsConfigs =
{
new Mongodbatlas.Inputs.ClusterReplicationSpecRegionsConfigArgs
{
RegionName = "EU_CENTRAL_1",
ElectableNodes = 3,
Priority = 7,
ReadOnlyNodes = 0,
},
},
},
new Mongodbatlas.Inputs.ClusterReplicationSpecArgs
{
ZoneName = "Zone 2",
NumShards = 1,
RegionsConfigs =
{
new Mongodbatlas.Inputs.ClusterReplicationSpecRegionsConfigArgs
{
RegionName = "US_EAST_2",
ElectableNodes = 3,
Priority = 7,
ReadOnlyNodes = 0,
},
},
},
},
});
var config = new Mongodbatlas.GlobalClusterConfig("config", new Mongodbatlas.GlobalClusterConfigArgs
{
ProjectId = test.ProjectId,
ClusterName = test.Name,
ManagedNamespaces =
{
new Mongodbatlas.Inputs.GlobalClusterConfigManagedNamespaceArgs
{
Db = "mydata",
Collection = "publishers",
CustomShardKey = "city",
},
},
CustomZoneMappings =
{
new Mongodbatlas.Inputs.GlobalClusterConfigCustomZoneMappingArgs
{
Location = "CA",
Zone = "Zone 1",
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := mongodbatlas.NewCluster(ctx, "test", &mongodbatlas.ClusterArgs{
ProjectId: pulumi.String("<YOUR-PROJECT-ID>"),
DiskSizeGb: pulumi.Float64(80),
BackupEnabled: pulumi.Bool(false),
ProviderBackupEnabled: pulumi.Bool(true),
ClusterType: pulumi.String("GEOSHARDED"),
ProviderName: pulumi.String("AWS"),
ProviderDiskIops: pulumi.Int(240),
ProviderInstanceSizeName: pulumi.String("M30"),
ReplicationSpecs: mongodbatlas.ClusterReplicationSpecArray{
&mongodbatlas.ClusterReplicationSpecArgs{
ZoneName: pulumi.String("Zone 1"),
NumShards: pulumi.Int(1),
RegionsConfigs: mongodbatlas.ClusterReplicationSpecRegionsConfigArray{
&mongodbatlas.ClusterReplicationSpecRegionsConfigArgs{
RegionName: pulumi.String("EU_CENTRAL_1"),
ElectableNodes: pulumi.Int(3),
Priority: pulumi.Int(7),
ReadOnlyNodes: pulumi.Int(0),
},
},
},
&mongodbatlas.ClusterReplicationSpecArgs{
ZoneName: pulumi.String("Zone 2"),
NumShards: pulumi.Int(1),
RegionsConfigs: mongodbatlas.ClusterReplicationSpecRegionsConfigArray{
&mongodbatlas.ClusterReplicationSpecRegionsConfigArgs{
RegionName: pulumi.String("US_EAST_2"),
ElectableNodes: pulumi.Int(3),
Priority: pulumi.Int(7),
ReadOnlyNodes: pulumi.Int(0),
},
},
},
},
})
if err != nil {
return err
}
_, err = mongodbatlas.NewGlobalClusterConfig(ctx, "config", &mongodbatlas.GlobalClusterConfigArgs{
ProjectId: test.ProjectId,
ClusterName: test.Name,
ManagedNamespaces: mongodbatlas.GlobalClusterConfigManagedNamespaceArray{
&mongodbatlas.GlobalClusterConfigManagedNamespaceArgs{
Db: pulumi.String("mydata"),
Collection: pulumi.String("publishers"),
CustomShardKey: pulumi.String("city"),
},
},
CustomZoneMappings: mongodbatlas.GlobalClusterConfigCustomZoneMappingArray{
&mongodbatlas.GlobalClusterConfigCustomZoneMappingArgs{
Location: pulumi.String("CA"),
Zone: pulumi.String("Zone 1"),
},
},
})
if err != nil {
return err
}
return nil
})
}
Example Global cluster config
import * as pulumi from "@pulumi/pulumi";
import * as mongodbatlas from "@pulumi/mongodbatlas";
const cluster_test = new mongodbatlas.Cluster("cluster-test", {
projectId: "<YOUR-PROJECT-ID>",
numShards: 1,
replicationFactor: 3,
backupEnabled: true,
autoScalingDiskGbEnabled: true,
mongoDbMajorVersion: "4.0",
providerName: "AWS",
diskSizeGb: 100,
providerDiskIops: 300,
providerEncryptEbsVolume: false,
providerInstanceSizeName: "M40",
providerRegionName: "US_EAST_1",
});
const config = new mongodbatlas.GlobalClusterConfig("config", {
projectId: mongodbatlas_cluster.test.project_id,
clusterName: mongodbatlas_cluster.test.name,
managedNamespaces: [{
db: "mydata",
collection: "publishers",
customShardKey: "city",
}],
customZoneMappings: [{
location: "CA",
zone: "Zone 1",
}],
});
import pulumi
import pulumi_mongodbatlas as mongodbatlas
cluster_test = mongodbatlas.Cluster("cluster-test",
project_id="<YOUR-PROJECT-ID>",
num_shards=1,
replication_factor=3,
backup_enabled=True,
auto_scaling_disk_gb_enabled=True,
mongo_db_major_version="4.0",
provider_name="AWS",
disk_size_gb=100,
provider_disk_iops=300,
provider_encrypt_ebs_volume=False,
provider_instance_size_name="M40",
provider_region_name="US_EAST_1")
config = mongodbatlas.GlobalClusterConfig("config",
project_id=mongodbatlas_cluster["test"]["project_id"],
cluster_name=mongodbatlas_cluster["test"]["name"],
managed_namespaces=[mongodbatlas.GlobalClusterConfigManagedNamespaceArgs(
db="mydata",
collection="publishers",
custom_shard_key="city",
)],
custom_zone_mappings=[mongodbatlas.GlobalClusterConfigCustomZoneMappingArgs(
location="CA",
zone="Zone 1",
)])
using Pulumi;
using Mongodbatlas = Pulumi.Mongodbatlas;
class MyStack : Stack
{
public MyStack()
{
var cluster_test = new Mongodbatlas.Cluster("cluster-test", new Mongodbatlas.ClusterArgs
{
ProjectId = "<YOUR-PROJECT-ID>",
NumShards = 1,
ReplicationFactor = 3,
BackupEnabled = true,
AutoScalingDiskGbEnabled = true,
MongoDbMajorVersion = "4.0",
ProviderName = "AWS",
DiskSizeGb = 100,
ProviderDiskIops = 300,
ProviderEncryptEbsVolume = false,
ProviderInstanceSizeName = "M40",
ProviderRegionName = "US_EAST_1",
});
var config = new Mongodbatlas.GlobalClusterConfig("config", new Mongodbatlas.GlobalClusterConfigArgs
{
ProjectId = mongodbatlas_cluster.Test.Project_id,
ClusterName = mongodbatlas_cluster.Test.Name,
ManagedNamespaces =
{
new Mongodbatlas.Inputs.GlobalClusterConfigManagedNamespaceArgs
{
Db = "mydata",
Collection = "publishers",
CustomShardKey = "city",
},
},
CustomZoneMappings =
{
new Mongodbatlas.Inputs.GlobalClusterConfigCustomZoneMappingArgs
{
Location = "CA",
Zone = "Zone 1",
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-mongodbatlas/sdk/go/mongodbatlas"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := mongodbatlas.NewCluster(ctx, "cluster_test", &mongodbatlas.ClusterArgs{
ProjectId: pulumi.String("<YOUR-PROJECT-ID>"),
NumShards: pulumi.Int(1),
ReplicationFactor: pulumi.Int(3),
BackupEnabled: pulumi.Bool(true),
AutoScalingDiskGbEnabled: pulumi.Bool(true),
MongoDbMajorVersion: pulumi.String("4.0"),
ProviderName: pulumi.String("AWS"),
DiskSizeGb: pulumi.Float64(100),
ProviderDiskIops: pulumi.Int(300),
ProviderEncryptEbsVolume: pulumi.Bool(false),
ProviderInstanceSizeName: pulumi.String("M40"),
ProviderRegionName: pulumi.String("US_EAST_1"),
})
if err != nil {
return err
}
_, err = mongodbatlas.NewGlobalClusterConfig(ctx, "config", &mongodbatlas.GlobalClusterConfigArgs{
ProjectId: pulumi.Any(mongodbatlas_cluster.Test.Project_id),
ClusterName: pulumi.Any(mongodbatlas_cluster.Test.Name),
ManagedNamespaces: mongodbatlas.GlobalClusterConfigManagedNamespaceArray{
&mongodbatlas.GlobalClusterConfigManagedNamespaceArgs{
Db: pulumi.String("mydata"),
Collection: pulumi.String("publishers"),
CustomShardKey: pulumi.String("city"),
},
},
CustomZoneMappings: mongodbatlas.GlobalClusterConfigCustomZoneMappingArray{
&mongodbatlas.GlobalClusterConfigCustomZoneMappingArgs{
Location: pulumi.String("CA"),
Zone: pulumi.String("Zone 1"),
},
},
})
if err != nil {
return err
}
return nil
})
}
Create a GlobalClusterConfig Resource
new GlobalClusterConfig(name: string, args: GlobalClusterConfigArgs, opts?: CustomResourceOptions);
def GlobalClusterConfig(resource_name: str, opts: Optional[ResourceOptions] = None, cluster_name: Optional[str] = None, custom_zone_mappings: Optional[Sequence[GlobalClusterConfigCustomZoneMappingArgs]] = None, managed_namespaces: Optional[Sequence[GlobalClusterConfigManagedNamespaceArgs]] = None, project_id: Optional[str] = None)
func NewGlobalClusterConfig(ctx *Context, name string, args GlobalClusterConfigArgs, opts ...ResourceOption) (*GlobalClusterConfig, error)
public GlobalClusterConfig(string name, GlobalClusterConfigArgs args, CustomResourceOptions? opts = null)
- name string
- The unique name of the resource.
- args GlobalClusterConfigArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args GlobalClusterConfigArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args GlobalClusterConfigArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
GlobalClusterConfig Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The GlobalClusterConfig resource accepts the following input properties:
- Cluster
Name string - Project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- Custom
Zone List<GlobalMappings Cluster Config Custom Zone Mapping Args> Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- Managed
Namespaces List<GlobalCluster Config Managed Namespace Args> Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- Cluster
Name string - Project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- Custom
Zone []GlobalMappings Cluster Config Custom Zone Mapping Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- Managed
Namespaces []GlobalCluster Config Managed Namespace Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- cluster
Name string - project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- custom
Zone GlobalMappings Cluster Config Custom Zone Mapping[] Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- managed
Namespaces GlobalCluster Config Managed Namespace[] Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- cluster_
name str - project_
id str The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- custom_
zone_ Sequence[Globalmappings Cluster Config Custom Zone Mapping Args] Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- managed_
namespaces Sequence[GlobalCluster Config Managed Namespace Args] Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
Outputs
All input properties are implicitly available as output properties. Additionally, the GlobalClusterConfig resource produces the following output properties:
- Custom
Zone Dictionary<string, object>Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- Id string
- The provider-assigned unique ID for this managed resource.
- Custom
Zone map[string]interface{}Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- Id string
- The provider-assigned unique ID for this managed resource.
- custom
Zone {[key: string]: any}Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- id string
- The provider-assigned unique ID for this managed resource.
- custom_
zone_ Mapping[str, Any]mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- id str
- The provider-assigned unique ID for this managed resource.
Look up an Existing GlobalClusterConfig Resource
Get an existing GlobalClusterConfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: GlobalClusterConfigState, opts?: CustomResourceOptions): GlobalClusterConfig
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, cluster_name: Optional[str] = None, custom_zone_mapping: Optional[Mapping[str, Any]] = None, custom_zone_mappings: Optional[Sequence[GlobalClusterConfigCustomZoneMappingArgs]] = None, managed_namespaces: Optional[Sequence[GlobalClusterConfigManagedNamespaceArgs]] = None, project_id: Optional[str] = None) -> GlobalClusterConfig
func GetGlobalClusterConfig(ctx *Context, name string, id IDInput, state *GlobalClusterConfigState, opts ...ResourceOption) (*GlobalClusterConfig, error)
public static GlobalClusterConfig Get(string name, Input<string> id, GlobalClusterConfigState? state, CustomResourceOptions? opts = null)
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Cluster
Name string - Custom
Zone Dictionary<string, object>Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- Custom
Zone List<GlobalMappings Cluster Config Custom Zone Mapping Args> Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- Managed
Namespaces List<GlobalCluster Config Managed Namespace Args> Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- Project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- Cluster
Name string - Custom
Zone map[string]interface{}Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- Custom
Zone []GlobalMappings Cluster Config Custom Zone Mapping Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- Managed
Namespaces []GlobalCluster Config Managed Namespace Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- Project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- cluster
Name string - custom
Zone {[key: string]: any}Mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- custom
Zone GlobalMappings Cluster Config Custom Zone Mapping[] Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- managed
Namespaces GlobalCluster Config Managed Namespace[] Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- project
Id string The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
- cluster_
name str - custom_
zone_ Mapping[str, Any]mapping A map of all custom zone mappings defined for the Global Cluster. Atlas automatically maps each location code to the closest geographical zone. Custom zone mappings allow administrators to override these automatic mappings. If your Global Cluster does not have any custom zone mappings, this document is empty.
- custom_
zone_ Sequence[Globalmappings Cluster Config Custom Zone Mapping Args] Each element in the list maps one ISO location code to a zone in your Global Cluster. See Custom Zone Mapping below for more details.
- managed_
namespaces Sequence[GlobalCluster Config Managed Namespace Args] Add a managed namespaces to a Global Cluster. For more information about managed namespaces, see Global Clusters. See Managed Namespace below for more details.
- project_
id str The unique ID for the project to create the database user. * `cluster_name - (Required) The name of the Global Cluster.
Supporting Types
GlobalClusterConfigCustomZoneMapping
GlobalClusterConfigManagedNamespace
- Collection string
The name of the collection associated with the managed namespace.
- Custom
Shard stringKey The custom shard key for the collection. Global Clusters require a compound shard key consisting of a location field and a user-selected second key, the custom shard key.
- Db string
The name of the database containing the collection.
- Collection string
The name of the collection associated with the managed namespace.
- Custom
Shard stringKey The custom shard key for the collection. Global Clusters require a compound shard key consisting of a location field and a user-selected second key, the custom shard key.
- Db string
The name of the database containing the collection.
- collection string
The name of the collection associated with the managed namespace.
- custom
Shard stringKey The custom shard key for the collection. Global Clusters require a compound shard key consisting of a location field and a user-selected second key, the custom shard key.
- db string
The name of the database containing the collection.
- collection str
The name of the collection associated with the managed namespace.
- custom_
shard_ strkey The custom shard key for the collection. Global Clusters require a compound shard key consisting of a location field and a user-selected second key, the custom shard key.
- db str
The name of the database containing the collection.
Import
Database users can be imported using project ID and cluster name, in the format PROJECTID-CLUSTER_NAME
, e.g.
$ pulumi import mongodbatlas:index/globalClusterConfig:GlobalClusterConfig config 1112222b3bf99403840e8934-my-cluster
See detailed information for arguments and attributesMongoDB API Global Clusters
Package Details
- Repository
- https://github.com/pulumi/pulumi-mongodbatlas
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mongodbatlas
Terraform Provider.