Highly Illogical: Safely Leverage Logic in TF
summary
Claim: OpenTofu/Terraform’s functional-style expressions invite deeply nested, hard-to-debug logic, so put most complexity into locals with atomic values and enforce conventions (either centralized locals or limited inline rules) rather than scattering scripts. Uses: variable validation, outputs, TF_LOG and TF console for inspection, and occasional pre/post Python or Bash for things Terraform cannot do. Practice: emit intermediate outputs for debugging, avoid non‑deterministic interpolation during apply, and prefer clear, testable constructions over one‑line monstrosities.
AI-written summary · about
chapters (9)
- 0:00Welcome
- 1:02Logic in OpenTofu
- 4:16Functional programming in TF
- 8:32Pitfalls in TF logic
- 12:28Logic organization best practices
- 16:20Logic placement decisions
- 18:52Readability in TF code
- 20:38Debugging techniques
- 22:06Q&A on modules
related talks
10mLightning Talk: Locals Only: Patterns and Anti-Patterns in OpenTofu Local Variables
26mManage Complexity with Terraform: Tips and Tricks from the Trenches
30mTaste Testing Tofu
35mTerraform Practices - The Good, the Bad and the Ugly
14mLightning Talk: 5 Security Tips for Terraform
30mMeet the experts: Terraform module design
30mTerraform in Depth QA and Fireside Chat
05mWAT.tf
