In the realm of Amazon Web Services there’s this thing called a Landing Zone, a set of infrastructure as code modules built to deploy new environments faster. You can build a Landing Zone using CloudFormation, CDK, Terraform, or any other tool you like. The point is that you have a starting point for as many use-cases as possible. For a Landing Zone to work you have to write reusable generalized code that could work for any client and any combination of infrastructure.
While trying to create a Landing Zone in Terraform I found that it’s very hard to make them follow the DRY principle (Don’t Repeat Yourself). After a while the code started to be really hard to maintain. But then I found Dynamic blocks.