<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Veems</title>
    <description>The latest articles on DEV Community by Veems (@itsveems).</description>
    <link>https://dev.to/itsveems</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995417%2Fcc0aae51-cfd2-420c-a718-423d910fae51.png</url>
      <title>DEV Community: Veems</title>
      <link>https://dev.to/itsveems</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/itsveems"/>
    <language>en</language>
    <item>
      <title>permadiff: separate Terraform plan noise from real changes — and fix it at the source</title>
      <dc:creator>Veems</dc:creator>
      <pubDate>Sun, 21 Jun 2026 16:01:48 +0000</pubDate>
      <link>https://dev.to/itsveems/permadiff-separate-terraform-plan-noise-from-real-changes-and-fix-it-at-the-source-20k5</link>
      <guid>https://dev.to/itsveems/permadiff-separate-terraform-plan-noise-from-real-changes-and-fix-it-at-the-source-20k5</guid>
      <description>&lt;p&gt;Every Terraform user knows the plan that shows an "update in place" which isn't a change at all: an IAM policy whose JSON got reordered, a security-group rule list shuffled, &lt;code&gt;"80"&lt;/code&gt; that became &lt;code&gt;80&lt;/code&gt;, a &lt;code&gt;tags = {}&lt;/code&gt; that flipped to null. The before and after are semantically identical — AWS stores the value in its own canonical form — but the plan never goes away. The usual "fix" is a reflexive &lt;code&gt;lifecycle { ignore_changes = [...] }&lt;/code&gt;, which makes the diff disappear &lt;strong&gt;and&lt;/strong&gt; silently hides any real future change to that attribute.&lt;/p&gt;

&lt;p&gt;So I wrote &lt;strong&gt;permadiff&lt;/strong&gt; to stop doing that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;permadiff reads &lt;code&gt;terraform show -json&lt;/code&gt; output and, for every in-place update, tries to &lt;em&gt;prove&lt;/em&gt; the diff is cosmetic by canonicalising both sides — sorting policy statements, treating set-semantic lists as sets, coercing scalar types, normalising DNS names, and so on. If (and only if) the canonical before and after are identical, it labels the attribute a no-op, explains in plain English why AWS treats them as equal, and suggests the fix that makes the diff disappear at the source. Real changes are listed plainly and never suppressed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;terraform show &lt;span class="nt"&gt;-json&lt;/span&gt; plan.tfplan | permadiff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  One rule: prove it or it's real
&lt;/h2&gt;

&lt;p&gt;A false negative (missed noise) is fine; a false positive (a real change mislabelled as noise) is not — that's how a tool gets someone owned. So every pattern ships with a look-alike "real twin" fixture that must stay classified as real, and the canonicalisers fail closed on anything they don't fully understand.&lt;/p&gt;

&lt;p&gt;Take the most common perma-diff there is. You apply an IAM policy; AWS stores the statements back in a different order; the next &lt;code&gt;terraform plan&lt;/code&gt; shows the whole&lt;br&gt;
&lt;code&gt;policy = jsonencode(...)&lt;/code&gt; as an update-in-place — a wall of diff over a document that means exactly the same thing. permadiff sorts the statements (order is insignificant in IAM), proves the before and after are identical, and reports a no-op.&lt;/p&gt;

&lt;p&gt;Now the thin ice: a genuine permission change surfaces in that &lt;em&gt;same&lt;/em&gt; &lt;code&gt;~ policy&lt;/code&gt; block. Change one &lt;code&gt;Resource&lt;/code&gt; from &lt;code&gt;arn:aws:s3:::app-data/Backups/*&lt;/code&gt; to &lt;code&gt;.../exports/*&lt;/code&gt; and the plan looks almost exactly like the harmless reorder — but it isn't. Guess that "policy diffs are usually just noise" and you've quietly shipped a real change. permadiff canonicalises both sides and compares them: the reorder collapses to equal, the resource edit doesn't — so it stays a real change.&lt;/p&gt;
&lt;h2&gt;
  
  
  Details
&lt;/h2&gt;

&lt;p&gt;It's fully offline and deterministic — rule-based against a YAML pattern catalogue compiled into a single static Go binary. No network calls, no telemetry, never edits your files. v1 covers 13 AWS pattern families (IAM/S3/KMS/SQS policy JSON, security-group rule sets, tags, ECS container definitions, AWS Batch job definitions, type coercion, Route 53 names, set-semantic lists, computed-field churn, curated JSON-document attributes). Other providers' resources pass through&lt;br&gt;
untouched as real changes.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/itsveems/permadiff/cmd/permadiff@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/itsveems" rel="noopener noreferrer"&gt;
        itsveems
      &lt;/a&gt; / &lt;a href="https://github.com/itsveems/permadiff" rel="noopener noreferrer"&gt;
        permadiff
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Separate Terraform plan noise from real changes — and fix the noise at its source.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;permadiff&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="https://github.com/itsveems/permadiff/actions/workflows/ci.yml" rel="noopener noreferrer"&gt;&lt;img src="https://github.com/itsveems/permadiff/actions/workflows/ci.yml/badge.svg" alt="ci"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Separate Terraform plan noise from real changes — and fix the noise at its source.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;a rel="noopener noreferrer" href="https://github.com/itsveems/permadiff/docs/screenshot.svg"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fitsveems%2Fpermadiff%2FHEAD%2Fdocs%2Fscreenshot.svg" alt="permadiff separating perma-diff noise from real changes in a Terraform plan, with a fix for each no-op" width="760"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Reproduce this output: &lt;code&gt;permadiff examples/demo-plan.json&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;permadiff&lt;/code&gt; reads &lt;code&gt;terraform show -json&lt;/code&gt; output and identifies &lt;strong&gt;perma-diffs&lt;/strong&gt;
update-in-place changes that are &lt;em&gt;not real changes&lt;/em&gt; — artifacts of provider
normalisation, JSON reordering, type coercion, or formatting, where before and
after are semantically identical. For each one it explains &lt;strong&gt;why&lt;/strong&gt; it's a no-op
and suggests the &lt;strong&gt;correct fix&lt;/strong&gt;, so the diff disappears instead of getting
buried under a reflexive &lt;code&gt;ignore_changes&lt;/code&gt;.&lt;/p&gt;
&lt;div class="snippet-clipboard-content notranslate position-relative overflow-auto"&gt;
&lt;pre class="notranslate"&gt;&lt;code&gt;permadiff  6 changes: 2 perma-diff no-ops (with fixes) · 4 real changes
PERMA-DIFF NOISE (2) — semantically identical before and after; nothing changes in AWS
──────────────────────────────────────────────────────────────────────────────

  ~ aws_iam_policy.app_data
      • policy — IAM policy JSON normalisation
        AWS stores IAM policy documents in its own normalised form: object keys reordered,
        whitespace stripped, single-element arrays and scalars interchanged, and statements
        reordered. None of that changes what the policy allows&lt;/code&gt;&lt;/pre&gt;…&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/itsveems/permadiff" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;It's deliberately conservative — it'll miss noise rather than risk mislabelling a real change. If you have a perma-diff it doesn't catch, contributing is usually just YAML + two fixtures (the no-op and its real twin), no Go required. I'd love to hear which perma-diffs hurt the most in your stacks.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>aws</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
