Menu

Terraform Modules: Composition Over Abstraction
📰
0

Terraform Modules: Composition Over Abstraction

DEV Community·Bartłomiej Danek·about 1 month ago
#VRsoOXAf
Reading 0:00
15s threshold

Terraform Modules: Composition Over Abstraction Terraform makes it easy to build large, highly abstracted modules that try to solve everything in one place. At first glance, this feels efficient: fewer modules, fewer calls, less wiring. In practice, that approach often creates more problems than it solves. A better pattern-especially as infrastructure grows-is to design small, focused, “atomic” modules and combine them using composition . What We Mean by Composition In this context, composition means: Building infrastructure by combining smaller, independent modules instead of hiding everything behind a single, all-in-one module. Instead of: one module doing everything internally you have: multiple modules wired together explicitly module "role" { ... } module "policy" { ... } module "attachment" { role = module . role . name policy = module . policy . arn } Enter fullscreen mode Exit fullscreen mode This is not just a stylistic choice-it directly impacts maintainability, safety, and clarity.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More