Module version semantics?

The public registry docs at [3] effectively say that all module versions must match: ^v?[0-9]+\.[0-9]+\.[0-9]+$

Is this a registry.terraform.io implementation detail, or part of terraform’s module semantics?

If this is just an implementation detail of registry.terraform.io, are there other restrictions on versions in terraform? I checked [2] and [3], but neither really describes the format of the versions.

Ross

[1] - https://www.terraform.io/docs/registry/modules/publish.html#requirements
[2] - https://www.terraform.io/docs/configuration/modules.html#module-versions
[3] - https://www.terraform.io/docs/registry/api.html

Hi @rvandegrift,

The version syntax is required to follow the Semantic Versioning syntax, because Terraform allows boundary-based version constraints which require decomposing the version string into separate parts to decide if a particular version matches the given version constraint.

The documentation about publishing modules (your reference 1) also says that modules should follow the semantic versioning conventions, in addition to the syntax. Terraform can’t check or enforce that itself, although Terraform’s version constraint behavior does have a special case that prerelease versions can be selected only be an exact version constraint, and not by a boundary-based constraint.

Some of the documentation related to your question has been revised as part of the Terraform 0.13 work. The module version handling itself has not changed in 0.13 but these revisions came as part of updating the documentation to talk about provider registries too. The new documents are not yet published on the main website but you can preview them via GitHub’s markdown rendering of the raw content that the website is built from:

Because the Terraform website uses a different URL scheme than is reflected in the raw files in the repository links from these preview renderings will not work as they will after this content is published, but you can hopefully see from the link URLs what other pages those links are referring to if you want to read some other related pages.

Makes sense. I read over the registry protocol doc from the beta, it makes the requirement perfectly clear.

Thanks so much,
Ross