From 5284343f77dbe030ed946d5d2ff11e126b761465 Mon Sep 17 00:00:00 2001 From: christian-calabrese Date: Thu, 2 May 2024 15:29:19 +0200 Subject: [PATCH 1/2] fix: function app slot failing migration when app_service_plan_id not set --- .../services/appservice/migration/linux_function_app_slot.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/services/appservice/migration/linux_function_app_slot.go b/internal/services/appservice/migration/linux_function_app_slot.go index d26019e371a5..5e9e001ae5cd 100644 --- a/internal/services/appservice/migration/linux_function_app_slot.go +++ b/internal/services/appservice/migration/linux_function_app_slot.go @@ -1575,9 +1575,8 @@ func (l LinuxFunctionAppSlotV0toV1) Schema() map[string]*pluginsdk.Schema { func (l LinuxFunctionAppSlotV0toV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - oldId := rawState["service_plan_id"].(string) - // service_plan_id can be empty if it is not in a different Service Plan to the "parent" app - if oldId == "" { + oldId, ok := rawState["service_plan_id"].(string) + if !ok || oldId == "" { return rawState, nil } parsedId, err := commonids.ParseAppServicePlanIDInsensitively(oldId) From 76e0ce89910803eddc413e4a4870efb6fd827a84 Mon Sep 17 00:00:00 2001 From: christian-calabrese Date: Wed, 8 May 2024 09:07:30 +0200 Subject: [PATCH 2/2] doc: reinserted original comment --- .../services/appservice/migration/linux_function_app_slot.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/appservice/migration/linux_function_app_slot.go b/internal/services/appservice/migration/linux_function_app_slot.go index 5e9e001ae5cd..a7c6107e9d93 100644 --- a/internal/services/appservice/migration/linux_function_app_slot.go +++ b/internal/services/appservice/migration/linux_function_app_slot.go @@ -1576,6 +1576,7 @@ func (l LinuxFunctionAppSlotV0toV1) Schema() map[string]*pluginsdk.Schema { func (l LinuxFunctionAppSlotV0toV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { oldId, ok := rawState["service_plan_id"].(string) + // service_plan_id can be empty if it is not in a different Service Plan to the "parent" app if !ok || oldId == "" { return rawState, nil }