
Terraform modules let you write a piece of infrastructure code once and reuse it across your workspaces. You package the resources into a self-contained component, then call that component wherever you need it. As your deployments get more complex, that packaging is what keeps the code manageable.
Writing a module is the easy part. There are plenty of resources to help, whether you build one from scratch, pull it from the public Terraform module registry, or use a provider like Hestio to manage them for you. This post isn't about creating modules. It's about what happens when you try to scale their usage across an organization.
When scaling your module usage, there are a number of factors to consider:
The more modules you have and the more developers using them, the bigger this gets. Users keep asking for more modules and more services, and without a system in place it gets hard to track what you have and who is pulling what.
If those challenges sound familiar, a private module registry from a Terraform Automation & Collaboration (TACO) platform like Scalr or Terraform Cloud will help. A private registry lets you curate a list of modules and share them with your organization. Most private Terraform registries give you the same core functionality:

Screenshot of the AWS S3 Terraform Module
That baseline is common across most Terraform module registries. In larger organizations, though, you run into scaling issues the baseline doesn't cover: RBAC, reporting, and how modules get shared between teams.
Scalr has a few key differentiators in the way the module registry has been implemented:
Scalr's module registry uses a namespace-based model to spare administrators a lot of operational pain. You don't want teams stepping on each other when they deploy, so Scalr lets you create environments that give each team or app its own space for their workspaces. Importing modules into every single environment by hand would be a mess. Namespace sharing is the way around that:

Illustration of the Sample Structure in Scalr
All module namespaces are created at the account scope, and for each one you choose how it's shared:
Create and maintain the module in one place and share with many organizations, teams, and environments. This allows you to create organizational standards while still scoping sensitive modules to the teams and environments that should see them.
Terraform code can be deployed into workspaces by using the Terraform CLI, through PR automation with a VCS provider, or through the Scalr private module registry referred to as "no-code deployments". With this method, your users who are not as familiar with Terraform can create a workspace directly from the module registry and will be prompted to fill in any required inputs that do not already have a value. This greatly simplifies the overall experience, but the users will still see the core Terraform workflow in action while the resources are being created.

Creating a workspace in Scalr
Once you have figured out how to distribute the Terraform module code and have your users deploy it in their workspaces, you'll want to understand the overall usage. Just because you have told your users to use the module registry doesn't mean they are doing that. The Scalr Terraform reports feature gives you insights into the following:
That last point is critical as you'll be able to identify if anyone is working around controls to pull Terraform modules from a different module registry or even from a Github repository that is not approved. The reports not only help you understand the module usage, but also ensure compliance.

Modules-in-use Report
As mentioned, you'll need to make sure you are not a bottleneck for your development teams. Hestio, a Scalr partner, created low code modules that the most advanced or novice Terraform users can deploy. The modules can be shared with your organization and Hestio will take care of the maintenance for you.

Example of Hestio Module
The Scalr module registry gives you a way to manage Terraform modules safely at any size. When you sit down to plan your own module strategy, these are the areas worth thinking through:
Try it out in Scalr today, everything listed here is included in Scalr's free tier.
