Skip to content

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

Description

@System-Arch

Describe the bug
The xray_ignore_rule resource does not detect soft-deleted ignore rules. When a rule is deleted (via UI, API, or another Terraform workspace), the Xray API returns HTTP 200 with deleted_at and deleted_by fields populated — it does NOT return 404.

The provider's Read function only checks for HTTP 404 to detect deletion, so soft-deleted rules are never removed from state. This causes permanent Terraform state drift: subsequent plan and apply operations silently skip the stale resource.
Requirements for an issue

  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue) [See test code submitted as part of PR]
  • Your version of Artifactory and Xray (you can curl Artifactory version at $host/artifactory/api/system/version and Xray version at
    $host/xray/api/v1/system/version
  • Your version of terraform
  • Your version of terraform provider
  • Your product license (E+/E/Pro)
  • Is your Xray Cloud or Self-Hosted
  • JFrog support reference (if already raised with support team)

Expected behavior
When an ignore rule is soft-deleted, terraform plan should detect the deletion and propose re-creating the rule.

Additional context

Proposed fix

Add deleted_by and deleted_at fields to IgnoreRuleAPIModel. In Read(), after the existing HTTP 404 check, add:

if ignoreRule.DeletedAt != nil {
    resp.State.RemoveResource(ctx)
    return
}

Environment

  • Artifactory: Version 7.146.15
  • Xray: Version 3.143.19
  • Terraform CLI: 1.12
  • Provider version: 3.1.10
  • JFrog Platform: 11.x E+ (self-hosted)

Affected files

  • pkg/xray/resource/resource_xray_ignore_rule.go

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions