Skip to content

Commit

Permalink
Preserve custom policy when changing name or description of a service…
Browse files Browse the repository at this point in the history
… account (#597)
  • Loading branch information
ribetm authored Nov 12, 2024
1 parent 5fa48b3 commit d613d26
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit d613d26

Please sign in to comment.