Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service account values to read and import #525

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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