Yes, the command as shown looks correct, but obviously Terraform is not able to parse the -var-file argument for some reason. If you run the command with TF_LOG=trace it will show the exact cli arguments as seen by terraform, and may highlight whatever the problem is.
Sorry, TF_LOG here is an environment variable, not a command line argument. Set TF_LOG=trace in the environment before running the command, and the trace logs will be output showing how terraform is parsing the arguments.
On one of the early lines of the logs we can see how the shell (Powershell in your case) presented the individual arguments to Terraform. In there I can see that for some reason PowerShell is treating .tfvars as a separate argument rather than as part of the argument containing the -var-file option.
Unfortunately PowerShell has various bugs like this when running traditional CLI commands, because it’s primarily designed for running its own “cmdlets” and so has to make some assumptions and guesses about your intent when you are running a command that isn’t integrated with PowerShell.
I would suggest running Terraform in the traditional windows Command Prompt (cmd.exe) instead, because it typically does not corrupt the command line or require unusual quoting and escaping when running external programs.
These new error messages do at least confirm that the Windows command interpreter is correctly passing the full and correct filenames test.tfvars and prod.tfvars to Terraform, and it’s Terraform itself which can’t find the files.
I’m not sure if I’m reading all of the paths in your screenshot directly, but it looks like you’re running Terraform from the root of your VSCode workspace, but that these two variable files are in a subdirectory called “Vars (Variable Files)”. If that’s true, I think these errors are correct because the files are not in the current working directory where you are running Terraform. If you move those two .tfvars files up to the workspace root, or if you switch into the subdirectory first before running terraform plan ..., do you get a better result?