1

In a project I am working on we have a module like this:

module "module-name" {
   source = "https://github.com/some/repo/releases/download/v0.1.7/filename.zip"
    ...
}

Currently when ever there is a release in https://github.com/some/repo/ we have to manually come and update the version string. Is there a way to make the source to just pull the latest release?

Cogito Ergo Sum
  • 592
  • 6
  • 18

1 Answers1

1

This is currently not possible with Github as the source provider type. In this situation, versions must be specified with git references, and cannot be specified with Terraform version arguments. Git references do not support anything other than hard specifications on branches, tags, etc.

With the private module registry in Terraform Cloud or Enterprise, then one could do this with a version argument specifying the minimum version like:

module "module-name" {
  source  = "server/namespace/module"
  version = ">= 1.0"
}

and then the latest version above the minimum specified (in this situation 1.0) would be retrieved during terraform init.

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67