Terraform

You have a Git repository with Terraform files but no .gitignore. What would you add to a .gitignore file in Terraform repository?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

**/.terraform/*
*.tfstate
*.tfstate.*
*.tfvars
*.tfvars.json

You don't want to store state file nor any downloaded providers in .terraform directory. It also doesn't makes sense to share/store the state backup files.