Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 1.01 KB

README.md

File metadata and controls

27 lines (20 loc) · 1.01 KB

terraform-parser

docs.rs Crates.io Crates.io

Incredibly fast, strongly typed Terraform JSON Output Format parser written in Rust. Based on serde.

Usage

use std::fs;
use terraform_parser::TerraformParser;

fn main() {
  let state =
    fs::read_to_string("./state.json").expect("Something went wrong reading the state file");

  let plan =
    fs::read_to_string("./plan.json").expect("Something went wrong reading the plan file");

  let parsed_state = TerraformParser::parse_state(&state);
  let parsed_plan = TerraformParser::parse_plan(&plan);

  println!("{}", parsed_state.unwrap().terraform_version);
  println!("{}", parsed_plan.unwrap().format_version);
}