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

Terraform模块源:目标是GitHub中的最新版本和特定文件,terraform,hcl,Terraform,Hcl,在我正在进行的一个项目中,我们有这样一个模块: module "module-name" { source = "https://github.com/some/repo/releases/download/v0.1.7/filename.zip" ... } 当前,https://github.com/some/repo/我们必须手动来更新版本字符串。有没有办法让源代码只获取最新版本?这在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中的私有模块注册中心,可以使用version参数指定最低版本,如:

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

然后,将在
terraform init

期间检索高于指定最小值的最新版本(在这种情况下,
1.0
),不,这在Github作为源提供程序时是不可能的。您需要使用Terraform Cloud/Enterprise进行
版本
规范。啊,很高兴知道。如果你想获得学分,你可以提供这个答案。