This repository was archived by the owner on Jun 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,13 @@ output "version" {
1515 description = " Enterprise DB instance version"
1616 value = module. enterprise_db . version
1717}
18+
19+ output "hostname" {
20+ description = " Database hostname. Only contains value when var.service_credential_names or var.users are set."
21+ value = module. enterprise_db . hostname
22+ }
23+
24+ output "port" {
25+ description = " Database port. Only contains value when var.service_credential_names or var.users are set."
26+ value = module. enterprise_db . port
27+ }
Original file line number Diff line number Diff line change @@ -41,10 +41,10 @@ output "cbr_rule_ids" {
4141
4242output "hostname" {
4343 description = " Database hostname. Only contains value when var.service_credential_names or var.users are set."
44- value = length (var. service_credential_names ) > 0 ? nonsensitive (ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.hostname" ]) : length (var. users ) > 0 ? nonsensitive ( flatten ( data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. hostname )) : null
44+ value = length (var. service_credential_names ) > 0 ? nonsensitive (ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.hostname" ]) : length (var. users ) > 0 ? data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. hostname : null
4545}
4646
4747output "port" {
4848 description = " Database port. Only contains value when var.service_credential_names or var.users are set."
49- value = length (var. service_credential_names ) > 0 ? nonsensitive (ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.port" ]) : length (var. users ) > 0 ? nonsensitive ( flatten ( data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. port )) : null
49+ value = length (var. service_credential_names ) > 0 ? nonsensitive (ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.port" ]) : length (var. users ) > 0 ? data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. port : null
5050}
Original file line number Diff line number Diff line change 88 "os"
99 "testing"
1010
11+ "github.com/gruntwork-io/terratest/modules/terraform"
1112 "github.com/stretchr/testify/assert"
1213 "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common"
1314 "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
@@ -59,9 +60,17 @@ func TestRunFSCloudExample(t *testing.T) {
5960 },
6061 })
6162
63+ options .SkipTestTearDown = true
6264 output , err := options .RunTestConsistency ()
6365 assert .Nil (t , err , "This should not have errored" )
6466 assert .NotNil (t , output , "Expected some output" )
67+
68+ // check for outputs
69+ outputs := terraform .OutputAll (options .Testing , options .TerraformOptions )
70+ expectedOutputs := []string {"port" , "hostname" }
71+ _ , outputErr := testhelper .ValidateTerraformOutputs (outputs , expectedOutputs ... )
72+ assert .NoErrorf (t , outputErr , "Some outputs not found or nil" )
73+ options .TestTearDown ()
6574}
6675
6776func TestRunUpgradeCompleteExample (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments