diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 9ce16fa39632..7f9839ce9746 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -425,11 +425,21 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { configResp, err := client.GetConfiguration(ctx, resGroup, name) if err != nil { + if utils.ResponseWasNotFound(configResp.Response) { + log.Printf("[DEBUG] Configuration of App Service %q (resource group %q) was not found", name, resGroup) + d.SetId("") + return nil + } return fmt.Errorf("Error making Read request on AzureRM App Service Configuration %q: %+v", name, err) } appSettingsResp, err := client.ListApplicationSettings(ctx, resGroup, name) if err != nil { + if utils.ResponseWasNotFound(appSettingsResp.Response) { + log.Printf("[DEBUG] Application Settings of App Service %q (resource group %q) were not found", name, resGroup) + d.SetId("") + return nil + } return fmt.Errorf("Error making Read request on AzureRM App Service AppSettings %q: %+v", name, err) } diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 803400bd56de..829b0a55daad 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -347,11 +347,21 @@ func resourceArmAppServiceSlotRead(d *schema.ResourceData, meta interface{}) err configResp, err := client.GetConfigurationSlot(ctx, resGroup, appServiceName, slot) if err != nil { + if utils.ResponseWasNotFound(configResp.Response) { + log.Printf("[DEBUG] Configuration of App Service Slot %q/%q (resource group %q) was not found", appServiceName, slot, resGroup) + d.SetId("") + return nil + } return fmt.Errorf("Error making Read request on AzureRM App Service Slot Configuration %q/%q: %+v", appServiceName, slot, err) } appSettingsResp, err := client.ListApplicationSettingsSlot(ctx, resGroup, appServiceName, slot) if err != nil { + if utils.ResponseWasNotFound(appSettingsResp.Response) { + log.Printf("[DEBUG] Application Settings of App Service Slot %q/%q (resource group %q) were not found", appServiceName, slot, resGroup) + d.SetId("") + return nil + } return fmt.Errorf("Error making Read request on AzureRM App Service Slot AppSettings %q/%q: %+v", appServiceName, slot, err) }