From 1950a13c5a2962a4ef5981d71c1866d0d567c1b1 Mon Sep 17 00:00:00 2001 From: hezijie Date: Tue, 26 Mar 2024 13:39:54 +0800 Subject: [PATCH] add type assert check to avoid panic --- internal/services/appservice/migration/linux_web_app_slot.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/appservice/migration/linux_web_app_slot.go b/internal/services/appservice/migration/linux_web_app_slot.go index a928e8ba18b3..3fad96efd4bf 100644 --- a/internal/services/appservice/migration/linux_web_app_slot.go +++ b/internal/services/appservice/migration/linux_web_app_slot.go @@ -1739,8 +1739,8 @@ func (l LinuxWebAppSlotV0toV1) Schema() map[string]*pluginsdk.Schema { func (l LinuxWebAppSlotV0toV1) UpgradeFunc() pluginsdk.StateUpgraderFunc { return func(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { - oldId := rawState["service_plan_id"].(string) - if oldId == "" { + oldId, ok := rawState["service_plan_id"].(string) + if !ok || oldId == "" { return rawState, nil } parsedId, err := commonids.ParseAppServicePlanIDInsensitively(oldId)