Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semanser/terraform-parser
Terraform State and Plan parser written in Rust
https://github.com/semanser/terraform-parser
parser rust rust-crate serde serde-json terraform
Last synced: 10 days ago
JSON representation
Terraform State and Plan parser written in Rust
- Host: GitHub
- URL: https://github.com/semanser/terraform-parser
- Owner: semanser
- Created: 2022-04-08T21:02:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-10T19:13:18.000Z (over 2 years ago)
- Last Synced: 2024-10-11T18:12:22.859Z (26 days ago)
- Topics: parser, rust, rust-crate, serde, serde-json, terraform
- Language: Rust
- Homepage:
- Size: 6.84 KB
- Stars: 59
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# terraform-parser
[![docs.rs](https://img.shields.io/docsrs/terraform-parser)](https://docs.rs/terraform-parser/0.1.0/terraform_parser)
[![Crates.io](https://img.shields.io/crates/d/terraform-parser)](https://crates.io/crates/terraform-parser)
![Crates.io](https://img.shields.io/crates/l/terraform-parser)Incredibly fast, strongly typed Terraform [JSON Output Format](https://www.terraform.io/internals/json-format) parser written in Rust. Based on [serde](https://github.com/serde-rs/serde).
# Usage
```rust
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);
}
```