Opinionated Terraform Best Practices and Anti-Patterns
Get tips for making the most of Terraform when scaling your infrastructure as your organization grows.
» What You'll Learn
In this talk (video below), Hila Fish, an engineer at Wix, covers practices put together with blood, sweat, and tears to give you a paved path to make the most of your work with Terraform.
While learning what practices are most safe and efficient for your own company will take experimentation, this talk should help lead you down the right path by providing some broadly applicable advice and giving guidance on quick wins, practices that should become second nature, and patterns for scalability in the long haul:
» Quick Wins
Version lock - for Terraform versions, modules, and providers
Tagging resources
Remote state usage
Use verified community modules where possible
» Second Nature
Use
env vars
andtfvars
when necessary, de-hardcode one-time names, keep things genericFile structure - Read: Refactor Monolithic Terraform Configuration
Applying classic code best practices - Read: The Pragmatic Programmer
» Long Haul
Structuring your TF code base (workplace usage) - Read: Module Creation - Recommended Pattern
Terraform execution - Read: Running Terraform in Automation
Practices enforcement - Read: Policy as Code