diff --git a/README.md b/README.md
index 19f9a85..6c70ce6 100644
--- a/README.md
+++ b/README.md
@@ -214,6 +214,7 @@ Available targets:
| [arn](#output\_arn) | Amazon Resource Name (ARN) of the cluster |
| [cluster\_name](#output\_cluster\_name) | Cluster Identifier |
| [endpoint](#output\_endpoint) | Endpoint of the DocumentDB cluster |
+| [instance\_name](#output\_instance\_name) | Cluster Instance Identifier |
| [master\_host](#output\_master\_host) | DB master hostname |
| [master\_password](#output\_master\_password) | Password for the master DB user |
| [master\_username](#output\_master\_username) | Username for the master DB user |
diff --git a/docs/terraform.md b/docs/terraform.md
index 060e9dd..080dc3b 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -106,6 +106,7 @@
| [arn](#output\_arn) | Amazon Resource Name (ARN) of the cluster |
| [cluster\_name](#output\_cluster\_name) | Cluster Identifier |
| [endpoint](#output\_endpoint) | Endpoint of the DocumentDB cluster |
+| [instance\_name](#output\_instance\_name) | Cluster Instance Identifier |
| [master\_host](#output\_master\_host) | DB master hostname |
| [master\_password](#output\_master\_password) | Password for the master DB user |
| [master\_username](#output\_master\_username) | Username for the master DB user |
diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf
index 384b37a..065b8f2 100644
--- a/examples/complete/outputs.tf
+++ b/examples/complete/outputs.tf
@@ -23,6 +23,11 @@ output "cluster_name" {
description = "DocumentDB Cluster Identifier"
}
+output "instance_name" {
+ value = module.documentdb_cluster.instance_name
+ description = "DocumentDB Cluster Instance Identifier"
+}
+
output "arn" {
value = module.documentdb_cluster.arn
description = "Amazon Resource Name (ARN) of the DocumentDB cluster"
diff --git a/outputs.tf b/outputs.tf
index 832ef27..9270cbe 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -14,6 +14,11 @@ output "cluster_name" {
description = "Cluster Identifier"
}
+output "instance_name" {
+ value = toset(aws_docdb_cluster_instance.default[*].identifier)
+ description = "Cluster Instance Identifier"
+}
+
output "arn" {
value = join("", aws_docdb_cluster.default[*].arn)
description = "Amazon Resource Name (ARN) of the cluster"
diff --git a/test/src/examples_complete_test.go b/test/src/examples_complete_test.go
index d899ffc..3c8ad27 100644
--- a/test/src/examples_complete_test.go
+++ b/test/src/examples_complete_test.go
@@ -70,6 +70,11 @@ func TestExamplesComplete(t *testing.T) {
// Verify we're getting back the outputs we expect
assert.Equal(t, "eg-test-documentdb-cluster-"+randId, clusterName)
+ // Run `terraform output` to get the value of an output variable
+ instanceName := terraform.Output(t, terraformOptions, "instance_name")
+ // Verify we're getting back the outputs we expect
+ assert.Equal(t, "eg-test-documentdb-cluster-"+randID, instanceName)
+
// Run `terraform output` to get the value of an output variable
endpoint := terraform.Output(t, terraformOptions, "endpoint")
// Verify we're getting back the outputs we expect