From 769b22c353eb389c24888a905f3db6d1a52e9cc2 Mon Sep 17 00:00:00 2001 From: hkavya26 Date: Thu, 3 Feb 2022 09:40:19 +0530 Subject: [PATCH] Fix #3529 Enhance service_id error message --- ibm/service/iamidentity/resource_ibm_iam_service_id.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ibm/service/iamidentity/resource_ibm_iam_service_id.go b/ibm/service/iamidentity/resource_ibm_iam_service_id.go index 9e4e4aa3ff..c269a677e0 100644 --- a/ibm/service/iamidentity/resource_ibm_iam_service_id.go +++ b/ibm/service/iamidentity/resource_ibm_iam_service_id.go @@ -5,6 +5,7 @@ package iamidentity import ( "context" + "fmt" "log" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" @@ -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) @@ -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) @@ -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)) } } @@ -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("")