liveBook · Manning

Facade pattern

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

A structural infrastructure design pattern in which a module exposes selected resource attributes as an abstraction for dependent modules.

The facade pattern exposes selected resource attributes through module outputs, giving dependent modules a simplified abstraction instead of direct access to the low-level resource. section 4.3

Storage bucket and access control

A storage-bucket module outputs the bucket name or object. An access-control module consumes that facade to configure permissions. Adding location later can extend the facade without changing the access module. section 4.3

Choose the facade when:

  • One low-level module serves a few high-level modules. section 4.6
  • You want low implementation and troubleshooting effort while accepting weaker scalability and change isolation. section 4.6
  • You need to evolve modules through dependency injection while preserving idempotency and composability. section 4.6
Figure 4.8 The facade simplifies attributes to the name of the storage bucket for use by the access control module.

Shows how the facade reduces a storage bucket's attributes to the name required by an access-control module. section 4.3

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Defines the abstraction, demonstrates outputs in code, and compares implementation, troubleshooting, scalability, and isolation trade-offs.
Examples
Uses a GCP storage bucket facade consumed by access-control rules and illustrated with a bucket-name abstraction.
What you can do after
Apply it via module outputs to isolate dependent resources from low-level metadata changes.
How it connects
Connects dependency injection with dependency inversion, inversion of control, adapter pattern, and mediator pattern.

Also explained in

Compare how 3 books explain facade pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.