Compare Terraform Files Online

Paste two Terraform configurations. See what was added, removed, or changed — line by line with word-level highlights.

🔒 100% private — runs entirely in your browser

or try sample data

What is Terraform Diff?

Terraform Diff compares two Terraform configuration files (HCL) and shows you exactly which resources, variables, and settings changed. Whether you're reviewing infrastructure changes, comparing environments, or auditing provider upgrades, this tool gives you a clear view of every modification.

Infrastructure as Code demands careful review. A single character change in a Terraform file can provision a larger instance, open a security group, or destroy a database. Comparing HCL files side by side before running terraform plan or terraform apply catches issues early in the review process.

The tool works with HCL (.tf) files, JSON Terraform format (.tf.json), and even terraform plan output. Word-level highlighting shows exactly which arguments changed within a resource block. Everything runs client-side — your infrastructure configurations stay private.

Terraform Comparison — Common Scenarios

Reviewing resource changes

# Before: staging configuration
resource "aws_instance" "web" { instance_type = "t2.micro" root_block_device { volume_size = 20 volume_type = "gp2" } tags = { Environment = "staging" }
} # After: production-ready
resource "aws_instance" "web" { instance_type = "t3.small" root_block_device { volume_size = 50 volume_type = "gp3" encrypted = true } tags = { Environment = "production" ManagedBy = "terraform" }
}

The diff highlights instance type upgrade, volume changes, encryption addition, and tag modifications at a glance.

Provider version upgrades

# Before
required_providers { aws = { source = "hashicorp/aws" version = "~> 4.0" }
} # After
required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" }
}

Major provider version bumps can introduce breaking changes. The diff makes version constraint changes immediately visible.

Security group rule additions

# Reviewing security changes is critical.
# The diff shows:
# - New HTTPS ingress rule (port 443)
# - Updated description text
# - Any changed CIDR blocks # Paste both security group configs
# to verify no unintended access changes

Security group changes affect network access. Always diff these carefully before applying — an open CIDR block can expose services to the internet.

Terraform Comparison Gotchas

HCL vs JSON format

Terraform supports both HCL (.tf) and JSON (.tf.json) formats. This tool compares text line by line, so comparing HCL with JSON will show almost every line as changed. Compare like-with-like: HCL to HCL, or JSON to JSON.

State drift vs config changes

This tool compares configuration files, not Terraform state. If real infrastructure has drifted from the config (manual changes, other tools), those differences won't appear here. Use terraform plan to detect state drift.

Provider version pinning

Changing version = "~> 4.0" to version = "~> 5.0" looks small but can introduce breaking changes. Provider major versions often rename resources, change argument names, or alter default behaviors. Always check the provider changelog alongside the diff.

Frequently Asked Questions

How do I compare two Terraform files?

Paste your Terraform HCL (or JSON) files into the two panels and click Compare. The tool shows a side-by-side diff with line-by-line comparison and word-level highlighting for modified lines.

Can I compare terraform plan output?

Yes. You can paste the text output from terraform plan runs and compare them. This helps identify differences between planned changes across environments or runs.

Does this work with Terragrunt or OpenTofu?

Yes. Terragrunt HCL files and OpenTofu configurations use the same HCL syntax and are fully compatible with this text-based comparison tool.

Is my Terraform config safe?

Yes. This tool runs entirely in your browser. Your HCL files, including any provider credentials, backend configurations, or infrastructure details, are never sent to any server.

Can I compare Terraform modules?

Yes. Compare module source files, variable definitions, or output configurations. The tool handles any HCL text content.