The port_search Terraform data source currently calls POST /v1/entities/search, which requires a property field in every rule. This means relation-based filter rules are not supported, and the following query fails with "rules/0" must have required property 'property':
data "port_search" "pd_entities" {
query = jsonencode({
"combinator" : "and",
"rules" : [
{ "relation" : "pagerduty_escalation", "operator" : "isNotEmpty" }
]
})
}
The blueprint-scoped endpoint POST /v1/blueprints/{blueprint}/entities/search does support relation-based rules (e.g. filtering by isNotEmpty on a relation field), but the port_search data source does not expose this endpoint.
Requested change:
Add support for relation-based filter rules in the port_search data source, either by:
Exposing the blueprint-scoped search endpoint (/v1/blueprints/{blueprint}/entities/search) as an option in the data source, or
Updating the global search endpoint to accept relation rules without requiring a property field.
Use case:
We need to find all entities across blueprints where a specific relation (e.g. pagerduty_escalation) is set (i.e. isNotEmpty). Today this requires a multi-step REST API workaround outside of the Terraform provider, which undermines the goal of managing Port infrastructure as code.
Current workaround:
Query /v1/blueprints to discover all blueprints that define the target relation.
For each blueprint, query /v1/blueprints/{blueprint}/entities/search with a relation rule.
This is brittle and forces us to bypass the Terraform provider entirely.
Created by Oladipupo Ibeun
·