-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to have an empty output #6
Comments
Thanks for trying out the tool @xocasdashdash . Today, we have to run Thoughts ? |
Is the command something like this? terraform plan -detailed-exitcode -out planfile
status=$?
if [[ "$status" == "0" ]]; then
echo "no changes"
elif [[ "$status" == "1" ]]; then
echo "terraform threw an error"
elif [[ "$status" == "2" ]]; then
echo "diff detected, running tf-summarizer"
status=0
tf-summarizer planfile
else
echo "terraform threw an unknown error"
fi
rm -f planfile
exit $status |
I also have the same query. I use Terragrunt which generates lot of Terraform plans. After the json plans are generated, I iterate through all the json files, and print the path to reference the terraform module/source (see below PATH:) and call tf-summarize for each plan. However when the plan are empty, then tf-summarize will return nothing but I am still display the module path with no changes (example PATH: components/worker/event-bus/). It would be much better if I could test tf-summarize invocation to know if it has detected changes so I can avoid print the path when there are no detected changes. Example:
Desired output:
Thank you very much for your assistance. |
Loving the tool,
I'm looking to add an option in order to know if the plan is empty and either output a preset message (
no changes in current plan
), putting out an empty plan or exiting with a specific error code (terraform already does this with the-detailed-exitcode
flag).What do you think?
The text was updated successfully, but these errors were encountered: