Terraform 模块源:目标最新版本和 GitHub 中的特定文件

Terraform Module Source: Target Latest Release and specific file in GitHub

在我正在进行的项目中,我们有一个这样的模块:

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

目前,只要 https://github.com/some/repo/ 中有一个版本,我们就必须手动更新版本字符串。有没有办法让源只提取最新版本?

目前无法使用 Github 作为源提供程序类型。在这种情况下,必须使用 git 引用指定版本,并且不能使用 Terraform 版本参数指定。 Git 除了对分支、标签等的硬规范外,引用不支持任何内容

使用 Terraform Cloud 或 Enterprise 中的私有模块注册表,然后可以使用指定最低版本的版本参数来执行此操作,例如:

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

然后将在 terraform init 期间检索高于指定最小值的最新版本(在这种情况下 1.0)。