简体   繁体   English

如何在 Terragrunt 中引用私有 git 存储库的特定分支?

[英]How do I refer to a specific branch of a private git repo in Terragrunt?

I want to refer to a feature/IaC (any specific branch other than the main) branch of a multibranch private git repo as a source parameter of Terragrunt's configuration file .我想将多分支私有git 存储库的feature/IaC (除主分支以外的任何特定分支)分支作为Terragrunt 配置文件的源参数

Here is a piece of code from my terragrunt.hcl file这是我的terragrunt.hcl文件中的一段代码

terraform {
 source = "what_link_to_put_here?"
}

Thanks in advance.提前致谢。

As official docs said : 正如官方文档所说

By default, Terraform will clone and use the default branch (referenced by HEAD) in the selected repository.默认情况下,Terraform 将克隆并使用所选存储库中的默认分支(由 HEAD 引用)。 You can override this using the ref argument.您可以使用 ref 参数覆盖它。 The value of the ref argument can be any reference that would be accepted by the git checkout command, such as branch , SHA-1 hash (short or full), or tag names. ref 参数的值可以是git 检出命令可接受的任何引用,例如branch 、SHA-1 hash(短或完整)或标签名称。 The Git documentation contains a complete list. Git 文档包含完整列表。

So:所以:

source = "git::https://example.com/vpc.git?ref=xxx"  //xxx is a branch name.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM