terraform-wrapper
A type-safe Terraform CLI wrapper for Rust.
Installation
[]
= "0.1"
= { = "1", = ["rt-multi-thread", "macros"] }
Minimum supported Rust version: 1.85.0
Quick Start
use ;
use InitCommand;
use ApplyCommand;
use ;
use DestroyCommand;
async
Note: You must import the TerraformCommand trait to call .execute().
Commands
| Command | Description |
|---|---|
InitCommand |
Prepare working directory, download providers |
ValidateCommand |
Check configuration validity |
PlanCommand |
Preview infrastructure changes |
ApplyCommand |
Create or update infrastructure |
DestroyCommand |
Destroy infrastructure |
OutputCommand |
Read output values |
VersionCommand |
Get Terraform version info |
Features
JSON output parsing is enabled by default. Disable it if you only need raw command output:
[]
= { = "0.1", = false }
Why terraform-wrapper?
| terraform-wrapper | terrars | terraform-rs | |
|---|---|---|---|
| Approach | CLI wrapper | CDK-style codegen | Minimal CLI wrapper |
| Async | Yes (tokio) | No | No |
| JSON output | Typed structs | N/A | No |
| Maintained | Active | Active | Unmaintained (2021) |
| Use case | Orchestration tools | Generate .tf in Rust | Basic CLI calls |
Use terraform-wrapper when you need to programmatically drive Terraform lifecycles (provision, extract outputs, tear down) from Rust with type-safe, async APIs.
Documentation
Full API reference is available on docs.rs.
See the examples/ directory for working examples.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.