What is Dynamic Blocks in Terraform: A Step-by-Step Guide
<p>The Dynamic Block in Terraform is one of the most useful options for making your code dynamic. Previously, we could use dynamic conditions like ‘for_each’ and ‘if’ conditions at the resource block level. However, with the dynamic block, we can also apply the same logic to resource sub-blocks or nested blocks, such as ‘Identity’ in an Azure SQL Server resource block.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*tQus39jpr58QvnaIHnmzSA.png" style="height:264px; width:700px" /></p>
<p>Example of Resource Block and Nested Block</p>
<p>The dynamic block is very useful in a couple of scenarios for creating error-free, dynamic code that can iterate based on the variable values you are passing, such as:</p>
<p><a href="https://medium.com/@amjad30nagori/what-is-dynamic-block-in-terraform-a-step-by-step-guide-b56b706edd47"><strong>Learn More</strong></a></p>