Terraform modules using a git branch as a source
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
.
As mentioned in the Terraform documentation here:
git::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=myBranch
You can use something like this:
module "test_module" {
source = "git::ssh://bitbucketURL/my_repo.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