Terraform
Runs Terraform commands against a working directory via the terraform CLI. An agent can initialize, validate, plan, apply, and destroy infrastructure, read output values, and inspect/manage state.
Add to an agent node's tools array with _node_type: "tool-terraform". See Connector Reference — How connectors are used.
Authentication
| Field | Required | Description |
|---|---|---|
working_dir | No | Path to the directory containing .tf files; all terraform commands run with this as their working directory (cmd.Dir). If omitted, commands run in the worker process's current directory. |
{
"name": "terraform",
"_node_type": "tool-terraform",
"working_dir": "/workspace/infra/prod"
}
Tools
terraform_init
Initialize Terraform working directory. Run this first before plan/apply.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
upgrade | boolean | No | Upgrade modules and providers |
Returns: The combined stdout+stderr of terraform init -no-color [-upgrade]. If the command exits non-zero, returns terraform error: <err>\n<output> instead of failing the tool call.
terraform_validate
Validate Terraform configuration syntax and internal consistency.
No parameters.
Returns: The combined stdout+stderr of terraform validate -no-color (or terraform error: <err>\n<output> on failure).
terraform_plan
Generate Terraform execution plan showing what changes will be made. No changes are applied.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
vars | string | No | Variables as key=value pairs comma-separated |
target | string | No | Target specific resource e.g. aws_instance.web |
Returns: The combined stdout+stderr of terraform plan -no-color [-var k=v ...] [-target=<target>] (or terraform error: <err>\n<output> on failure).
terraform_apply
Apply Terraform changes to create/update infrastructure. Use auto_approve=true to skip confirmation.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
vars | string | No | Variables as key=value pairs comma-separated |
auto_approve | boolean | No | Skip interactive confirmation |
Returns: The combined stdout+stderr of terraform apply -no-color [-auto-approve] [-var k=v ...] (or terraform error: <err>\n<output> on failure).
terraform_destroy
Destroy Terraform-managed infrastructure. Irreversible — use auto_approve carefully.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
target | string | No | Destroy specific resource only |
auto_approve | boolean | No | Skip interactive confirmation |
Returns: The combined stdout+stderr of terraform destroy -no-color [-auto-approve] [-target=<target>] (or terraform error: <err>\n<output> on failure).
terraform_output
Read Terraform output values (e.g. created resource IDs, URLs, IPs).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Specific output name (empty = all) |
Returns: The combined stdout+stderr of terraform output -no-color [<name>] (or terraform error: <err>\n<output> on failure).
terraform_state
Manage Terraform state: list resources, show details, move or remove entries.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sub_command | string | Yes | State subcommand: list show mv rm |
address | string | No | Resource address e.g. aws_instance.web |
Returns: The combined stdout+stderr of terraform state <sub_command> -no-color [<address>] (or terraform error: <err>\n<output> on failure).