Skip to content

Handle soft-deleted ignore rules in Read to prevent state drift - #424

Open
System-Arch wants to merge 1 commit into
jfrog:mainfrom
System-Arch:fix-ignore-rule-soft-delete-detection
Open

Handle soft-deleted ignore rules in Read to prevent state drift#424
System-Arch wants to merge 1 commit into
jfrog:mainfrom
System-Arch:fix-ignore-rule-soft-delete-detection

Conversation

@System-Arch

Copy link
Copy Markdown

Description

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.

Changes

  • Add deleted_by and deleted_at fields to IgnoreRuleAPIModel
  • Check deleted_at in Read() after the HTTP 404 check; when set, call resp.State.RemoveResource(ctx)
  • 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 via PlanOnly + ExpectNonEmptyPlan
  • Update CHANGELOG.md

Notes

The existing testCheckIgnoreRule test helper (used by CheckDestroy) already handles soft-deletion by checking deleted_at — this fix brings the provider's Read path in line with that behavior.

Fixes #423

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
System-Arch force-pushed the fix-ignore-rule-soft-delete-detection branch from 466277d to bd98ac7 Compare July 31, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: xray_ignore_rule: Read does not detect soft-deleted rules, causing permanent state drift

1 participant