Skip to content

Commit

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

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

* add nil-check on props
  • Loading branch information
ms-henglu authored Jul 21, 2021
1 parent 4df66f0 commit 50a29fb
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 50a29fb

Please sign in to comment.