Skip to content

Commit

Permalink
fix crash when create compute cluster without specifying subnetId (ha…
Browse files Browse the repository at this point in the history
…shicorp#12658)

* fix crash when create machine learning compute cluster without specifying subnetId

* add nil-check on props
  • Loading branch information
ms-henglu authored and yupwei68 committed Jul 26, 2021
1 parent 870b7f3 commit a6d6e81
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,14 @@ func resourceComputeClusterRead(d *pluginsdk.ResourceData, meta interface{}) err
return fmt.Errorf("compute resource %s is not an Aml Compute cluster", id.ComputeName)
}

d.Set("vm_size", computeCluster.Properties.VMSize)
d.Set("vm_priority", computeCluster.Properties.VMPriority)
d.Set("scale_settings", flattenScaleSettings(computeCluster.Properties.ScaleSettings))
d.Set("subnet_resource_id", computeCluster.Properties.Subnet.ID)
if props := computeCluster.Properties; props != nil {
d.Set("vm_size", props.VMSize)
d.Set("vm_priority", props.VMPriority)
d.Set("scale_settings", flattenScaleSettings(props.ScaleSettings))
if props.Subnet != nil {
d.Set("subnet_resource_id", props.Subnet.ID)
}
}

if location := computeResource.Location; location != nil {
d.Set("location", azure.NormalizeLocation(*location))
Expand Down

0 comments on commit a6d6e81

Please sign in to comment.