Terraform doesn't detect any provider requirements

Hi @apparentlymart I have same issue and terraform provider shows no provider


Although the provider is stated in the main.tf file
image

Please how do I solve this issue

Hi @kellynthy,

In order for Terraform to detect that requirement the main.tf file you showed must be in the directory C:\Users\Fujitsu\Desktop\Projects\Azure Terraform, since that is where terraform init would look for it, and where terraform providers looks for it.

Can you confirm that main.tf is in the same directory where you are running terraform providers? For example, you should be able to run a command at that same prompt to show the contents of the file, such as with the following PowerShell command:

PS C:\Users\Fujitsu\Desktop\Projects\Azure Terraform> Get-Content -Path .\main.tf

Yes. the main.tf file is in the same directory I am running terraform init and terraform providers

@kellynthy,

That output shows the main.tf file as possibly being empty (0kb). Are you certain you have saved the changes to the correct location?

I just saved it again and the init worked… I had Auto saved on vscode turned on and it was off this time… Thank you