From 84111450596c733c651dfad10452b925d2c280d1 Mon Sep 17 00:00:00 2001 From: Ian Moroney Date: Fri, 5 Apr 2019 23:26:50 +0100 Subject: [PATCH 1/4] Update resource_arm_app_service_slot.go Enhancing error handling for app service slot app settings --- azurerm/resource_arm_app_service_slot.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 803400bd56de..0ad248824eb8 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -352,6 +352,11 @@ func resourceArmAppServiceSlotRead(d *schema.ResourceData, meta interface{}) 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) } From 21b6d0522d9be428f7edc8b5b190c0e7142730c6 Mon Sep 17 00:00:00 2001 From: Ian Moroney Date: Fri, 5 Apr 2019 23:34:01 +0100 Subject: [PATCH 2/4] Update resource_arm_app_service.go Enhancing error handling for app service app settings --- azurerm/resource_arm_app_service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 9ce16fa39632..2bbd9eeb1364 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -430,6 +430,11 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { 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) } From d7bb9996b42e78e69aac175ad231b3a4d024fd15 Mon Sep 17 00:00:00 2001 From: Ian Moroney Date: Fri, 5 Apr 2019 23:42:34 +0100 Subject: [PATCH 3/4] Update resource_arm_app_service.go Enhancing error handling for app service configuration --- azurerm/resource_arm_app_service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 2bbd9eeb1364..7f9839ce9746 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -425,6 +425,11 @@ 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) } From e203268d9be84fc1fee88a6fda104c229ae976b8 Mon Sep 17 00:00:00 2001 From: Ian Moroney Date: Fri, 5 Apr 2019 23:43:52 +0100 Subject: [PATCH 4/4] Update resource_arm_app_service_slot.go Enhancing error handling for app service configuration --- azurerm/resource_arm_app_service_slot.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azurerm/resource_arm_app_service_slot.go b/azurerm/resource_arm_app_service_slot.go index 0ad248824eb8..829b0a55daad 100644 --- a/azurerm/resource_arm_app_service_slot.go +++ b/azurerm/resource_arm_app_service_slot.go @@ -347,6 +347,11 @@ 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) }