Skip to main content
DevOps Insightsguides & answers

Terraform · troubleshooting

Error: Module not installed

Terraform found a module block it has not downloaded or linked yet, or one whose source changed since terraform init last ran. Run terraform init again in that directory.

Reproduced on Terraform 1.14.0, . Where the text says “reproduced”, the behaviour was run on that version, not taken from documentation.

First published

New to this? Read what is actually happening first, then come back to the steps.

On this page · 8 sections

Before you start

  • A terminal in the directory you run Terraform in, with access to the module sources.

Run this first

step 1 of 1
terraform init

Look for - NAME in SOURCE for every module block

Lists each module as it installs it, with its source.

Work out which cause you have

A few questions to narrow the list. Every answer ends in a command that confirms or rules the cause out — this cannot see your cluster, so nothing here is a certainty until you have checked.

Narrow it down

0 answered · nothing is sent anywhere

Which message do you see?

Cause space

2 of 2 still possible

  • init has not run in this checkoutCommon
  • A module was added or its source changedCommon

Nothing ruled out yet. Answer the question above and the branches your answer eliminates will strike through here.

Or diagnose it manually

In this order. The first command usually contains the whole answer.

  1. Step 1

    terraform init

    Lists each module as it installs it, with its source.

    Look for - NAME in SOURCE for every module block

Every cause, and how to fix it

Ordered by how often each one turns out to be the answer.

init has not run in this checkout

Common

A fresh clone, a CI job, or a different working directory, where .terraform does not exist.

Confirm

ls .terraform/modules/modules.json

No such file

Fix

  • Run terraform init in the same directory before validate or plan.
  • In a CI job that only validates: terraform init -backend=false, then terraform validate.
terraform init -backend=false -input=false
terraform validate

Reproduced on Terraform 1.14.0: installed the module and validated.

A module was added or its source changed

Common

init installed the old set of modules; the configuration now asks for a different one.

Confirm

git diff -- '*.tf' | grep -n source

A changed or new source line

Fix

  • Run terraform init again; it installs the new module and keeps the rest.

Understanding it properly

Skip this if you are mid-incident — the working part of the page is above. Worth reading afterwards, because understanding the mechanism is what stops the next one.

In plain terms

terraform init fetches every module the configuration uses into the .terraform directory. Adding a module, changing its source, or running in a fresh CI checkout without that directory leaves Terraform with nothing to read, and it says so. Re-running init fixes it.

Words used on this page

.terraform directory
Where terraform init keeps downloaded modules and providers; it is not committed.
init -backend=false
Installs modules and providers without connecting to the state backend; enough for validate in CI.
What is actually happening

Reproduced on 23 October 2026 with Terraform 1.14.0 and a local module. terraform validate before init printed Error: Module not installed and This module is not yet installed. Run "terraform init" to install all modules required by this configuration.

After the module's source was changed, the message became Error: Module source has changed, again asking for terraform init. In both cases nothing else was wrong with the configuration.

terraform init fixed both, and so did terraform init -backend=false, which suits CI jobs that only validate and have no state credentials.

How to tell this is your problem
WhereWhat you see
terraform validate or planError: Module not installed … This module is not yet installed. Run "terraform init"
After editing a module blockError: Module source has changed … The source address was changed since this module was installed.

How to know it is actually fixed

  • terraform validate prints Success! The configuration is valid.

Stopping it happening again

  • Make terraform init the first step of every CI job, and run it after pulling changes that touch module blocks.
  • Do not commit or cache .terraform across branches; let init rebuild it.

Sources

Behaviour described here is drawn from official documentation. Where a figure could not be confirmed on an official page it is attributed in the text rather than stated as canonical.

Did this get you to an answer?

No text box on purpose — please do not paste production logs anywhere

Something wrong or out of date? Report it