It sounds like you have an older copy of the
local provider already installed in your
.terraform directory, and so Terraform is trying to use it in preference to downloading a newer version.
There are a couple different ways you can proceed here:
- If you just want a one-off local solution, you could try just deleting the
.terraform directory and running
terraform init to get Terraform to re-install all of the dependencies. That should either get you into a working state or give you a message explaining why that’s not possible (e.g. if the
local provider is constrained to only versions that are not Terraform 0.12-compatible.)
- Alternatively, you could add an explicit version constraint to the configuration to indicate that only the versions that are v0.12-compatible are acceptable, and then run
terraform init and Terraform should see that your existing installed version is not compatible and upgrade it.
To add the version constraint, either find an existing Terraform block or create a new one and put the
required_providers block inside it:
local = "~> 1.2.0"
An advantage of an explicit version constraint is that it should also fix things for anyone else who is in the same situation as you, of having an existing
.terraform directory containing plugin versions that are no longer appropriate. If you’d like to do it for the AWS provider too then a suitable version constraint could be
"~> 2.7.0", where 2.7.0 is the release that introduced Terraform 0.12 compatibility.