Fixing a bug in VM Extension if the RG didn't exist (#11894)
This commit is contained in:
parent
e39f4e1993
commit
705e3541d0
|
@ -153,13 +153,14 @@ func resourceArmVirtualMachineExtensionsRead(d *schema.ResourceData, meta interf
|
||||||
name := id.Path["extensions"]
|
name := id.Path["extensions"]
|
||||||
|
|
||||||
resp, err := client.Get(resGroup, vmName, name, "")
|
resp, err := client.Get(resGroup, vmName, name, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Virtual Machine Extension %s: %s", name, err)
|
|
||||||
}
|
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return fmt.Errorf("Error making Read request on Virtual Machine Extension %s: %s", name, err)
|
||||||
|
}
|
||||||
|
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
d.Set("location", azureRMNormalizeLocation(*resp.Location))
|
d.Set("location", azureRMNormalizeLocation(*resp.Location))
|
||||||
|
|
Loading…
Reference in New Issue