Open 7timus opened 7 months ago
I'm experiencing the same issue, though I'm using Terraform v1.7.3 on windows_amd64
Looks like a problem in latest azurerm version. I tried multiple versions and azurem version = "3.86.0" doesn't have this issue.
We have a similar issue with a function app. here is our stack trace. (Using v 3.92.0)
panic: interface conversion: interface {} is nil, not string
goroutine 659 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/migration.(*WindowsFunctionAppSlotV0toV1).UpgradeFunc.WindowsFunctionAppSlotV0toV1.UpgradeFunc.func1({0x0?, 0x0?}, 0x0?, {0x0?, 0x0?})
github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/migration/windows_function_app_slot.go:1530 +0x13c
github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk.StateUpgrades.func1({0x9cd5dc0, 0xc005b26960}, 0x0?, {0x84d0460, 0xc001ce4900})
github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk/state_upgrades.go:55 +0x5e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).upgradeJSONState(0xc000b21b00, {0x9cd5dc0, 0xc005b26960}, 0xd?, 0x949d654?, 0x14?)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:485 +0x75
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).UpgradeResourceState(0xc000b21b00, {0x9cd5dc0?, 0xc005b26870?}, 0xc0023eec80)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:361 +0x3fa
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).UpgradeResourceState(0xc0008eb9a0, {0x9cd5dc0?, 0xc005a55ad0?}, 0xc0022ea5a0)
github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:757 +0x258
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_UpgradeResourceState_Handler({0x909dea0?, 0xc0008eb9a0}, {0x9cd5dc0, 0xc005a55ad0}, 0xc00234abd0, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:395 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000460000, {0x9cfcba0, 0xc001af0340}, 0xc002400ea0, 0xc001b16ea0, 0xf6c3ed8, 0x0)
google.golang.org/grpc@v1.58.3/server.go:1374 +0xde7
google.golang.org/grpc.(*Server).handleStream(0xc000460000, {0x9cfcba0, 0xc001af0340}, 0xc002400ea0, 0x0)
google.golang.org/grpc@v1.58.3/server.go:1751 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/grpc@v1.58.3/server.go:986 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 9
google.golang.org/grpc@v1.58.3/server.go:997 +0x145
looked at the sources and they are essentially the same code that is failing.
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
I also saw similar issue that was fixed with a null check so hopefully it will be a quick fix? :D Update: We have also tried adding the service_plan_id explicitly and still we get a failure in this line, so it might be a totally different issue?
Also experiencing this with AzureRM version 3.94.0 and terraform version 1.7.4
Stack trace from the terraform-provider-azurerm_v3.94.0_x5.exe plugin:
panic: interface conversion: interface {} is nil, not string
goroutine 1989 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/migration.(*WindowsWebAppSlotV0toV1).UpgradeFunc.WindowsWebAppSlotV0toV1.UpgradeFunc.func1({0x0?, 0x0?}, 0x0?, {0x0?, 0x0?})
github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/migration/windows_web_app_slot.go:1806 +0x13c
github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk.StateUpgrades.func1({0x94d1ee0, 0xc003feac90}, 0x0?, {0x7ca8ca0, 0xc001d2a900})
github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk/state_upgrades.go:55 +0x5e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).upgradeJSONState(0xc000b3b110, {0x94d1ee0, 0xc003feac90}, 0xd?, 0x8c9c37f?, 0x14?)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:485 +0x75
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).UpgradeResourceState(0xc000b3b110, {0x94d1ee0?, 0xc003feab70?}, 0xc002e77540)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.29.0/helper/schema/grpc_provider.go:361 +0x3fa
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).UpgradeResourceState(0xc000f603c0, {0x94d1ee0?, 0xc003fea3c0?}, 0xc002ed2a50)
github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/tf5server/server.go:757 +0x258
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_UpgradeResourceState_Handler({0x889aee0?, 0xc000f603c0}, {0x94d1ee0, 0xc003fea3c0}, 0xc00292d340, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:395 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002b01e0, {0x94f9060, 0xc001ad0000}, 0xc002f2c7e0, 0xc001a1dcb0, 0xeec8ed8, 0x0)
google.golang.org/grpc@v1.58.3/server.go:1374 +0xde7
google.golang.org/grpc.(*Server).handleStream(0xc0002b01e0, {0x94f9060, 0xc001ad0000}, 0xc002f2c7e0, 0x0)
google.golang.org/grpc@v1.58.3/server.go:1751 +0x9e7
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/grpc@v1.58.3/server.go:986 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 23
google.golang.org/grpc@v1.58.3/server.go:997 +0x145
Error: The terraform-provider-azurerm_v3.94.0_x5.exe plugin crashed!
Downgrading to v3.86.0 as per @7timus recommendation allowed plan to complete without issue. Once terraform applied with v3.86.0 I then upgraded back to v3.94.0 and plan/apply worked. Assume issue is with some migration of property not being handled correctly in 3.87-3.94, but if you apply the interim 3.86.0 it has the missing piece.
This looks to be the same slot migration problem that was fixed for the linux resource here - https://github.com/hashicorp/terraform-provider-azurerm/pull/25838
I guess the same fix is needed on the windows side of the provider?
Is there an existing issue for this?
Community Note
Terraform Version
Terraform v1.6.6 on windows_amd64
AzureRM Provider Version
3.91.0
Affected Resource(s)/Data Source(s)
azurerm_windows_web_app_slot
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Terraform plan output in tfplan file
Actual Behaviour
Terraform azurerm plugin crashed
Steps to Reproduce
terraform plan
Important Factoids
No response
References
No response