> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/private-registry/private-registry.md).

# Private Registry

Terraform provides a public registry, where you can share and reuse your terraform modules or providers, but sometimes you need to define a Terraform module that can be accessed only within your organization.

<figure><img src="https://4014930676-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MfAN3V983Y82_trlbcu%2Fuploads%2Fgit-blob-a17632401938d735274a9c4e6fd8a2fb537624af%2Fregistry-modules.png?alt=media" alt="The organization registry"><figcaption><p>The organization registry</p></figcaption></figure>

Terrakube provides a private registry that works similarly to the [public Terraform Registry](https://developer.hashicorp.com/terraform/registry) and helps you share [Terraform providers](https://developer.hashicorp.com/terraform/language/providers) and [Terraform modules](https://developer.hashicorp.com/terraform/language/modules) privately across your organization. You can use any of the main [VCS providers](https://docs.terrakube.io/set-up/vcs-providers.md) to maintain your terraform module code.

{% hint style="info" %}
The Terrakube UI publishes [private modules](https://docs.terrakube.io/private-registry/private-registry/publishing-private-modules.md). You can add providers from the public registry in the UI, or publish your own with the [Terrakube API](https://docs.terrakube.io/api-reference/methods/provider.md).
{% endhint %}

```mermaid
flowchart LR
    git[Git repository<br/>tags vX.Y.Z] -->|refreshed from tags| api[Terrakube API]
    api --> reg[Registry]
    pub[Publish provider<br/>API] --> api
    reg --> store[(Object storage)]
    cli[terraform init] -->|module and provider protocols| reg
    pub2[Public registry] -.->|import provider| api
```

Modules are published from a git repository: each semantic version tag becomes a module version. Providers are imported from the public registry or uploaded through the API. Terraform and OpenTofu then install both through the standard registry protocols after logging in.

In this section:

{% content-ref url="/pages/vOnmliCIxsBaBUhCNooO" %}
[Publishing Private Modules](https://docs.terrakube.io/private-registry/private-registry/publishing-private-modules.md)
{% endcontent-ref %}

{% content-ref url="/pages/mGbyG4dOq3DyCGqtPMsm" %}
[Using Private Modules](https://docs.terrakube.io/private-registry/private-registry/using-private-modules.md)
{% endcontent-ref %}

{% content-ref url="/pages/E2V3bGymJ7KLaLYWpeDu" %}
[Deprecating and Removing Versions](https://docs.terrakube.io/private-registry/private-registry/deprecating-and-removing-versions.md)
{% endcontent-ref %}

### New versions appear after a refresh

Terrakube reads a module's git tags every 5 minutes and the registry caches the version list for 10 minutes. To shorten the delay, set `ModuleRefreshInterval` (API, seconds, default `300`) and `ModuleVersionsCacheTtlSeconds` (registry, seconds, default `600`). Setting both to `30` brings a new tag into the registry in about a minute.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terrakube.io/private-registry/private-registry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
