Skip to content

azuretek/tfjson

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tfjson

Utility to read in a Terraform plan file and dump it out in JSON. Standalone version of Terraform PR #3170.

Installation

$ go get github.com/rcyrus/tfjson

Usage

Given the following Terraform resources:

provider "aws" {
  region = "us-east-1"
}

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

module "inner" {
  source = "./inner"
}

// in inner module:

resource "aws_vpc" "inner" {
  cidr_block = "10.0.0.0/8"
}

Running terraform plan -out=terraform.tfplan produces a Terraform plan file. The JSON representation produced by tfjson looks like:

$ tfjson terraform.tfplan
{
    "aws_vpc.main": {
        "cidr_block": "10.0.0.0/16",
        "default_network_acl_id": "",
        "default_route_table_id": "",
        "default_security_group_id": "",
        "destroy": false,
        "destroy_tainted": false,
        "dhcp_options_id": "",
        "enable_classiclink": "",
        "enable_dns_hostnames": "",
        "enable_dns_support": "",
        "id": "",
        "instance_tenancy": "",
        "main_route_table_id": ""
    },
    "destroy": false,
    "inner": {
        "aws_vpc.inner": {
            "cidr_block": "10.0.0.0/8",
            "default_network_acl_id": "",
            "default_route_table_id": "",
            "default_security_group_id": "",
            "destroy": false,
            "destroy_tainted": false,
            "dhcp_options_id": "",
            "enable_classiclink": "",
            "enable_dns_hostnames": "",
            "enable_dns_support": "",
            "id": "",
            "instance_tenancy": "",
            "main_route_table_id": ""
        },
        "destroy": false
    }
}

License

This project is made available under the MIT License.

About

Terraform plan file to JSON

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%