Giter Club home page Giter Club logo

go-terraform-plan's Introduction

Converts a Terraform plan file to JSON. Also provides a Go library for reading Terraform plan files.

We use the actual Terraform libraries to ensure correctness.

Installation

To install, run:

go get github.com/justinbarrick/go-terraform-plan
go install github.com/justinbarrick/go-terraform-plan

Docker

There is also a docker image:

$ terraform plan -out=terraform.plan
$ docker run -w "$(pwd)" -v "$(pwd):$(pwd)" justinbarrick/terraform-plan -plan ./terraform.plan
$ cat terraform.plan |docker run -i justinbarrick/terraform-plan
$

Usage

To use, write out a terraform plan and then parse it:

$ terraform plan -out=terraform.plan
$ go-terraform-plan ./terraform.plan |jq .
{
  "Stats": {
    "ToAdd": 0,
    "ToChange": 1,
    "ToDestroy": 0
  },
  "Resources": [
    {
      "Addr": {
        "Path": null,
        "Index": -1,
        "InstanceType": 1,
        "InstanceTypeSet": false,
        "Name": "kubernetes_subdomains",
        "Type": "cloudflare_record",
        "Mode": 0
      },
      "Action": "Update",
      "ActionRaw": 3,
      "Attributes": [
        {
          "Path": "ttl",
          "Action": "Update",
          "ActionRaw": 3,
          "OldValue": "1",
          "NewValue": "3600",
          "NewComputed": false,
          "Sensitive": false,
          "ForcesNew": false
        }
      ],
      "Tainted": false,
      "Deposed": false
    }
  ]
}

As a library

You can also use this as a library. See plan/plan_test.go for an example.

go-terraform-plan's People

Stargazers

René Kuhn avatar Nishad Saithaly avatar  avatar Max Gelman avatar

Watchers

James Cloos avatar

Forkers

seanson

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.