module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.0.0"
name = "production-vpc"
cidr = "10.0.0.0/16"
}
A module is a directory of .tf files that you can call multiple times with different inputs. The source can be a local path, a Git repo, a Terraform Registry module, or an S3 bucket.
Modules let you DRY up your infrastructure code. Common pattern: one module for VPC, one for EKS, one for RDS — all called from a root module.