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

Fix #3529 Enhance service_id error message #3536

Merged
merged 1 commit into from
Feb 4, 2022
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
9 changes: 5 additions & 4 deletions ibm/service/iamidentity/resource_ibm_iam_service_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package iamidentity

import (
"context"
"fmt"
"log"

"github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns"
Expand Down Expand Up @@ -92,7 +93,7 @@ func resourceIBMIAMServiceIDCreate(context context.Context, d *schema.ResourceDa
serviceID, resp, err := iamIdentityClient.CreateServiceID(&createServiceIDOptions)
if err != nil || serviceID == nil {
log.Printf("Error creating serviceID: %s, %s", err, resp)
return diag.FromErr(err)
return diag.FromErr(fmt.Errorf("[ERROR] Error creating serviceID: %s %s", err, resp))
}
d.SetId(*serviceID.ID)

Expand All @@ -115,7 +116,7 @@ func resourceIBMIAMServiceIDRead(context context.Context, d *schema.ResourceData
return nil
}
log.Printf("Error retrieving serviceID: %s %s", err, resp)
return diag.FromErr(err)
return diag.FromErr(fmt.Errorf("[ERROR] Error retrieving serviceID: %s %s", err, resp))
}
if serviceID.Name != nil {
d.Set("name", *serviceID.Name)
Expand Down Expand Up @@ -169,7 +170,7 @@ func resourceIBMIAMServiceIDUpdate(context context.Context, d *schema.ResourceDa
_, resp, err := iamIdentityClient.UpdateServiceID(&updateServiceIDOptions)
if err != nil {
log.Printf("Error updating serviceID: %s, %s", err, resp)
return diag.FromErr(err)
return diag.FromErr(fmt.Errorf("[ERROR] Error updating serviceID: %s %s", err, resp))
}
}

Expand All @@ -190,7 +191,7 @@ func resourceIBMIAMServiceIDDelete(context context.Context, d *schema.ResourceDa
resp, err := iamIdentityClient.DeleteServiceID(&deleteServiceIDOptions)
if err != nil {
log.Printf("Error deleting serviceID: %s %s", err, resp)
return diag.FromErr(err)
return diag.FromErr(fmt.Errorf("[ERROR] Error deleting serviceID: %s %s", err, resp))
}

d.SetId("")
Expand Down