-
Notifications
You must be signed in to change notification settings - Fork 13
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
Failed to parse Terraform plan JSON file with YAML error #24
Comments
Hi, @jwicks! I was able to reproduce this issue using the Terraform github action. The problem is that the Terraform github action wraps the Terraform binary with a script that does two things:
So assuming you're doing something like this:
Your JSON file ends up with a few extra lines. It's definitely not ideal, but two potential ways that you can work around this is to either use the Terraform binary directly or strip out those lines, like:
The YAML specification is actually a superset of JSON, so all valid JSON is also valid YAML. The YAML parser that we're using gives us some nice features beyond what's available in JSON libraries that we looked at and it lets us reuse code in a few places. |
If you're using the
If this resolves your issue, I'll go ahead and add this to the README. |
Nice! Yep using |
I have a strange error when using this action to scan a Terraform plan output file in JSON format:
Here is my workflow step config:
I've debugged and made sure the
infrastructure/terraform.plan.json
file is there. It starts with{"format_version":"0.2","terraform_version":"1.0.5",...
I've run regula via docker from my workstation and confirmed it works:
Also strangely, when I run the above
docker run...
approach from a GitHub Action shell command, I get the same error as using the github-action:Is this an issue with the regula-action or regula itself? Why is regula attempting to parse my TF plan JSON file using YAML? I'm assuming it's executing this line: https://github.com/fugue/regula/blob/9d6ddbaf2fa6e1bfe8b4afb50fbe0548ce5f8013/pkg/loader/tfplan.go#L35
The text was updated successfully, but these errors were encountered: