Skip to content

Commit 27d15b4

Browse files
feat: added new output member_hostnames which will list hostnames for all MongoDB replica set members if applicable (#617)
1 parent 4790cff commit 27d15b4

File tree

7 files changed

+27
-0
lines changed

7 files changed

+27
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ You need the following permissions to run this module.
124124
| <a name="output_guid"></a> [guid](#output\_guid) | MongoDB instance guid |
125125
| <a name="output_hostname"></a> [hostname](#output\_hostname) | Database connection hostname |
126126
| <a name="output_id"></a> [id](#output\_id) | MongoDB instance ID |
127+
| <a name="output_member_hostnames"></a> [member\_hostnames](#output\_member\_hostnames) | List of hostnames for all MongoDB replica set members |
127128
| <a name="output_port"></a> [port](#output\_port) | Database connection port |
128129
| <a name="output_service_credentials_json"></a> [service\_credentials\_json](#output\_service\_credentials\_json) | Service credentials json map |
129130
| <a name="output_service_credentials_object"></a> [service\_credentials\_object](#output\_service\_credentials\_object) | Service credentials object |

examples/basic/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ output "hostname" {
2626
value = module.database.hostname
2727
}
2828

29+
output "member_hostnames" {
30+
description = "List of hostnames for all MongoDB replica set members"
31+
value = module.database.member_hostnames
32+
}
33+
2934
output "port" {
3035
description = "Database connection port"
3136
value = module.database.port

examples/complete/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ output "hostname" {
3939
value = module.icd_mongodb.hostname
4040
}
4141

42+
output "member_hostnames" {
43+
description = "List of hostnames for all MongoDB replica set members"
44+
value = module.icd_mongodb.member_hostnames
45+
}
46+
4247
output "port" {
4348
description = "MongoDB instance port"
4449
value = module.icd_mongodb.port

examples/fscloud/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ output "hostname" {
2121
value = module.mongodb.hostname
2222
}
2323

24+
output "member_hostnames" {
25+
description = "List of hostnames for all MongoDB replica set members"
26+
value = module.mongodb.member_hostnames
27+
}
28+
2429
output "port" {
2530
description = "Database port. Only contains value when var.service_credential_names or var.users are set."
2631
value = module.mongodb.port

modules/fscloud/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ No resources.
6868
| <a name="output_guid"></a> [guid](#output\_guid) | MongoDB instance guid |
6969
| <a name="output_hostname"></a> [hostname](#output\_hostname) | Database connection hostname |
7070
| <a name="output_id"></a> [id](#output\_id) | MongoDB instance id |
71+
| <a name="output_member_hostnames"></a> [member\_hostnames](#output\_member\_hostnames) | List of hostnames for all MongoDB replica set members |
7172
| <a name="output_port"></a> [port](#output\_port) | Database connection port |
7273
| <a name="output_service_credentials_json"></a> [service\_credentials\_json](#output\_service\_credentials\_json) | Service credentials json map |
7374
| <a name="output_service_credentials_object"></a> [service\_credentials\_object](#output\_service\_credentials\_object) | Service credentials object |

modules/fscloud/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ output "hostname" {
4949
value = module.mongodb.hostname
5050
}
5151

52+
output "member_hostnames" {
53+
description = "List of hostnames for all MongoDB replica set members"
54+
value = module.mongodb.member_hostnames
55+
}
56+
5257
output "port" {
5358
description = "Database connection port"
5459
value = module.mongodb.port

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ output "hostname" {
4949
value = data.ibm_database_connection.database_connection.mongodb[0].hosts[0].hostname
5050
}
5151

52+
output "member_hostnames" {
53+
description = "List of hostnames for all MongoDB replica set members"
54+
value = [for host in data.ibm_database_connection.database_connection.mongodb[0].hosts : host.hostname]
55+
}
56+
5257
output "port" {
5358
description = "Database connection port"
5459
value = data.ibm_database_connection.database_connection.mongodb[0].hosts[0].port

0 commit comments

Comments
 (0)