This one caught me out whilst importing an already existing Azure App Service plan into Terraform state.
ID was missing the serverfarms elementTerraform
It wasn’t until I actually read through the error shown below that I realised the answer was staring me in the face! The azure_service_plan import command published in the Terraform documentation uses an upper case F in serverFarms, meaning that the serverfarms element isn’t actually included.
So just change
C:\development\terraform\prog [main ≡]> terraform import azurerm_service_plan.asp-hub-prog-dev-uks /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/rg-hub-prog-dev-uks/providers/Microsoft.Web/serverFarms/asp-hub-prog-dev-uks
Error: parsing Resource ID "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/rg-hub-prog-dev-uks/providers/Microsoft.Web/serverFarms/asp-hub-prog-dev-uks": ID was missing the `serverfarms` element