Skip to content

Conversation

@rafaelherik
Copy link
Owner

Summary

  • Prior to this change, Terraform’s “replace” operations were being folded into generic apply or destroy workflows, resulting in inaccurate counts and reporting.
  • This PR updates both the Analyzer and the Reporter so that “replace” is recognized and handled as its own action type throughout the processing pipeline.

What Changed

  • Analyzer

    • Added “replace” to the set of supported actions
    • Updated the diff logic so that any plan entry with a “replace” change is categorized correctly
  • Reporter

    • Enhanced the output schema to include a “replace” column in both detailed tables and summary sections
    • Adjusted summary statistics to surface replace counts separately from apply/destroy
  • Tests

    • New unit tests covering scenarios with replace-only, mixed replace/apply/destroy, and edge cases (e.g. replace followed by no-op)
    • Extended snapshot tests to ensure report templates render the replace column as expected

Why This Matters

  • Having a dedicated “replace” category improves visibility into resource lifecycles, especially for workflows that rely on in-place replacement versus full destruction or creation.
  • Accurate analytics and reporting empower teams to optimize their change management and catch expensive or risky replacements before they go live.

Backward Compatibility

  • No breaking changes: code paths for apply, destroy, and import remain untouched if “replace” never appears in the plan.
  • Reporters will simply add an extra column when replace actions are present.

@rafaelherik rafaelherik linked an issue Jun 26, 2025 that may be closed by this pull request
@rafaelherik rafaelherik self-assigned this Jun 26, 2025
@rafaelherik rafaelherik added the bug Something isn't working label Jun 26, 2025
@rafaelherik rafaelherik merged commit 09c2340 into main Jun 26, 2025
7 checks passed
@rafaelherik rafaelherik deleted the fix/incorrect-replacement-action-handling branch July 8, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Handling of [delete, create] Replacement Actions

2 participants