Member-only story

How to publish and share privately Terraform modules

Mohamed Dhaoui
9 min readSep 17, 2022

Software development encourages code reuse through reusable artifacts, such as libraries, packages and modules. Most programming languages enable developers to package and publish these reusable components and make them available on a registry. For example, Python has Python Package Index, PowerShell has PowerShell Gallery, Javascript has npm. There are also Cloud solutions like Google Artifact Registry that helps to publish and share containers, java or python libraries.

For Terraform users, the Terraform Registry enables the distribution of Terraform modules, which are reusable configurations. The Terraform Registry acts as a centralized repository for module sharing, making modules easier to discover and reuse.

The Terraform Registry is available in two variants:

  • Public Registry: houses official Terraform providers — which are services that interact with an API to expose and manage a specific resource — and community-contributed modules. Anyone can publish and consume providers, modules, and policies on the public Terraform Registry.
  • Private Registry: available as part of the Terraform Cloud, and it enables…

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Mohamed Dhaoui
Mohamed Dhaoui

Written by Mohamed Dhaoui

Lead Data engineer and Data science practitioner ! Interested in data science and software development topics. GCP 5x certified and Go fan.

Responses (3)

Write a response

Hello Mohamed,
Great article.
I followed same steps to publish a module to terraform registry.
but after running curl command, getting title not found error
curl \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/vnd.api+json"…

Nice article.
You seem to miss the one catch that private modules have when hosted in this way.
If you manage multiple organizations then you must have the module published to each organization individually, and then the code for each organization to…

Good article. I am trying the same in an automated pipeline using Python. However, i get an error as Setup Failed when i upload the tar file. Any thoughts as it doesnt have much logs to indicate what went wrong.