diff --git a/ibm/service/power/resource_ibm_pi_capture.go b/ibm/service/power/resource_ibm_pi_capture.go index 107a432da9a..b91d1974907 100644 --- a/ibm/service/power/resource_ibm_pi_capture.go +++ b/ibm/service/power/resource_ibm_pi_capture.go @@ -198,11 +198,13 @@ func resourceIBMPICaptureCreate(ctx context.Context, d *schema.ResourceData, met if err != nil { log.Printf("Error on get of ibm pi capture (%s) while applying pi_user_tags: %s", capturename, err) } - if imagedata.Crn != "" { - oldList, newList := d.GetChange(Arg_UserTags) - err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, string(imagedata.Crn), "", UserTagType) - if err != nil { - log.Printf("Error on update of pi capture (%s) pi_user_tags during creation: %s", *imagedata.ImageID, err) + if imagedata != nil { + if imagedata.Crn != "" { + oldList, newList := d.GetChange(Arg_UserTags) + err = flex.UpdateGlobalTagsUsingCRN(oldList, newList, meta, string(imagedata.Crn), "", UserTagType) + if err != nil { + log.Printf("Error on update of pi capture (%s) pi_user_tags during creation: %s", *imagedata.ImageID, err) + } } } }