# List resources using selectors

List resources for a workspace using selectors. Pagination is optional: when limit and page are omitted (or zero), all matching resources are returned for backward compatibility.

Endpoint: POST /iacm/api/orgs/{org}/projects/{project}/workspaces/{identifier}/resources/search
Version: 1.0
Security: x-api-key

## Path parameters:

  - `org` (string, required)
    Org is the organisation identifier.
    Example: "vjb"

  - `project` (string, required)
    Project is the project identifier.
    Example: "28i"

  - `identifier` (string, required)
    Workspace identifier
    Example: "Labore autem ipsam eos est quis dignissimos."

## Header parameters:

  - `Harness-Account` (string, required)
    Account is the internal customer account ID.
    Example: "kb3"

## Request fields (application/json):

  - `limit` (integer)
    Limit is the number of records to return for a page. When omitted, all records are returned.
    Example: 30

  - `page` (integer)
    Page is the page number to return relative to the page 'limit'. When omitted, all records are returned.
    Example: 1

  - `selectors` (array)
    Example: [{"include_conditions":[{"attribute":"tag.environment","operator":"equals","value":"prod"}],"path_id":"qa","provider":"aws","resource_type":"aws_instance","search_text":"some text"},{"include_conditions":[{"attribute":"tag.environment","operator":"equals","value":"prod"}],"path_id":"qa","provider":"aws","resource_type":"aws_instance","search_text":"some text"}]

  - `selectors.include_conditions` (array)
    The conditions to include the resource.
    Example: [{"attribute":"tag.environment","operator":"equals","value":"prod"}]

  - `selectors.include_conditions.attribute` (string, required)
    Attribute is the attribute to select on.
    Example: "<+attributes.region>"

  - `selectors.include_conditions.operator` (string, required)
    Operator is the operator to use for the selector.
    Enum: "equals", "not_equals", "contains", "not_contains", "starts_with", "ends_with"

  - `selectors.include_conditions.value` (string, required)
    Value is the value to check.
    Example: "europe"

  - `selectors.path_id` (string)
    Path identifier to filter resources by
    Example: "qa"

  - `selectors.provider` (string)
    Provider Type to filter resources by
    Example: "aws"

  - `selectors.resource_type` (string)
    Type is the type of resource to select.
    Example: "aws_instance"

  - `selectors.search_text` (string)
    Search resources by text string
    Example: "some text"

## Response 200 fields (application/json):

  - `data_sources` (array, required)
    Example: [{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"}]

  - `data_sources.attributes` (object, required)
    A map of values related to the resource
    Example: {"ami":"ami-830c94ec","instance_type":"t2.micro"}

  - `data_sources.createdAt` (integer)
    Timestamp when the resource was created.
    Example: 1627590400

  - `data_sources.drift_attributes` (object, required)
    A map of values related to the resource
    Example: {"instance_type":"t2.nano"}

  - `data_sources.drift_status` (string, required)
    Indicates if this resource is experiencing drift.
    Enum: "changed", "deleted", "unchanged"

  - `data_sources.lastSyncedAt` (integer)
    Timestamp when the resource was last updated.
    Example: 1627686800

  - `data_sources.mode` (string, required)
    Mode associated with the resource.
    Enum: "resource", "data", "output"

  - `data_sources.module` (string, required)
    Module associated with the resource.
    Example: "full_stack"

  - `data_sources.monthly_cost` (number)
    Current period cost from CCM (null if no cost data).
    Example: 0.15965863958721543

  - `data_sources.monthly_saving` (number)
    Monthly potential saving from CCM (null if no cost data).
    Example: 0.2914243350928799

  - `data_sources.name` (string, required)
    Name associated with the resource.
    Example: "app_server"

  - `data_sources.path_id` (string, required)
    Path associated with the resource. Could be namespace, environment or stack id.
    Example: "namespace"

  - `data_sources.provider` (string, required)
    Cloud provider associated with the resource.
    Example: "AWS"

  - `data_sources.recommendation_count` (integer)
    Number of CCM recommendations for this resource (null if no cost data).
    Example: 189649844261067840

  - `data_sources.resource_id` (string, required)
    Unique identifier for the resource from the cloud provider.
    Example: "arn:aws:s3:::my-bucket"

  - `data_sources.sensitive_attributes` (array, required)
    A list of the sensitive attribute keys
    Example: ["instance_type"]

  - `data_sources.type` (string, required)
    Type of the provisioned resource.
    Example: "S3 Bucket"

  - `outputs` (array, required)
    Example: [{"expression":"<+outputs.instance_id>","name":"instance_public_ip","sensitive":true,"stack_path":"IaCM/TGOverride/environments/dev/ec2","value":"Occaecati incidunt tempore et."},{"expression":"<+outputs.instance_id>","name":"instance_public_ip","sensitive":true,"stack_path":"IaCM/TGOverride/environments/dev/ec2","value":"Occaecati incidunt tempore et."}]

  - `outputs.expression` (string)
    JEXL expression for dynamic output resolution
    Example: "<+outputs.instance_id>"

  - `outputs.name` (string, required)
    Name associated with the output.
    Example: "instance_public_ip"

  - `outputs.sensitive` (boolean, required)
    Indicates whether this value is sensitive
    Example: true

  - `outputs.stack_path` (string)
    Stack path for Terragrunt workspaces
    Example: "IaCM/TGOverride/environments/dev/ec2"

  - `outputs.value` (string, required)
    Value associated with the output.
    Example: "Exercitationem non eveniet."

  - `resources` (array, required)
    Example: [{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"},{"attributes":{"ami":"ami-830c94ec","instance_type":"t2.micro"},"createdAt":1627590400,"drift_attributes":{"instance_type":"t2.nano"},"drift_status":"changed","lastSyncedAt":1627686800,"mode":"resource","module":"full_stack","monthly_cost":0.32546890397784883,"monthly_saving":0.35814372810159073,"name":"app_server","path_id":"namespace","provider":"AWS","recommendation_count":8335073474648751000,"resource_id":"arn:aws:s3:::my-bucket","sensitive_attributes":["instance_type"],"type":"S3 Bucket"}]

  - `stack_outputs` (object)
    Outputs grouped by stack path for Terragrunt workspaces
    Example: {"IaCM/TGOverride/environments/dev/ec2":[{"name":"instance_id","sensitive":false,"stack_path":"IaCM/TGOverride/environments/dev/ec2","value":"i-1234567890abcdef0"}]}

  - `total_resources` (integer, required)
    Total number of resources managed by this workspace
    Example: 42

## Response 401 fields (application/vnd.goa.error):

  - `fault` (boolean, required)
    Is the error a server-side fault?
    Example: true

  - `id` (string, required)
    ID is a unique identifier for this particular occurrence of the problem.
    Example: "123abc"

  - `message` (string, required)
    Message is a human-readable explanation specific to this occurrence of the problem.
    Example: "parameter 'p' must be an integer"

  - `name` (string, required)
    Name is the name of this class of errors.
    Example: "bad_request"

  - `temporary` (boolean, required)
    Is the error temporary?
    Example: true

  - `timeout` (boolean, required)
    Is the error a timeout?
    Example: true


