Rationale for Correct Answer: Setting the module version (for registry modules) pins the module release Terraform will use. By pinning the version, Terraform will not “update” the module to newer releases during terraform init -upgrade or terraform get -update unless you change the version constraint. This is the standard way to control module updates and keep module code stable across runs.
Analysis of Incorrect Options (Distractors):
B (lifecycle): lifecycle is for resources, not module blocks.
C (count): count controls how many module instances are created; it doesn’t control module source updates.
D (source): source tells Terraform where the module comes from; it doesn’t prevent updates by itself (a VCS/ref pin would be done in the source string, but the module block argument that achieves this in the typical module workflow is version for registry modules).
Key Concept: Module version pinning to control module upgrades.
[Reference: Terraform Objectives — Interact with Terraform Modules (module sources and versioning)., , , , , ]
Submit