Skip to content

Commit

Permalink
Address review#1
Browse files Browse the repository at this point in the history
  • Loading branch information
gro1m committed May 12, 2021
1 parent cbb8010 commit 6e90374
Showing 1 changed file with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ func resourceComputeClusterCreate(d *schema.ResourceData, meta interface{}) erro
name := d.Get("name").(string)

// Get Machine Learning Workspace Name and Resource Group from ID
unparsedWorkspaceID := d.Get("machine_learning_workspace_id").(string)

workspaceID, err := parse.WorkspaceID(unparsedWorkspaceID)
workspaceID, err := parse.WorkspaceID(d.Get("machine_learning_workspace_id").(string))
if err != nil {
return err
}
Expand All @@ -162,8 +160,7 @@ func resourceComputeClusterCreate(d *schema.ResourceData, meta interface{}) erro
vmSize := d.Get("vm_size").(string)
vmPriority := d.Get("vm_priority").(string)

inputScaleSettings := d.Get("scale_settings").([]interface{})
scaleSettings := expandScaleSettings(inputScaleSettings)
scaleSettings := expandScaleSettings(d.Get("scale_settings").([]interface{}))

subnetResourceId := d.Get("subnet_resource_id").(string)

Expand Down Expand Up @@ -248,21 +245,9 @@ func resourceComputeClusterCreate(d *schema.ResourceData, meta interface{}) erro
return fmt.Errorf("error waiting for creation of Compute Cluster %q in workspace %q (Resource Group %q): %+v",
name, workspaceID.Name, workspaceID.ResourceGroup, err)
}
resp, err := mlComputeClient.Get(ctx, workspaceID.ResourceGroup, workspaceID.Name, name)
if err != nil {
return fmt.Errorf("error retrieving Compute Cluster Compute %q in workspace %q (Resource Group %q): %+v",
name, workspaceID.Name, workspaceID.ResourceGroup, err)
}

if resp.ID == nil {
return fmt.Errorf("cannot read Compute Cluster ID %q in workspace %q (Resource Group %q) ID",
name, workspaceID.Name, workspaceID.ResourceGroup)
}

id, err := parse.ComputeClusterID(*resp.ID)
if err != nil {
return err
}
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
id := parse.NewComputeClusterID(subscriptionId, workspaceID.ResourceGroup, workspaceID.Name, name)
d.SetId(id.ID())

return resourceComputeClusterRead(d, meta)
Expand Down

0 comments on commit 6e90374

Please sign in to comment.