Terraform v0.13 "Failed to instantiate provider" for every project

Hi @rymancl,

I think the trick here is that the automatic upgrade flow is making a (shaky) assumption that it’s typical for all workspaces of a particular configuration will tend to use the same providers, and so I think it’s trying to use the default workspace as a proxy for what legacy providers might be needed for all workspaces. That isn’t working in your case, though.

I think switching workspaces before init would fail because it can’t access the backend to see which workspaces are available, but we might be able to “cheat” by using the environment variable override for workspace, which takes priority over what terraform workspace select chooses:

set TF_WORKSPACE=preprod
terraform init

(From the output you shared it seems like you’re using Windows, so I’ve used Windows-command-prompt-style environment variable setting above, but the general idea is to set the TF_WORKSPACE environment variable, whichever way you do it.)

I must admit that I’m proposing this without being certain that terraform init is actually equipped to respect that environment variable, since the environment variable is usually used primarily with terraform plan and terraform apply, but if it does work then that might give you a path to get the automatic upgrade working using a workspace other than default as the “model” for which legacy providers are needed.