After publishing a module into the private module registry in Terraform Cloud or Enterprise, the following error is received:
Error publishing module This module has already been published. Click here to view this module.
If the link in the error is clicked, the status message indefinitely states “Waiting for module to become ready”.
On rare occasions, networking issues may occur during module publication that cause corruption. When this happens, Terraform Cloud behaves as though the module is published, while in reality it is damaged and inaccessible.
To resolve the issue, the module must be deleted through the Terraform Cloud API. After deleting the corrupted module, it can be republished through the UI.
curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request POST \ https://app.terraform.io/api/v2/registry-modules/actions/delete/my-organization/my-module
Please see our module deletion API documentation for full details on how to perform an API deletion.