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.
Terraform gets stuck on this message:
Refreshing Terraform state in-memory prior to plan…
Before you run your
terraform plan (or other command where it gets stuck), first run this:
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.