• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Terraform
  • Install
  • Tutorials
    • About the Docs
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • CDK for Terraform
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
  • Registry(opens in new tab)
  • Try Cloud(opens in new tab)
  • Sign up
Terraform Home

Configuration Language

Skip to main content
  • Configuration Language
  • Data Sources
    • Overview
    • Module Blocks
    • Module Sources
      • Overview
      • Standard Module Structure
      • Providers Within Modules
      • Best Practices: Module Composition
      • Publishing Modules
      • Refactoring Modules
  • Upgrading to Terraform v1.3
  • v1.x Compatibility Promises

  • Terraform Internals

  • Resources

  • Tutorial Library
  • Certifications
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  • Terraform Registry
    (opens in new tab)
  1. Developer
  2. Terraform
  3. Configuration Language
  4. Modules
  5. Module Development
  6. Publishing Modules
  • Terraform
  • v1.2.x
  • v1.1 and earlier

ยปPublishing Modules

If you've built a module that you intend to be reused, we recommend publishing the module on the Terraform Registry. This will version your module, generate documentation, and more.

Published modules can be easily consumed by Terraform, and users can constrain module versions for safe and predictable updates. The following example shows how a caller might use a module from the Terraform Registry:

module "consul" {
  source = "hashicorp/consul/aws"
}

If you do not wish to publish your modules in the public registry, you can instead use a private registry to get the same benefits.

We welcome contributions of Terraform modules from our community members, partners, and customers. Our ecosystem is made richer by each new module created or an existing one updated, as they reflect the wide range of experience and technical requirements of the community that uses them. Our cloud provider partners often seek to develop specific modules for popular or challenging use cases on their platform and utilize them as valuable learning experiences to empathize with their users. Similarly, our community module developers incorporate a variety of opinions and use cases from the broader Terraform community. Both types of modules have their place in the Terraform registry, accessible to practitioners who can decide which modules best fit their requirements.

Distribution via other sources

Although the registry is the native mechanism for distributing re-usable modules, Terraform can also install modules from various other sources. The alternative sources do not support the first-class versioning mechanism, but some sources have their own mechanisms for selecting particular VCS commits, etc.

We recommend that modules distributed via other protocols still use the standard module structure so that they can be used in a similar way as a registry module or be published on the registry at a later time.

Edit this page on GitHub

On this page

  1. Publishing Modules
  2. Distribution via other sources
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)