By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For Cloud Engineers, DevOps, and Certification Takers)
What it is:The Terraform Registry is a public (or private) repository of pre-built, reusable infrastructure modules—think "Lego blocks" for your cloud. Verified Modules are battle-tested, officially supported modules (e.g., AWS VPC, Azure AKS) that follow best practices.
Why it matters in production:- Speed: Deploy a secure, multi-AZ VPC in 5 minutes instead of 5 hours.- Consistency: No more "works on my machine" drift—every team uses the same module.- Security: Verified modules are audited for misconfigurations (e.g., no open S3 buckets).- Cost: Avoid reinventing the wheel (and paying for it).
Real-world scenario:You’re a cloud engineer at a fintech startup. Your CTO demands a PCI-compliant AWS environment in 2 weeks. You could hand-code everything… or use a verified module for VPC, security groups, and logging. Which do you choose?
Production insight: Always check the module’s README.md for hidden costs (e.g., NAT Gateway pricing).
README.md
? Verified Modules
Production insight: Verified ≠ perfect. Still audit for your compliance needs (e.g., HIPAA).
? Module Source
terraform-aws-modules/vpc/aws
Production insight: Pin versions to avoid breaking changes (use version = "3.14.0").
version = "3.14.0"
? Module Inputs/Outputs
cidr_block
vpc_id
Production insight: Document outputs in your README—future you will thank you.
README
? Private Registry
Production insight: Use Terraform Cloud or GitHub Packages for private modules.
? Module Discovery
Prerequisites:- AWS account with admin IAM permissions.- Terraform installed (terraform --version).- AWS CLI configured (aws sts get-caller-identity).
terraform --version
aws sts get-caller-identity
Task: Deploy a 3-tier VPC (public/private subnets, NAT Gateway) using the verified terraform-aws-modules/vpc/aws module.
mkdir tf-vpc && cd tf-vpc touch main.tf
Paste this into main.tf:
main.tf
module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "3.14.0" # Pin to avoid breaking changes name = "prod-vpc" cidr = "10.0.0.0/16" azs = ["us-east-1a", "us-east-1b", "us-east-1c"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] enable_nat_gateway = true single_nat_gateway = true # Cost-saving: 1 NAT for all AZs tags = { Terraform = "true" Environment = "prod" } }
terraform init # Downloads the module terraform plan # Verify changes terraform apply # Type "yes" to confirm
prod-vpc
bash aws ec2 describe-vpcs --filters "Name=tag:Name,Values=prod-vpc"
Expected Output:
{ "Vpcs": [ { "VpcId": "vpc-12345678", "CidrBlock": "10.0.0.0/16", "Tags": [{ "Key": "Name", "Value": "prod-vpc" }] } ] }
ec2:Describe*
sensitive = true
single_nat_gateway = true
RI: true
terraform-aws-modules/ec2-instance
Environment
Owner
enable_flow_log = true
terraform apply
version = "x.y.z"
var.cidr_block
❌ acme-corp/vpc (no verification).
acme-corp/vpc
"How do you avoid breaking changes in a module?"
❌ Use latest (exam trap!).
latest
"What’s the cost-saving input for NAT Gateway?"
enable_nat_gateway = false
Community = use at your own risk (check GitHub stars/issues).
Module Inputs vs. Outputs:
Challenge:Deploy an AWS EKS cluster using the verified terraform-aws-modules/eks/aws module. Configure it with: - 2 worker nodes (t3.medium).- Private endpoint enabled.- Output the cluster name and endpoint.
terraform-aws-modules/eks/aws
Solution:
module "eks" { source = "terraform-aws-modules/eks/aws" version = "18.29.0" cluster_name = "prod-eks" cluster_version = "1.27" subnets = module.vpc.private_subnets # From earlier VPC module node_groups = { eks_nodes = { desired_capacity = 2 max_capacity = 3 min_capacity = 1 instance_types = ["t3.medium"] } } cluster_endpoint_private_access = true } output "cluster_name" { value = module.eks.cluster_name } output "cluster_endpoint" { value = module.eks.cluster_endpoint }
Why it works:- Uses a verified module (blue checkmark).- Private endpoint = secure (no public internet access).- Outputs let you reference the cluster elsewhere.
terraform init
source = "terraform-aws-modules/vpc/aws"
output "vpc_id" { value = module.vpc.vpc_id }
source = "app.terraform.io/my-org/vpc/aws"
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.