Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: Provider produced inconsistent result after apply" after creation of ignore rule with specified artifact with path but no version #303

Open
jlabhard opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jlabhard
Copy link

Describe the bug
When creating an ignore rule that includes an artifact with a specified path but no version, the provider successfully creates it, but returns the error Error: Provider produced inconsistent result after apply when retrieving its state.

If the version is specified, the apply passes with no error. However, we would like for the ignore rule to affect all version of the artifact

Requirements for and issue

  • Artifactory Version 7.90.17
  • XRay Version 3.104.18
  • Terraform v1.10.5
  • jfrog/xray v3.0.3

main.tf:

terraform {
  required_providers {
    xray = {
      source  = "jfrog/xray"
      version = "3.0.3"
    }
  }
}

provider "xray" {
  url = var.xray_url
}

resource "xray_ignore_rule" "ignore-rules" {

  notes           = "Test"

  "artifact" {
      name = "test"
      path = "test/"
  }

  vulnerabilities = ["test"]
}

Error:

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ xray_ignore_rule.ignore-rules["10c2776f7ed4c591086bd8669fc94b9f91847fed2a64026453c0da2b8e1279dd"],
│ provider "provider[\"registry.terraform.io/jfrog/xray\"]" produced an
│ unexpected new value: .artifact: planned set element
│ cty.ObjectVal(map[string]cty.Value{"name":cty.StringVal("test"),
│ "path":cty.StringVal("test/"), "version":cty.NullVal(cty.String)}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

The resource is correctly created but becomes tainted in the terraform state.

If the version is specified, then the apply successfully complete.

Expected behavior
The apply should successfully complete without requiring to specify the version.

Additional context
From DEBUG logs:

POST Request:

2025-02-19T14:29:11.0783766Z   | ==============================================================================
2025-02-19T14:29:11.0783907Z   | ~~~ REQUEST ~~~
2025-02-19T14:29:11.0784125Z   | POST  /xray/api/v1/ignore_rules  HTTP/1.1
2025-02-19T14:29:11.0784261Z   | HOST   : <REDACTED>
2025-02-19T14:29:11.0784378Z   | HEADERS:
2025-02-19T14:29:11.0784496Z   | \tAccept: */*
2025-02-19T14:29:11.0784613Z   | \tAuthorization: <REDACTED>
2025-02-19T14:29:11.0784788Z   | \tContent-Type: application/json
2025-02-19T14:29:11.0784989Z   | \tUser-Agent: jfrog/terraform-provider-xray/3.0.0
2025-02-19T14:29:11.0785117Z   | BODY   :
2025-02-19T14:29:11.0785220Z   | {
2025-02-19T14:29:11.0785394Z   |    "notes": "Test",
2025-02-19T14:29:11.0785532Z   |    "ignore_filters": {
2025-02-19T14:29:11.0785650Z   |       "vulnerabilities": [
2025-02-19T14:29:11.0785756Z   |          "test"
2025-02-19T14:29:11.0785855Z   |       ],
2025-02-19T14:29:11.0787401Z   |       "artifacts": [
2025-02-19T14:29:11.0787510Z   |          {
2025-02-19T14:29:11.0787660Z   |             "name": "test",
2025-02-19T14:29:11.0787885Z   |             "path": "test/"
2025-02-19T14:29:11.0787995Z   |          }
2025-02-19T14:29:11.0788094Z   |       ]
2025-02-19T14:29:11.0788196Z   |    }
2025-02-19T14:29:11.0788294Z   | }
2025-02-19T14:29:11.0788388Z   | 
2025-02-19T14:29:11.0788598Z   | ------------------------------------------------------------------------------
2025-02-19T14:29:11.0788736Z   | ~~~ RESPONSE ~~~
2025-02-19T14:29:11.0788849Z   | STATUS       : 201 Created
2025-02-19T14:29:11.0788961Z   | PROTO        : HTTP/1.1
2025-02-19T14:29:11.0789141Z   | RECEIVED AT  : 2025-02-19T14:29:11.077913579Z
2025-02-19T14:29:11.0789271Z   | TIME DURATION: 43.254975ms
2025-02-19T14:29:11.0789936Z   | HEADERS      :
2025-02-19T14:29:11.0790089Z   | \tConnection: keep-alive
2025-02-19T14:29:11.0790243Z   | \tContent-Length: 87
2025-02-19T14:29:11.0790407Z   | \tContent-Type: application/json
2025-02-19T14:29:11.0790542Z   | \tDate: Wed, 19 Feb 2025 14:28:56 GMT
2025-02-19T14:29:11.0790733Z   | \tStrict-Transport-Security: always
2025-02-19T14:29:11.0790903Z   | \tX-Content-Type-Options: nosniff
2025-02-19T14:29:11.0791039Z   | BODY         :
2025-02-19T14:29:11.0791139Z   | {
2025-02-19T14:29:11.0791366Z   |    "info": "Successfully added Ignore rule with id: 89960e89-d4f5-4f40-5da1-7b324d001abb"
2025-02-19T14:29:11.0791508Z   | }
2025-02-19T14:29:11.0791639Z   | ==============================================================================

Following GET Request:

2025-02-19T14:29:11.0973676Z   | ==============================================================================
2025-02-19T14:29:11.0973873Z   | ~~~ REQUEST ~~~
2025-02-19T14:29:11.0974307Z   | GET  /xray/api/v1/ignore_rules/89960e89-d4f5-4f40-5da1-7b324d001abb  HTTP/1.1
2025-02-19T14:29:11.0974734Z   | HOST   : <REDACTED>
2025-02-19T14:29:11.0974884Z   | HEADERS:
2025-02-19T14:29:11.0974997Z   | \tAccept: */*
2025-02-19T14:29:11.0975118Z   | \tAuthorization: <REDACTED>
2025-02-19T14:29:11.0975295Z   | \tContent-Type: application/json
2025-02-19T14:29:11.0975561Z   | \tUser-Agent: jfrog/terraform-provider-xray/3.0.0
2025-02-19T14:29:11.0975689Z   | BODY   :
2025-02-19T14:29:11.0975800Z   | ***** NO CONTENT *****
2025-02-19T14:29:11.0976049Z   | ------------------------------------------------------------------------------
2025-02-19T14:29:11.0976279Z   | ~~~ RESPONSE ~~~
2025-02-19T14:29:11.0976458Z   | STATUS       : 200 OK
2025-02-19T14:29:11.0976624Z   | PROTO        : HTTP/1.1
2025-02-19T14:29:11.0976898Z   | RECEIVED AT  : 2025-02-19T14:29:11.096758755Z
2025-02-19T14:29:11.0977114Z   | TIME DURATION: 18.747986ms
2025-02-19T14:29:11.0977289Z   | HEADERS      :
2025-02-19T14:29:11.0977527Z   | \tConnection: keep-alive
2025-02-19T14:29:11.0977775Z   | \tContent-Type: application/json
2025-02-19T14:29:11.0977993Z   | \tDate: Wed, 19 Feb 2025 14:28:56 GMT
2025-02-19T14:29:11.0978270Z   | \tStrict-Transport-Security: always
2025-02-19T14:29:11.0978537Z   | \tX-Content-Type-Options: nosniff
2025-02-19T14:29:11.0978713Z   | BODY         :
2025-02-19T14:29:11.0978818Z   | {
2025-02-19T14:29:11.0978995Z   |    "id": "89960e89-d4f5-4f40-5da1-7b324d001abb",
2025-02-19T14:29:11.0979215Z   |    "author": "test",
2025-02-19T14:29:11.0979430Z   |    "created": "2025-02-19T15:29:11.065+01:00",
2025-02-19T14:29:11.0979728Z   |    "notes": "Test",
2025-02-19T14:29:11.0979910Z   |    "is_expired": false,
2025-02-19T14:29:11.0980656Z   |    "ignore_filters": {
2025-02-19T14:29:11.0980768Z   |       "vulnerabilities": [
2025-02-19T14:29:11.0980875Z   |          "test"
2025-02-19T14:29:11.0980973Z   |       ],
2025-02-19T14:29:11.0981126Z   |       "artifacts": [
2025-02-19T14:29:11.0981257Z   |          {
2025-02-19T14:29:11.0981411Z   |             "name": "test",
2025-02-19T14:29:11.0981575Z   |             "path": "test/"
2025-02-19T14:29:11.0981716Z   |          }
2025-02-19T14:29:11.0981858Z   |       ]
2025-02-19T14:29:11.0983237Z   |    }
2025-02-19T14:29:11.0983342Z   | }
2025-02-19T14:29:11.0983477Z   | ==============================================================================

Then the provider seems to not be able to retrieve the path, and assigns it null instead:

2025-02-19T14:29:11.0990761Z 2025-02-19T14:29:11.098Z [DEBUG] provider.terraform-provider-xray_v3.0.3: Value switched to prior value due to semantic equality logic: tf_attribute_path="artifact[Value({\"name\":\"test\",\"path\":<null>,\"version\":<null>})].name" tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.13.0/internal/fwschemadata/value_semantic_equality.go:91 @module=sdk.framework tf_provider_addr=registry.terraform.io/jfrog/xray tf_req_id=6632a40c-7a39-77cb-ba80-9dbf6334e7e5 tf_resource_type=xray_ignore_rule timestamp=2025-02-19T14:29:11.097Z
@jlabhard jlabhard added the bug Something isn't working label Feb 19, 2025
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

No branches or pull requests

3 participants