Register a Module
Register an OpenTofu or Terraform module in the Harness IaCM Module Registry using the onboarding pipeline flow, including storage type selection, auto-sync, and org/project scoping.
Registering a module connects a Git repository to the Module Registry and makes its tagged versions available for consumption. During registration, you configure the module's repository, storage type, scope, and onboarding pipeline.
You can register a module through the Add New Module wizard or the harness_platform_infra_module Terraform resource.
Before you begin
Git tag: A module version is a Git tag. Create a tag or release on your module's repository before you register, otherwise there are no versions for the registry to pick up. Go to Tags to tag with Harness Code Repository.
Module structure: Your repository must follow the expected layout. Go to Set Up a Module to prepare the repository.
Pipeline permissions: You need View, Create/Edit, and Execute permissions on Pipelines in the target project. Go to RBAC in Harness to configure roles.
Git authentication: Your Git connector must be able to access the module repository. This is separate from the
TF_TOKEN_app_harness_ioauthentication used when a workspace consumes the registered module at runtime. Go to Use a Module to configure runtime authentication.
Understand module tags and versions
The Module Registry uses three different tag-related concepts. Only Git tags represent module versions.
Tags field on the module
Optional organizational labels inside Harness for search and filtering. These are not versions.
Git Tag Pattern field
A wildcard filter (for example, SQSv*) that limits which Git tags become module versions.
Git tags in the repository
The actual Git tags that correspond to module versions.
For example, if your repository has tags SQSv.1.0.0, SQSv.1.0.1, S3v.1.0.0, and S3v.1.0.1, set Git Tag Pattern to SQSv* to onboard only the SQS module versions.
Module scopes
You can register a module at the account, organization, or project scope. The scope controls where the module is visible and who can consume it.
Account
Available to all organizations and projects in the account.
Organization
Available to all projects within the selected organization.
Project
Available only within the selected project.
Regardless of module scope, the onboarding pipeline always runs inside a Harness project. Select the org and project in Step 2 of the wizard where your shared onboarding pipelines live.
Register a module
Registration is a three-step wizard titled Add New Module. You can also register using the Terraform/OpenTofu provider.
Step 1: Module details
In the Harness left navigation, select Infrastructure as Code Management, then select Module Registry.
Click New Module.
Under Basic information, configure the module identity:
In the Name field, enter a module name. This identifier is used when referencing the module in OpenTofu or Terraform configurations.
In the Provider field, enter the provider name (for example,
aws,gcp, orazurerm).Optionally, select the Edit icon next to Description to add a description.
Optionally, select the Edit icon next to Tags to add organizational labels for search and filtering. Tags are not version identifiers.
Under Repository, configure the source:
For Select Git Provider, select Harness Code Repository or Third-party Git provider.
From the Git Connector dropdown, select the connector that has read access to your module repository.
From the Git Fetch Type dropdown, select how Harness retrieves the module. The default is Latest from Branch.
From the Git Branch dropdown, select or enter the target branch.
Optionally, in the Folder Path field, enter the path to your module if it is not at the repository root. Go to Register a module from a subdirectory for details.
Select Advanced to expand storage options, then configure:
Under Storage type, select Artifact (recommended) or Git reference. Artifact is preselected.
Storage typeHow it worksWhen to useArtifact (recommended)
Packages each version as a ZIP artifact on the IaCM server. No Git credentials are needed at workspace runtime.
Use for all new modules.
Git reference (legacy)
Links directly to a specific Git tag in your repository. Workspaces retrieve the module from Git during execution and require Git credentials at runtime.
Only if you have a specific reason to retain legacy behavior. This flow is being deprecated.
GIT REFERENCE CONSTRAINT
Git reference is supported only when a single Git connector is consistently used across all modules in the registry.
Optionally, in the Git Tag Pattern field, enter a wildcard filter to limit which Git tags become module versions (for example,
SQSv*). Go to Understand module tags and versions for details.
Click Next.
Step 2: Organization and Project
From the Organization dropdown, select the organization where the onboarding pipeline will run.
From the Project dropdown, select the project.
Click Next.
Step 3: Execution pipeline
The execution pipeline fetches your module's metadata from Git and populates the registry. Each time you push a new matching Git tag, the pipeline runs and the new version appears in the Module Registry.
From the pipeline list, select a pipeline to fetch module metadata:
Default Pipelines lists the auto-generated onboarding pipeline (
iacm_auto_generated_onboarding_pipeline). Select it if you do not need a custom onboarding flow.Custom Pipelines lists any pipelines already in the selected project. Select a custom pipeline if you need a modified onboarding flow.
If no pipeline exists in the selected project, Harness creates
iacm_auto_generated_onboarding_pipelineautomatically when you click Create.
Confirm the Enable auto-sync checkbox is selected. When enabled, Harness creates a webhook trigger on the selected pipeline so each new matching Git tag triggers a sync automatically, without manual re-registration.
If you do not enable auto-sync, you can trigger a sync manually by clicking the Sync button on the module page at any time.
Click Create.
Register a module with the harness_platform_infra_module resource. The repository field is the repository name only, not a URL.
REPOSITORY FIELD FORMAT
The repository field must be the repository name only, not a full URL. Entering a full URL causes registration to fail.
Bootstrap the onboarding pipeline first. The pipeline must already exist before Terraform can reference it. Create it one of two ways:
Register one module through the UI first. The Add New Module wizard creates
iacm_auto_generated_onboarding_pipelineautomatically. All subsequent Terraform registrations can point to it.Create it via the onboarding API:
Register a module from a subdirectory
By default, the registry expects the root module (main.tf) at the repository root and submodules inside a modules/ folder. If your module does not sit at the repository root, for example in a monorepo holding multiple modules, set the Folder Path field when you register it. Folder Path maps to the repository_path argument on the harness_platform_infra_module Terraform resource.
Setting Folder Path re-roots all resolution, including where the registry looks for the modules/ folder, so submodules are discovered relative to the path you set.
Example: Root module lives in terraform/infrastructure:
Set Folder Path during registration:
In the New Module wizard, configure the module name, provider, connector, and repository.
In the Folder Path field, enter the path from the repository root to the directory containing the root module, for example
terraform/infrastructure.Complete the remaining fields and click Create.
Or set the equivalent repository_path argument in Terraform:
Troubleshooting
Next steps
Go to Explore Module Details to review your registered module's parsed metadata and published versions.
Go to Use a Module to reference the registered module from an OpenTofu or Terraform configuration.
Go to Test a Module to set up automated module testing.
Last updated
Was this helpful?