Meet the experts: Terraform module design
summary
Practical rules for Terraform modules: favor default null for optional inputs, validate complex object variables and provide examples, place locals near the resources that use them, use count only for true conditionals and prefer for_each with keyed maps for clean outputs, avoid heavy for_each when creating hundreds of identical resources, output whole resource objects when helpful, test examples with terraform test or Terratest in a sandbox CI pipeline, enforce semver for breaking changes and generate docs with terraform-docs plus simple diagrams.
AI-written summary · about
chapters (10)
- 0:00Introductions and background
- 1:20Fundamentals of module design
- 3:11Input variables and nulls
- 6:13Managing local values
- 8:14Resource loops and iteration
- 13:00Designing module outputs
- 15:58Version control and updates
- 19:59Testing strategies
- 24:15Documentation best practices
- 27:14When not to write modules
related talks
46mTerraform best practices with examples and arguments
46mTerraform best practices with examples and arguments
35mTerraform Practices - The Good, the Bad and the Ugly
26mManage Complexity with Terraform: Tips and Tricks from the Trenches
25mThe 'Data, Transformations, and Resources' Pattern in Terraform
48mCodifying Infrastructure with Terraform for the Future
29mTerraform Practices - The Good, the Bad, and the Ugly
58mTerraform: Uncovering Best Practices for Building Modules
