0
votes

Apologies if this may appear like a trivial question, but when I usually run terraform plan or terraform apply you get a dump at the end of information about what what resources will be created, changed or destroyed. This is great!

However, as you may notice, sometimes this output of resources exceeds the terminal buffer, so I can't see all the resources being changed.

So how would I dump this exact information into a readable file so that I can view everything that is going to be changed?

Disclaimer - it is not terraform plan -out=tfplan, as this creates an unreadable file.

Anyone have any suggestions here? I also tried stdout into a file, but this did not show the full dump of resources as I need it to.

2
Why not just redirect stdout into a file?ydaetskcoR
"but this did not show the full dump of resources as I need it to" Why not? That is very unusual behavior.Matt Schuchard

2 Answers

2
votes

Edit: You can use terraform plan -out=/path/to/file

If you are on linux/Mac then you can redirect output to a file.

$terraform plan > output.txt

You can then use any reader like cat,more etc to read a file.

P.S: I am not an active user on windows,so I am not very sure if the same will work on windows.

2
votes

Apologies for the delayed response. After running plan with output file, I use show command with -no-color, for example:

terraform plan -out tf.plan

terraform show -no-color tf.plan > tfplan.txt