Expecting error could not load plugin instead of below error

I have run terraform init and have deleted .terraform and another .terraform. Lock file
and then I was expecting could not load plugin error but it is showing different error. Please suggest.

Please see below screenshot

The message tells you to run terraform init. Do that.

Hi @sk8228402,

If you’ve deleted the .terraform directory then you have effectively “un-initialized” this working directory.

Therefore you will need to run terraform init first to re-initialize this working directory, and then you can use the other commands such as terraform plan which require an initialized working directory.

I think you implied you also deleted the .terraform.lock.hcl file, in which case this is the error message I would expect: you’ve removed Terraform’s record about which version is selected for each provider, and so Terraform does not know which version of hashicorp/azurerm to use. terraform init will also reconstruct the .terraform.lock.hcl file, which should therefore also fix this error.

1 Like

Thank you apparentlymart