Lightning Talk: Locals Only: Patterns and Anti-Patterns in OpenTofu Local Variables
summary
Locals are named values defined in locals blocks that reduce repetition but also create hidden complexity when misused; advice includes consolidating into a single locals.tf file to avoid runtime name collisions, avoiding inline string or loop logic by pulling transformations into locals, not implementing type safety or defaults via multiple competing variables, and never using excessively nested logic that requires refactoring to understand. Use locals inside modules to shrink the input surface and export locals via outputs for easy troubleshooting.
AI-written summary · about
related talks
28mHighly Illogical: Safely Leverage Logic in TF
11mLightning Talk: A Tale of Three Configs: On Best Practices with OpenTofu Structuring
11mLightning Talk: Staying in Sync: Managing Upgrades in OpenTofu and Terraform Modul...
26mManage Complexity with Terraform: Tips and Tricks from the Trenches
30mMeet the experts: Terraform module design
30mTaste Testing Tofu
10mLightning Talk: 800 Reasons To Love OpenTofu (We Counted Them All)
32mNavigating the OpenTofu Landscape From Basics to Mastery
