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

[ISSUE] Provider v1.0.56 data intersight_search_search_item ignoring additional_attributes for filter #300

Closed
3 tasks
scotttyso opened this issue Oct 9, 2024 · 2 comments

Comments

@scotttyso
Copy link

Bug Report Checklist

  • Have you provided a full/minimal configuration to reproduce the issue?
  • Have you [tested with the latest master] to confirm the issue still exists?
  • Have you provided the terraform console logs with environment variable set to TF_LOG=trace?
Description

For sometime I have been using additional_attributes with data intersight_search_search_item to filter, since there is no complex filter option. Noticed that going from v1.0.55 to v1.0.56 the additional_properties are now being ignored for the filter.

Using this workaround as proposed in this issue

Terraform-provider-intersight version

v1.0.56

Configuration file
data "intersight_search_search_item" "policies" {
  for_each = { for v in local.policy_types : v => v if length(compact(local.data_policies[v])) > 0 }
  additional_properties = jsonencode(
    { "ClassId" = "${local.bucket["${each.key}_policy"].object_type}' and Name in ('${trim(join("', '", local.data_policies[each.key]), ", '")
    }') and ObjectType eq '${local.bucket["${each.key}_policy"].object_type}" }
  )
}
Actual output (Attach screenshots if applicable)

I have the log and I can upload if you want but I can simply state that in 1.0.55 I see

GET /api/v1/search/SearchItems?%24count=true&%24filter=%28ClassId+eq+%27fabric.PortPolicy%27+and+Name+in+%28%27r143e-2-a%27%2C+%27r143e-2-b%27%29+and+ObjectType+eq+%27fabric.PortPolicy%27%29 HTTP/1.1 

and in 1.0.56 I see

GET /api/v1/search/SearchItems?%24filter=&%24skip=9200&%24top=100 HTTP/1.1
GET /api/v1/search/SearchItems?%24filter=&%24skip=9300&%24top=100 HTTP/1.1
GET /api/v1/search/SearchItems?%24filter=&%24skip=9400&%24top=100 HTTP/1.1
GET /api/v1/search/SearchItems?%24filter=&%24skip=9500&%24top=100 HTTP/1.1
GET /api/v1/search/SearchItems?%24filter=&%24skip=9600&%24top=100 HTTP/1.1 

as can be seen above it is going through every item in Intersight essentially.

Related issues/PRs
Suggest a fix
@scotttyso
Copy link
Author

I do have the DEBUG Log files for v1.0.55 and v1.0.56 for comparison if you want them but the .56 file is 25MB

@scotttyso
Copy link
Author

changing the order of ClassId and ObjectType works to work around this.

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

No branches or pull requests

1 participant