liveBook · Manning

Terraform Provider Registry

As explained in Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu

The Terraform Public Registry is a publicly accessible registry for publishing and obtaining Terraform modules and providers.

When a Terraform workspace needs a provider or reusable module, the Terraform Public Registry supplies a public place to find it. Running terraform init downloads the workspace’s required providers from the registry and configures them locally. Provider documentation also exposes available resources, helping map a service’s capabilities before implementation. section 2.4.1

The registry fits Terraform’s provider model: Terraform Core translates configuration into provider operations, while providers handle communication with vendor systems. Providers can therefore be released independently of Terraform, and the registry makes thousands of provider interfaces available. section 1.2

Selecting a public module

A VPN capability can be added without building the implementation from scratch by declaring a registry module: module "vpn" { source = "tedivm/cloudinit/general" version = "~> 1.0" services = ["consul", "nomad"] } The source identifies the public module, while version constrains which releases Terraform may use. A version range gives the configuration control over when module updates are accepted. section 3.1.1

Publishing requires registering the repository once, then maintaining releases:

  • Publish modules from a public GitHub repository; submit the repository to the registry and select it through the publishing workflow. section 8.1.3
  • Create a properly semantic-versioned Git tag or release; the registry monitors the repository and adds new releases automatically. section 8.1.3
  • Register a provider by adding a public signing key, selecting Publish and Provider, and connecting the provider repository; subsequent releases appear automatically. section 12.8.3
Listing 3.1 Using a public module
module "vpn" {
  source  = "tedivm/cloudinit/general"                  #1
  version = "~> 1.0"                                    #2
 
  services = ["consul", "nomad"]                        #3
}

Inspect the annotated module declaration showing how source, version, and module arguments combine to consume a public registry module. section 3.1.1

How Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu covers it

How deep it goes
Explains provider discovery, initialization, module version constraints, and publication workflows, but stops short of registry internals.
Examples
Uses terraform init, a VPN module declaration, public GitHub repositories, provider signing keys, and semantic-versioned releases.
What it assumes
Assumes familiarity with Terraform workspaces, providers, modules, GitHub repositories, and configuration blocks.
What you can do after
Apply the registry by downloading providers, selecting versioned modules, and publishing registered providers or modules.
How it connects
Connects Terraform Core with providers, modules, Terraform CLI, GitHub repositories, semantic versioning, and signing keys.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu. The section links point to the parts of the book it draws on.