Terraform modules using a git branch as a source

我与影子孤独终老i 提交于 2020-11-29 04:22:28

问题


Using Terraform modules with a git branch as a source,
I am referring to:

git::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=v0.0.1

In my module source parameter, this works great and provides me with my module at tag v0.0.1 on master.

However I'd like to specify a branch, not a tag, but am not sure how to do this.


回答1:


As mentioned in the Terraform documentation here:

git::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=myBranch



回答2:


Exactly the same way. You have a generic ref there that Git will work out what you mean by context assuming no collisions.

If you do have 2 refs that are ambiguous then Git will error and tell you that it's an ambiguous ref and force you to specify the full ref using refs/heads/branch-name or refs/tags/tag-name.




回答3:


You can use something like this:

module "test_module" {
  source = "git::ssh://bitbucketURL/my_repo.git.git?ref=BranchName"
}

bitbucketURL: Go to bitbucket UI, check clone URL, copy from it.

If you are using something other then bitbucket, please refer to: https://www.terraform.io/docs/modules/sources.html



来源:https://stackoverflow.com/questions/52538920/terraform-modules-using-a-git-branch-as-a-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!