Skip to content

Add instance_name to outputs to return a list of cluster instance identifiers #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Available targets:
| <a name="output_arn"></a> [arn](#output\_arn) | Amazon Resource Name (ARN) of the cluster |
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Cluster Identifier |
| <a name="output_endpoint"></a> [endpoint](#output\_endpoint) | Endpoint of the DocumentDB cluster |
| <a name="output_instance_name"></a> [instance\_name](#output\_instance\_name) | Cluster Instance Identifier |
| <a name="output_master_host"></a> [master\_host](#output\_master\_host) | DB master hostname |
| <a name="output_master_password"></a> [master\_password](#output\_master\_password) | Password for the master DB user |
| <a name="output_master_username"></a> [master\_username](#output\_master\_username) | Username for the master DB user |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
| <a name="output_arn"></a> [arn](#output\_arn) | Amazon Resource Name (ARN) of the cluster |
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Cluster Identifier |
| <a name="output_endpoint"></a> [endpoint](#output\_endpoint) | Endpoint of the DocumentDB cluster |
| <a name="output_instance_name"></a> [instance\_name](#output\_instance\_name) | Cluster Instance Identifier |
| <a name="output_master_host"></a> [master\_host](#output\_master\_host) | DB master hostname |
| <a name="output_master_password"></a> [master\_password](#output\_master\_password) | Password for the master DB user |
| <a name="output_master_username"></a> [master\_username](#output\_master\_username) | Username for the master DB user |
Expand Down
5 changes: 5 additions & 0 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down