I set up terraform to use a backend to remotely store the statefile. That works fine.

My project take several minutes for the full terraform apply to complete. During development, sometimes one of the later stages hangs (seemingly) eternally. I need the outputs in order to manually connect to the servers and inspect what is broken. However, the statefile does not get written until the terraform process completes. So there are no outputs available during the first terraform apply.

Is there a way to make terraform update the statefile intermediately, while it is still busy applying things?

I know I could solve this by separating the process into multiple modules, and apply each one after the other. But I am looking for a solution where I can still apply all at once.

1

There are 1 answers

0
ashraf minhaj On BEST ANSWER

When you run

terraform plan

you get the outputs also. What you can do is save that file before applying -

terraform plan -out tf.plan

Then you apply. You can look into this file to find the changes.

Remember, you won't find the output data that were to be showed after apply, like a thing that does not exist yet.

Best wishes.