Admin Module Consumers API
Admins and operators who install and maintain their organization's Terraform Enterprise instance are able to use the module-consumers
endpoint.
This endpoint is deprecated: We will remove this endpoint in a future release. Use the Registry Sharing API instead. Continue using the Admin Organizations API to configure global module sharing.
There are two ways to configure module sharing using the Admin API:
- This endpoint, which allows an organization to share modules with a specific list of other organizations.
- The update an organization endpoint, whose
data.attributes.global-module-sharing
property allows an organization to share modules with every organization in the instance.
Update an Organization's Module Consumers
This API endpoint is available in Terraform Enterprise as of version 202012-1.
PATCH /admin/organizations/:name/module-consumers
This endpoint sets the list of organizations that can use modules from the sharing organization's private registry. Sharing with specific organizations will automatically turn off global module sharing, which is configured with the update an organization endpoint (via the data.attributes.global-module-sharing
property).
Parameter | Description |
---|---|
:name | The name of the organization whose registry is being shared |
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "module-partnerships" ) | The list of module consumers was successfully updated |
404 | JSON API error object | Organization not found or user unauthorized to perform action |
422 | JSON API error object | Malformed request body (missing attributes, wrong types, etc.) |
Request Body
This PATCH endpoint requires a JSON object with the following properties as a request payload.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "module-partnerships" | |
data.attributes.module-consuming-organization-ids | array[string] | A list of external ids for organizations that will be able to access modules in the producing organization's registry. These should have an org- prefix. |
Sample Payload
{ "data": { "type": "module-partnerships", "attributes": { "module-consuming-organization-ids": [ "org-939hp5K7kecppVmd" ] } }}
Sample Request
curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request PATCH \ --data @payload.json \ https://tfe.example.com/api/v2/admin/organizations/my-organization/module-consumers
Sample Response
{ "data": [ { "id": "mp-tQATArr4gyYDBvkF", "type": "module-partnerships", "attributes": { "consuming-organization-id": "org-939hp5K7kecppVmd", "consuming-organization-name": "other-organization", "producing-organization-id": "org-etdex8r9VLnyHFct", "producing-organization-name": "my-organization" } } ]}