Skip to content

Commit

Permalink
add import test step
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Oct 10, 2024
1 parent 536a53c commit 3fba942
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vault/resource_database_secret_backend_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ func TestAccDatabaseSecretBackendConnection_postgresql(t *testing.T) {
}

func TestAccDatabaseSecretBackendConnection_postgresql_tls(t *testing.T) {
testResource := "vault_database_secret_backend_connection.test"
resourceName := "vault_database_secret_backend_connection.test"
backend := acctest.RandomWithPrefix("tf-test-db")
pluginName := dbEnginePostgres.DefaultPluginName()
name := acctest.RandomWithPrefix("db")
Expand All @@ -852,11 +852,13 @@ func TestAccDatabaseSecretBackendConnection_postgresql_tls(t *testing.T) {
{
Config: testAccDatabaseSecretBackendConnectionConfig_postgresql_tls(name, backend, testPostgresCACert, testPostgresClientCert, testPostgresClientKey),
Check: testComposeCheckFuncCommonDatabaseSecretBackend(name, backend, pluginName,
resource.TestCheckResourceAttr(testResource, "postgresql.0.tls_ca", testPostgresCACert),
resource.TestCheckResourceAttr(testResource, "postgresql.0.tls_certificate", testPostgresClientCert),
resource.TestCheckResourceAttr(testResource, "postgresql.0.private_key", testPostgresClientKey),
resource.TestCheckResourceAttr(resourceName, "postgresql.0.tls_ca", testPostgresCACert),
resource.TestCheckResourceAttr(resourceName, "postgresql.0.tls_certificate", testPostgresClientCert),
resource.TestCheckResourceAttr(resourceName, "postgresql.0.private_key", testPostgresClientKey),
),
},
// the private key is a secret that is never revealed by Vault
testutil.GetImportTestStep(resourceName, false, nil, "postgresql.0.private_key"),
},
})
}
Expand Down Expand Up @@ -1757,7 +1759,6 @@ resource "vault_database_secret_backend_connection" "test" {
postgresql {
connection_url = "postgresql://{{username}}:{{password}}@localhost:5432/postgres?sslmode=verify-full"
username = "user1"
password = "pass1"
tls_ca = %q
tls_certificate = %q
Expand Down

0 comments on commit 3fba942

Please sign in to comment.