Expand description
Streaming JSON output from terraform plan and terraform apply.
When run with -json, Terraform produces one JSON object per line (NDJSON),
each representing an event like resource creation, progress, or completion.
This module provides stream_terraform which yields JsonLogLine events
as they arrive, useful for progress reporting in orchestration tools.
§Example
use terraform_wrapper::prelude::*;
use terraform_wrapper::streaming::{stream_terraform, JsonLogLine};
let tf = Terraform::builder().working_dir("./infra").build()?;
let result = stream_terraform(&tf, ApplyCommand::new().auto_approve().json(), &[0], |line| {
println!("[{}] {}", line.log_type, line.message);
}).await?;
assert!(result.success);Structs§
- Json
LogLine - A single JSON log line from Terraform’s streaming output.
Functions§
- stream_
terraform - Execute a Terraform command with streaming JSON output.