Should a module output whole resources or individual attributes?
IntermediateConceptModules
Answer
Individual attributes are a stable contract: consumers depend only on what you chose to expose. Outputting an entire resource object leaks all its attributes (including sensitive ones) and makes internal refactors breaking changes. Use whole objects only for deliberate "bundle" outputs such as { id, arn, name }.
More on Modules
What is a Terraform module and why use one?BeginnerHow do you call a module?BeginnerHow do inputs and outputs work with modules?BeginnerWhich module source types exist and where does `version` apply?IntermediateHow should you version and pin modules?IntermediateCan you use `count` and `for_each` on modules?Intermediate