Problem
When you publish a new version of a private module to a GitHub repository integrated with the Terraform Enterprise private module registry, the operation fails. The webhook delivery details in GitHub show a 401 Unauthorized error with the message signature does not match.
Cause
This error typically indicates a stale or misconfigured webhook between Terraform Enterprise and the GitHub repository. The signature key used by Terraform Enterprise to sign webhook payloads no longer matches the secret configured in the GitHub webhook, causing GitHub to reject the request as unauthorized.
Solution
The most effective way to resolve this issue is to reset the connection by deleting the module from the Terraform Enterprise registry and then re-publishing it. This process automatically deletes the old webhook and creates a new one with a valid signature key.
This procedure does not affect the module's source code in your GitHub repository.
Step 1: Delete the Module from the Private Registry
- In Terraform Enterprise, navigate to your organization's settings and select Registry.
- Select the module that is experiencing the issue.
- Click Manage module for organization.
- Click Delete module.
- Select the option Delete all versions for this provider for this module.
- Type
deleteinto the confirmation box and click Delete.
The module is now removed from your organization's private registry.
Step 2: Verify Webhook Deletion in GitHub
- Navigate to your GitHub repository's webhook settings page. The URL follows this pattern:
https://github.com/<your_profile>/<repo_name>/settings/hooks - Confirm that the webhook pointing to your Terraform Enterprise instance has been removed. If it still exists, manually delete it by clicking Delete and confirming the action.
Step 3: Re-publish the Module
- In your Terraform Enterprise organization, navigate to Registry.
- Click Publish and select Module.
- Select the VCS provider connection for your GitHub repository.
- Choose the repository containing your module from the list.
- On the Confirm Selection screen, ensure the publishing type is set to Tag, which is the default.
- Click Publish module.
After a few moments, the module will be published to your private registry. This action creates a new webhook in the GitHub repository. You can verify its creation by navigating to the repository's Settings > Webhooks page and confirming the presence of a new, active webhook pointing to your Terraform Enterprise instance.
Step 4: Test with a New Tag Release
- In your GitHub repository, navigate to the Releases page.
- Click Draft a new release.
- In the Choose a tag dropdown, type a new version tag for your release (e.g.,
v1.0.1) and select Create new tag. - Provide a title for the release and click Publish release.
- After the release is published, refresh the module page in the Terraform Enterprise registry. The new version tag now appears in the list, confirming the integration is working correctly.
Additional Information
- For more details on webhook troubleshooting, refer to the guide on How to verify a VCS webhook is being received by Terraform Enterprise.