Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision data center infrastructure using a declarative configuration language.
Terraform Anti-Patterns Overview
Hardcoding Sensitive Values
Not Using Modules
Not Using Remote State
Not Using State Locking
Not Using Workspaces for Environment Separation
Not Using Data Sources for External Resources
Not Using Count or For_each for Resource Collections
count
or for_each
to create multiple instances of a resource dynamically.Not Using Version Constraints
Not Using Resource Targeting Carefully
Not Using Output Values
Not Using Terraform Fmt
terraform fmt
to automatically format your code according to the standard style.Not Using Terraform Validate
terraform validate
to check for syntax errors and other issues before running terraform plan
or terraform apply
.Not Using Proper Resource Naming
Not Using Proper Error Handling
count
or for_each
to handle potential errors.