-
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
error when parsing input: unexpected end of JSON input #20
Comments
May I know which CICD you use ? Also, how terraform is installed ? Reason for asking:For Github actions,If you are using Check if there is similar thing happen in your CICD setup. |
@dineshba I run in GitLab CI. |
Could you try this once? terraform show -json tfplan > output.json
tf-summarize output.json
# if we still get the json parse error,
# cat output.json # see if the output.json is valid json |
https://docs.gitlab.com/runner/shells/
Temporary workaround 🏄♂️:
|
Glad that we have a workaround. I will try to reproduce this issue and understand the reason behind it. This will help me to fix this issue. |
I had the same problem. But I figured out that I used a non-existing file calling |
Hi @kayman-mk. Thanks for confirming the issue. For the non-existing file, I am getting below error $ tf-summarize invalid.json
error reading from input: error when opening file invalid.json: open invalid.json: no such file or directory and I am in |
@dineshba I am seeing a similar error using the latest version tag v0.3.2 installed via go. |
yes, still same with 0.3.2, however point above workaround works pretty well. So you output a json plan from terraform then pipe it to tf-summarize, e.g.: |
@GregoryOrciuch Yeah workaround is now working for me now. I was doing something wrong with terraform show step. |
Got the same error with When i download the exact plan file from the pipeline and run it locally using the same tf-summarize version, it works though. |
I'm seeing this same issue on a GitHub actions runner, I've fixed it with |
As a data point, I am unable to reproduce this locally on Mac OS (Sonoma 14.2.1) using
However, the same command(s) and
However, passing raw JSON via STDIN works as expected both locally on Mac OS and in GitHub Actions's Ubuntu runner:
This suggests to me the possibility of an OS-specific bug/inconsistently related to how |
👋 @dineshba I've created a quick fix for this bug via PR #64. I've also managed to create a reproducible demo for you over in #63, whose GitHub Actions runs encounter the |
* correct input reading logic This addresses #20 and ensures input is read from the plan file -- and not via STDIN -- if a plan file argument is provided. This also seeks to improve some of the error messaging to be a bit more clear. * demo issue 20 fix via GH Actions Ideally, tf-summarize would feature a suite of automated tests verifying its functionality. In absenece of that, this demos the issue #20 fix via GH Actions. * use consistent TF version when invoking TF - ensure the generation of the `example` directory data is done in a consistent, reproducible fashion - ensure GH Actions uses the same version of TF expected by the `example` directory - add plan and plan JSON files to source control, for testing purposes * add automated test verifying STDIN vs file-provided input This adds a basic automated test verifying the validity of the issue #20 fix. * remove `demo` job from Build GH Actions workflow Per code review request, @dineshba would prefer this be kept in a separate file.
@dineshba This issue was addressed in PR #64 (now merged), but never included in a tf-summarize GitHub release ( |
let me release it tomorrow with another PR merged #70 |
Created the new release v0.3.8 @mdb. Thanks for ur PRs. Really appreciated. |
I'm trying to fire it from CICD where I install version 0.2.2 (and tried 0.2.5 with same effect).
I took the one for linux_amd64 release build, but it fail to kind of run:
but that is very legit tf.plan file.
If I run it locally (when tf-summarize is installed by macos brew it works well), so it has to be something with a release thing.
Any suggestions?
The text was updated successfully, but these errors were encountered: