Great question, thanks for taking the time to write it up with good background info.I'll give you my thoughts on some of those questions. For background I'm the main engineer working on the module registry currently however this is just my take rather than an official HashiCorp position that has been set in stone!
I would say it's unlikely we will encourage "mono repo" style modules in the public registry at least in the sense you describe
... you really want well-defined modules that do one thing well and can be easily discovered and then composed with others rather than a whole bunch of kitchen-sink frameworks that are only really designed to be used on their own.
Longer term we'd hope to see more re-use of common modules, often maintained by vendors themselves, in the registry and the composition of several core modules from different vendors seems to loose a lot of the benefits of monolithic single-org repos.
Concretely, some of the challenges for mono-repos are around versioning since one git tag applies to all the nested modules, and that many organisations need control over permissions that can be easily granted at repo level with different teams owning different modules etc.
> Does the Terraform Registry plan to avoid/block support for mega-repos, or to allow for their use on the Terraform platform?I don't think we'd consciously try to "block" that use case, however as things are it's not obvious that the choices we make to optimize for reusable modules will necessarily be the right choices for people publishing mono repos.It's not something we've actively tried to guard against though and will certainly be interested to see how organisations are interested in using the registry.
> Would the Registry be open to providing an API for us to register/publish a new module that is just a URL to the actual archive file?The public registry is unlikely to support this in the near future. The main reason for that is that we fairly intentionally choose to integrate it reasonably tightly with GitHub repositories to make it easier to work with and simpler to operate.
All that said I'll point out two things:1. The public registry _does_ support "nested" submodules - as long as there is at least one `.tf` file in the root module and preferably a README, you can put all your code into submodules which can actually be imported individually if required with `src = "org/module-name/provider//sub-module-name` we've not exposed that widely in docs/UI etc. yet but we do plan to make that a much more first-class experience soon. This doesn't solve for issues like the repo name convention but some of what you want can be achieved this way.
1. The public registry _does_ support "nested" submodules - as long as there is at least one `.tf` file in the root module and preferably a README, you can put all your code into submodules which can actually be imported individually if required with `src = "org/module-name/provider//sub-module-name` we've not exposed that widely in docs/UI etc. yet but we do plan to make that a much more first-class experience soon. This doesn't solve for issues like the repo name convention but some of what you want can be achieved this way.
Hi Paul,
On Monday, January 8, 2018 at 4:44:01 PM UTC-5, pba...@hashicorp.com wrote:Great question, thanks for taking the time to write it up with good background info.I'll give you my thoughts on some of those questions. For background I'm the main engineer working on the module registry currently however this is just my take rather than an official HashiCorp position that has been set in stone!Hi Paul,
Thanks for taking the time to write, and I'm sorry for the terrible delay in getting back to you with my follow-up questions here.
I would say it's unlikely we will encourage "mono repo" style modules in the public registry at least in the sense you describeright, I don't think they need to be _encouraged_, though I'm hoping it would be possible to use the registry with a mega-repo the way some of us choose to do (as you said, sometimes it makes a lot of sense).... you really want well-defined modules that do one thing well and can be easily discovered and then composed with others rather than a whole bunch of kitchen-sink frameworks that are only really designed to be used on their own.I don't disagree, and I'd like to publish our modules as separate consumable modules, but I'd like to continue managing them in git via one mega-repo, and that does not seem possible ATM.Longer term we'd hope to see more re-use of common modules, often maintained by vendors themselves, in the registry and the composition of several core modules from different vendors seems to loose a lot of the benefits of monolithic single-org repos.I think that will be great! Unfortunately, at least in my experience with Terraform and other CM tools, there are times when common/upstream modules will work, but most of the time I'm going to be managing some repo of modules to accomplish what's being asked of me.Concretely, some of the challenges for mono-repos are around versioning since one git tag applies to all the nested modules, and that many organisations need control over permissions that can be easily granted at repo level with different teams owning different modules etc.I'd be fine with all modules in a mega-repo getting the same version.
At the same time, I think I can work out those issues without pushing them up to the registry, and I think this is easily accomplished with an API in the TF registry that allows us to create/release a module with a URL we control, EG, if I can upload a .zip to S3 and tell the registry about it and give it a version, we'd be fine, no?
> Does the Terraform Registry plan to avoid/block support for mega-repos, or to allow for their use on the Terraform platform?I don't think we'd consciously try to "block" that use case, however as things are it's not obvious that the choices we make to optimize for reusable modules will necessarily be the right choices for people publishing mono repos.It's not something we've actively tried to guard against though and will certainly be interested to see how organisations are interested in using the registry.We would like to publish our modules on the registry, and use the registry as the standard way to distribute and use our modules, though we would like to manage some of these modules in mega-repos. Hosting the modules on S3 also seems to make sense for this situation.> Would the Registry be open to providing an API for us to register/publish a new module that is just a URL to the actual archive file?The public registry is unlikely to support this in the near future. The main reason for that is that we fairly intentionally choose to integrate it reasonably tightly with GitHub repositories to make it easier to work with and simpler to operate.Integrating with Github is a great idea, but I am not sure I see how forcing or requiring it is. I would love to publish modules on the Terraform Registry. An API to publish the module as a zip built by my CI system would allow me to do so. Is this completely untenable?
All that said I'll point out two things:1. The public registry _does_ support "nested" submodules - as long as there is at least one `.tf` file in the root module and preferably a README, you can put all your code into submodules which can actually be imported individually if required with `src = "org/module-name/provider//sub-module-name` we've not exposed that widely in docs/UI etc. yet but we do plan to make that a much more first-class experience soon. This doesn't solve for issues like the repo name convention but some of what you want can be achieved this way.I'll happily rename a repo to make it work. But I am wondering, in our case.. we have all modules in `tf-modules`, and a bunch of test/example env in `tests`. Those tests use a bunch of the modules in `tf-modules` and it all works very well. You have noted the registry will improve this experience soon, would our repo as it is laid out with the modules in `tf-modules` and TF env in `tests`, work out ok with the nested submodule idea you have presented? or would we need to shuffle around those module/test locations?
any recommendations are appreciated :)
Thanks!--
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-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/3cb22192-7382-4c8c-ae91-daaaebd6bff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks!
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-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/8f954277-bb2f-4263-bea7-120445ee8dc1%40googlegroups.com.
Best,Mitchell
It is unlikely we’ll uncouple ourselves from GitHub for the public registry, it was a design decision we made early on to simplify quite a lot for us.
All that said I'll point out two things:1. The public registry _does_ support "nested" submodules - as long as there is at least one `.tf` file in the root module and preferably a README, you can put all your code into submodules which can actually be imported individually if required with `src = "org/module-name/provider//sub-module-name` we've not exposed that widely in docs/UI etc. yet but we do plan to make that a much more first-class experience soon. This doesn't solve for issues like the repo name convention but some of what you want can be achieved this way.I'll happily rename a repo to make it work. But I am wondering, in our case.. we have all modules in `tf-modules`, and a bunch of test/example env in `tests`. Those tests use a bunch of the modules in `tf-modules` and it all works very well. You have noted the registry will improve this experience soon, would our repo as it is laid out with the modules in `tf-modules` and TF env in `tests`, work out ok with the nested submodule idea you have presented? or would we need to shuffle around those module/test locations?
any recommendations are appreciated :)As long as there is a root module (a “.tf” file in the root), you can reference any subdirectory using the advanced double-slash syntax:source = “myuser/mymodule/myprovider//subdir”This is a feature that is documented but only meant for advanced usage. The double-slash “//“ tells our downloader what separates the download URL from a directory change once downloaded. In this case, it’d download your module, then set the root directory to be “subdir” relative to that module.
What you’ll be sacrificing by using a non-standard format of course is documentation generation and so on. We’re also about to ship automatic example parsing/showcasing (via the examples directory as documented currently), showing submodules in the UI, and some more. And by using a non-standard structure you unfortunately won’t have any of this. But, you could still use the module.
I hope that helps, I’ve tried to lay out the options and tradeoffs.
I hope that helps, I’ve tried to lay out the options and tradeoffs.Yes, definitely, thank you!
--
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-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/2e91742b-1f04-42fc-9a66-7c5d658170b2%40googlegroups.com.
I'm a little confused, is the submodule / advanced use noted above non-standard? Or what is the non-standard part here?I may be confused as well. :)So the standard submodule (“nested module”) structure would be a directory “./modules/<name>” for each nested module. This is a flat directory — a nested module can’t itself have nested modules — but nested modules can reference each other via relative paths. If you do follow this format, you can have many modules in your single module and the registry frontend UI will eventually (very soon) expose these, including their README.
My “non-standard” comment was just if you put the modules in any other structure. You could still reference them using the double-slash notation but the registry (and any future tooling) wouldn’t find or treat them special.
Hey Jason,I think Mitchell covered pretty much everything there so I won't repeat but I just wanted to add one response to:> I'd be fine with all modules in a mega-repo getting the same version.
>
> At the same time, I think I can work out those issues without pushing them up to the registry, and I think this is easily accomplished with an API in the TF registry that allows us to create/release a module with a URL we control, EG, if I can upload a .zip to S3 and tell the registry about it and give it a version, we'd be fine, no?
You probably know this, but you can already import modules directly from GitHub [1] or S3 [2] (or many other places) just as easily as the registry. You don't get version constraint support but as discussed that's of minimal value with a mono-repo anyway - you can still bind to a specific commit or pet a version string in the S3 object name etc.
But to be pragmatic, if you don't need any of it's primary benefits of versioning and automated documentation and the ergonomics aren't working for you then there are other solutions too! The registry for now will likely remain optimised for people discovering smaller, composable modules since that is a use-case we think will become increasingly important and is not well served but the existing tooling (due to discovery, manual version constraint solving etc.).