Introduction
There are cases when users want to share the private module/provider registry between multiple organizations. This document provides the procedure for sharing the private module/provider registry within organizations.
Expected Outcome
The private provider/module registry is shared between different organizations and becomes visible to them.
Please note that the source path will change when using the private module/provider from the shared organization.
Prerequisites
- Basic understanding of running API calls
- Terraform Enterprise admin access
- Admin API token (User) with access to the organizations where you want to share the module/provider registry
Use Case
Private modules/providers registered to one organization can be accessed and reused by other organizations.
This allows other organizations to use these modules and providers in their Terraform configuration without needing to manage the modules or providers themselves.
Procedure
- Generate the admin user API token. Copy the generated token and export it using command below
$ export TOKEN="<API Token>
- Create a file payload.json with below sample content. Replace "org1-name" & "org2-name" with the names of consumer organizations where you want to share the modules/providers.
{
"data": {
"type": "registry-partnerships",
"attributes": {
"module_consumers": ["org1-name"],
"provider_consumers": ["org1-name", "org2-name"]
}
}
}
- Run the API call using the command below. Replace the "<tfe.example.com>" with the Terraform Enterprise FQDN & "<my-organization>" with the organization name from where you want to share the provider/module registry.
$ curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json" \
--request PUT \
--data @payload.json \
https://<tfe.example.com>/api/v2/admin/organizations/<my-organization>/registry-partnerships
- The successful execution will not result any errors/output.
References:
- https://developer.hashicorp.com/terraform/enterprise/api-docs/admin/registry-sharing#admin-registry-sharing-api