How do you consume a versioned module from a VCS or the Terraform Registry?
Answer
module "vpc" {
source = "git::https://github.com/org/infra-modules.git//vpc?ref=v1.2.3"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b"]
}
For registry modules, use
versionconstraints (for exampleversion = ">= 1.2.0, < 2.0.0").Always pin module versions to keep plans reproducible and review upstream releases before upgrading.
Prefer tags or immutable SHAs for VCS sources to guarantee repeatable builds.