Resource: aws_docdb_cluster_instance

Provides an DocumentDB Cluster Resource Instance. A Cluster Instance Resource defines attributes that are specific to a single instance in a DocumentDB Cluster.

You do not designate a primary and subsequent replicas. Instead, you simply add DocumentDB Instances and DocumentDB manages the replication. You can use the count meta-parameter to make multiple instances and join them all to the same DocumentDB Cluster, or you may specify different Cluster Instance resources with various instance_class sizes.

Example Usage

resource "aws_docdb_cluster_instance" "cluster_instances" {
  count              = 2
  identifier         = "docdb-cluster-demo-${count.index}"
  cluster_identifier = aws_docdb_cluster.default.id
  instance_class     = "db.r5.large"
}

resource "aws_docdb_cluster" "default" {
  cluster_identifier = "docdb-cluster-demo"
  availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
  master_username    = "foo"
  master_password    = "barbut8chars"
}

Argument Reference

For more detailed documentation about each argument, refer to the AWS official documentation.

This argument supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import DocumentDB Cluster Instances using the identifier. For example:

import {
  to = aws_docdb_cluster_instance.prod_instance_1
  id = "aurora-cluster-instance-1"
}

Using terraform import, import DocumentDB Cluster Instances using the identifier. For example:

% terraform import aws_docdb_cluster_instance.prod_instance_1 aurora-cluster-instance-1