Problem
When trying to add a private registry module you may find that none of the repositories are populating in the Choose the Repository
picklist. Even after manually typing in a repository name and clicking Publish module
, an Error publishing module
popup box would be received. The raw logs may report the following error:
2021-09-21 14:23:16 [WARN] [bd350213-e360-46a5-8eeb-882cebdb38d8] VCS webhook creation failure: <Repository name>/terraform-<provider>-<provider name>s: 404 Not Found
2021-09-21 14:23:16 [DEBUG] Failed to create webhook on repository excluded from capture: DSN not set
2021-09-21 14:23:16 [ERROR] [bd350213-e360-46a5-8eeb-882cebdb38d8] {:error=>"RuntimeError", :id=>2692340, :message=>"Failed to create webhook on repository"}
2021-09-21 14:23:16 [DEBUG] [bd350213-e360-46a5-8eeb-882cebdb38d8] {:error=>"RuntimeError", :id=>2692340, :message=>"Failed to create webhook on repository", :backtrace=>["/app/app/models/vcs/<repo>:in `rescue in create_webhook'",
Cause
The user ownership for the repo was changed within the VCS. When the repo ownership changes the Terraform Enterprise Workspace is unaware and it still would be using the previous user's OAuth token configurations to connect to the repo. To reflect the update in Terraform Enterprise will require a manual VCS connection revoke and reconnection within that Organization VCS providers to the new repo user owner.
Solution
To revoke the VCS connection and re-connect the OAuth connection under the appropriate user, please follow the instructions below.
- Where the workspace is located, connect to its Organization version-control settings for Terraform Enterprise the URL is similar to
https://<tfe-url>/app/<Organization>/settings/version-control
and for Terraform Cloud the URL would look likehttps://app.terraform.io/app/<Organization>/settings/version-control
- Locate the VCS provider where the connection needs revoking.
- Click
Revoke Connection
- Confirm the revoke connection popup if presented and the connection should be dropped
- Within the same VCS provider space, a
Connect Organization
button should now illuminate - Click the
Connect Organization
An authorization redirect to the VCS provider should occur due to the owner change - Ensure the user has appropriate permissions according to your VCS provider listed here
https://www.terraform.io/docs/cloud/vcs/index.html
and authorize access -
Select
Add SSH key
on the next page if required for your VCS connection (ssh key recreation may be required due to the owner change). Otherwise, selectSkip and finish
- Once these steps are completed the VCS and OAuth connection have been refreshed against the new repo user
Outcome
After the VCS connections are refreshed per the previous steps, verify the module publishing is nomimal by adding a module. The repositories associated with the module under the name format terraform-<PROVIDER>-<NAME>
within theChoose the Repository
picklist should now populate.
Additional Information
- For additional assistance please contact HashiCorp Support to request additional assistance.