Git Product home page Git Product logo

Comments (3)

jwicks avatar jwicks commented on June 27, 2024 1

Nice! Yep using terraform_wrapper: false fixed it for me!! 👍 Thanks!

from regula-action.

jason-fugue avatar jason-fugue commented on June 27, 2024

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:

  1. It echoes out the command that it's running
  2. After running the command, it echoes out two Github Action workflow commands:
::set-output name=std-err
::set-output name=exit-code

So assuming you're doing something like this:

terraform show -json plan.tfplan > terraform.plan.json

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:

terraform show -json plan.tfplan | tail -n +2 | head -n 1 > terraform.plan.json

Why is regula attempting to parse my TF plan JSON file using YAML?

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.

from regula-action.

jason-fugue avatar jason-fugue commented on June 27, 2024

If you're using the setup-terraform action, there's an option to use the Terraform binary without the wrapper and it seems to fix the issue:

    - uses: hashicorp/setup-terraform@v1
      with:
        terraform_wrapper: false
        terraform_version: 1.0.5

If this resolves your issue, I'll go ahead and add this to the README.

from regula-action.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.