A copied or backup .tf file is still in the directory
CommonA file duplicated in the editor or file manager, such as main copy.tf or main-old.tf, still ends in .tf, so Terraform loads it.
Confirm
ls -la *.tf *.tf.json 2>/dev/null
A copy or backup of another file in the list; the error names both locations
Fix
- Check which of the two files holds the version you want to keep (the error names both). Then delete the other, or rename it so it no longer ends in .tf (main.tf.bak is ignored).
- Better, keep old versions in Git rather than in the directory.