From d82e5add3686e25ce91d5d9177ba41e440000815 Mon Sep 17 00:00:00 2001 From: DexterPOSH Date: Thu, 18 Oct 2018 18:52:55 +0530 Subject: [PATCH 1/2] Adds logic to return nil if none appsettings --- azurerm/resource_arm_function_app.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azurerm/resource_arm_function_app.go b/azurerm/resource_arm_function_app.go index 071ae1084297..fe810343d654 100644 --- a/azurerm/resource_arm_function_app.go +++ b/azurerm/resource_arm_function_app.go @@ -402,6 +402,10 @@ func resourceArmFunctionAppRead(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 Function App %q (resource group %q) were not found", name, resGroup) + return nil + } return fmt.Errorf("Error making Read request on AzureRM Function App AppSettings %q: %+v", name, err) } From fae611192d74d86c569a26fcff65e209c34ab9ff Mon Sep 17 00:00:00 2001 From: DexterPOSH Date: Sat, 20 Oct 2018 10:32:27 +0530 Subject: [PATCH 2/2] Clears the id --- azurerm/resource_arm_function_app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/azurerm/resource_arm_function_app.go b/azurerm/resource_arm_function_app.go index fe810343d654..4525f3668e44 100644 --- a/azurerm/resource_arm_function_app.go +++ b/azurerm/resource_arm_function_app.go @@ -404,6 +404,7 @@ func resourceArmFunctionAppRead(d *schema.ResourceData, meta interface{}) error if err != nil { if utils.ResponseWasNotFound(appSettingsResp.Response) { log.Printf("[DEBUG] Application Settings of Function App %q (resource group %q) were not found", name, resGroup) + d.SetId("") return nil } return fmt.Errorf("Error making Read request on AzureRM Function App AppSettings %q: %+v", name, err)