Use of `namespace` in the Terraform Module Registry API

There are many mentions in the Registry API docs regarding the term ‘namespace’, and what it’s used for. For one endpoint in particular, I can deduce its use by the documentation for that endpoint: “Restricts listing to modules published by this user or organization”

I am however wanting to set up an internal (to our company) module registry, where one (our own) organization is publishing modules to it. Therefore, is it a mandatory entity of the Registry protocol? Is there a way that I can omit it as a concept from my implementation?

Hi @jameshopkins,

The namespace concept is a mandatory part of the protocol, but the protocol doesn’t dictate what you might use it for.

In the public Terraform Registry this is used to represent GitHub usernames, while in the private registry in Terraform Cloud & Enterprise this is used for the organization name within those platforms.

If you don’t need any sort of organizational subdivisions in your environment then the best option would be to just select a specific name to use as the only namespace in your registry implementation, and then all of the registry addresses talking to your host will have that single namespace. If you need to partition things more later on then you can add more namespaces.

The namespace portion is mandatory because otherwise the module address syntax would be ambiguous; it uses the number of segments to determine whether the first portion is a hostname or a namespace name.