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

Preserve custom policy when changing name or description of a service account #597

Merged
merged 1 commit into from
Nov 12, 2024
Merged
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
5 changes: 4 additions & 1 deletion minio/resource_minio_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
return NewResourceError("Minio does not support removing service account names", d.Id(), serviceAccountConfig.MinioName)
}
err := serviceAccountConfig.MinioAdmin.UpdateServiceAccount(ctx, d.Id(), madmin.UpdateServiceAccountReq{
NewName: serviceAccountConfig.MinioName,
NewName: serviceAccountConfig.MinioName,
NewPolicy: processServiceAccountPolicy(policy),
})
if err != nil {
return NewResourceError("error updating service account name %s: %s", d.Id(), err)
Expand All @@ -207,6 +208,7 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
}
err := serviceAccountConfig.MinioAdmin.UpdateServiceAccount(ctx, d.Id(), madmin.UpdateServiceAccountReq{
NewDescription: serviceAccountConfig.MinioDescription,
NewPolicy: processServiceAccountPolicy(policy),
})
if err != nil {
return NewResourceError("error updating service account description %s: %s", d.Id(), err)
Expand All @@ -220,6 +222,7 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
}
err = serviceAccountConfig.MinioAdmin.UpdateServiceAccount(ctx, d.Id(), madmin.UpdateServiceAccountReq{
NewExpiration: &expiration,
NewPolicy: processServiceAccountPolicy(policy),
})
if err != nil {
return NewResourceError("error updating service account expiration %s: %s", d.Id(), err)
Expand Down
Loading