File tree Expand file tree Collapse file tree 3 files changed +9
-20
lines changed
Expand file tree Collapse file tree 3 files changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -214,9 +214,3 @@ data "ibm_database_connection" "database_connection" {
214214 user_id = var. users [0 ]. name
215215 user_type = var. users [0 ]. type
216216}
217-
218- locals {
219- # Used for output only
220- hostname = length (var. service_credential_names ) > 0 ? ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.hostname" ] : length (var. users ) > 0 ? flatten (data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. hostname ) : null
221- port = length (var. service_credential_names ) > 0 ? ibm_resource_key. service_credentials [keys (var. service_credential_names )[0 ]]. credentials [" connection.postgres.hosts.0.port" ] : length (var. users ) > 0 ? flatten (data. ibm_database_connection . database_connection [0 ]. postgres [0 ]. hosts [0 ]. port ) : null
222- }
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 = nonsensitive (local . hostname )
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
4545}
4646
4747output "port" {
4848 description = " Database port. Only contains value when var.service_credential_names or var.users are set."
49- value = nonsensitive (local . port )
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
5050}
Original file line number Diff line number Diff line change @@ -71,17 +71,6 @@ func TestRunUpgradeCompleteExample(t *testing.T) {
7171 _ , err := rand .Read (randomBytes )
7272 randomPass := base64 .URLEncoding .EncodeToString (randomBytes )[:10 ]
7373
74- // User Object
75- type User struct {
76- Name string
77- Password string
78- Type string
79- }
80-
81- users := []User {
82- {Name : "testuser" , Password : randomPass , Type : "database" }, // pragma: allowlist secret
83- }
84-
8574 options := testhelper .TestOptionsDefaultWithVars (& testhelper.TestOptions {
8675 Testing : t ,
8776 TerraformDir : "examples/complete" ,
@@ -90,7 +79,13 @@ func TestRunUpgradeCompleteExample(t *testing.T) {
9079 ResourceGroup : resourceGroup ,
9180 TerraformVars : map [string ]interface {}{
9281 "pg_version" : "11" , // Always lock to the lowest supported Postgres version
93- "users" : users ,
82+ "users" : []map [string ]interface {}{
83+ {
84+ "name" : "testuser" ,
85+ "password" : randomPass , // pragma: allowlist secret
86+ "type" : "database" ,
87+ },
88+ },
9489 "admin_pass" : randomPass ,
9590 },
9691 })
You can’t perform that action at this time.
0 commit comments