Explore and Use a Module
Explore a registered module's versions and parsed metadata, then reference the module from your OpenTofu or Terraform configuration.
Once a module is registered, Harness parses metadata from the module repository and presents it on the module detail view. The tabs are populated automatically from the module's files, so you can review its inputs, outputs, dependencies, resources, documentation, and submodules without manually entering this information.
If you make changes to the module, update the source files and sync the module to refresh the registry metadata.
Before you begin
A registered module: Register a module before you explore its details or use it. Go to Register a Module to add one.
Explore module details
Each tab maps to a file in your module repository.

Readme
README.md
Renders the module's README.md directly.
Instructions
Generated
A code snippet you can copy into your OpenTofu or Terraform configuration to reference the module.
Inputs
variables.tf
The module's input variables: name, type, description, and default value.
Outputs
outputs.tf
The values the module returns after execution.
Dependencies
versions.tf
Required providers and version constraints.
Resources
OpenTofu/Terraform configuration files
The resources defined by the module.
Submodules
modules/
Metadata extracted from the modules/ folder (one level deep).
Examples
examples/
Example configurations from the module's examples/ directory.
The Readme tab renders the module's README.md directly. Harness parses this file from the module repository and displays it formatted on the detail page. A well-structured README documents the module's purpose, required inputs, and usage examples for consumers.
Go to Set Up a Module for the required module file structure.
The Instructions tab shows a generated code snippet you can copy directly into your OpenTofu or Terraform configuration. The snippet pre-fills the source address and latest version for the module.
Go to Reference a root module and Reference a submodule for the full source address format and version pinning details.
The Inputs tab is populated from variables.tf:
The Outputs tab is populated from outputs.tf:
The Dependencies tab is populated from versions.tf:
Resources are defined within your OpenTofu or Terraform configuration files. They are applied when you run your provision pipelines:
The Submodules tab shows metadata extracted from the modules/ folder. The registry collects metadata one level deep, so only direct children of modules/ appear.
Go to Set Up a Module for submodule structure and metadata requirements.
The Examples tab shows configurations from the module's examples/ directory. Each example demonstrates a working usage pattern for the module.
Go to Set Up a Module for the examples directory structure.
Manage module versions and source
Version dropdown
Select a published version to view its metadata. The available versions correspond to Git tags that have been registered for the module. Selecting a version reflects the module's state at that point in time.
Source Code
Click SOURCE CODE to open the module's source repository.

Sync
Click Sync to fetch newly available matching Git tags and make their versions available in the registry. This is in addition to auto-sync, if you enabled it at registration.
After you review a module and choose a version, you can reference it from your OpenTofu or Terraform configuration.
Use a module
How you reference it depends on whether you want the whole module or a submodule inside it.
Reference a root module
Reference the root module by its source and version. The version corresponds to a Git tag, so specifying a version pins the configuration to that module version. The source address follows the format app.harness.io/<account-id>/<module-name>/<provider>. Replace <account-id>, <module-name>, and <provider> with the values for your registered module. You can find the pre-filled source address and version for your module on the Instructions tab of the module detail page.

Reference a submodule
Reference a submodule with the // subpath syntax. A submodule does not carry its own version; it inherits the root module's version. Submodules must be located in the module's modules/ directory to appear in the registry. Go to Set Up a Module for submodule structure and metadata requirements.
Authenticate the OpenTofu or Terraform CLI
When you run OpenTofu or Terraform commands locally against a configuration that sources modules from the Harness registry, the CLI must authenticate with app.harness.io. Without this authentication, tofu init or terraform init fails with a 401 error when it tries to download the module.
OpenTofu and Terraform read authentication tokens from environment variables named TF_TOKEN_<hostname>, where dots in the hostname are replaced with underscores. Set the variable to a Harness personal access token (PAT) before running any local commands:
Once the variable is set, subsequent tofu validate, tofu plan, and equivalent Terraform commands work for the duration of your shell session. To persist the token across sessions, add the export line to your shell profile (for example, ~/.zshrc or ~/.bashrc). Alternatively, store credentials in the OpenTofu or Terraform credentials file (~/.tofurc or ~/.terraform.d/credentials.tfrc.json).
Troubleshooting
Next steps
Go to Test a Module to validate module changes before consumers use them.
Go to Manage Version Lifecycle to manage the lifecycle of published module versions.
Go to Govern Module Usage to control which modules and versions teams can use.
Last updated
Was this helpful?