Problem
When uploading a module to the registry, you receive an error indicating an invalid release number.
Upon review of the support bundle, a similar error was logged.
invalid version: 0.60.1-example-module-23.012 is not a valid SemVer string: numeric
prerelease elements may not contain leading zeros
Cause
- Terraform Enterprise has a specific behavior regarding handling zero-padded numbers in pre-release versions. Zero-padded numeric identifiers in versions are generally considered invalid. However, there is a distinction based on the context of these numbers:
-
- - **Invalid Case: Purely Numeric Zero-Padded Pre-Releases**
- Example: `1.2.3-01`
- In this case, Terraform Enterprise would mark this version as invalid because the pre-release version `01` is purely numeric and is zero-padded. Numeric identifiers should not include leading zeros as they can cause ambiguity and might be interpreted differently.
- - **Invalid Case: Purely Numeric Zero-Padded Pre-Releases**
-
- - **Valid Case: Zero-Padded Numbers with Alphanumeric Characters**
- Example: `1.2.3-0alpha0`
- In this scenario, Terraform Enterprise treats the version as valid. The presence of alphanumeric characters (like `alpha`) in the pre-release identifier makes the leading zero acceptable. This is because the identifier is no longer purely numeric; it's alphanumeric, where the leading zero is not solely defining a numeric value but is part of a larger string identifier.
- - **Valid Case: Zero-Padded Numbers with Alphanumeric Characters**
Solutions:
- Correct the pre-release identifier by adding alphanumeric characters or removing the preceding zero.
Outcome
The module should load successfully