Introduction
This guide provides the procedure for sharing a private module or provider registry between multiple organizations in Terraform Enterprise.
Expected Outcome
The private provider or module registry is shared between different organizations and becomes visible to them.
Note that the source path will change when using the private module or provider from the shared organization.
Prerequisites
- A basic understanding of executing API calls.
- Administrator access to the Terraform Enterprise instance.
- An admin user API token with access to the organizations involved in the registry sharing.
Use Case
Private modules or providers registered to one organization can be accessed and reused by other organizations. This allows consumer organizations to use these modules and providers in their Terraform configuration without needing to manage the modules or providers themselves.
Procedure
-
Generate an admin user API token. Copy the generated token and export it as an environment variable.
$ export TOKEN="<API_TOKEN>"
-
Create a file named
payload.jsonwith the following content. Replaceorg1-nameandorg2-namewith the names of the consumer organizations where you want to share the registry.{ "data": { "type": "registry-partnerships", "attributes": { "module_consumers": [ "org1-name" ], "provider_consumers": [ "org1-name", "org2-name" ] } } } -
Execute the API call using the following
curlcommand. Replace<TFE_HOSTNAME>with your Terraform Enterprise FQDN and<SOURCE_ORGANIZATION>with the name of the organization sharing the registry.$ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PUT \ --data @payload.json \ https://<TFE_HOSTNAME>/api/v2/admin/organizations/<SOURCE_ORGANIZATION>/registry-partnerships
- A successful execution will not produce any output.
Additional Information
- For more details, refer to the Admin Registry Sharing API documentation.