alicloud_mongodb_sharding_instance

Provides a MongoDB Sharding Instance resource supports replica set instances only. the MongoDB provides stable, reliable, and automatic scalable database services. It offers a full range of database solutions, such as disaster recovery, backup, recovery, monitoring, and alarms. You can see detail product introduction here

Example Usage

Create a Mongodb Sharding instance

variable "name" {
  default = "terraform-example"
}

data "alicloud_mongodb_zones" "default" {
}

locals {
  index   = length(data.alicloud_mongodb_zones.default.zones) - 1
  zone_id = data.alicloud_mongodb_zones.default.zones[local.index].id
}

resource "alicloud_vpc" "default" {
  vpc_name   = var.name
  cidr_block = "172.17.3.0/24"
}

resource "alicloud_vswitch" "default" {
  vswitch_name = var.name
  cidr_block   = "172.17.3.0/24"
  vpc_id       = alicloud_vpc.default.id
  zone_id      = local.zone_id
}

resource "alicloud_mongodb_sharding_instance" "default" {
  engine_version = "4.2"
  vswitch_id     = alicloud_vswitch.default.id
  zone_id        = local.zone_id
  name           = var.name
  mongo_list {
    node_class = "dds.mongos.mid"
  }
  mongo_list {
    node_class = "dds.mongos.mid"
  }
  shard_list {
    node_class   = "dds.shard.mid"
    node_storage = "10"
  }
  shard_list {
    node_class        = "dds.shard.standard"
    node_storage      = "20"
    readonly_replicas = "1"
  }
}

Module Support

You can use to the existing mongodb-sharding module to create a MongoDB Sharding Instance resource one-click.

Argument Reference

The following arguments are supported:

mongo_list

The mongo_list supports the following:

shard_list

The shard_list supports the following:

config_server_list

The config_server_list supports the following:

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

MongoDB Sharding Instance can be imported using the id, e.g.

$ terraform import alicloud_mongodb_sharding_instance.example dds-bp1291daeda44195