Problem
When attempting to publish a provider to the private registry by following the Create a version and platform documentation, the API call to the Create a Provider Version endpoint fails with a 404 not found error.
{
"errors": [
{
"status": "404",
"title": "not found"
}
]
}This error occurs during the step where you construct and send the API request to create the provider version.
Cause
The 404 not found error occurs because the provider you are trying to create a version for does not yet exist in the private registry. The API endpoint for creating a provider version requires a pre-existing provider record to associate the new version with. If the provider is missing, the API cannot find the specified resource and returns the error.
Solution
To resolve this issue, you must create the provider in the private registry before attempting to create a version for it. Follow the correct procedural order:
- Create the Private Provider: Use the Create a Provider API endpoint to add your provider to the HCP Terraform private registry.
- Create the Provider Version and Platform: Once the provider exists, proceed with the steps outlined in the Create a version and platform documentation. The API call to create the provider version will now succeed.
Outcome
By following the correct sequence of API calls—creating the provider first, then the version—you can successfully publish a provider to the HCP Terraform private registry.