Feature Request: Extend Data Source newrelic_entity
to Return Multiple Entities with Different Filter Capabilities #2760
Description
Extend data source newrelic_entity
to return multiple entities with different filter capabilities
Currently, the data source newrelic_entity
requires an entity name and optional different filter attributes as noted here: https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/data-sources/entity#argument-reference
Additionally the newrelic_entity
only returns the first matched entity instead of multiple.
The request here is for something more aligned with what is available in the Nerdgraph API for entity search.
Example here is searching for all key/value matching env:prod
.
{
actor {
entitySearch(queryBuilder: {tags: {key: "env", value: "prod"}}) {
results {
entities {
guid
}
}
}
}
}
Describe Alternatives
Current alternative to accomplish this would be to import the GraphQL TF provider and use the Nerdgraph API that way.
There doesn't appear to be any way to loop through any results with the current data source option in TF.
Additional context
The situation in a green/blue deployment to use tags to identify which color is a live workload and which is a staging workload.
This seems like a good use case for the TF provider to automatically update the tags during swap to let workloads know that blue resources are now live and the green resources no longer are. It would be ideal to do this at the same time as the CICD changes the dns so that they are in sync.