Skip to content

Commit

Permalink
Bug Fix: azurerm_app_service_plan - workaround for missing error on…
Browse files Browse the repository at this point in the history
… 404 #3990
  • Loading branch information
mbfrahry authored Aug 1, 2019
1 parent c3e5b2d commit eadab9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azurerm/resource_arm_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ func resourceArmAppServicePlanRead(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error making Read request on App Service Plan %q (Resource Group %q): %+v", name, resourceGroup, err)
}

// A 404 doesn't error from the app service plan sdk so we'll add this check here to catch resource not found responses
// TODO This block can be removed if https://github.com/Azure/azure-sdk-for-go/issues/5407 gets addressed.
if utils.ResponseWasNotFound(resp.Response) {
log.Printf("[DEBUG] App Service Plan %q was not found in Resource Group %q - removnig from state!", name, resourceGroup)
d.SetId("")
return nil
}

d.Set("name", name)
d.Set("resource_group_name", resourceGroup)
if location := resp.Location; location != nil {
Expand Down

0 comments on commit eadab9b

Please sign in to comment.