The builder pattern assembles a configurable set of infrastructure resources. Inputs determine which components are created, while defaults provide a reusable starting configuration. section 3.5
Use it when one system needs meaningful combinations of related resources. A database module, for example, can create a private or public load balancer and add the corresponding server, network, and firewall configuration. section 3.5
A practical implementation separates resource customization from system composition:
- Create factory modules for individual resources such as database servers, load balancers, and firewall rules. section 3.5
- Initialize the builder with required values and default resources. section 3.5
- Expose operations that enable or disable resource groups, such as internal or external load balancing. section 3.5
- Choose the pattern by assessing reuse, update frequency, purpose, and whether multiple resources must be composed. section 3.6
Database module with selectable exposure
A DatabaseModule starts with a database server, then extends its resource collection with either an internal or external load balancer. The selected factory supplies the matching forwarding rule and configuration. section 3.5
Figure 3.9 A builder module for the database would include parameters to select the type of load balancer and firewall rules that the module must create.
Shows how builder parameters select the load balancer type and the firewall rules that must be created with it. section 3.5





