Skip to content

Commit

Permalink
Update resource_ibm_is_bare_metal_server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ibm committed Dec 20, 2023
1 parent 8a0d5c8 commit 8da93a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ibm/service/vpc/resource_ibm_is_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou
if err != nil {
return diag.FromErr(err)
}
options := &vpcv1.CreateBareMetalServerOptions{}
createbmsoptions := &vpcv1.CreateBareMetalServerOptions{}
options := &vpcv1.BareMetalServerPrototype{}
var imageStr string
if image, ok := d.GetOk(isBareMetalServerImage); ok {
imageStr = image.(string)
Expand All @@ -705,7 +706,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou
// enable secure boot

if _, ok := d.GetOkExists(isBareMetalServerEnableSecureBoot); ok {
options.SetEnableSecureBoot(d.Get(isBareMetalServerEnableSecureBoot).(bool))
options.EnableSecureBoot = core.BoolPtr(d.Get(isBareMetalServerEnableSecureBoot).(bool))
}

// trusted_platform_module
Expand All @@ -715,7 +716,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou
if err != nil {
return diag.FromErr(err)
}
options.SetTrustedPlatformModule(trustedPlatformModuleModel)
options.TrustedPlatformModule = trustedPlatformModuleModel
}

keySet := d.Get(isBareMetalServerKeys).(*schema.Set)
Expand Down Expand Up @@ -1300,8 +1301,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou
ID: &vpc,
}
}

bms, response, err := sess.CreateBareMetalServerWithContext(context, options)
createbmsoptions.BareMetalServerPrototype = options
bms, response, err := sess.CreateBareMetalServerWithContext(context, createbmsoptions)
if err != nil {
return diag.FromErr(fmt.Errorf("[DEBUG] Create bare metal server err %s\n%s", err, response))
}
Expand Down

0 comments on commit 8da93a4

Please sign in to comment.