• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Terraform Enterprise

Skip to main content
  • Terraform Enterprise
    • Overview
    • Account
      • Overview
      • Registry Sharing
      • Module Sharing
      • Organizations
      • Runs
      • Settings
      • Terraform Versions
      • Users
      • Workspaces
    • Agent Pools
    • Agent Tokens
    • Applies
    • Audit Trails
    • Comments
    • Configuration Versions
    • Cost Estimates
    • Invoices
    • Notification Configurations
    • OAuth Clients
    • OAuth Tokens
    • Organizations
    • Organization Memberships
    • Organization Tags
    • Organization Tokens
    • Plan Exports
    • Plans
    • Policies
    • Policy Checks
    • Policy Sets
    • Policy Set Parameters
    • Runs
    • Run Triggers
    • SSH Keys
    • State Versions
    • State Version Outputs
    • Team Access
    • Team Membership
    • Team Tokens
    • Teams
    • User Tokens
    • Users
    • Variables
    • VCS Events
    • Workspaces
    • Workspace-Specific Variables
    • Workspace Resources
    • Variable Sets
    • Changelog
    • Stability Policy
  • Operational Modes
  • Migrating to Terraform Enterprise
  • Support

  • Terraform Cloud Agents

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Terraform Enterprise
  4. API
  5. Admin
  6. Module Sharing
  • Terraform Enterprise
  • v202301-1
  • v202212-2
  • v202212-1
  • v202211-1
  • v202210-1
  • v202209-2
  • v202209-1
  • v202208-3
  • v202208-2
  • v202208-1
  • v202207-2
  • v202207-1
  • v202206-1

»Admin Module Sharing API

Terraform Enterprise Only: The admin API is exclusive to Terraform Enterprise, and can only be used by the admins and operators who install and maintain their organization's Terraform Enterprise instance.

Note:: This Admin Module Sharing API is deprecated and will be removed in a future release. Transition existing integrations with this API to the Registry Sharing API. Continue using the Admin Organizations API to configure global module sharing.

There are two ways to configure module sharing via 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.

Enabling either option will disable the other. For more information, see Administration: Module Sharing.

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).

ParameterDescription
:nameThe name of the organization whose registry is being shared
StatusResponseReason
200JSON API document (type: "module-partnerships")The list of module consumers was successfully updated
404JSON API error objectOrganization not found or user unauthorized to perform action
422JSON API error objectMalformed 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 pathTypeDefaultDescription
data.typestringMust be "module-partnerships"
data.attributes.module-consuming-organization-idsarray[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"
      }
    }
  ]
}
Edit this page on GitHub

On this page

  1. Admin Module Sharing API
  2. Update an Organization's Module Consumers
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)