node-terraform-unidiff

a cli tool to generate a visual diff of Terraform Plan changes

MIT License

Downloads
665
Stars
0
Committers
3

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

Package Rankings
Top 11.37% on Npmjs.org
Badges
Extracted from project README
license release semantic
Related Projects