Handle soft-deleted ignore rules in Read to prevent state drift - #424
Open
System-Arch wants to merge 1 commit into
Open
Handle soft-deleted ignore rules in Read to prevent state drift#424System-Arch wants to merge 1 commit into
System-Arch wants to merge 1 commit into
Conversation
System-Arch
had a problem deploying
to
development
June 10, 2026 09:53 — with
GitHub Actions
Failure
System-Arch
force-pushed
the
fix-ignore-rule-soft-delete-detection
branch
from
July 31, 2026 11:44
ff04366 to
466277d
Compare
Xray soft-deletes ignore rules: the API returns HTTP 200 with deleted_at and deleted_by fields instead of 404. The provider only checked for 404, so soft-deleted rules were never detected as removed, causing permanent Terraform state drift. Add deleted_by and deleted_at fields to IgnoreRuleAPIModel and check for deleted_at in Read(). When set, remove the resource from state so Terraform can recreate it on the next apply. Add acceptance test TestAccIgnoreRule_SoftDeleted that creates a rule, deletes it out of band via the API, and verifies the provider detects the soft-delete on refresh.
System-Arch
force-pushed
the
fix-ignore-rule-soft-delete-detection
branch
from
July 31, 2026 12:12
466277d to
bd98ac7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Xray soft-deletes ignore rules: the API returns HTTP 200 with
deleted_atanddeleted_byfields instead of 404. The provider only checked for 404, so soft-deleted rules were never detected as removed, causing permanent Terraform state drift.Changes
deleted_byanddeleted_atfields toIgnoreRuleAPIModeldeleted_atinRead()after the HTTP 404 check; when set, callresp.State.RemoveResource(ctx)TestAccIgnoreRule_SoftDeletedthat creates a rule, deletes it out of band via the API, and verifies the provider detects the soft-delete viaPlanOnly+ExpectNonEmptyPlanNotes
The existing
testCheckIgnoreRuletest helper (used byCheckDestroy) already handles soft-deletion by checkingdeleted_at— this fix brings the provider'sReadpath in line with that behavior.Fixes #423