github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/modules/publish.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Publishing Modules" 4 sidebar_current: "docs-modules-publish" 5 description: |- 6 A module is a container for multiple resources that are used together. 7 --- 8 9 ## Publishing Modules 10 11 If you've built a module that you intend to be reused, we recommend 12 [publishing the module](/docs/registry/modules/publish.html) on the 13 [Terraform Registry](https://registry.terraform.io). This will version 14 your module, generate documentation, and more. 15 16 Published modules can be easily consumed by Terraform, and users can 17 [constrain module versions](/docs/configuration/modules.html#module-versions) 18 for safe and predictable updates. The following example shows how a caller 19 might use a module from the Terraform Registry: 20 21 ```hcl 22 module "consul" { 23 source = "hashicorp/consul/aws" 24 } 25 ``` 26 27 If you do not wish to publish your modules in the public registry, you can 28 instead use a [private registry](/docs/registry/private.html) to get 29 the same benefits. 30 31 ### Distribution via other sources 32 33 Although the registry is the native mechanism for distributing re-usable 34 modules, Terraform can also install modules from 35 [various other sources](/docs/modules/sources.html). The alternative sources 36 do not support the first-class versioning mechanism, but some sources have 37 their own mechanisms for selecting particular VCS commits, etc. 38 39 We recommend that modules distributed via other protocols still use the 40 [standard module structure](./#standard-module-structure) so that it can 41 be used in a similar way to a registry module, or even _become_ a registry 42 module at a later time.