Terraform upgrade to 0.15, getting "Invalid legacy provider address" for provider we don't use
Googling did turn up this thread, which led us to the answer.
Terraform has the notion of a "default" workspace, and if you run terraform init
without specifying a workspace, it will initialize based on this workspace. However, we don't use the default workspace; each of our root modules is in an explicit workspace.
Our build process used terraform workspace select ...
before plan
and apply
. But you can't select a workspace this way until you init
. And init
was using the default workspace (which I guess has an actual default config inside the Terraform binary, used for initializing completely new projects).
The solution is to use the TF_WORKSPACE
environment variable when running init
(we now use it everywhere):
TF_WORKSPACE=${WORKSPACE} terraform -chdir=${MODULE} init --upgrade