possible to use an enterprise github repo with sub-directories as module source?

1,063 views
Skip to first unread message

thelostspore

unread,
Aug 31, 2016, 1:56:35 PM8/31/16
to Terraform

Is there a way to use an enterprise Github repo with sub-directories as a Terraform module source? Reading the Module source doc, I'm attempting to use the Generic Git repository type, however, it does not appear as though its possible to access sub-directories using this method. E.g.,


module "awesome" {
 source = "git::https://github.enterprise.com/org/repo.git//path//to//module"
 # Note: I've also tried without the "forced source type."
}


Unfortunately terraform get downloads the entire repository contents. I can't say that I would expect this to work (given that its not explicitly supported) but perhaps someone out there has figured it out. If not, perhaps it could be a feature request.

David Adams

unread,
Sep 13, 2016, 11:06:47 AM9/13/16
to terrafo...@googlegroups.com
Yes I really want this to work for some internal terraform modules rather than have them each be their own git repo. Unless github has some special API for pulling just a subdirectory it seems like this should be equally doable for any git repo.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/9aab4643-f9b4-46c4-b4ae-56e4784dbfbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roderick R

unread,
Sep 14, 2016, 8:32:38 AM9/14/16
to Terraform
This is possible and works well for me with GitHub Enterprise. In your example you are using double slash for every subdirectory when only one (the initial) double slash is needed.

Try the following:

module "awesome" {
source = "git::https://github.enterprise.com/org/repo//path/to/module"
}

Reply all
Reply to author
Forward
0 new messages