Terraform & OpenTofu State Visualizer

Visualize Terraform (.tfstate) and OpenTofu state files online into interactive architecture diagrams, dependency graphs, Mermaid.js code, and Draw.io XML—100% client-side with automatic secret masking.

Terraform & OpenTofu State Visualizer

Online tool

100% Client-Side Sandbox
Try Demo:

Engine: Resources: Dependencies: Modules:

Drop your Terraform or OpenTofu State File Here

Supports raw terraform.tfstate, tofu.tfstate (v3 & v4), and terraform show -json outputs. Processed 100% locally in your browser.

Option A: Raw State File

Locate your local state file or pull remote state to JSON:

terraform state pull > state.tfstate
Option B: OpenTofu / Plan JSON

Export encrypted or remote state cleanly via CLI:

tofu show -json > state.json
Address / Name Type Module Provider Instances Action

Mermaid.js Architecture Diagram

Paste this block directly into a GitHub Pull Request, Notion doc, or GitLab Wiki.


        

Depends On ():
State Attributes

Paste .tfstate or Plan JSON

⚡

Fast to use

Designed to help you complete the task without unnecessary steps.

◇

Works in your browser

No separate desktop software is needed for this online tool.

✓

Simple workflow

Enter your information, use the tool and work with the result.

What Is a Terraform & OpenTofu State Visualizer?

A Terraform and OpenTofu state visualizer is an interactive Infrastructure-as-Code (IaC) inspection tool that parses your deployment state JSON and maps every provisioned cloud resource, module, and dependency into a clear topological architecture diagram.

When managing complex cloud environments across AWS, Microsoft Azure, Google Cloud Platform (GCP), or Kubernetes, raw .tfstate files quickly grow into thousands of lines of nested JSON. Reading these files manually to trace why a subnet, security group, or IAM role is blocking a teardown is slow and error-prone.

By rendering your state file visually, platform engineers, SREs, and DevOps teams can audit resource hierarchies, isolate blast radiuses before running terraform apply or tofu destroy, and generate up-to-date infrastructure documentation automatically.

How to Visualize Terraform and OpenTofu State Files Online

You can generate an interactive infrastructure diagram from either a raw state file or a CLI JSON export in four simple steps:

  1. Export Your State JSON: Locate your local terraform.tfstate / tofu.tfstate file, pull remote state using terraform state pull > state.tfstate, or export a clean representation using terraform show -json > state.json (or tofu show -json > state.json).
  2. Load Into the Client-Side Sandbox: Drag and drop your file into the visualizer workspace above, or paste the raw JSON payload directly. You can even turn off your Wi-Fi before dropping the file to verify zero network transmission.
  3. Filter & Inspect Dependencies: Use the module selector, search bar, and data-source toggle to isolate specific microservices or VPC tiers. Click any resource node to inspect its live attributes and upstream depends_on edges.
  4. Export for Documentation or PRs: Export your visual graph as a scalable SVG image, copy the generated Mermaid.js markdown for GitHub Pull Requests, download a Draw.io (.drawio) XML file, or download a secret-scrubbed .tfstate file for safe team debugging.

100% Client-Side Security & Automatic Secret Sanitization

In production DevOps workflows, a .tfstate file is one of the most sensitive artifacts in your organization. Even when you mark variables as sensitive = true in HCL, Terraform and OpenTofu store plaintext database master passwords, TLS private keys, OAuth client secrets, and cloud API tokens inside the state JSON.

Uploading a production state file to a server-based web application violates cloud security compliance (SOC2, ISO 27001, HIPAA). That is why this visualizer is built as a zero-backend, browser-only sandbox:

  • Zero Network Uploads: File parsing utilizes the native browser FileReader API and in-memory JavaScript execution. Your state payload never crosses the network or touches a server database.
  • Offline Mode Verification: Once this page loads, you can disconnect from the internet completely and analyze your production state files in an air-gapped browser session.
  • Auto-Redacted Attribute Inspector: Sensitive keys matching patterns such as password, secret_key, private_key, access_token, and client_secret are automatically blurred in the UI.
  • One-Click State Sanitizer: Need to share a broken state file with a colleague or open a GitHub issue? Use the Download Scrubbed .tfstate feature to replace all sensitive string values with REDACTED placeholders while preserving the exact structural graph.

First-Class OpenTofu Support & v1.7+ State Encryption Handling

As engineering organizations migrate to OpenTofu alongside HashiCorp Terraform, tooling compatibility is essential. This visualizer natively supports both Terraform state v4 schemas and OpenTofu state outputs.

One of OpenTofu's flagship security features (introduced in OpenTofu v1.7+) is native client-side state and plan encryption using AES-GCM and key providers such as PBKDF2, AWS KMS, GCP KMS, and OpenBao. If you drop an encrypted tofu.tfstate file directly into the tool, the parser automatically detects the encryption metadata block and guides you on exporting a decrypted JSON stream locally via tofu show -json so you can visualize your resources without exposing your encryption passphrase.

Why Use an Interactive Visualizer Instead of "terraform graph"?

Both Terraform and OpenTofu ship with a built-in CLI command: terraform graph (or tofu graph). However, DevOps engineers rarely use it for real-world debugging because it outputs raw Graphviz DOT syntax that becomes unreadable "spaghetti" once a project exceeds 20 resources.

Comparing native CLI graphing against an interactive state visualizer highlights key workflow improvements:

  • No Graphviz Binary Required: You do not need to install local Graphviz packages or pipe CLI output through dot -Tsvg > graph.svg.
  • Collapsed Resource Instances: When you use count or for_each to provision 10 subnets or 50 IAM policies, raw DOT graphs draw 50 overlapping boxes. Our visualizer intelligently groups multi-instance resources into a single clean card with an instance multiplier badge (e.g., ×3).
  • Live Attribute Inspection: Static SVG outputs from Graphviz only show resource names. In our interactive canvas, clicking any node opens a side panel showing CIDR blocks, ARNs, instance sizes, regions, and upstream dependencies.
  • Module Isolation: Instead of staring at a monolithic diagram of 300 nodes, you can filter the canvas down to a single child module (such as module.vpc or module.eks) in real time.

Understanding the Terraform & OpenTofu .tfstate v4 JSON Structure

Modern Terraform (v0.12 through v1.9+) and OpenTofu state files use State Format Version 4. Understanding how this JSON schema is structured helps when debugging state drift or performing manual state surgery:

  • version & terraform_version: Defines the schema version (usually 4) and the binary version that last mutated the state.
  • serial & lineage: The lineage is a unique UUID assigned when a state is first initialized, while serial is a monotonically increasing integer incremented on every state write to prevent concurrent state corruption.
  • resources[] Array: Each object inside the resources array represents a resource block (e.g., aws_eks_cluster.production), containing its module path, mode (managed vs data), type, name, and provider configuration.
  • instances[] & dependencies[]: Inside each resource, the instances array holds the actual cloud attributes (IDs, ARNs, endpoints) and the explicit dependencies array that powers our topological graph engine.

Convert Terraform State to Mermaid.js and Draw.io Diagrams

Keeping cloud architecture diagrams synchronized with actual production infrastructure is a notorious challenge. Diagrams drawn manually in Visio or Lucidchart become outdated the moment an engineer merges a new Pull Request.

This tool bridges the gap between live infrastructure state and engineering documentation through two automated export pipelines:

  1. Terraform State to Mermaid.js: Switch to the Mermaid / Draw.io tab to generate clean flowchart LR Markdown syntax. Paste this code block directly into a GitHub Pull Request description, GitLab Merge Request, Notion page, or Backstage developer portal—GitHub renders the Mermaid diagram natively with zero external plugins.
  2. Terraform State to Draw.io (.drawio XML): Click Export Draw.io to download a standards-compliant mxGraphModel XML file pre-populated with your exact resource coordinates, provider color accents, and orthogonal dependency arrows. Open the file in diagrams.net (Draw.io) to add custom annotations for stakeholder presentations or security audits.

Auditing Blast Radius, State Drift, and Dependency Chains

Before running destructive state commands like terraform state rm, terraform state mv, or targeted applies (terraform apply -target=...), engineers must understand the downstream blast radius of a resource.

By selecting any node on the canvas, all connected dependency curves highlight in bright cyan. Upstream nodes (left) represent foundational infrastructure that the selected resource relies upon (such as a VPC or KMS key), while downstream nodes (right) represent dependent services (such as EKS node groups, RDS databases, or Kubernetes ingresses) that will be impacted or recreated if the upstream resource forces replacement.

Multi-Cloud Provider Recognition (AWS, Azure, GCP, Kubernetes)

Modern platform engineering rarely lives in a single cloud. A single state file frequently provisions an AWS VPC and EKS cluster, configures Kubernetes deployments and Helm releases inside that cluster, and registers DNS records on Cloudflare.

Our parser automatically classifies resource prefixes and applies visual color-coding across major cloud and SaaS providers:

  • Amazon Web Services (aws_*): VPCs, Subnets, Security Groups, EKS, RDS, S3, IAM, Lambda (Amber accent).
  • Microsoft Azure (azurerm_*, azuread_*): Resource Groups, VNets, AKS Clusters, Key Vaults, Storage Accounts (Sky Blue accent).
  • Google Cloud Platform (google_*): Compute Networks, GKE Clusters, Cloud SQL, BigQuery, GCS Buckets (Emerald accent).
  • Kubernetes & Helm (kubernetes_*, helm_*): Ingresses, Deployments, ConfigMaps, Secrets, Namespaces (Cyan accent).
  • Cloudflare & Core Providers (cloudflare_*, random_*, tls_*, null_*): DNS records, WAF rules, and utility resources.

