Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Jan 17, 2025
1 parent d601371 commit 411572d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion vault/resource_database_secret_backend_static_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func databaseSecretBackendStaticRoleRead(ctx context.Context, d *schema.Resource
}
}

if provider.IsAPISupported(meta, provider.VaultVersion118) {
if provider.IsAPISupported(meta, provider.VaultVersion118) && provider.IsEnterpriseSupported(meta) {
if err := d.Set(consts.FieldSkipImportRotation, role.Data[consts.FieldSkipImportRotation]); err != nil {
return diag.FromErr(err)
}
Expand Down
24 changes: 7 additions & 17 deletions vault/resource_database_secret_backend_static_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ func TestAccDatabaseSecretBackendStaticRole_Rootless(t *testing.T) {
name := acctest.RandomWithPrefix("staticrole")
resourceName := "vault_database_secret_backend_static_role.test"

testRoleStaticCreate := `
CREATE ROLE "{{name}}" WITH
LOGIN
PASSWORD '{{password}}';
`

// create static database user
testutil.CreateTestPGUser(t, connURLTestRoot, username, "testpassword", testRoleStaticCreate)

Expand Down Expand Up @@ -206,8 +200,7 @@ CREATE ROLE "{{name}}" WITH
// TestAccDatabaseSecretBackendStaticRole_SkipImportRotation tests the skip
// auto import Rotation configuration.
// To run locally you will need to set the following env vars:
// - POSTGRES_URL_TEST
// - POSTGRES_URL_ROOTLESS
// - POSTGRES_URL
func TestAccDatabaseSecretBackendStaticRole_SkipImportRotation(t *testing.T) {
connURL := testutil.SkipTestEnvUnset(t, "POSTGRES_URL")[0]

Expand All @@ -217,12 +210,6 @@ func TestAccDatabaseSecretBackendStaticRole_SkipImportRotation(t *testing.T) {
name := acctest.RandomWithPrefix("staticrole")
resourceName := "vault_database_secret_backend_static_role.test"

testRoleStaticCreate := `
CREATE ROLE "{{name}}" WITH
LOGIN
PASSWORD '{{password}}';
`

// create static database user
testutil.CreateTestPGUser(t, connURL, username, "testpassword", testRoleStaticCreate)

Expand All @@ -238,10 +225,7 @@ CREATE ROLE "{{name}}" WITH
Config: testAccDatabaseSecretBackendStaticRoleConfig_skipImportRotation(name, username, dbName, backend, connURL, "testpassword"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "name", name),
resource.TestCheckResourceAttr(resourceName, "backend", backend),
resource.TestCheckResourceAttr(resourceName, "username", username),
resource.TestCheckResourceAttr(resourceName, "db_name", dbName),
resource.TestCheckResourceAttr(resourceName, "rotation_period", "3600"),
resource.TestCheckResourceAttr(resourceName, "skip_import_rotation", "true"),
),
},
Expand Down Expand Up @@ -474,3 +458,9 @@ resource "vault_database_secret_backend_static_role" "test" {
}
`, path, db, connURL, name, username, smPassword)
}

var testRoleStaticCreate = `
CREATE ROLE "{{name}}" WITH
LOGIN
PASSWORD '{{password}}';
`

0 comments on commit 411572d

Please sign in to comment.