Skip to content

Fix helm_release values causing perpetual diffs due to line ending differences - #1786

Open
raman1236 wants to merge 1 commit into
hashicorp:mainfrom
raman1236:fix/values-line-endings-543
Open

Fix helm_release values causing perpetual diffs due to line ending differences#1786
raman1236 wants to merge 1 commit into
hashicorp:mainfrom
raman1236:fix/values-line-endings-543

Conversation

@raman1236

Copy link
Copy Markdown

Description

Fixes #543

When values YAML files have CRLF line endings (common on Windows) but state was stored with LF line endings (from Linux/Mac), Terraform detects spurious diffs and plans unnecessary changes.

Solution

Added a list plan modifier (normalizeLineEndingsList) for the values attribute that normalizes CRLF (\r\n) line endings to LF (\n) before comparison. If the values are semantically identical (only differing in line endings), the plan is suppressed.

How It Works

// In the plan modifier:
normalizedPlan := strings.ReplaceAll(planStr.ValueString(), "\r\n", "\n")
normalizedState := strings.ReplaceAll(stateStr.ValueString(), "\r\n", "\n")
if normalizedPlan != normalizedState {
    equal = false
}

Testing

  • Verified compilation succeeds
  • When values only differ by line endings, no plan changes are detected

@raman1236
raman1236 requested a review from a team as a code owner May 1, 2026 01:22
@github-actions github-actions Bot added the size/S label May 1, 2026
@raman1236 raman1236 changed the title fix(helm_release): normalize line endings in values to prevent cross-platform diffs Fix helm_release values causing perpetual diffs due to line ending differences May 1, 2026
…platform diffs

Fixes hashicorp#543

When values YAML files have CRLF line endings (common on Windows) but
state was stored with LF line endings (from Linux/Mac), Terraform detects
spurious diffs and plans unnecessary changes.

Added a list plan modifier for the 'values' attribute that normalizes
CRLF line endings to LF before comparison. If the values are semantically
identical (only differing in line endings), the plan is suppressed.
@raman1236
raman1236 force-pushed the fix/values-line-endings-543 branch from 7b8960c to a6bd2bb Compare May 1, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Line endings affect plan when using a values.yaml file for a helm deployment

1 participant