From 08b8f7270ee408991cdf3dd7047bcc5a9dae13a5 Mon Sep 17 00:00:00 2001 From: Lars Gohlke Date: Fri, 26 Jan 2024 15:27:21 +0100 Subject: [PATCH] adds tf_graph --- tools/terraform.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/terraform.sh b/tools/terraform.sh index 21aa071..ec3f973 100644 --- a/tools/terraform.sh +++ b/tools/terraform.sh @@ -153,6 +153,18 @@ function tf_plan { fi } +tf_graph() { + local plan=$(mktemp) + local graph=$(mktemp) + local image=$(mktemp) + + terraform plan -out "$plan" $* + terraform graph -plan="$plan" -draw-cycles > "$graph" + + dot -Tpng -o "${image}.png" "$graph" + open "${image}.png" +} + function tf_test { if [[ ! -d tests ]]; then read -r -p "Want to create a tests directory? (y/n) : " -n 1 reply