Terraform

Why does it matter where you store the tfstate file? In your answer make sure to address the following:

Difficulty: unrated

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

Answer

  • tfstate contains credentials in plain text. You don't want to put it in publicly shared location.

  • tfstate shouldn't be modified concurrently so putting it in a shared location available for everyone with "write" permissions might lead to issues. (Terraform remote state doesn't has this problem).

  • tfstate is an important file. As such, it might be better to put it in a location that has regular backups and good security.

    As such, tfstate shouldn't be stored in git repositories. secured storage such as secured buckets, is a better option.