Junior — Middle
Can GitLab or GitHub be used for storing project state files?
sobes.tech AI
Answer from AI
GitLab and GitHub can be used to store project state files, but this is not always optimal. State files (e.g., Terraform state) often contain sensitive data and require locking to prevent conflicts during concurrent access.
Git does not support file-level locking, so conflicts and state corruption can occur when working collaboratively with such files.
It is better to use specialized backends for storing state files, such as:
- Terraform Remote Backend (S3, Azure Blob Storage, Google Cloud Storage)
- HashiCorp Consul
- Terraform Cloud
If using GitLab or GitHub, it is recommended to implement additional measures, such as encrypting state files and strict merge processes, but this complicates the workflow.