Managing module versions
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Pinning follows the module source
- Registry modules: the version argument
- Pinning Git modules with ?ref=
- Installing and updating modules
- Exam-pattern recognition: version traps
How module version pinning varies by source type
| Aspect | Registry module | Git (VCS) module | Local path module |
|---|---|---|---|
| Pinning mechanism | `version` argument | `?ref=` in the source URL | None (shares caller's version) |
| Accepted values | Constraint string: `"~> 1.2"`, `">= 1.0"`, `"1.2.0"` | Any git ref: branch, tag, or commit SHA | Not applicable |
| If unspecified | `init` installs the newest available release | Clones the default branch (`HEAD`) | Always in lockstep with the caller |
| Move to a newer version | `init -upgrade` / `get -update` within the constraint | Edit `?ref=` to the new tag, then re-init | Not applicable |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.