Why storing the state in versioned control repo is not a good idea?
Answer
Sensitive data: some resources may specify sensitive data (like passwords and tokens) and everything in a state file is stored in plain text.
Prone to errors: when working with Git repos, you mayo often find yourself switch branches, checkout specific commits, perform rebases, ... all these operations may end up in you eventually performing
terraform applyon non-latest version of your Terraform code. Keeping state outside Git eliminates that risk.Lack of locking and audit trails compared to managed backends.