Skip to content

Commit

Permalink
Add service account values to read and import (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsier authored and felladrin committed Nov 4, 2023
1 parent ceec923 commit f83e303
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions minio/resource_minio_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ func minioReadServiceAccount(ctx context.Context, d *schema.ResourceData, meta i
return NewResourceError("reading service account failed", d.Id(), err)
}

_ = d.Set("disable_user", output.AccountStatus == "off")

if err := d.Set("target_user", output.ParentUser); err != nil {
return NewResourceError("reading service account failed", d.Id(), err)
}

_ = d.Set("policy", output.Policy)

return nil
Expand Down
13 changes: 13 additions & 0 deletions minio/resource_minio_service_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ func TestServiceAccount_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckMinioServiceAccountExists(resourceName, &serviceAccount),
testAccCheckMinioServiceAccountAttributes(resourceName, targetUser, status),
resource.TestCheckResourceAttr(resourceName, "target_user", targetUser),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"update_secret", "secret_key"},
},
},
})
}
Expand Down Expand Up @@ -130,6 +137,12 @@ func TestServiceAccount_Policy(t *testing.T) {
testAccCheckMinioServiceAccountExists(resourceName2, &serviceAccount),
),
},
{
ResourceName: resourceName2,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"update_secret", "secret_key"},
},
},
})
}
Expand Down

0 comments on commit f83e303

Please sign in to comment.