Issue Summary
Despite publishing version, say, 0.3.0
of the module say, Azure-Module, to GitHub, Terraform fails to locate it and defaults to the only successfully published version, say, 0.1.0
.
When attempting to initialize Terraform using terraform init -upgrade
, the following error appears:
Error: Unresolvable module version constraint on modules\Azure-Module\main.tf line 49: 49: module "Azure-Module" { There is no available version of module "app.terraform.io/OrganizationName/Azure-Module/azure" (modules\Azure-Module\main.tf:49) which matches the given version constraint. The newest available version is 0.1.0.
Root Cause
This issue typically arises when the expected module versions (e.g., 0.2.0
, 0.3.0
) are not successfully published to the Terraform Cloud private module registry.
In this specific case:
- Versions
0.2.0
and0.3.0
of the moduleAzure-Module
were not published successfully. - Only version
0.1.0
appears in the module registry. - Since the newer versions failed to publish, Terraform defaults to the last successful version (0.1.0), which may not satisfy the version constraint declared in your configuration.
Although the code exists in GitHub, Terraform Cloud only recognizes versions that:
- Are successfully published through an integrated VCS or upload
- Complete a successful run with valid metadata and structure
If the publish operation fails (e.g., due to errors in the module, structure, or versioning), the version will not be registered in the module registry—even if present in the source repository.
Resolution Steps
To resolve this error, follow these steps:
1. Clean Up Partially Published Versions
- Go to Terraform Cloud > Private Registry.
- Locate the module
Azure-Module
. - Remove any versions (
0.2.0
,0.3.0
, etc.) that were not published successfully.
2. Re-publish the Module
- After cleanup, re-publish the module versions using the appropriate method.
- Verify that the run associated with the module version completes successfully.
Note : To troubleshoot module publishing errors, check the runs page of the module publishing workspace for failures.
If the issue persists or you need further assistance with publishing modules, feel free to open a support ticket and provide:
- The workspace name and the module name
- The failing module versions
- Raw run logs and trace logs (if available)