Terragrunt 从特定分支下载模块
Terragrunt download module from specific branch
我最近开始使用 terragrunt 并且一直想知道是否可以从特定分支而不是特定标签(或除标签之外)而不是默认情况下下载模块 master
从主站下载特定标签:
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=v.0.0.1"
}
从 repo 下载特定分支?
# Pseudo code
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=v.0.0.1%branch=test"
}
查看 terragrunt cli/download_source_test.go
源代码,没有明显的方法来指定分支。
这意味着您需要向该分支添加一个标签,并将该标签用作 ref
。
也就是说,首先检查 ref=<mybranch>
是否有效。
但是直接引用分支名的OP potatopotato confirms 是不行的
I just made changes on branch, and:
git add
git commit
git tag -a 'v1.branch'
git push --follow-tags -u origin <branch_name>
and I could use the tag reference to the branch, not master
.
和German Dautin's points to Terraform / Module Sources / Selecting a Revision.
By default, Terraform will clone and use the default branch (referenced by HEAD) in the selected repository. You can override this using the ref argument:
module "vpc" {
source = "git::https://example.com/vpc.git?ref=v1.2.0"
}
The value of the ref argument can be any reference that would be accepted by the git checkout command, including branch and tag names.
因此可以使用分支名称。
我能够使用以下方法指定一个分支:
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=branch-name"
}
我最近开始使用 terragrunt 并且一直想知道是否可以从特定分支而不是特定标签(或除标签之外)而不是默认情况下下载模块 master
从主站下载特定标签:
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=v.0.0.1"
}
从 repo 下载特定分支?
# Pseudo code
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=v.0.0.1%branch=test"
}
查看 terragrunt cli/download_source_test.go
源代码,没有明显的方法来指定分支。
这意味着您需要向该分支添加一个标签,并将该标签用作 ref
。
也就是说,首先检查 ref=<mybranch>
是否有效。
但是直接引用分支名的OP potatopotato confirms
I just made changes on branch, and:
git add git commit git tag -a 'v1.branch' git push --follow-tags -u origin <branch_name>
and I could use the tag reference to the branch, not
master
.
和German Dautin's
By default, Terraform will clone and use the default branch (referenced by HEAD) in the selected repository. You can override this using the ref argument:
module "vpc" { source = "git::https://example.com/vpc.git?ref=v1.2.0" }
The value of the ref argument can be any reference that would be accepted by the git checkout command, including branch and tag names.
因此可以使用分支名称。
我能够使用以下方法指定一个分支:
terraform {
source = "git@github.com:<repo>/infrastructure-modules.git//gcp/bucket?ref=branch-name"
}