Turning the pile of bucket, Pub/Sub, Cloud Run, and BigQuery resources from earlier chapters into one reusable ingest-pipeline module — and reaching for Google's Cloud Foundation Toolkit for the project, network, and storage scaffolding around it.
7 topics
A module is the unit of reuse in Terraform, and it is a smaller idea than it sounds: any directory of .tf files is a module, so you have been writing them since your first configuration. What this chapter adds is the discipline of treating a directory as a black box — inputs in, outputs out, internals private — so the six interdependent resources of the Hatch ingest pipeline become one thing you call once per event type instead of copy-paste you maintain in ten places.
The running example is Layer A, the Hatch pipeline. You will package its bucket, Pub/Sub topic, Cloud Run service, BigQuery dataset, and service account into a single ingest-pipeline module, then consume Google's Cloud Foundation Toolkit modules for the undifferentiated plumbing around it — the project, the VPC, the storage scaffolding. The seven topics move from what a module is, through inputs, sourcing, versioning, and composition, to the design principles that separate a module other teams adopt from one they fork in frustration.