Skip to content

[REQ] Improve intersight_search_search_item #174

@jerewill-cisco

Description

@jerewill-cisco

The Issue

The current syntax for the intersight_search_search_item data source (which is also poorly documented) essentially allows us to insert positive (i.e. eq) searches for attributes, such as this...

data "intersight_search_search_item" "example_by_model" {
  additional_properties = jsonencode({ "Model" = "UCSC-C220-M5SX"})
}

But not a simple negative (i.e. ne) searches for attributes. More complex searches are not supported in a direct way.

Although it's possible to hack the attribute packing to create a more complex search as long as your search includes at least one positive element like this... (it's essentially an injection attack, which IMO should also be 'fixed' as a part of this request)

data "intersight_search_search_item" "example_exclude_model" {
  additional_properties = jsonencode({ "Presence" = "equipped' and Model ne 'UCSC-C220-M5SX"})
}

or

data "intersight_search_search_item" "os_linux" {
  additional_properties = jsonencode({ "Presence" = "equipped' and Tags/any(t:t/Key eq 'os' and t/Value eq 'linux') and ObjectType eq 'compute.PhysicalSummary" })
}

Really complex syntax is completely out of reach.

Proposed Solution

The data source should accept the standard set of parameters as an array. Syntax should appear similar to this...

data "intersight_search_search_item" "os_linux" {
    odata {
        filter = "ObjectType ne 'compute.PhysicalSummary' and Tags/any(t:t/Key eq 'os' and t/Value eq 'linux')"
        select = "BiosUnits,Model,Serial"
        top = "2"
        expand = "BiosUnits($select=RunningFirmware%3b$expand=RunningFirmware($select=PackageVersion))"
    }
}

This would provide a much more obvious and expressive syntax as well as access to the complex search capabilities that are available in Intersight.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions