Skip to content

Commit

Permalink
Remove redundant state updates
Browse files Browse the repository at this point in the history
These are all followed by a read call
  • Loading branch information
ribetm committed Nov 10, 2024
1 parent cf71cc8 commit b46acb1
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions minio/resource_minio_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func minioCreateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
d.SetId(aws.StringValue(&accessKey))
_ = d.Set("access_key", accessKey)
_ = d.Set("secret_key", secretKey)
d.Set("expiration", serviceAccount.Expiration.Format(time.RFC3339))

if serviceAccountConfig.MinioDisableUser {
err = serviceAccountConfig.MinioAdmin.UpdateServiceAccount(ctx, accessKey, madmin.UpdateServiceAccountReq{NewStatus: "off"})
Expand Down Expand Up @@ -200,8 +199,6 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
if err != nil {
return NewResourceError("error updating service account name %s: %s", d.Id(), err)
}

_ = d.Set("name", serviceAccountConfig.MinioName)
}

if d.HasChange("description") {
Expand All @@ -214,8 +211,6 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
if err != nil {
return NewResourceError("error updating service account description %s: %s", d.Id(), err)
}

_ = d.Set("description", serviceAccountConfig.MinioDescription)
}

if d.HasChange("expiration") {
Expand All @@ -229,15 +224,12 @@ func minioUpdateServiceAccount(ctx context.Context, d *schema.ResourceData, meta
if err != nil {
return NewResourceError("error updating service account expiration %s: %s", d.Id(), err)
}

_ = d.Set("expiration", serviceAccountConfig.MinioExpiration)
}

return minioReadServiceAccount(ctx, d, meta)
}

func minioReadServiceAccount(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {

serviceAccountConfig := ServiceAccountConfig(d, meta)

output, err := serviceAccountConfig.MinioAdmin.InfoServiceAccount(ctx, d.Id())
Expand Down

0 comments on commit b46acb1

Please sign in to comment.