Terraform modules using a git branch as a source

terraform module source variable
terraform nested modules
terraform module source gitlab
terraform module source = git subfolder
terraform module path
terraform clone git repo
terraform module output
terraform module example github

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


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.

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.

Terraform modules using a git branch as a source, GitHub is home to over 50 million developers working together to host module "​consul" { source = "github.com/hashicorp/consul/terraform/aws?branch=foo" terraform get: can't use variable in module source parameter? » Module Sources The source argument in a module block tells Terraform where to find the source code for the desired child module. Terraform uses this during the module installation step of terraform init to download the source code to a directory on local disk so that it can be used by other Terraform commands.

Completing the answer, the source link with a branch would be


Add support for git tags/branches in module sources · Issue #1145 , In this post you'll see how reuse your Terraform code using modules to Use the source parameter to specify the path of your module as shown below: to a specific branch or version in a git repository using the ?ref query. To be able to use our modules directly from Git, the first thing we need to do is amend our Terraform configurations that call those modules to reference Git instead. This change is as simple as changing the “source” field in the module reference to a Git URL rather than a path. HTTPS or SSH. Accessing a Git repo can be done using HTTPS or SSH.

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

Working with Terraform modules, In this post, we'll show you how to use Terraform modules by covering the module is in a private Git repository, to use that repo as a module source , you will  which makes it: hard to make any reproducible build; security hazard - imagine I'm using tf_aws_sg and accidentally upgrade to a version that exposes some ports to for example

How to create reusable infrastructure with Terraform modules, In this chapter, I'll show you how to create and use Terraform modules by Within the module definition, the source parameter specifies the folder where the with Git repos, you can use a module from the code examples GitHub repo for this  Terraform downloads module from git source for branch to re-use already-downloaded modules where possible. Although we had initially planned to leave that out of

4. How to Create Reusable Infrastructure with Terraform Modules , I'm using git for modules and each module I want to have a test branch along with the Open source Terraform module to serve the website using AWS S3,  Note that if your Terraform module is in a private Git repository, to use that repo as a module source, you will need to give Terraform a way to authenticate to that Git repository. I recommend using SSH auth so that you don’t have to hard-code the credentials for your repo in the code itself.

terraform modules and git : Terraform, Accessing a Git repo can be done using HTTPS or SSH. module "aks-module" { source = "c:\\terraform\\modules\\aks" cluster_name  Terraform Pro is to Terraform what GitHub is to Git Terraform Pro is designed for teams to collaborate on and organize many Terraform states, configurations, modules, and variables. At the core of that collaboration is our integration with version control systems like GitHub to take infrastructure as code configurations and turn it into real infrastructure on any provider.