Skip to content

Commit

Permalink
Merge pull request #1900 from terraform-providers/azurestack-subnet
Browse files Browse the repository at this point in the history
subnet data source: small fix to error handling
  • Loading branch information
katbyte authored Sep 8, 2018
2 parents e97bebd + bd4c07a commit cac833a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions azurerm/data_source_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,13 @@ func dataSourceArmSubnetRead(d *schema.ResourceData, meta interface{}) error {
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.Get(ctx, resourceGroup, virtualNetworkName, name, "")
if err != nil {
return fmt.Errorf("Error reading Subnet: %+v", err)
}

d.SetId(*resp.ID)

if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
return fmt.Errorf("Error: Subnet %q (Virtual Network %q / Resource Group %q) was not found", name, resourceGroup, virtualNetworkName)
}
return fmt.Errorf("Error making Read request on Azure Subnet %q: %+v", name, err)
}
d.SetId(*resp.ID)

d.Set("name", name)
d.Set("resource_group_name", resourceGroup)
Expand Down

0 comments on commit cac833a

Please sign in to comment.