Securing credentials in the local repo in terraform file

I want to store credential as secret in the local repo it self , those credentials are there in the main.tf file

instead of using terraform.tfvars , because if I use terraform.tfvars there I can see credentials
is there any way to do in the local and while pushing to remote also I should able to proceed in same way.

Please suggest , thanks