Interview Prep/Terraform/Modules and Code Structure

Two modules require different version ranges of the same provider and `init` fails. What now?

AdvancedScenarioModules and Code Structure
Answer

Situation read → Version constraints from all modules must intersect.

What I'd do →

  1. Run terraform providers to see which module requires what.
  2. Update or fork the module with the overly strict constraint (~> 4.0 while others need >= 5).
  3. In your own modules use >= lower bounds and let the root set the ceiling.

Why → Terraform installs one version per provider per root module, so module constraints must be compatible.

Interview tip → Strict upper bounds in shared modules are the usual culprit.

All Terraform questions Roadmap: Terraform

More on Modules and Code Structure