Did this terraform plan -out=tfplan followed by
terraform graph -type=plan -plan=tfplan | dot -Tpng > tfplan.png which gives the following error.
Error: : syntax error in line 1 near 'digraph
dot -V: dot - graphviz version 8.1.0
terraform -version: Terraform v1.5.6
Unfortunately I’m not sure what to suggest here. The keyword
digraph is the typical initial token in a valid graphviz “dot” file representing a directed graph, so I cannot explain why the
dot program would reject that input.
I do notice that in the error message you shared there seems to be a
' symbol just before
digraph, but I’m not sure if that’s intended to be taken literally or if that was just the quotes around the keyword “digraph” and you’ve missed the closing quote when you copied the error message.
It might help to run the
terraform graph ... command first, without piping it into
dot, to verify that its output seems sensible. If you’re not sure how to decide if the output is sensible, you could share that text here and I will try to help review it.
If you do share any further code or shell output here, please mark it up properly as “Preformatted text” using the forum’s formatting features (in the toolbar above the editor window) so that the output is readable and won’t be misinterpreted by the forum software as normal text.