Skip to content

Commit

Permalink
data.azurerm_security_group - fixing crash where id is nil #6910
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfrahry committed May 13, 2020
1 parent 04b5466 commit 55e8dc1
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -148,9 +148,12 @@ func dataSourceArmNetworkSecurityGroupRead(d *schema.ResourceData, meta interfac
if utils.ResponseWasNotFound(resp.Response) {
return fmt.Errorf("Error: Network Security Group %q (Resource Group %q) was not found", name, resourceGroup)
}
return fmt.Errorf("Error making Read request on Network Security Group %q (Resource Group %q): %+v", name, resourceGroup, err)
return fmt.Errorf("making Read request on Network Security Group %q (Resource Group %q): %+v", name, resourceGroup, err)
}

if resp.ID == nil || *resp.ID == "" {
return fmt.Errorf("reading request on Network Security Group %q (Resource Group %q): %+v", name, resourceGroup, err)
}
d.SetId(*resp.ID)

d.Set("name", resp.Name)
Expand Down

0 comments on commit 55e8dc1

Please sign in to comment.