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

Add Search data source #153

Merged
merged 9 commits into from
Jun 6, 2024
Merged

Conversation

Tankilevitch
Copy link
Contributor

@Tankilevitch Tankilevitch commented May 28, 2024

Description

What - Added search capability as data source
Why - To query entities from port and create resources based on data inside the portal
How -

Usage Examples

data "port_search" "all_service" {
  query = jsonencode({
    "combinator" : "and", "rules" : [
      { "operator" : "=", "property" : "$blueprint", "value" : "Service" },
    ]
  })
}
data "port_search" "all_service" {
  query = jsonencode({
    "combinator" : "and", "rules" : [
      { "operator" : "=", "property" : "$blueprint", "value" : "Service" },
      { "operator" : "=", "property" : "$identifier", "value" : "Ads" },
    ]
  })
}

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Non-breaking change (fix of existing functionality that will not change current behavior)
  • Documentation (added/updated documentation)

Copy link
Member

@erikzaadi erikzaadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nits, waiting for a cool example!

docs/data-sources/port_search.md Show resolved Hide resolved
docs/data-sources/port_search.md Show resolved Hide resolved
docs/data-sources/port_search.md Outdated Show resolved Hide resolved
})
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that an example of the usage could be cool here, E.g:

locals {
    has_services = length(data.port_search.all_services.Entities) > 0
}
my_other_module "identifier" {
   count = locals.has_services
   ...
}

Copy link
Member

@erikzaadi erikzaadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

2 participants