Skip to main content

@webframp/terraform

v2026.04.22.2

Read Terraform and OpenTofu state via CLI and marshal into swamp data.

Shells out to terraform show -json (or tofu show -json) to read state from any configured backend, then writes swamp resources keyed by Terraform resource address for CEL consumption in workflows and reports.

Supports workspace selection and binary switching between Terraform and OpenTofu via global arguments.

Quick Start

swamp extension pull @webframp/terraform
swamp model create @webframp/terraform tf-infra \
  --global-arg workDir=/path/to/terraform/repo

Repository

https://github.com/webframp/swamp-extensions

Labels

terraformopentofuiacinfrastructurestate

Contents

Quality score

How well-documented and verifiable this extension is.

100%

Grade A

  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types1/1earned
  • Has description1/1earned
  • At least one platform tag (or universal)1/1earned
  • Two or more platform tags (or universal)1/1earned
  • License declared1/1earned
  • Verified public repository2/2earned

Install

$ swamp extension pull @webframp/terraform

@webframp/terraformv2026.04.14.1terraform/terraform.ts

Global Arguments

ArgumentTypeDescription
workDirstringPath to the initialized Terraform/OpenTofu working directory
workspacestringTerraform workspace name
binarystringCLI binary to use: 'terraform' or 'tofu'
list_resourcesList all resources in Terraform state with address, type, provider, and module path
read_stateRead full Terraform state — writes one resource per Terraform resource keyed by address
get_outputsRead Terraform outputs — writes a summary resource plus one resource per output

Resources

tf_inventory(1h)— Summary of all Terraform-managed resources
tf_resource(1h)— Individual Terraform resource with full attribute values
tf_output(1h)— Terraform output value