README
Terraform Plan Unidiff
Generate a human readable diff of Terraform Plan changes, using Unified format (unidiff
)
Usage
CLI
npx @ahmadnassri/terraform-unidiff /path/to/plan.json
Library
Installation
npm install @ahmadnassri/terraform-unidiff
API
const unidiff = require('@ahmadnassri/terraform-unidiff')
const plan = fs.readFileSync('path/to/plan.json')
const { summary, patches } = unidiff(plan)
console.log(patches) // array of changes in unidiff format
console.log(summary) // object with changes counts { create: 1, update: 3, delete: 0 }
Plan JSON
to obtain a Terraform plan in JSON format, run the following command:
terraform plan -out terraform.plan && terraform show -json terraform.plan > terraform.json
Author: Ahmad Nassri • Twitter: @AhmadNassri