Skip to content

Terraform State and Plan parser written in Rust

Notifications You must be signed in to change notification settings

semanser/terraform-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);
}