Day 10 - Terraform Dynamic Blocks, Conditional Expressions, and Splat Expressions
There is a moment in learning Terraform where it stops feeling like writing static code, and starts feeling like shaping logic. Day 10 was that moment for me. Until now, I was defining resources directly. Today, I learned how to make Terraform think, repeat intelligently, and extract data cleanly . The three pillars of today’s learning: Conditional Expressions Dynamic Blocks Splat Expressions What I Built To understand these concepts, I created a simple but meaningful setup: S3 buckets with environment-based logic A security group with multiple ingress rules Outputs that collect values dynamically Nothing too fancy. But powerful enough to understand how real-world Terraform becomes scalable. Conditional Expressions What It Means Conditional expressions allow Terraform to choose values based on conditions. Simple idea: If something is true → use one value If not → use another Example I Used bucket_count = var.environment == "prod" ? 2 : 1 This means:...