Plugin Protocol V6 filter data source

I’m trying to write a new provider that can help provide other providers with additional information populated from an API. So it’s only going to need the data source and the ability to filter on calls to that api. I have not seen any examples or references in the godoc to using filters? Can someone please help?

For example if someone had this HCL

data "us_states" "arizona" {
  filter {
    name = "arizona"
  }
} 

I imagine this could be added to the Read DataSource interface function but anything that signature passes in doesn’t seem to have any reference to filters?

It sounds like you maybe believe “filters” to be a core Terraform concept, perhaps because you have seen something similar in other existing providers.

This is not the case - whatever example you are thinking of, that’s just some custom behaviour implemented by the implementors of whatever provider you have observed it in.

ok thanks for the clarity. So would the proper way be implementing a resource to do that then?

The front page of the Terraform provider development documentation is here: Home - Plugin Development | Terraform | HashiCorp Developer

It links to a tutorial walkthrough of writing a Terraform plugin: Custom Framework Providers | Terraform | HashiCorp Developer

If you want to create (and manage the lifecycle) of something you use a resource. Your use case sounds like a lookup, so that’s a data source.

Your data source can have whatever schema you like, including user input fields (like filters).

Use a data source.