The Terraform Registry is the official catalog for discovering and consuming modules and providers. In real-world work, "which module, at which version, and how to pin it" largely determines quality and reproducibility.
This article walks through how to identify Verified modules, versioning, reading inputs/outputs, provider integration, and the introduction procedure — woven together with the perspective of the Associate exam.
The Terraform Registry hosts both modules and providers. Modules are referenced by setting `source` to an address in the form <namespace>/<name>/<provider> (e.g. terraform-aws-modules/vpc/aws).
As trust indicators, check the publisher's namespace, update frequency, download count, README/Examples, how issues are resolved, and Registry badges (such as Verified). The UI and badge labels can change over time, but generally "Verified" indicates a reviewed publisher, signaling higher expected quality and maintenance.
| Type | Source / Marker | Main Benefits | Main Risks / Caveats |
|---|---|---|---|
| Verified module | Verified badge, established namespace | Higher expected quality and maintenance; thorough docs | Major updates may still introduce breaking changes |
| Community (unverified) module | General namespace, no badge | Wide variety of choices; covers niche requirements | Variable quality; risk of abandoned maintenance |
| In-house module | Internal repo / Private Registry | Fits requirements; review and security managed in-house | Initial dev and maintenance cost; risk of tribal knowledge |
Modules generally follow SemVer. Expect major bumps for breaking changes, minor for backward-compatible additions, and patches for fixes. Terraform does not pin module versions in the lock file, so you must explicitly state constraints in the `version` of the `module` block.
Providers are constrained via `required_providers` and pinned in `.terraform.lock.hcl` (created/updated at init). This distinction shows up on the exam and is also easy to mix up in practice.
Each module's Registry page organizes Inputs (variables), Outputs, Resources, and Examples. Start with Examples to grasp the minimal configuration, then read through Inputs from the top, checking required vs optional, type, default, nullable, and sensitive. Outputs are the entry point for values referenced by downstream modules or external integrations.
If submodules exist, they are often split by purpose — choose them without excess or omission.
Modules use providers internally, but provider configuration and credentials should generally be set at the root module, passing aliases through the `providers` meta-argument as needed. Alias design is critical for region splits and multi-account operations.
`.terraform.lock.hcl` is a mechanism for pinning provider binaries — it does not apply to modules. Remember the role split: modules pinned via version constraints, providers pinned via the lock file.
As an example, adopt a Verified module that builds an AWS VPC. Search the Registry for "terraform-aws-modules/vpc/aws," and review the README, Inputs/Outputs, Requirements, and version history (CHANGELOG). Watch for compatibility across major versions, and pin with `~>` to allow only minor and patch updates.
Starting from the minimal configuration, parameterize design choices like CIDR and subnet layout to match your in-house standards (naming, tags, partition policy).
Minimal example (including version pinning and provider constraints)
terraform {
required_version = ">= 1.4.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = var.aws_region
}
variable "aws_region" {
type = string
description = "AWS region"
default = "ap-northeast-1"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"
name = "nicheelab-main"
cidr = "10.10.0.0/16"
azs = ["ap-northeast-1a", "ap-northeast-1c"]
private_subnets = ["10.10.1.0/24", "10.10.2.0/24"]
public_subnets = ["10.10.11.0/24", "10.10.12.0/24"]
enable_nat_gateway = true
single_nat_gateway = true
tags = {
Project = "NicheeLab"
Env = "dev"
}
}
output "vpc_id" {
value = module.vpc.vpc_id
}
Frequent topics: how to reference the Registry (the form of the source address), the difference between pinning modules and providers, trust indicators like Verified, how to read variables/outputs, and the basic init/plan/apply flow.
Pitfalls include unintended upgrades from omitting `version` on a module, missing provider aliases, and Requirements mismatches (e.g. failing to meet the minimum Terraform or provider version).
Flow from Registry to root/child modules and providers
Associate
問題 1
You are introducing a Verified module from the Terraform Registry. Which is the most appropriate way to prevent unplanned diffs caused by unexpected future changes?
正解: A
Terraform does not pin modules via the lock file, so the recommended approach is to state a SemVer constraint in the module block's version. Providers are pinned via required_providers and the lock file, but modules require a separate version specification. Pointing directly at a branch or upgrading on every run hurts reproducibility.
What's the difference between Verified and Official?
In the Registry, providers owned by HashiCorp are labeled "Official," while partners and reviewed publishers get the "Verified" badge. For modules, the practical approach is to check trust indicators like Verified along with the publisher's track record. UI labels can change over time, so ultimately judge based on the README, changelog, and how issues are handled.
Can modules be locked completely?
Modules don't have a .lock file like providers do. Practical measures include strictly pinning with SemVer (e.g. "= 5.1.2" or "~> 5.1"), avoiding `terraform init -upgrade` when it's not needed, and locking the Terraform version and provider constraints in CI. For stricter control, distributing only audited versions through an internal Private Registry is an effective approach.
How do I apply the same module across multiple AWS regions/accounts?
Define multiple `provider "aws"` blocks with aliases at the root, then map them via the module's `providers` meta-argument. Use variables for regions and credentials, and switch between them via workspaces or per-environment tfvars for safe operation.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
HCL Syntax: Terraform's Configuration Language (2026)
HCL2 fundamentals for Terraform — blocks, attributes, expres...
Terraform Authoring & Operations Pro: Complete Guide (2026)
Tactics for the Terraform Pro exam — module authoring, works...
Terraform Providers: Plugin Management Fundamentals (2026)
Provider mechanics — required_providers, versions, mirrors, ...
Terraform Resource Blocks: Declarative Infra Units (2026)
Resource block fundamentals — addresses, references, common ...
Terraform Data Sources: Read-Only External Data (2026)
Data source basics — declaration, refresh behavior, dependen...