A platform team must guarantee that every S3 bucket created by application teams has default encryption, versioning and a public access block. Application teams should decide only the bucket name and the log retention period. What should the platform team provide?
Choose one.
A module enforces standards by keeping opinionated settings inside and exposing only the choices that belong to the caller.
Encapsulating organisational standards is a core reason to write a module: the module's interface is its inputs, so anything not exposed as an input cannot be changed by callers. Exposing every argument with secure defaults looks flexible but lets callers override the controls, and shared tfvars or locals rely on every team wiring them correctly.
- List what must be guaranteed and what callers may choose.
- Check whether each option lets a caller override a guaranteed control.
- Prefer the option whose inputs are only the caller-owned decisions.
Exam tip: What a module does not expose as an input, its callers cannot change.
Terraform Professional (002): Refactoring into Modules and the Module Contract — the lesson that teaches this.