Essential Terraform & OpenTofu State CLI Commands Cheat Sheet

Pair this online visualizer with these non-destructive CLI commands when auditing remote backends (S3, GCS, Azure Blob, Terraform Cloud, or GitLab Managed State):

  • terraform state pull > state.tfstate — Downloads the current remote state to a local JSON file without modifying infrastructure.
  • tofu show -json > state.json — Exports the current state (or a saved plan file) in standardized machine-readable JSON format, automatically handling client-side decryption if configured.
  • terraform state list — Lists all resource addresses tracked in the current state file.
  • terraform plan -out=tfplan && terraform show -json tfplan > plan.json — Exports an execution plan into JSON so you can inspect proposed state values prior to applying changes.

Questions & answers

Frequently Asked Questions

Is it safe to open my production .tfstate file in this online visualizer?
Yes. This tool is engineered as a 100% client-side browser application. Your .tfstate or JSON file is parsed locally in your browser memory using JavaScript and never uploaded to any external server. You can verify this by loading the page, disconnecting your Wi-Fi or internet connection, and dropping your state file into the workspace.
Does this visualizer support both Terraform and OpenTofu state files?
Yes. It supports raw state files (terraform.tfstate and tofu.tfstate) as well as JSON outputs generated via "terraform show -json" and "tofu show -json" across Terraform v0.12 through v1.9+ and OpenTofu v1.6 through v1.8+.
How does the tool protect passwords, API keys, and secrets inside my state file?
The attribute inspector automatically scans JSON keys for sensitive patterns (such as password, secret, token, private_key, client_secret, and access_key) and masks their values by default. You can also click "Download Scrubbed .tfstate" to export a sanitized copy of your state file with all sensitive values replaced by REDACTED placeholders.
How do I visualize an OpenTofu v1.7+ encrypted state file?
If you use OpenTofu client-side state encryption (AES-GCM), the raw .tfstate file on disk is encrypted. Run "tofu show -json > decrypted-state.json" in your terminal so OpenTofu decrypts the payload locally in memory, then drop that JSON file into the visualizer.
How do I export a remote Terraform state from AWS S3, GCS, or Terraform Cloud to visualize it?
In your initialized project directory, run "terraform state pull > state.tfstate" (or "tofu state pull > state.tfstate"). This safely downloads a read-only copy of your remote state JSON to your machine, which you can then drag and drop into the visualizer.
Can I convert a Terraform state file into a Mermaid.js diagram for GitHub Pull Requests?
Yes. Once your state file is loaded, click the "Mermaid / Draw.io" tab or open the Export menu and select "Copy Mermaid.js for PR". You can paste the generated Mermaid flowchart markdown directly into any GitHub Pull Request, GitLab Merge Request, or Notion document.
Can I export my Terraform architecture diagram to Draw.io (diagrams.net)?
Yes. Open the "Export / Sanitize" dropdown and click "Export Draw.io (.drawio)". This downloads an XML diagram file containing all your resource nodes, provider colors, and dependency connectors, ready to be edited in Draw.io or diagrams.net.
How is this different from the built-in "terraform graph" command?
The "terraform graph" CLI command outputs raw Graphviz DOT code that requires installing Graphviz locally and often renders unreadable overlapping boxes on large projects. This visualizer runs instantly in your browser, groups multi-instance count/for_each resources into clean cards, color-codes cloud providers, lets you filter by module, and lets you inspect resource attributes interactively.
How does the visualizer handle resources created with "count" or "for_each"?
Instead of cluttering your diagram with dozens of identical boxes for each index or key, the parser consolidates instances of the same resource block into a single node and displays an instance multiplier badge (such as ×3) while preserving all dependency links.
Can I filter the dependency graph by specific Terraform modules?
Yes. The top filter bar automatically extracts every root and child module (such as module.vpc, module.eks, or module.database) from your state file. Selecting a module isolates its resources and recalculates the graph layout automatically.
Can I hide data sources (data.*) to focus only on managed resources?
Yes. Uncheck the "Data Sources" toggle in the filter bar to hide read-only data blocks (such as data.aws_caller_identity or data.aws_iam_policy_document) and declutter your architecture diagram.
What cloud providers are supported in the diagram?
The visualizer parses any Terraform or OpenTofu provider and includes built-in visual styling and badges for AWS (aws_*), Microsoft Azure (azurerm_*, azuread_*), Google Cloud (google_*), Kubernetes (kubernetes_*), Helm (helm_*), and Cloudflare (cloudflare_*).

Explore more AabiTech tools

Browse the complete collection of practical online tools for development, text, design, calculations and everyday digital work.