Modules (Bicep) or nested deployments (ARM JSON) is a popular mechanism for code reuse. A nested template is represented as a resource defined inside its parent template, containing the full "child template" to execute.
This embedding works well, but creates the following challenge:
- Any changes in size to a child template also increase the size of parent templates. This creates challenges around storage limits and increases memory usage unneccessarily.
- Because child templates are embedded as JSON, line number or positional information is lost when being deployed.
- There is often duplication (e.g. if a child module is referenced multiple times).
- The above problems grow exponentially with the depth of the nested structure.