How to Fix the Terraform Stuck on “Refreshing State…” Problem

  • Home /
  • Blog Posts /
  • How to fix the Terraform stuck on “Refreshing state…” problem

Terraform is a fantastic tool to help automate your infrastructure as code.

Quite a few times however, I have noticed a few strange issues, one of them is when Terraform gets stuck while refreshing the state.

This can happen when running terraform plan or in-fact, when running a range of other commands that require the state-file to be refreshed and used.

The problem

Terraform gets stuck on this message:

Refreshing Terraform state in-memory prior to plan…

The solution

Before you run your terraform plan (or other command where it gets stuck), first run this:

export TF_LOG=TRACE

Then try and run your command again.

This will tell you exactly why the problem is occurring so that you know just what to fix.