Presentation

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

  1. Version lock - for Terraform versions, modules, and providers

  2. Tagging resources

  3. Remote state usage

  4. Use verified community modules where possible

Second Nature

  1. Use env vars and tfvars when necessary, de-hardcode one-time names, keep things generic

  2. File structure - Read: Refactor Monolithic Terraform Configuration

  3. Applying classic code best practices - Read: The Pragmatic Programmer

Long Haul

  1. Structuring your TF code base (workplace usage) - Read: Module Creation - Recommended Pattern

  2. Terraform execution - Read: Running Terraform in Automation

  3. Practices enforcement - Read: Policy as Code

More resources like this one