Home

Awesome

Terraform-diff

Terraform-diff helps you detect what Terraform projects have changed when changes are made to Terraform modules.

Example

Given the following Terraform setup:

.
├── modules
│   └── module1
│   │   └── main.tf
│   └── module2
│   │   └── main.tf
│   └── module3
│       └── main.tf
└── project1
│   └─── main.tf
└── project2
    └─── main.tf

And the following dependencies:

The logic would be:

This is where Terraform-diff is useful:

$ terraform-diff -h
Usage of terraform-diff:
  -output string
      output format (text or json) (default "text")
  -range string
      git commit range
$ terraform-diff project1 project2
project1
$ terraform-diff --range fbf666c786...ca37f7145f -o json project1 project2
{
  "project1",
  "project2"
}

Trade-offs

terraform-diff relies on git & static analysis of the Terraform files. It will not detect, among others: