From b5794002f39d894330773d9057cb62d5874e7916 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 28 Dec 2023 23:07:22 +0530 Subject: [PATCH] added a nil check for boottarget of bms --- ibm/service/vpc/resource_ibm_is_bare_metal_server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index 8e419168b9..0d16c8493b 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -1361,9 +1361,11 @@ func bareMetalServerGet(context context.Context, d *schema.ResourceData, meta in } d.SetId(*bms.ID) d.Set(isBareMetalServerBandwidth, bms.Bandwidth) - bmsBootTargetIntf := bms.BootTarget.(*vpcv1.BareMetalServerBootTarget) - bmsBootTarget := bmsBootTargetIntf.ID - d.Set(isBareMetalServerBootTarget, bmsBootTarget) + if bms.BootTarget != nil { + bmsBootTargetIntf := bms.BootTarget.(*vpcv1.BareMetalServerBootTarget) + bmsBootTarget := bmsBootTargetIntf.ID + d.Set(isBareMetalServerBootTarget, bmsBootTarget) + } cpuList := make([]map[string]interface{}, 0) if bms.Cpu != nil { currentCPU := map[string]interface{}{}