Skip to main content

Crate terraform_wrapper

Crate terraform_wrapper 

Source
Expand description

A type-safe Terraform CLI wrapper for Rust.

terraform-wrapper provides builder-pattern command structs for driving the Terraform CLI programmatically. Each command produces typed output and runs asynchronously via tokio.

§Quick Start

use terraform_wrapper::{Terraform, TerraformCommand};
use terraform_wrapper::commands::init::InitCommand;
use terraform_wrapper::commands::apply::ApplyCommand;
use terraform_wrapper::commands::output::{OutputCommand, OutputResult};

let tf = Terraform::builder()
    .working_dir("/tmp/my-infra")
    .build()?;

InitCommand::new().execute(&tf).await?;

ApplyCommand::new()
    .auto_approve()
    .var("region", "us-west-2")
    .execute(&tf)
    .await?;

let result = OutputCommand::new()
    .name("public_ip")
    .raw()
    .execute(&tf)
    .await?;

Re-exports§

pub use command::TerraformCommand;
pub use error::Error;
pub use error::Result;
pub use exec::CommandOutput;

Modules§

command
commands
error
exec
types

Structs§

Terraform
Terraform client configuration.
TerraformBuilder
Builder for constructing a Terraform client.