After creating main.tf
and executing terraform apply
The following files are created:
Should I add these files to Git?
You should add .terraform
to your .gitignore
file and never commit it.
terraform.tfstate
, on the other hand, is something you'd want to preserve. The best way to do this is to use a remote backend, such as S3. Committing this to source control is a bad practice, but would still work and is definitely better than losing the state file.