Terraform modules package related resources behind a reusable interface. Variables make inputs explicit and validated; outputs expose values such as a load balancer hostname to a root module or another stack.
Keep modules focused on one responsibility and document their inputs and outputs. Use sensitive variable and output markings for values that should not appear casually in plans or logs, while remembering that state still needs encryption and access control.