Terraform: Difference between revisions

add Resources
Add best practices
 
Line 4: Line 4:


Although Terraform is the dominant leader in the space (citation needed), there has been some general community forming behind the [https://opentofu.org/ OpenTofu] project (open source fork of Terraform due to the licensing brouhaha - see 'Related') that is hosted by the Linux Foundation.
Although Terraform is the dominant leader in the space (citation needed), there has been some general community forming behind the [https://opentofu.org/ OpenTofu] project (open source fork of Terraform due to the licensing brouhaha - see 'Related') that is hosted by the Linux Foundation.
== Best Practices ==
# Manipulate state only through TF commands (don't edit the state file directly)
# Use shared remote storage (not local) for state files. E.g. Amazon S3 bucket. (If your backend storage offers file locking, automatic versioning and backup, then use those features.)
# Use file locking on state files to avoid contention issues.
# Backup state files to avoid data loss / aid recovery.
# Use separate state files for each environment.
# Put TF files into a repo (aka GitOps).
# Use CI for TF code. (Use git flow, pull requests, etc. to review and test code changes; control who can merge changes.)
# Use CD pipelines for (automated) deployment rather than manual tf apply.


== Resources ==
== Resources ==